igniteui-astro-components 1.4.0 → 1.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
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": {
@@ -93,7 +93,8 @@ defaults.
93
93
 
94
94
  `Sample.astro` adds one step on top: when it renders the widget it derives the
95
95
  theme from the current platform — Angular → Material, React / Web Components /
96
- Blazor → Bootstrap — unless `defaultSampleTheme` is set. That default is
96
+ Blazor → Bootstrap, with a `wc` sample taking the Web Components default on
97
+ any platform — unless `defaultSampleTheme` is set. That default is
97
98
  functional, not cosmetic: the picker's selection is posted into the sample
98
99
  iframe on every load, so it decides how the demo actually renders.
99
100
 
@@ -18,8 +18,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
18
18
  | `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
19
19
  | `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
20
20
  | `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
21
+ | `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
21
22
  | `iframeOnly` | `boolean` | `false` | Render only the iframe — no navbar, no code tabs, no live-edit footer. |
22
23
  | `fullscreenBtn` | `boolean` | `false` | When `iframeOnly={true}`, also renders a "View in full screen" button below the iframe. |
24
+ | `hideCode` | `boolean` | `false` | Keep the widget's frame but drop its code viewer: no tabs header, no code fetch, no live-edit or full-screen buttons. The footer carries only the theme picker (`showThemePicker`); without it there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. |
23
25
  | `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
24
26
  | `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
25
27
  | `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
@@ -43,6 +45,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
43
45
 
44
46
  <Sample src="/grid/grid/filtering" lob />
45
47
 
48
+ {/* Web Components sample shared by every platform's docs */}
49
+
50
+ <Sample src="/themes/palettes/scales" wc fitContent iframeOnly />
51
+
46
52
  {/* Bare iframe for embedding */}
47
53
 
48
54
  <Sample src="/charts/bar-chart/overview" iframeOnly height={300} />
@@ -50,6 +56,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
50
56
  {/* Bare iframe + fullscreen link */}
51
57
 
52
58
  <Sample src="/charts/bar-chart/overview" iframeOnly fullscreenBtn height={300} />
59
+
60
+ {/* Demo only, with the theme picker: no code tabs or live-edit buttons */}
61
+
62
+ <Sample src="/inputs/radio/interaction-state" hideCode showThemePicker height={400} />
53
63
  ```
54
64
 
55
65
  ## Environment configuration
