igniteui-astro-components 0.0.29 → 1.0.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 +17 -14
- package/src/components/DocsSidebar/DocsSidebar.scss +3 -2
- package/src/components/DocsSidebar/SidebarFilterInput.scss +1 -3
- package/src/components/DocsSubHeader/DocsSubHeader.scss +1 -1
- package/src/components/DocsTree/docs-tree.scss +0 -1
- package/src/components/mdx/Sample/README.md +16 -10
- package/src/components/mdx/Sample/Sample.astro +156 -19
- package/src/components/mdx/Sample/Sample.scss +238 -9
- package/src/integration.ts +26 -14
- package/src/layouts/DocsLayout/DocsLayout.scss +0 -4
- package/src/plugins/rehype-heading-anchors.ts +53 -61
- package/src/plugins/rehype-pagefind-ignore.ts +19 -28
- package/src/plugins/rehype-table-wrapper.ts +38 -36
- package/src/plugins/remark-env-vars.ts +26 -20
- package/src/plugins/remark-html-transforms.ts +21 -18
- package/src/plugins/remark-md-links.ts +43 -31
- package/src/scripts/sample-widget.ts +288 -1
- package/src/styles/global/_code-blocks.scss +2 -23
- package/src/styles/global/_copy-button.scss +32 -0
- package/src/styles/global/_search-shared.scss +1 -1
- package/src/styles/global/_variables.scss +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-astro-components",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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": {
|
|
7
|
-
"node": "
|
|
7
|
+
"node": ">=22.12.0"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Infragistics",
|
|
@@ -83,41 +83,44 @@
|
|
|
83
83
|
"./package.json": "./package.json"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"astro": "^
|
|
86
|
+
"astro": "^7.0.0",
|
|
87
|
+
"igniteui-theming": "^26.0.1",
|
|
87
88
|
"igniteui-webcomponents": "^7.2.4"
|
|
88
89
|
},
|
|
89
90
|
"dependencies": {
|
|
91
|
+
"@astrojs/mdx": "^7.0.7",
|
|
92
|
+
"@astrojs/markdown-satteri": "^0.3.5",
|
|
90
93
|
"@fontsource-variable/instrument-sans": "^5.2.8",
|
|
91
94
|
"@fontsource-variable/inter": "^5.2.8",
|
|
92
95
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
96
|
+
"github-slugger": "^2.0.0",
|
|
93
97
|
"jsdom": "^29.0.1",
|
|
98
|
+
"satteri": "^0.9.5",
|
|
94
99
|
"shiki": "^3.23.0"
|
|
95
100
|
},
|
|
96
101
|
"devDependencies": {
|
|
102
|
+
"@astrojs/check": "^0.9.9",
|
|
97
103
|
"@types/jsdom": "^21.1.7",
|
|
98
|
-
"astro": "^
|
|
104
|
+
"astro": "^7.2.2",
|
|
99
105
|
"husky": "^9.1.7",
|
|
100
106
|
"igniteui-theming": "^26.0.1",
|
|
107
|
+
"igniteui-webcomponents": "^7.2.4",
|
|
101
108
|
"lint-staged": "^17.0.8",
|
|
102
109
|
"oxlint": "^1.72.0",
|
|
103
110
|
"prettier": "^3.9.4",
|
|
104
111
|
"prettier-plugin-astro": "^0.14.1",
|
|
105
112
|
"sass": "^1.83.0",
|
|
106
|
-
"typescript": "^5.
|
|
113
|
+
"typescript": "^5.9.3"
|
|
107
114
|
},
|
|
108
|
-
"workspaces": [
|
|
109
|
-
"playground"
|
|
110
|
-
],
|
|
111
115
|
"publishConfig": {
|
|
112
116
|
"access": "public"
|
|
113
117
|
},
|
|
114
118
|
"scripts": {
|
|
115
|
-
"playground": "npm
|
|
116
|
-
"playground:dev": "
|
|
117
|
-
"playground:build": "
|
|
118
|
-
"playground:preview": "
|
|
119
|
-
"playground:
|
|
120
|
-
"playground:check": "npm --prefix playground run check",
|
|
119
|
+
"playground": "npm run playground:dev",
|
|
120
|
+
"playground:dev": "astro sync --root playground && astro dev --root playground --port 4567",
|
|
121
|
+
"playground:build": "astro sync --root playground && astro build --root playground",
|
|
122
|
+
"playground:preview": "astro preview --root playground --port 4567",
|
|
123
|
+
"playground:check": "astro check --root playground",
|
|
121
124
|
"lint": "oxlint .",
|
|
122
125
|
"lint:fix": "oxlint . --fix",
|
|
123
126
|
"format": "prettier --write .",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// Desktop base. On tablet/mobile DocsLayout.scss turns this into a slide-in overlay.
|
|
5
5
|
.docs-sidebar {
|
|
6
6
|
--igd-sidebar-z-index: 0;
|
|
7
|
+
|
|
7
8
|
display: flex;
|
|
8
9
|
flex-direction: column;
|
|
9
10
|
z-index: var(--igd-sidebar-z-index);
|
|
@@ -15,7 +16,6 @@
|
|
|
15
16
|
height: calc(100dvh - var(--igd-header-height));
|
|
16
17
|
max-height: 100dvh;
|
|
17
18
|
align-self: start;
|
|
18
|
-
view-transition-name: docs-sidebar;
|
|
19
19
|
|
|
20
20
|
.sidebar-gutter {
|
|
21
21
|
display: grid;
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
overflow-y: hidden;
|
|
24
24
|
padding: rem(16px);
|
|
25
25
|
border-bottom: var(--igd-app-outline);
|
|
26
|
-
min-height: rem(73px);
|
|
27
26
|
|
|
28
27
|
&:empty {
|
|
29
28
|
display: none;
|
|
@@ -66,6 +65,8 @@
|
|
|
66
65
|
padding-block: rem(12px);
|
|
67
66
|
scroll-behavior: smooth;
|
|
68
67
|
overscroll-behavior: contain;
|
|
68
|
+
flex-grow: 1;
|
|
69
|
+
flex-basis: 0%;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
.sidebar-premium-icon {
|
|
@@ -10,16 +10,22 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type
|
|
14
|
-
| --------------- |
|
|
15
|
-
| `src` | `string`
|
|
16
|
-
| `height` | `number`
|
|
17
|
-
| `alt` | `string`
|
|
18
|
-
| `lob` | `boolean`
|
|
19
|
-
| `dv` | `boolean`
|
|
20
|
-
| `crm` | `boolean`
|
|
21
|
-
| `iframeOnly` | `boolean`
|
|
22
|
-
| `fullscreenBtn` | `boolean`
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| --------------- | ------------------------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `src` | `string` | _(required)_ | Sample path relative to the demos base URL, e.g. `"/charts/data-chart/axis-crossing"`. |
|
|
16
|
+
| `height` | `number` | `150` (`50` if `fitContent`) | iframe height in pixels. With `fitContent` it is only the loading placeholder / cross-origin fallback. |
|
|
17
|
+
| `alt` | `string` | `''` | `title` attribute for the iframe (accessibility). |
|
|
18
|
+
| `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
|
|
19
|
+
| `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
|
|
20
|
+
| `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
|
|
21
|
+
| `iframeOnly` | `boolean` | `false` | Render only the iframe — no navbar, no code tabs, no live-edit footer. |
|
|
22
|
+
| `fullscreenBtn` | `boolean` | `false` | When `iframeOnly={true}`, also renders a "View in full screen" button below the iframe. |
|
|
23
|
+
| `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
|
+
| `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
|
+
| `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"`. |
|
|
26
|
+
| `resizable` | `boolean` | `false` | Show a drag handle on the right edge that resizes the iframe's width so responsive demos can be previewed at different widths. Left/right arrow keys resize it when focused. Combines with `fitContent`: the drag owns the width, the content keeps dictating the height. |
|
|
27
|
+
| `noBorder` | `boolean` | `true` | Drop the 1px border drawn around the iframe/container. Pass `noBorder={false}` to draw it — recommended whenever chrome (code tabs or `fullscreenBtn`) is visible. |
|
|
28
|
+
| `noBackground` | `boolean` | `true` | Hide the grid-pattern backdrop drawn behind the iframe, keeping the container fully transparent. Pass `noBackground={false}` to show it. |
|
|
23
29
|
|
|
24
30
|
## Examples
|
|
25
31
|
|
|
@@ -19,6 +19,10 @@ import './Sample.scss';
|
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
src: string;
|
|
22
|
+
/**
|
|
23
|
+
* Iframe height in px. Default 150. With `fitContent` it is only the
|
|
24
|
+
* loading placeholder / cross-origin fallback and defaults to 50.
|
|
25
|
+
*/
|
|
22
26
|
height?: number;
|
|
23
27
|
alt?: string;
|
|
24
28
|
/** Use lobDemosBaseUrl instead of demosBaseUrl (for LOB/grid-dynamic demos). */
|
|
@@ -31,21 +35,106 @@ interface Props {
|
|
|
31
35
|
iframeOnly?: boolean;
|
|
32
36
|
/** When used with iframeOnly, also render a "View in full screen" button below. */
|
|
33
37
|
fullscreenBtn?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Size the iframe to fit its content: the embedded page dictates the
|
|
40
|
+
* iframe's size. `height` serves only as the placeholder/fallback — shown
|
|
41
|
+
* while the demo loads and kept if a cross-origin demo never reports its
|
|
42
|
+
* size. Same-origin demos are measured directly; cross-origin demos must
|
|
43
|
+
* report via postMessage. See sample-widget.ts for the contract.
|
|
44
|
+
* Note: an iframe clips at its edge, so demos with ink overflow (shadows,
|
|
45
|
+
* glows, focus rings) must reserve room for it in their own layout —
|
|
46
|
+
* e.g. body padding matching the shadow's blur + offset.
|
|
47
|
+
*/
|
|
48
|
+
fitContent?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Padding around the iframe inside the container: `none` = 0 (default),
|
|
51
|
+
* `sm` = 8px, `md` = 16px, `lg` = 32px. The padding is applied by the host
|
|
52
|
+
* container, never inside the embedded page.
|
|
53
|
+
*/
|
|
54
|
+
spacing?: 'none' | 'sm' | 'md' | 'lg';
|
|
55
|
+
/**
|
|
56
|
+
* Where the iframe sits inside the container when it doesn't fill it (e.g.
|
|
57
|
+
* after being resized narrower, or with `fitContent` on small content).
|
|
58
|
+
* Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical
|
|
59
|
+
* token (`top`, `center`, `bottom`), space-separated in any order — e.g.
|
|
60
|
+
* "center", "start top", "end bottom". Demo pages must never position
|
|
61
|
+
* themselves (no centering/min-height on their body); this prop is the
|
|
62
|
+
* single place alignment is decided.
|
|
63
|
+
*/
|
|
64
|
+
position?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Show a drag handle on the right edge that resizes the iframe's width so
|
|
67
|
+
* responsive demos can be previewed at different widths. Only the iframe is
|
|
68
|
+
* resized (horizontally); the component's own footprint never changes.
|
|
69
|
+
* When focused, the left/right arrow keys resize it too. Combines with
|
|
70
|
+
* `fitContent`: the drag owns the width while the content keeps dictating
|
|
71
|
+
* the height, so a reflowed demo never scrolls inside the iframe.
|
|
72
|
+
*/
|
|
73
|
+
resizable?: boolean;
|
|
74
|
+
/** Drop the 1px border drawn around the iframe/container. Defaults to true. */
|
|
75
|
+
noBorder?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Hide the grid-pattern backdrop drawn behind the iframe (default). The
|
|
78
|
+
* container is fully transparent, so a demo without a background of its own
|
|
79
|
+
* sits directly on the page.
|
|
80
|
+
*/
|
|
81
|
+
noBackground?: boolean;
|
|
34
82
|
}
|
|
35
83
|
|
|
36
84
|
const {
|
|
37
85
|
src,
|
|
38
|
-
height = 400,
|
|
39
86
|
alt = '',
|
|
40
87
|
lob = false,
|
|
41
88
|
dv = false,
|
|
42
89
|
crm = false,
|
|
43
90
|
iframeOnly = false,
|
|
44
91
|
fullscreenBtn = false,
|
|
92
|
+
fitContent = false,
|
|
93
|
+
spacing = 'none',
|
|
94
|
+
position,
|
|
95
|
+
resizable = false,
|
|
96
|
+
noBorder = true,
|
|
97
|
+
noBackground = true,
|
|
45
98
|
} = Astro.props;
|
|
99
|
+
|
|
100
|
+
// Fixed samples default to 150px. In fitContent mode `height` is only the
|
|
101
|
+
// loading placeholder, so an unspecified one defaults lower (50px) to avoid
|
|
102
|
+
// reserving a tall wall of space that collapses once the demo reports its size.
|
|
103
|
+
const height = Astro.props.height ?? (fitContent ? 50 : 150);
|
|
46
104
|
const { name, lower } = Astro.locals.platformContext as PlatformContext;
|
|
105
|
+
|
|
47
106
|
const env = Astro.locals.envVars ?? {};
|
|
48
107
|
|
|
108
|
+
// ─ Layout options (spacing / position / resize) ────────────────────────────────
|
|
109
|
+
const spacingVal = ['none', 'sm', 'md', 'lg'].includes(spacing) ? spacing : 'none';
|
|
110
|
+
|
|
111
|
+
// fitContent: the container grows around the iframe, so it gets no inline
|
|
112
|
+
// height. The iframe carries `height` as the placeholder/fallback until the
|
|
113
|
+
// demo's measured/reported size replaces it (sample-widget.ts).
|
|
114
|
+
const containerStyle = fitContent ? undefined : `height: ${height}px`;
|
|
115
|
+
const iframeStyle = fitContent ? `width: 100%; height: ${height}px;` : 'width: 100%; height: 100%;';
|
|
116
|
+
|
|
117
|
+
// Split `position` into a horizontal + vertical token. "center" applies to
|
|
118
|
+
// whichever axis isn't otherwise specified. These become data-attributes the
|
|
119
|
+
// SCSS turns into flex alignment (and gives the frame slack so the alignment is
|
|
120
|
+
// actually visible — a full-size frame has nothing to align).
|
|
121
|
+
const posTokens = (position ?? '').toLowerCase().split(/\s+/).filter(Boolean);
|
|
122
|
+
const hToken =
|
|
123
|
+
posTokens.find((t) => t === 'start' || t === 'end') ??
|
|
124
|
+
(posTokens.includes('center') ? 'center' : undefined);
|
|
125
|
+
const vToken =
|
|
126
|
+
posTokens.find((t) => t === 'top' || t === 'bottom') ??
|
|
127
|
+
(posTokens.includes('center') ? 'center' : undefined);
|
|
128
|
+
|
|
129
|
+
// Resizing is horizontal-only. With fitContent the drag owns the width and the
|
|
130
|
+
// measured content keeps dictating the height (sample-widget.ts skips width
|
|
131
|
+
// measurement on resizable containers so the two never fight).
|
|
132
|
+
const isResizable = resizable;
|
|
133
|
+
|
|
134
|
+
// Flex layout is only needed (and only turned on) when one of the new options
|
|
135
|
+
// requires it — keeps the default rendering byte-for-byte unchanged.
|
|
136
|
+
const useFlex = Boolean(hToken || vToken || isResizable);
|
|
137
|
+
|
|
49
138
|
// DV samples (charts, gauges, maps, excel) use dvDemosBaseUrl when available.
|
|
50
139
|
const DV_PREFIXES = ['gauges/', 'maps/', 'excel/', 'charts/'];
|
|
51
140
|
const srcNoSlash = src.replace(/^\//, '');
|
|
@@ -69,14 +158,38 @@ const exampleTabId = `${widgetId}-example`;
|
|
|
69
158
|
{
|
|
70
159
|
iframeOnly ? (
|
|
71
160
|
<>
|
|
72
|
-
<div
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
161
|
+
<div
|
|
162
|
+
class:list={[
|
|
163
|
+
'igd-sample-container',
|
|
164
|
+
{
|
|
165
|
+
'igd-sample-container--fit-content': fitContent,
|
|
166
|
+
'igd-sample-container--flex': useFlex,
|
|
167
|
+
'igd-sample-container--resizable': isResizable,
|
|
168
|
+
'igd-sample-container--no-border': noBorder,
|
|
169
|
+
'igd-sample-container--no-background': noBackground,
|
|
170
|
+
},
|
|
171
|
+
]}
|
|
172
|
+
data-fit-content={fitContent ? 'true' : undefined}
|
|
173
|
+
data-spacing={spacingVal}
|
|
174
|
+
data-justify={hToken}
|
|
175
|
+
data-valign={vToken}
|
|
176
|
+
data-resizable={isResizable ? 'true' : undefined}
|
|
177
|
+
tabindex={isResizable ? '0' : undefined}
|
|
178
|
+
aria-label={
|
|
179
|
+
isResizable ? 'Resizable sample — use the left and right arrow keys to resize' : undefined
|
|
180
|
+
}
|
|
181
|
+
style={containerStyle}
|
|
182
|
+
>
|
|
183
|
+
<div class="igd-sample-frame">
|
|
184
|
+
<iframe
|
|
185
|
+
src={iframeSrc}
|
|
186
|
+
title={alt || `${name} Example`}
|
|
187
|
+
style={iframeStyle}
|
|
188
|
+
frameborder="0"
|
|
189
|
+
seamless
|
|
190
|
+
/>
|
|
191
|
+
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
192
|
+
</div>
|
|
80
193
|
{fullscreenBtn && (
|
|
81
194
|
<div class="igd-code-view__header-actions">
|
|
82
195
|
<igc-icon-button
|
|
@@ -106,23 +219,47 @@ const exampleTabId = `${widgetId}-example`;
|
|
|
106
219
|
<igc-tabs id={`${widgetId}-tabs`} alignment="start">
|
|
107
220
|
<igc-tab id={exampleTabId} label="EXAMPLE" selected>
|
|
108
221
|
<div
|
|
109
|
-
class=
|
|
222
|
+
class:list={[
|
|
223
|
+
'igd-sample-container',
|
|
224
|
+
'loading',
|
|
225
|
+
{
|
|
226
|
+
'igd-sample-container--fit-content': fitContent,
|
|
227
|
+
'igd-sample-container--flex': useFlex,
|
|
228
|
+
'igd-sample-container--resizable': isResizable,
|
|
229
|
+
'igd-sample-container--no-border': noBorder,
|
|
230
|
+
'igd-sample-container--no-background': noBackground,
|
|
231
|
+
},
|
|
232
|
+
]}
|
|
233
|
+
data-fit-content={fitContent ? 'true' : undefined}
|
|
234
|
+
data-spacing={spacingVal}
|
|
235
|
+
data-justify={hToken}
|
|
236
|
+
data-valign={vToken}
|
|
237
|
+
data-resizable={isResizable ? 'true' : undefined}
|
|
238
|
+
tabindex={isResizable ? '0' : undefined}
|
|
239
|
+
aria-label={
|
|
240
|
+
isResizable
|
|
241
|
+
? 'Resizable sample — use the left and right arrow keys to resize'
|
|
242
|
+
: undefined
|
|
243
|
+
}
|
|
110
244
|
aria-busy="true"
|
|
111
|
-
style={
|
|
245
|
+
style={containerStyle}
|
|
112
246
|
>
|
|
113
247
|
<igc-circular-progress
|
|
114
248
|
indeterminate
|
|
115
249
|
class="sample-loading-indicator"
|
|
116
250
|
aria-label="Loading sample"
|
|
117
251
|
/>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
252
|
+
<div class="igd-sample-frame">
|
|
253
|
+
<iframe
|
|
254
|
+
data-src={iframeSrc}
|
|
255
|
+
title={alt || `${name} Example`}
|
|
256
|
+
style={iframeStyle}
|
|
257
|
+
frameborder="0"
|
|
258
|
+
seamless
|
|
259
|
+
aria-hidden="true"
|
|
260
|
+
/>
|
|
261
|
+
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
262
|
+
</div>
|
|
126
263
|
</div>
|
|
127
264
|
</igc-tab>
|
|
128
265
|
</igc-tabs>
|