igniteui-astro-components 1.8.0 → 1.8.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/llms-full.txt +10 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/src/code-theme/README.md +5 -0
- package/src/code-theme/index.ts +22 -3
- package/src/components/mdx/Sample/README.md +4 -0
- package/src/scripts/sample-widget.ts +53 -0
package/llms-full.txt
CHANGED
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
|
|
91
91
|
### Code theme
|
|
92
92
|
|
|
93
|
-
- [Code theme](src/code-theme/README.md): `igniteui-astro-components/code-theme` — `igCodeTheme` (Shiki theme `ig-dark`: Rosé Pine Moon recoloured with `colorReplacements
|
|
93
|
+
- [Code theme](src/code-theme/README.md): `igniteui-astro-components/code-theme` — `igCodeTheme` (Shiki theme `ig-dark`: Rosé Pine Moon recoloured with `colorReplacements`, no italic) and `igShikiConfig` (`{ theme: igCodeTheme, wrap: true }`) for `markdown.shikiConfig`. Shiki writes colours inline; the surface comes from `--igd-code-*` tokens.
|
|
94
94
|
|
|
95
95
|
### Styles
|
|
96
96
|
|
|
@@ -3065,6 +3065,10 @@ A modifier the chrome ignores, or a `chrome` value that is not one of the three,
|
|
|
3065
3065
|
|
|
3066
3066
|
As in 1.x, `iframeOnly` wins over `hideCode`. A valid `chrome` wins over both, and the warning says the deprecated prop is ignored. A `chrome` that is not one of the three is ignored itself, so the deprecated prop still applies.
|
|
3067
3067
|
|
|
3068
|
+
### Clicks beside the demo
|
|
3069
|
+
|
|
3070
|
+
The iframe does not always fill the sample area: `position` leaves slack around it, `spacing` pads it, and a centered `fitContent` iframe has margins beside it. A `click` or `pointerdown` on that empty part of the area is forwarded to a same-origin demo as an untrusted event on its `<html>` element, so the demo's outside-click handling runs and open popups (a picker, a dropdown, a combo) close. The forwarded event carries no coordinates. A cross-origin demo cannot be reached, so its behavior is unchanged.
|
|
3071
|
+
|
|
3068
3072
|
### Examples
|
|
3069
3073
|
|
|
3070
3074
|
```mdx
|
|
@@ -3140,6 +3144,11 @@ Moon** recoloured with Shiki's `colorReplacements` to match the API Docs Figma
|
|
|
3140
3144
|
design (`api-snippet`, dark). Fenced Markdown/MDX blocks, Astro's `<Code>` and
|
|
3141
3145
|
the Sample component's code tabs all use it.
|
|
3142
3146
|
|
|
3147
|
+
Snippets use no italic. The theme removes `italic` from every token rule it
|
|
3148
|
+
inherits from Rosé Pine Moon (comments, attribute names, variables, built-in
|
|
3149
|
+
functions, Vue directives, Markdown emphasis), so tokens differ by colour only.
|
|
3150
|
+
`bold` stays.
|
|
3151
|
+
|
|
3143
3152
|
| Export | What it is |
|
|
3144
3153
|
| --------------- | ------------------------------------------------------------ |
|
|
3145
3154
|
| `igCodeTheme` | The Shiki theme object (`ig-dark`). |
|
package/llms.txt
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
## Code theme
|
|
80
80
|
|
|
81
|
-
- [Code theme](src/code-theme/README.md): `igniteui-astro-components/code-theme` — `igCodeTheme` (Shiki theme `ig-dark`: Rosé Pine Moon recoloured with `colorReplacements
|
|
81
|
+
- [Code theme](src/code-theme/README.md): `igniteui-astro-components/code-theme` — `igCodeTheme` (Shiki theme `ig-dark`: Rosé Pine Moon recoloured with `colorReplacements`, no italic) and `igShikiConfig` (`{ theme: igCodeTheme, wrap: true }`) for `markdown.shikiConfig`. Shiki writes colours inline; the surface comes from `--igd-code-*` tokens.
|
|
82
82
|
|
|
83
83
|
## Styles
|
|
84
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-astro-components",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.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": {
|
package/src/code-theme/README.md
CHANGED
|
@@ -5,6 +5,11 @@ Moon** recoloured with Shiki's `colorReplacements` to match the API Docs Figma
|
|
|
5
5
|
design (`api-snippet`, dark). Fenced Markdown/MDX blocks, Astro's `<Code>` and
|
|
6
6
|
the Sample component's code tabs all use it.
|
|
7
7
|
|
|
8
|
+
Snippets use no italic. The theme removes `italic` from every token rule it
|
|
9
|
+
inherits from Rosé Pine Moon (comments, attribute names, variables, built-in
|
|
10
|
+
functions, Vue directives, Markdown emphasis), so tokens differ by colour only.
|
|
11
|
+
`bold` stays.
|
|
12
|
+
|
|
8
13
|
| Export | What it is |
|
|
9
14
|
| --------------- | ------------------------------------------------------------ |
|
|
10
15
|
| `igCodeTheme` | The Shiki theme object (`ig-dark`). |
|
package/src/code-theme/index.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { ShikiConfig } from 'astro';
|
|
|
9
9
|
import type { ThemeRegistration } from 'shiki';
|
|
10
10
|
import rosePineMoon from '@shikijs/themes/rose-pine-moon';
|
|
11
11
|
|
|
12
|
+
type TokenColor = NonNullable<ThemeRegistration['tokenColors']>[number];
|
|
13
|
+
|
|
12
14
|
/** Object-literal, JSON and YAML keys and `obj.prop` access: Rosé Pine leaves them on the default text colour. */
|
|
13
15
|
const PROPERTY_KEY_SCOPES = [
|
|
14
16
|
'meta.object-literal.key',
|
|
@@ -18,7 +20,23 @@ const PROPERTY_KEY_SCOPES = [
|
|
|
18
20
|
'variable.other.object.property',
|
|
19
21
|
];
|
|
20
22
|
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Removes `italic` from a rule's `fontStyle` and keeps the other styles.
|
|
25
|
+
* An emptied `fontStyle` stays as `''`, which Shiki reads as no font style.
|
|
26
|
+
*/
|
|
27
|
+
function withoutItalic(rule: TokenColor): TokenColor {
|
|
28
|
+
const { fontStyle } = rule.settings;
|
|
29
|
+
if (fontStyle === undefined) return rule;
|
|
30
|
+
|
|
31
|
+
const kept = fontStyle
|
|
32
|
+
.split(/\s+/)
|
|
33
|
+
.filter((style) => style !== '' && style !== 'italic')
|
|
34
|
+
.join(' ');
|
|
35
|
+
|
|
36
|
+
return { ...rule, settings: { ...rule.settings, fontStyle: kept } };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Dark brand theme. Rosé Pine colour → brand colour, scopes unchanged, no italic. */
|
|
22
40
|
export const igCodeTheme: ThemeRegistration = {
|
|
23
41
|
...rosePineMoon,
|
|
24
42
|
name: 'ig-dark',
|
|
@@ -40,12 +58,13 @@ export const igCodeTheme: ThemeRegistration = {
|
|
|
40
58
|
'#eb6f92': '#ff4d25', // love: invalid, built-in functions
|
|
41
59
|
},
|
|
42
60
|
tokenColors: [
|
|
43
|
-
|
|
61
|
+
// Code snippets use no italic: tokens differ by colour only.
|
|
62
|
+
...(rosePineMoon.tokenColors ?? []).map(withoutItalic),
|
|
44
63
|
{ scope: PROPERTY_KEY_SCOPES, settings: { foreground: '#66adff' } },
|
|
45
64
|
// Keep a comment's `//` / `/* */` as muted as its text.
|
|
46
65
|
{
|
|
47
66
|
scope: ['punctuation.definition.comment'],
|
|
48
|
-
settings: { foreground: '#7d91ab'
|
|
67
|
+
settings: { foreground: '#7d91ab' },
|
|
49
68
|
},
|
|
50
69
|
],
|
|
51
70
|
};
|
|
@@ -56,6 +56,10 @@ A modifier the chrome ignores, or a `chrome` value that is not one of the three,
|
|
|
56
56
|
|
|
57
57
|
As in 1.x, `iframeOnly` wins over `hideCode`. A valid `chrome` wins over both, and the warning says the deprecated prop is ignored. A `chrome` that is not one of the three is ignored itself, so the deprecated prop still applies.
|
|
58
58
|
|
|
59
|
+
## Clicks beside the demo
|
|
60
|
+
|
|
61
|
+
The iframe does not always fill the sample area: `position` leaves slack around it, `spacing` pads it, and a centered `fitContent` iframe has margins beside it. A `click` or `pointerdown` on that empty part of the area is forwarded to a same-origin demo as an untrusted event on its `<html>` element, so the demo's outside-click handling runs and open popups (a picker, a dropdown, a combo) close. The forwarded event carries no coordinates. A cross-origin demo cannot be reached, so its behavior is unchanged.
|
|
62
|
+
|
|
59
63
|
## Examples
|
|
60
64
|
|
|
61
65
|
```mdx
|
|
@@ -983,6 +983,56 @@ function initResizableSamples(): void {
|
|
|
983
983
|
.forEach(wireResizable);
|
|
984
984
|
}
|
|
985
985
|
|
|
986
|
+
// ─── Click forwarding ───────────────────────────────────────────────────────────
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Forwards a `pointerdown` or `click` on the container's empty area to a
|
|
990
|
+
* same-origin demo's `<html>` element.
|
|
991
|
+
*/
|
|
992
|
+
function wireClickForwarding(container: HTMLElement): void {
|
|
993
|
+
if (container.dataset.clickForwardingWired) return;
|
|
994
|
+
container.dataset.clickForwardingWired = 'true';
|
|
995
|
+
|
|
996
|
+
const forward = (event: MouseEvent): void => {
|
|
997
|
+
if (event.target !== container) return;
|
|
998
|
+
const iframe = container.querySelector('iframe');
|
|
999
|
+
let doc: Document | null = null;
|
|
1000
|
+
try {
|
|
1001
|
+
doc = iframe?.contentDocument ?? null;
|
|
1002
|
+
} catch {
|
|
1003
|
+
// A cross-origin demo cannot be reached.
|
|
1004
|
+
}
|
|
1005
|
+
const win = iframe?.contentWindow as (Window & typeof globalThis) | null | undefined;
|
|
1006
|
+
if (!doc?.documentElement || !win) return;
|
|
1007
|
+
|
|
1008
|
+
const init = {
|
|
1009
|
+
bubbles: true,
|
|
1010
|
+
composed: true,
|
|
1011
|
+
cancelable: true,
|
|
1012
|
+
view: win,
|
|
1013
|
+
button: event.button,
|
|
1014
|
+
buttons: event.buttons,
|
|
1015
|
+
};
|
|
1016
|
+
doc.documentElement.dispatchEvent(
|
|
1017
|
+
event.type === 'pointerdown'
|
|
1018
|
+
? new win.PointerEvent('pointerdown', {
|
|
1019
|
+
...init,
|
|
1020
|
+
pointerId: 1,
|
|
1021
|
+
pointerType: 'mouse',
|
|
1022
|
+
isPrimary: true,
|
|
1023
|
+
})
|
|
1024
|
+
: new win.MouseEvent('click', init),
|
|
1025
|
+
);
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
container.addEventListener('pointerdown', forward);
|
|
1029
|
+
container.addEventListener('click', forward);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function initClickForwarding(): void {
|
|
1033
|
+
document.querySelectorAll<HTMLElement>('.igd-sample-container').forEach(wireClickForwarding);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
986
1036
|
// ─── Entry Point ──────────────────────────────────────────────────────────────
|
|
987
1037
|
|
|
988
1038
|
/**
|
|
@@ -1001,6 +1051,9 @@ export function initSampleWidgets(): void {
|
|
|
1001
1051
|
// Wire resizable samples so their drag handle / arrow keys work immediately.
|
|
1002
1052
|
initResizableSamples();
|
|
1003
1053
|
|
|
1054
|
+
// Forward clicks on the empty sample area to same-origin demos.
|
|
1055
|
+
initClickForwarding();
|
|
1056
|
+
|
|
1004
1057
|
// Kick off the Shiki download immediately so it is ready before the user
|
|
1005
1058
|
// opens a code tab (tabs appear only after an IntersectionObserver fires
|
|
1006
1059
|
// + a JSON fetch completes, giving Shiki time to load in parallel).
|