@@ -62,6 +72,9 @@ The base URLs are resolved from `environment.json` at build time via `siteMetaIn
62
72
  | `dvDemosBaseUrl` | Charts / gauges / maps / excel |
63
73
  | `lobDemosBaseUrl` | LOB / grids |
64
74
  | `crmDemoBaseUrl` | CRM demos |
75
+ | `wcDemosBaseUrl` | `wc` samples, on any platform |
76
+
77
+ Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without it the sample falls back to `demosBaseUrl`, the page's own platform browser, and the build logs a warning. Leave unused keys out rather than setting them to `""`: an empty string doesn't fall back, it produces a relative URL.
65
78
 
66
79
  ## Code highlighting
67
80
 
@@ -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 = env.defaultSampleTheme ?? PLATFORM_DEFAULT_THEME[name] ?? 'bootstrap';
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 flex alignment (and gives the frame slack so the alignment is
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 = lob
179
- ? (env.lobDemosBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
180
- : crm
181
- ? (env.crmDemoBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
182
- : isDv
183
- ? (env.dvDemosBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
184
- : (env.demosBaseUrl ?? '').replace(/\/$/, '');
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
- iframeOnly ? (
196
- <>
197
- <div
198
- class:list={[
199
- 'igd-sample-container',
200
- {
201
- 'igd-sample-container--fit-content': fitContent,
202
- 'igd-sample-container--flex': useFlex,
203
- 'igd-sample-container--resizable': isResizable,
204
- 'igd-sample-container--no-border': noBorder,
205
- 'igd-sample-container--no-background': noBackground,
206
- 'igd-sample-container--white-background': whiteBackground,
207
- },
208
- ]}
209
- data-fit-content={fitContent ? 'true' : undefined}
210
- data-spacing={spacingVal}
211
- data-justify={hToken}
212
- data-valign={vToken}
213
- data-resizable={isResizable ? 'true' : undefined}
214
- tabindex={isResizable ? '0' : undefined}
215
- aria-label={
216
- isResizable ? 'Resizable sample — use the left and right arrow keys to resize' : undefined
217
- }
218
- style={containerStyle}
219
- >
220
- <div class="igd-sample-frame">
221
- <iframe
222
- src={iframeSrc}
223
- title={alt || `${name} Example`}
224
- style={iframeStyle}
225
- frameborder="0"
226
- seamless
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
- {fullscreenBtn && (
231
- <div class="igd-code-view__header-actions">
232
- <igc-icon-button
233
- name="open-link-blank"
234
- collection="docs"
235
- variant="outlined"
236
- class="igd-full-screen-btn igd-edit-in-btn"
237
- href={iframeSrc}
238
- target="_blank"
239
- aria-label="Open in full screen"
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. In the default (block) layout it is transparent
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 flex alignment (position) can move the content-sized box
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 flex alignment can center it.
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-inline: calc(var(--igd-sample-spacing-sm, #{rem(8px)}) * -1);
278
- margin-block-end: calc(var(--igd-sample-spacing-sm, #{rem(8px)}) * -1);
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-inline: calc(var(--igd-sample-spacing-md, #{rem(16px)}) * -1);
287
- margin-block-end: calc(var(--igd-sample-spacing-md, #{rem(16px)}) * -1);
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-inline: calc(var(--igd-sample-spacing-lg, #{rem(32px)}) * -1);
296
- margin-block-end: calc(var(--igd-sample-spacing-lg, #{rem(32px)}) * -1);
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
- // Flex layout — only enabled when position/resize needs it. The `position`
301
- // prop is emitted as data-justify / data-valign attributes.
302
- &--flex {
303
- display: flex;
304
- justify-content: flex-start;
305
- align-items: stretch;
306
-
307
- &[data-justify='start'] {
308
- justify-content: flex-start;
309
- }
310
- &[data-justify='center'] {
311
- justify-content: center;
312
- }
313
- &[data-justify='end'] {
314
- justify-content: flex-end;
315
- }
316
-
317
- &[data-valign='top'] {
318
- align-items: flex-start;
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
- // Keep the fullscreen bar pinned to the bottom instead of becoming a
341
- // flex sibling of the iframe frame.
342
- > .igd-code-view__header-actions {
343
- position: absolute;
344
- inset-inline: 0;
345
- inset-block-end: 0;
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
@@ -252,6 +252,7 @@ function addFooter(
252
252
  explicitEditor: string | null,
253
253
  onStackblitz: (() => void) | null,
254
254
  _onCodeSandbox: (() => void) | null,
255
+ showFullscreen = true,
255
256
  ): void {
256
257
  // A footer may already be server-rendered (e.g. the playground's MockSample);
257
258
  // don't append a second one.
@@ -291,26 +292,28 @@ function addFooter(
291
292
  // footer.appendChild(btn);
292
293
  // }
293
294
 
294
- const fsBtn = document.createElement('igc-icon-button') as HTMLElement;
295
- fsBtn.setAttribute('name', 'open-external');
296
- fsBtn.setAttribute('collection', FOOTER_ICON_COLLECTION);
297
- fsBtn.setAttribute('variant', 'flat');
298
- fsBtn.setAttribute('aria-label', 'Open in full screen');
299
- fsBtn.className = 'igd-full-screen-btn igd-edit-in-btn';
300
- if (iframeSrc) {
301
- const fullscreenSrc = iframeSrc + (iframeSrc.includes('?') ? '&' : '?') + 'nav=0';
302
- fsBtn.setAttribute('href', fullscreenSrc);
303
- fsBtn.setAttribute('target', '_blank');
295
+ if (showFullscreen) {
296
+ const fsBtn = document.createElement('igc-icon-button') as HTMLElement;
297
+ fsBtn.setAttribute('name', 'open-external');
298
+ fsBtn.setAttribute('collection', FOOTER_ICON_COLLECTION);
299
+ fsBtn.setAttribute('variant', 'flat');
300
+ fsBtn.setAttribute('aria-label', 'Open in full screen');
301
+ fsBtn.className = 'igd-full-screen-btn igd-edit-in-btn';
302
+ if (iframeSrc) {
303
+ fsBtn.setAttribute('href', iframeSrc);
304
+ fsBtn.setAttribute('target', '_blank');
305
+ }
306
+ actions.appendChild(fsBtn);
304
307
  }
305
- actions.appendChild(fsBtn);
306
- footer.appendChild(actions);
308
+ if (actions.childElementCount) footer.appendChild(actions);
307
309
 
308
310
  if (themingBar) {
309
311
  themingBar.hidden = false;
310
312
  footer.appendChild(themingBar);
311
313
  }
312
314
 
313
- widget.appendChild(footer);
315
+ // Nothing to show (e.g. a `hideCode` sample without a theme picker): no footer.
316
+ if (footer.childElementCount) widget.appendChild(footer);
314
317
  }
315
318
 
316
319
  // ─── Angular Code Service ─────────────────────────────────────────────────────
@@ -629,7 +632,7 @@ function setFitSize(iframe: HTMLIFrameElement, size: { height?: number; width?:
629
632
  iframe.style.width = `${Math.ceil(size.width)}px`;
630
633
  // The frame defaults to full width (see Sample.scss); once the iframe
631
634
  // has a definite px width, let the frame shrink-wrap it so the host's
632
- // flex alignment (position) can move the content-sized box around.
635
+ // alignment (position) can move the content-sized box around.
633
636
  const frame = iframe.closest<HTMLElement>('.igd-sample-frame');
634
637
  if (frame) frame.style.width = 'auto';
635
638
  }
@@ -641,7 +644,7 @@ function setFitSize(iframe: HTMLIFrameElement, size: { height?: number; width?:
641
644
  * block-level demo content stretches to the viewport width, so instead we take
642
645
  * the right-most element box. Demos with intrinsically sized content (a lone
643
646
  * avatar, a button…) shrink the iframe to that content, letting the host's
644
- * flex alignment actually center/end-align it. Full-width demos measure the
647
+ * alignment actually center/end-align it. Full-width demos measure the
645
648
  * viewport width and are left as-is.
646
649
  *
647
650
  * Resizable containers are excluded entirely: there the user's drag owns the
@@ -832,7 +835,7 @@ function wireResizable(container: HTMLElement): void {
832
835
  const startW = frame.getBoundingClientRect().width;
833
836
  // A centered frame grows from both sides, so the handle covers half
834
837
  // the width change per pixel moved.
835
- const factor = getComputedStyle(container).justifyContent === 'center' ? 2 : 1;
838
+ const factor = getComputedStyle(frame).justifySelf === 'center' ? 2 : 1;
836
839
 
837
840
  const onMove = (ev: PointerEvent) => setWidth(startW + (ev.clientX - startX) * factor);
838
841
  const onUp = (ev: PointerEvent) => {
@@ -924,6 +927,8 @@ export function initSampleWidgets(): void {
924
927
  const demosBaseUrl = widget.dataset.demosBaseUrl || '';
925
928
  const githubSrc = widget.dataset.githubSrc || '';
926
929
  const platform = normalizePlatform(widget.dataset.platform || 'angular');
930
+ // `hideCode` samples render no tabs: only the demo and the theme picker.
931
+ const hideCode = widget.dataset.hideCode === 'true';
927
932
 
928
933
  if (!iframeSrc) return;
929
934
 
@@ -931,7 +936,7 @@ export function initSampleWidgets(): void {
931
936
  const samplePane = widget.querySelector<HTMLElement>('.igd-sample-container');
932
937
  const iframe = widget.querySelector<HTMLIFrameElement>('iframe');
933
938
 
934
- if (!igcTabs) return;
939
+ if (!igcTabs && !hideCode) return;
935
940
 
936
941
  const exampleTabId = `${widget.id}-example`;
937
942
 
@@ -988,7 +993,7 @@ export function initSampleWidgets(): void {
988
993
  }
989
994
 
990
995
  // Toggle fullscreen button visibility based on active tab.
991
- igcTabs.addEventListener('igcChange', (e: Event) => {
996
+ igcTabs?.addEventListener('igcChange', (e: Event) => {
992
997
  const detail = (e as CustomEvent<HTMLElement>).detail;
993
998
  const btn = widget.querySelector<HTMLElement>('.igd-full-screen-btn');
994
999
  if (btn) {
@@ -1033,6 +1038,13 @@ export function initSampleWidgets(): void {
1033
1038
  }
1034
1039
  }
1035
1040
 
1041
+ // No code to fetch and nothing to live-edit or open in full screen: the
1042
+ // footer carries only the theme picker, right away.
1043
+ if (hideCode || !igcTabs) {
1044
+ addFooter(widget, iframeSrc, null, null, null, false);
1045
+ return;
1046
+ }
1047
+
1036
1048
  if (!demosBaseUrl && !isXplatPlatform(platform)) return;
1037
1049
 
1038
1050
  const service = isXplatPlatform(platform)