@astryxdesign/core 0.6.3-canary.f22695a → 0.6.3
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/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +28 -13
- package/dist/Chat/ChatLayout.d.ts +0 -19
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +0 -19
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +34 -44
- package/dist/Citation/Citation.d.ts +1 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +2 -3
- package/dist/CodeBlock/highlightRanges.d.ts.map +1 -1
- package/dist/CodeBlock/highlightRanges.js +3 -14
- package/dist/Icon/Icon.d.ts +31 -6
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +71 -8
- package/dist/Link/useLinkComponent.d.ts +15 -5
- package/dist/Link/useLinkComponent.d.ts.map +1 -1
- package/dist/Link/useLinkComponent.js +51 -34
- package/dist/Markdown/Markdown.js +2 -2
- package/dist/Markdown/url.d.ts +0 -2
- package/dist/Markdown/url.d.ts.map +1 -1
- package/dist/Markdown/url.js +2 -8
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +0 -5
- package/dist/TopNav/TopNavMenu.d.ts +1 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -3
- package/dist/astryx.css +4 -2
- package/dist/hooks/useClickableContainer.d.ts +1 -10
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +4 -15
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/theme/generateThemeRules.d.ts +7 -13
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +35 -131
- package/package.json +4 -9
- package/src/Button/Button.doc.mjs +5 -5
- package/src/Button/Button.tsx +13 -15
- package/src/Chat/ChatLayout.doc.mjs +4 -12
- package/src/Chat/ChatLayout.test.tsx +0 -28
- package/src/Chat/ChatLayout.tsx +0 -19
- package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -31
- package/src/Chat/ChatLayoutScrollButton.tsx +14 -31
- package/src/Citation/Citation.doc.mjs +2 -2
- package/src/Citation/Citation.test.tsx +0 -17
- package/src/Citation/Citation.tsx +2 -4
- package/src/ClickableCard/ClickableCard.doc.mjs +2 -2
- package/src/CodeBlock/highlightRanges.test.ts +1 -143
- package/src/CodeBlock/highlightRanges.ts +5 -15
- package/src/Icon/Icon.doc.mjs +5 -7
- package/src/Icon/Icon.spec.md +40 -81
- package/src/Icon/Icon.test.tsx +3 -6
- package/src/Icon/Icon.tsx +68 -20
- package/src/IconButton/IconButton.doc.mjs +3 -3
- package/src/IconButton/IconButton.test.tsx +0 -40
- package/src/Item/Item.doc.mjs +2 -2
- package/src/Link/Link.doc.mjs +4 -6
- package/src/Link/LinkProvider.doc.mjs +2 -2
- package/src/Link/useLinkComponent.test.tsx +0 -333
- package/src/Link/useLinkComponent.ts +57 -29
- package/src/List/ListItem.doc.mjs +2 -2
- package/src/Markdown/Markdown.doc.mjs +2 -2
- package/src/Markdown/Markdown.spec.md +15 -19
- package/src/Markdown/Markdown.test.tsx +0 -52
- package/src/Markdown/Markdown.tsx +2 -2
- package/src/Markdown/parser.test.ts +0 -20
- package/src/Markdown/url.ts +3 -9
- package/src/PowerSearch/PowerSearchValueEditor.test.tsx +0 -51
- package/src/PowerSearch/PowerSearchValueEditor.tsx +0 -4
- package/src/Token/Token.doc.mjs +2 -2
- package/src/TopNav/TopNavMenu.doc.mjs +2 -2
- package/src/TopNav/TopNavMenu.test.tsx +0 -30
- package/src/TopNav/TopNavMenu.tsx +2 -7
- package/src/hooks/useClickableContainer.ts +4 -20
- package/src/index.ts +0 -3
- package/src/tailwind-theme.css +6 -0
- package/src/theme/Theme.test.tsx +0 -32
- package/src/theme/generateThemeRules.test.ts +2 -470
- package/src/theme/generateThemeRules.ts +51 -219
- package/src/theme/tokenValueCompat.test.ts +1 -4
- package/dist/Icon/IconDefaultSizeContext.d.ts +0 -4
- package/dist/Icon/IconDefaultSizeContext.d.ts.map +0 -1
- package/dist/Icon/IconDefaultSizeContext.js +0 -18
- package/dist/Icon/IconSize.stylex.d.ts +0 -65
- package/dist/Icon/IconSize.stylex.d.ts.map +0 -1
- package/dist/Icon/IconSize.stylex.js +0 -75
- package/dist/Timer/Timer.d.ts +0 -49
- package/dist/Timer/Timer.d.ts.map +0 -1
- package/dist/Timer/Timer.js +0 -158
- package/dist/Timer/index.d.ts +0 -9
- package/dist/Timer/index.d.ts.map +0 -1
- package/dist/Timer/index.js +0 -10
- package/dist/theme/declarationBoundary.d.ts +0 -17
- package/dist/theme/declarationBoundary.d.ts.map +0 -1
- package/dist/theme/declarationBoundary.js +0 -343
- package/dist/utils/safeUrl.d.ts +0 -11
- package/dist/utils/safeUrl.d.ts.map +0 -1
- package/dist/utils/safeUrl.js +0 -78
- package/src/Chat/ChatLayout.spec.md +0 -271
- package/src/Chat/ChatLayoutScrollButton.spec.md +0 -338
- package/src/Chat/__tests__/ChatLayoutScrollButton.a11y.chromium.spec.ts +0 -514
- package/src/Chat/__tests__/ChatLayoutScrollButtonSurface.a11y.chromium.spec.ts +0 -740
- package/src/Icon/IconDefaultSizeContext.ts +0 -23
- package/src/Icon/IconSize.stylex.ts +0 -70
- package/src/Link/__tests__/Link.navigation.a11y.chromium.spec.ts +0 -261
- package/src/Markdown/Markdown.renderBoundary.test.tsx +0 -72
- package/src/Timer/Timer.doc.mjs +0 -183
- package/src/Timer/Timer.spec.md +0 -215
- package/src/Timer/Timer.test.tsx +0 -302
- package/src/Timer/Timer.tsx +0 -258
- package/src/Timer/index.ts +0 -11
- package/src/hooks/useClickableContainer.test.tsx +0 -236
- package/src/theme/declarationBoundary.test.ts +0 -126
- package/src/theme/declarationBoundary.ts +0 -347
- package/src/utils/safeUrl.test.ts +0 -88
- package/src/utils/safeUrl.ts +0 -85
|
@@ -4,62 +4,79 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useLinkComponent.ts
|
|
7
|
-
* @input
|
|
8
|
-
* @output
|
|
9
|
-
* @position
|
|
10
|
-
* as destination-less anchors without invoking a router.
|
|
7
|
+
* @input React use, useMemo, createElement, forwardRef, LinkContext, LinkComponentType
|
|
8
|
+
* @output Exports useLinkComponent hook
|
|
9
|
+
* @position Hook for resolving the link component in Astryx components
|
|
11
10
|
*
|
|
12
|
-
*
|
|
11
|
+
* Resolution order: per-component `as` prop > LinkProvider context > native `<a>`.
|
|
12
|
+
*
|
|
13
|
+
* When the resolved component is a custom component (not native `<a>`),
|
|
14
|
+
* wraps it to pass `to={href}` alongside `href`. This enables compatibility
|
|
15
|
+
* with routers that use `to` (React Router, TanStack Router)
|
|
16
|
+
* without requiring an adapter component.
|
|
17
|
+
*
|
|
18
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
19
|
+
* - /packages/core/src/Link/index.ts
|
|
20
|
+
* - /packages/core/src/Link/Link.doc.mjs
|
|
13
21
|
*/
|
|
14
22
|
import { use, useMemo, createElement } from 'react';
|
|
15
23
|
import { LinkContext } from "./LinkContext.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Creates a wrapper component that passes both `href` and `to` props
|
|
26
|
+
* to the underlying link component. This enables routers that use `to`
|
|
27
|
+
* (React Router, TanStack Router) to work without an adapter.
|
|
28
|
+
*
|
|
29
|
+
* The wrapper is transparent: it forwards refs and all other props unchanged.
|
|
30
|
+
* Native `<a>` elements ignore the unknown `to` prop harmlessly.
|
|
31
|
+
*/
|
|
32
|
+
function createLinkWithTo(Component) {
|
|
33
|
+
function LinkWithTo({
|
|
19
34
|
href,
|
|
20
|
-
to,
|
|
21
35
|
ref,
|
|
22
36
|
...rest
|
|
23
37
|
}) {
|
|
24
|
-
// An undefined destination can crash a router or resolve to the current
|
|
25
|
-
// route. Reject the whole handoff, not just one prop or a fallback value.
|
|
26
|
-
if (!isSafeDestination(href) || !isSafeDestination(to)) {
|
|
27
|
-
return /*#__PURE__*/createElement('a', {
|
|
28
|
-
ref,
|
|
29
|
-
...rest
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (Component === 'a') {
|
|
33
|
-
return /*#__PURE__*/createElement('a', {
|
|
34
|
-
ref,
|
|
35
|
-
...rest,
|
|
36
|
-
href
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
38
|
return /*#__PURE__*/createElement(Component, {
|
|
40
39
|
ref,
|
|
41
|
-
...rest,
|
|
42
40
|
href,
|
|
43
|
-
to:
|
|
41
|
+
to: href,
|
|
42
|
+
...rest
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
return
|
|
45
|
+
LinkWithTo.displayName = `LinkWithTo(${typeof Component === 'string' ? Component : Component.displayName || Component.name || 'Component'})`;
|
|
46
|
+
return LinkWithTo;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* Resolves the link component to use.
|
|
51
|
+
*
|
|
52
|
+
* Priority: `as` prop > `LinkProvider` context > native `<a>`.
|
|
53
|
+
*
|
|
54
|
+
* When the resolved component is a custom component (not the native `<a>`),
|
|
55
|
+
* it is wrapped to receive both `href` and `to` props set to the same value.
|
|
56
|
+
* This allows `to`-based routers (React Router, TanStack Router) to work
|
|
57
|
+
* out of the box without a manual adapter.
|
|
58
|
+
*
|
|
59
|
+
* @param as - Per-component override. If provided, takes highest priority.
|
|
60
|
+
* @returns The resolved link component (with `to` injection for custom components).
|
|
54
61
|
*
|
|
55
62
|
* @example
|
|
56
63
|
* ```
|
|
57
|
-
*
|
|
58
|
-
*
|
|
64
|
+
* function MyComponent({ as }: { as?: LinkComponentType }) {
|
|
65
|
+
* const LinkComponent = useLinkComponent(as);
|
|
66
|
+
* return <LinkComponent href="/foo">Click me</LinkComponent>;
|
|
67
|
+
* }
|
|
59
68
|
* ```
|
|
60
69
|
*/
|
|
61
70
|
export function useLinkComponent(as) {
|
|
62
71
|
const ctx = use(LinkContext);
|
|
63
72
|
const resolved = as ?? ctx?.component ?? 'a';
|
|
64
|
-
|
|
73
|
+
|
|
74
|
+
// Memoize the wrapper to maintain referential stability.
|
|
75
|
+
// The wrapper is only created for custom components (not native <a>).
|
|
76
|
+
return useMemo(() => {
|
|
77
|
+
if (resolved === 'a') {
|
|
78
|
+
return 'a';
|
|
79
|
+
}
|
|
80
|
+
return createLinkWithTo(resolved);
|
|
81
|
+
}, [resolved]);
|
|
65
82
|
}
|
|
@@ -35,7 +35,7 @@ import { parseInlineAst, parseMarkdownAst, parseMarkdownAstIncremental, createIn
|
|
|
35
35
|
import { getMarkdownAstLegacyCodeLanguage, markdownAstText } from "./ast.js";
|
|
36
36
|
import { applyMarkdownTransforms, getMarkdownExtensionRenderer, markdownExtensionText, prepareMarkdownPlugins, reportMarkdownPluginFailure } from "./plugins/protocol.js";
|
|
37
37
|
import { getMarkdownFenceProposal } from "./plugins/semanticFence.js";
|
|
38
|
-
import {
|
|
38
|
+
import { sanitizeMarkdownUrl } from "./url.js";
|
|
39
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
40
|
import { useTranslator } from "../i18n/index.js";
|
|
41
41
|
|
|
@@ -668,7 +668,7 @@ function renderInline(node, index, onLinkClick, cursor, citationCtx, linkCompone
|
|
|
668
668
|
}
|
|
669
669
|
case 'link':
|
|
670
670
|
{
|
|
671
|
-
const safeHref =
|
|
671
|
+
const safeHref = sanitizeMarkdownUrl(node.url);
|
|
672
672
|
if (safeHref == null) {
|
|
673
673
|
// Unsafe URL — render as plain text
|
|
674
674
|
return /*#__PURE__*/_jsx("span", {
|
package/dist/Markdown/url.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/** Preserve the released parser policy for no-plugin output compatibility. */
|
|
2
2
|
export declare function isSafeMarkdownParserUrl(url: string): boolean;
|
|
3
|
-
/** Navigation and image rendering deliberately have different policies. */
|
|
4
|
-
export declare function sanitizeMarkdownLinkUrl(url: string): string | null;
|
|
5
3
|
export declare function sanitizeMarkdownUrl(url: string): string | null;
|
|
6
4
|
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/Markdown/url.ts"],"names":[],"mappings":"AAmBA,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/Markdown/url.ts"],"names":[],"mappings":"AAmBA,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK9D"}
|
package/dist/Markdown/url.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @position Shared URL policy for parser, transforms, and renderer
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const PARSER_DANGEROUS_URL_PATTERN = /^(?:javascript:|data:text\/html|vbscript:)/i;
|
|
11
11
|
const RENDER_DANGEROUS_URL_PATTERN = /^(?:javascript:|data:|vbscript:)/i;
|
|
12
12
|
function normalizeMarkdownUrl(url) {
|
|
13
13
|
// Browsers ignore embedded controls in schemes, so normalize before checking.
|
|
@@ -17,13 +17,7 @@ function normalizeMarkdownUrl(url) {
|
|
|
17
17
|
|
|
18
18
|
/** Preserve the released parser policy for no-plugin output compatibility. */
|
|
19
19
|
export function isSafeMarkdownParserUrl(url) {
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** Navigation and image rendering deliberately have different policies. */
|
|
24
|
-
export function sanitizeMarkdownLinkUrl(url) {
|
|
25
|
-
const normalized = sanitizeUrl(url);
|
|
26
|
-
return normalized === '' ? null : normalized;
|
|
20
|
+
return !PARSER_DANGEROUS_URL_PATTERN.test(normalizeMarkdownUrl(url));
|
|
27
21
|
}
|
|
28
22
|
export function sanitizeMarkdownUrl(url) {
|
|
29
23
|
const normalized = normalizeMarkdownUrl(url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSearchValueEditor.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchValueEditor.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAIZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAqBxD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"PowerSearchValueEditor.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/PowerSearchValueEditor.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAIZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAqBxD,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAspBD,wBAAgB,sBAAsB,CAAC,EACrC,aAAa,EACb,WAAW,EACX,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,GACX,EAAE,2BAA2B,4BA+H7B"}
|
|
@@ -489,11 +489,6 @@ function EnumListEditor({
|
|
|
489
489
|
placeholder: t('@astryx.powersearch.valueEditor.selectValuesPlaceholder'),
|
|
490
490
|
hasEntriesOnFocus: true,
|
|
491
491
|
debounceMs: 0
|
|
492
|
-
// A closed vocabulary: every value is a valid choice, so the menu shows
|
|
493
|
-
// all of them instead of BaseTypeahead's 10-suggestion default, which
|
|
494
|
-
// would silently drop valid choices with no way to reach them.
|
|
495
|
-
,
|
|
496
|
-
maxMenuItems: items.length
|
|
497
492
|
});
|
|
498
493
|
}
|
|
499
494
|
function EntityListEditor({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TopNavMenu.tsx
|
|
3
3
|
* @input Uses React, StyleX, usePopover, useMenuHover, useListFocus,
|
|
4
|
-
* useTypeahead, TopNavItem tokens
|
|
4
|
+
* useTypeahead, TopNavItem tokens
|
|
5
5
|
* @output Exports TopNavMenu component and related types
|
|
6
6
|
* @position Navigation item with hover-triggered overflow menu for TopNav
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNavMenu.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TopNavMenu.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAqM5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAMD,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACnE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,KAAK,EACL,KAAK,EACL,KAAW,EACX,SAAe,EACf,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EACR,EAAE,eAAe,4BAqQjB;yBAlRe,UAAU"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TopNavMenu.tsx
|
|
7
7
|
* @input Uses React, StyleX, usePopover, useMenuHover, useListFocus,
|
|
8
|
-
* useTypeahead, TopNavItem tokens
|
|
8
|
+
* useTypeahead, TopNavItem tokens
|
|
9
9
|
* @output Exports TopNavMenu component and related types
|
|
10
10
|
* @position Navigation item with hover-triggered overflow menu for TopNav
|
|
11
11
|
*
|
|
@@ -29,7 +29,6 @@ import { useTopNavSlot } from "./TopNavContext.js";
|
|
|
29
29
|
import { useTopNavRenderMode } from "./TopNavRenderContext.js";
|
|
30
30
|
import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
|
|
31
31
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
32
|
-
import { isSafeUrl } from "../utils/safeUrl.js";
|
|
33
32
|
import { themeProps } from "../utils/themeProps.js";
|
|
34
33
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
35
34
|
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
@@ -379,7 +378,7 @@ export function TopNavMenu({
|
|
|
379
378
|
// promotes exactly one item to 0.
|
|
380
379
|
,
|
|
381
380
|
tabIndex: -1,
|
|
382
|
-
href: item.href
|
|
381
|
+
href: item.href,
|
|
383
382
|
onClick: item.onClick,
|
|
384
383
|
...focusOutlineProps.focusVisible(styles.menuItem),
|
|
385
384
|
children: [/*#__PURE__*/_jsx("div", {
|
package/dist/astryx.css
CHANGED
|
@@ -904,7 +904,9 @@
|
|
|
904
904
|
.x1k6wstc:not(#\#):not(#\#):not(#\#){font-size:10px}
|
|
905
905
|
.xfifm61:not(#\#):not(#\#):not(#\#){font-size:12px}
|
|
906
906
|
.xif65rj:not(#\#):not(#\#):not(#\#){font-size:14px}
|
|
907
|
+
.x1j61zf2:not(#\#):not(#\#):not(#\#){font-size:16px}
|
|
907
908
|
.x1jchvi3:not(#\#):not(#\#):not(#\#){font-size:1rem}
|
|
909
|
+
.xwsyq91:not(#\#):not(#\#):not(#\#){font-size:20px}
|
|
908
910
|
.x1qlqyl8:not(#\#):not(#\#):not(#\#){font-size:inherit}
|
|
909
911
|
.xhs0kqb:not(#\#):not(#\#):not(#\#){font-size:var(--font-size-2xl)}
|
|
910
912
|
.x16a80zy:not(#\#):not(#\#):not(#\#){font-size:var(--font-size-2xs)}
|
|
@@ -1279,7 +1281,7 @@
|
|
|
1279
1281
|
.xnpjden:not(#\#):not(#\#):not(#\#){transition-property:opacity,background-color}
|
|
1280
1282
|
.xsm4mo9:not(#\#):not(#\#):not(#\#){transition-property:opacity,display,overlay}
|
|
1281
1283
|
.x1n1p2mu:not(#\#):not(#\#):not(#\#){transition-property:opacity,position}
|
|
1282
|
-
.
|
|
1284
|
+
.x1apppo2:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,max-width}
|
|
1283
1285
|
.x4bbghf:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,overlay,display}
|
|
1284
1286
|
.x6o7n8i:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform}
|
|
1285
1287
|
.xxup5nn:not(#\#):not(#\#):not(#\#){transition-property:opacity,visibility,transform}
|
|
@@ -1654,6 +1656,7 @@
|
|
|
1654
1656
|
.x55n99s:not(#\#):not(#\#):not(#\#):not(#\#){max-width:15em}
|
|
1655
1657
|
.x1ncir08:not(#\#):not(#\#):not(#\#):not(#\#){max-width:200px}
|
|
1656
1658
|
.xw5ewwj:not(#\#):not(#\#):not(#\#):not(#\#){max-width:300px}
|
|
1659
|
+
.x1x67gh:not(#\#):not(#\#):not(#\#):not(#\#){max-width:32px}
|
|
1657
1660
|
.xxc7z9f:not(#\#):not(#\#):not(#\#):not(#\#){max-width:360px}
|
|
1658
1661
|
.x1j9u4d2:not(#\#):not(#\#):not(#\#):not(#\#){max-width:400px}
|
|
1659
1662
|
.x17fpy1y:not(#\#):not(#\#):not(#\#):not(#\#){max-width:480px}
|
|
@@ -1668,7 +1671,6 @@
|
|
|
1668
1671
|
.x1m1aaou:not(#\#):not(#\#):not(#\#):not(#\#){max-width:min(960px,calc(100dvw - var(--spacing-4)))}
|
|
1669
1672
|
.x1x1rfll:not(#\#):not(#\#):not(#\#):not(#\#){max-width:none}
|
|
1670
1673
|
.xjl2t3p:not(#\#):not(#\#):not(#\#):not(#\#){max-width:var(--layout-content-width,none)}
|
|
1671
|
-
.x1jys5uj:not(#\#):not(#\#):not(#\#):not(#\#){max-width:var(--size-element-md)}
|
|
1672
1674
|
.xf68679:not(#\#):not(#\#):not(#\#):not(#\#){max-width:var(--x-maxWidth)}
|
|
1673
1675
|
.x2lwn1j:not(#\#):not(#\#):not(#\#):not(#\#){min-height:0}
|
|
1674
1676
|
.x1us19tq:not(#\#):not(#\#):not(#\#):not(#\#){min-height:100%}
|
|
@@ -7,11 +7,6 @@
|
|
|
7
7
|
* Solves the "nested interactive elements" problem: when a card is clickable
|
|
8
8
|
* but contains buttons/links, clicking those should NOT trigger the card's action.
|
|
9
9
|
*
|
|
10
|
-
* Every navigation exit here (window.open, location.href, and the delegated
|
|
11
|
-
* click on the interactive ref) runs after the shared navigation-destination
|
|
12
|
-
* rule in utils/safeUrl.ts; a blocked href does not navigate by any
|
|
13
|
-
* activation method.
|
|
14
|
-
*
|
|
15
10
|
* SYNC: When modified, update:
|
|
16
11
|
* - /packages/core/src/hooks/index.ts (export)
|
|
17
12
|
*/
|
|
@@ -35,11 +30,7 @@ export interface UseClickableContainerOptions {
|
|
|
35
30
|
interactiveRef?: RefObject<HTMLElement | null>;
|
|
36
31
|
/** Click handler */
|
|
37
32
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Navigation URL — when provided, clicking the container navigates. Checked
|
|
40
|
-
* with the shared navigation rule (utils/safeUrl.ts) before any activation
|
|
41
|
-
* method (plain, new-tab, Cmd/Ctrl-click, middle-click, delegated click).
|
|
42
|
-
*/
|
|
33
|
+
/** Navigation URL — when provided, clicking the container navigates */
|
|
43
34
|
href?: string;
|
|
44
35
|
/** Link target */
|
|
45
36
|
target?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClickableContainer.d.ts","sourceRoot":"","sources":["../../src/hooks/useClickableContainer.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"useClickableContainer.d.ts","sourceRoot":"","sources":["../../src/hooks/useClickableContainer.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAyB,KAAK,SAAS,EAAE,KAAK,UAAU,EAAC,MAAM,OAAO,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,QAmBvB,CAAC;AAmCZ,MAAM,WAAW,4BAA4B;IAC3C,yCAAyC;IACzC,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC5C,mEAAmE;IACnE,cAAc,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC/C,oBAAoB;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAClD,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,cAAc,EACd,OAAO,EAAE,WAAW,EACpB,IAAI,EACJ,MAAM,EACN,QAAgB,GACjB,EAAE,4BAA4B,GAAG,wBAAwB,CA6GzD"}
|
|
@@ -11,16 +11,10 @@
|
|
|
11
11
|
* Solves the "nested interactive elements" problem: when a card is clickable
|
|
12
12
|
* but contains buttons/links, clicking those should NOT trigger the card's action.
|
|
13
13
|
*
|
|
14
|
-
* Every navigation exit here (window.open, location.href, and the delegated
|
|
15
|
-
* click on the interactive ref) runs after the shared navigation-destination
|
|
16
|
-
* rule in utils/safeUrl.ts; a blocked href does not navigate by any
|
|
17
|
-
* activation method.
|
|
18
|
-
*
|
|
19
14
|
* SYNC: When modified, update:
|
|
20
15
|
* - /packages/core/src/hooks/index.ts (export)
|
|
21
16
|
*/
|
|
22
17
|
import { useCallback, useEffect } from 'react';
|
|
23
|
-
import { isSafeUrl } from "../utils/safeUrl.js";
|
|
24
18
|
|
|
25
19
|
/**
|
|
26
20
|
* Canonical list of interactive element selectors — native controls plus
|
|
@@ -134,12 +128,8 @@ export function useClickableContainer({
|
|
|
134
128
|
return;
|
|
135
129
|
}
|
|
136
130
|
|
|
137
|
-
// Navigate if href is provided
|
|
138
|
-
|
|
139
|
-
// navigation rule decides once, before target, modifier key, or the
|
|
140
|
-
// delegated anchor can select a sink. A blocked href simply does not
|
|
141
|
-
// navigate — the click handler above still ran.
|
|
142
|
-
if (href != null && isSafeUrl(href)) {
|
|
131
|
+
// Navigate if href is provided
|
|
132
|
+
if (href != null) {
|
|
143
133
|
const shouldOpenNewTab = target === '_blank' || event.ctrlKey || event.metaKey;
|
|
144
134
|
if (shouldOpenNewTab) {
|
|
145
135
|
window.open(href, '_blank', 'noopener');
|
|
@@ -181,10 +171,9 @@ export function useClickableContainer({
|
|
|
181
171
|
return;
|
|
182
172
|
}
|
|
183
173
|
|
|
184
|
-
// Middle-click on href opens in new tab
|
|
185
|
-
// this navigation never passes through React either).
|
|
174
|
+
// Middle-click on href opens in new tab
|
|
186
175
|
const isMiddleClick = event.button === 1;
|
|
187
|
-
if (isMiddleClick && href != null &&
|
|
176
|
+
if (isMiddleClick && href != null && (eventTarget === event.currentTarget || !hasInteractiveAncestor(eventTarget, containerEl))) {
|
|
188
177
|
window.open(href, '_blank', 'noopener');
|
|
189
178
|
}
|
|
190
179
|
}, [containerRef, href, disabled]);
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,a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AM,SAAS,CAAC;AACxC,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACzC,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -133,9 +133,6 @@ export * from "./Spinner/index.js";
|
|
|
133
133
|
// Timestamp display
|
|
134
134
|
export * from "./Timestamp/index.js";
|
|
135
135
|
|
|
136
|
-
// Elapsed timer display
|
|
137
|
-
export * from "./Timer/index.js";
|
|
138
|
-
|
|
139
136
|
// Overlay
|
|
140
137
|
export * from "./Overlay/index.js";
|
|
141
138
|
export * from "./Outline/index.js";
|
|
@@ -7,17 +7,11 @@
|
|
|
7
7
|
* Used by both the runtime path (Theme injects <style>) and the build
|
|
8
8
|
* path (`astryx theme build` pre-compiles to CSS files).
|
|
9
9
|
*
|
|
10
|
-
* Every consumer-supplied declaration is checked by declarationBoundary.ts
|
|
11
|
-
* before it is emitted, so a value can never end its declaration or rule
|
|
12
|
-
* early. A refused declaration is dropped and reported in the supplied
|
|
13
|
-
* warnings array (build receipts), or through `console.warn` (runtime).
|
|
14
|
-
*
|
|
15
10
|
* Extracted from defineTheme.ts to reduce cyclomatic complexity and provide
|
|
16
11
|
* a clear single-responsibility module for CSS generation.
|
|
17
12
|
*
|
|
18
|
-
* @input DefinedTheme (resolved theme object from defineTheme)
|
|
19
|
-
* @output CSS rule strings, split by layer (component vs prose)
|
|
20
|
-
* for each dropped declaration
|
|
13
|
+
* @input DefinedTheme (resolved theme object from defineTheme)
|
|
14
|
+
* @output CSS rule strings, split by layer (component vs prose)
|
|
21
15
|
* @position packages/core/src/theme/generateThemeRules.ts
|
|
22
16
|
*/
|
|
23
17
|
import type { ComponentStyleMap, DefinedTheme } from './defineTheme';
|
|
@@ -71,7 +65,7 @@ export interface ThemeRuleSource {
|
|
|
71
65
|
/** Resolved component style overrides. */
|
|
72
66
|
components?: ComponentStyleMap;
|
|
73
67
|
}
|
|
74
|
-
export declare function generateThemeRules(theme: ThemeRuleSource
|
|
68
|
+
export declare function generateThemeRules(theme: ThemeRuleSource): string[];
|
|
75
69
|
/**
|
|
76
70
|
* Generate theme rules split into component and prose groups.
|
|
77
71
|
*
|
|
@@ -82,7 +76,7 @@ export declare function generateThemeRules(theme: ThemeRuleSource, warnings?: st
|
|
|
82
76
|
* Component rules (tokens, stable .astryx-* targets plus data-* selectors) are
|
|
83
77
|
* that need to beat StyleX — they stay in astryx-theme (above StyleX layers).
|
|
84
78
|
*/
|
|
85
|
-
export declare function generateThemeRulesSplit(theme: DefinedTheme
|
|
79
|
+
export declare function generateThemeRulesSplit(theme: DefinedTheme): ThemeRulesSplit;
|
|
86
80
|
/**
|
|
87
81
|
* Generate CSS for on-media token and component overrides.
|
|
88
82
|
*
|
|
@@ -91,7 +85,7 @@ export declare function generateThemeRulesSplit(theme: DefinedTheme, warnings?:
|
|
|
91
85
|
* to media contexts — only tokens change. Themes can further customize
|
|
92
86
|
* via onDark.components / onLight.components.
|
|
93
87
|
*/
|
|
94
|
-
export declare function generateOnMediaCSS(theme: DefinedTheme
|
|
88
|
+
export declare function generateOnMediaCSS(theme: DefinedTheme): string;
|
|
95
89
|
/**
|
|
96
90
|
* Generate CSS for a theme's ordered adaptation rules.
|
|
97
91
|
*
|
|
@@ -101,7 +95,7 @@ export declare function generateOnMediaCSS(theme: DefinedTheme, warnings?: strin
|
|
|
101
95
|
* rule. Bare prose follows semantic variables, so token writes need no duplicate
|
|
102
96
|
* prose selectors here.
|
|
103
97
|
*/
|
|
104
|
-
export declare function generateAdaptationCSS(theme: DefinedTheme
|
|
98
|
+
export declare function generateAdaptationCSS(theme: DefinedTheme): ThemeCSSOutput;
|
|
105
99
|
/**
|
|
106
100
|
* The `--color-data-*` defaults as one unscoped `:root` block.
|
|
107
101
|
*
|
|
@@ -134,5 +128,5 @@ export declare function generateDataTokenDefaultsCSS(): string;
|
|
|
134
128
|
* The theme-independent `--color-data-*` defaults are not part of this output:
|
|
135
129
|
* see `generateDataTokenDefaultsCSS`.
|
|
136
130
|
*/
|
|
137
|
-
export declare function generateThemeCSS(theme: DefinedTheme
|
|
131
|
+
export declare function generateThemeCSS(theme: DefinedTheme): ThemeCSSOutput;
|
|
138
132
|
//# sourceMappingURL=generateThemeRules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAiHnE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAoND;;;;;GAKG;A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