@astryxdesign/lab 0.7.5-canary.fccd771 → 0.7.5-canary.fd0aba8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/astryx.integration.mjs +1 -1
- package/blocks/CommentPinShowcase.doc.mjs +1 -1
- package/blocks/CommentPinShowcase.tsx +2 -3
- package/dist/Chat/ChatUnreadDivider.js +1 -1
- package/dist/CircularProgress/CircularProgress.js +3 -3
- package/dist/CommentPin/CommentPin.d.ts +22 -7
- package/dist/CommentPin/CommentPin.d.ts.map +1 -1
- package/dist/CommentPin/CommentPin.js +115 -38
- package/dist/Comments/icons.d.ts.map +1 -1
- package/dist/Comments/icons.js +9 -2
- package/dist/DiffViewer/DiffViewer.d.ts +15 -4
- package/dist/DiffViewer/DiffViewer.d.ts.map +1 -1
- package/dist/DiffViewer/DiffViewer.js +31 -6
- package/dist/EmojiPicker/EmojiPicker.js +5 -8
- package/dist/InfoTip/InfoTip.d.ts +1 -1
- package/dist/InfoTip/InfoTip.js +1 -1
- package/dist/ListInput/ListInput.d.ts +1 -1
- package/dist/ListInput/ListInput.d.ts.map +1 -1
- package/dist/ListInput/ListInput.js +20 -1
- package/dist/LogStream/LogStream.d.ts.map +1 -1
- package/dist/LogStream/LogStream.js +2 -2
- package/dist/MobilePowerSearch/MobilePowerSearch.d.ts +49 -18
- package/dist/MobilePowerSearch/MobilePowerSearch.d.ts.map +1 -1
- package/dist/MobilePowerSearch/MobilePowerSearch.js +934 -366
- package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.d.ts +10 -16
- package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.d.ts.map +1 -1
- package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.js +218 -113
- package/dist/MobilePowerSearch/mobilePowerSearchUtils.d.ts +23 -1
- package/dist/MobilePowerSearch/mobilePowerSearchUtils.d.ts.map +1 -1
- package/dist/MobilePowerSearch/mobilePowerSearchUtils.js +62 -2
- package/dist/MobileTokenizer/MobileTokenizer.d.ts +35 -10
- package/dist/MobileTokenizer/MobileTokenizer.d.ts.map +1 -1
- package/dist/MobileTokenizer/MobileTokenizer.js +714 -305
- package/dist/SVGIcon/SVGIcon.js +3 -3
- package/dist/Stat/Stat.js +2 -2
- package/dist/Tour/Tour.d.ts +1 -1
- package/dist/Tour/Tour.js +1 -1
- package/dist/Tour/TourStep.d.ts +1 -1
- package/dist/Tour/TourStep.js +1 -1
- package/dist/TransferList/TransferList.d.ts.map +1 -1
- package/dist/TransferList/TransferList.js +20 -0
- package/dist/index.js +3 -3
- package/dist/lab.css +35 -22
- package/dist/reorderStyles.d.ts +2 -2
- package/dist/reorderStyles.d.ts.map +1 -1
- package/dist/reorderStyles.js +2 -2
- package/package.json +10 -10
- package/src/Chat/ChatUnreadDivider.tsx +1 -1
- package/src/Chat/__tests__/ChatTypingIndicator.a11y.chromium.spec.ts +1 -0
- package/src/CircularProgress/CircularProgress.tsx +3 -3
- package/src/CircularProgress/__tests__/CircularProgress.a11y.chromium.spec.ts +1 -0
- package/src/CommentPin/CommentPin.doc.mjs +82 -34
- package/src/CommentPin/CommentPin.spec.md +92 -81
- package/src/CommentPin/CommentPin.test.tsx +98 -19
- package/src/CommentPin/CommentPin.tsx +146 -82
- package/src/Comments/Comments.test.tsx +10 -4
- package/src/Comments/icons.test.tsx +76 -0
- package/src/Comments/icons.tsx +9 -2
- package/src/DiffViewer/DiffViewer.doc.mjs +8 -2
- package/src/DiffViewer/DiffViewer.test.tsx +71 -0
- package/src/DiffViewer/DiffViewer.tsx +52 -9
- package/src/EmojiPicker/EmojiPicker.test.tsx +21 -0
- package/src/EmojiPicker/EmojiPicker.tsx +8 -8
- package/src/InfoTip/InfoTip.test.tsx +9 -4
- package/src/InfoTip/InfoTip.tsx +1 -1
- package/src/ListInput/ListInput.test.tsx +43 -3
- package/src/ListInput/ListInput.tsx +24 -1
- package/src/LogStream/LogStream.doc.mjs +1 -1
- package/src/LogStream/LogStream.tsx +3 -5
- package/src/MobilePowerSearch/MobilePowerSearch.doc.mjs +5 -5
- package/src/MobilePowerSearch/MobilePowerSearch.test.tsx +1092 -167
- package/src/MobilePowerSearch/MobilePowerSearch.tsx +1094 -368
- package/src/MobilePowerSearch/MobilePowerSearchValueEditor.tsx +303 -120
- package/src/MobilePowerSearch/mobilePowerSearchUtils.ts +68 -1
- package/src/MobileTokenizer/MobileTokenizer.doc.mjs +9 -5
- package/src/MobileTokenizer/MobileTokenizer.test.tsx +589 -5
- package/src/MobileTokenizer/MobileTokenizer.tsx +889 -350
- package/src/SVGIcon/SVGIcon.tsx +3 -3
- package/src/Stat/Stat.tsx +2 -2
- package/src/Tour/Tour.doc.mjs +1 -1
- package/src/Tour/Tour.tsx +1 -1
- package/src/Tour/TourStep.tsx +1 -1
- package/src/TransferList/TransferList.composition.test.tsx +4 -4
- package/src/TransferList/TransferList.test.tsx +36 -0
- package/src/TransferList/TransferList.tsx +24 -0
- package/src/TransferList/TransferListSelector.test.tsx +4 -4
- package/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts +178 -0
- package/src/index.ts +3 -3
- package/src/reorderStyles.ts +7 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Components in lab:
|
|
|
12
12
|
- Compose with `@astryxdesign/core` components (use the theme, follow naming conventions)
|
|
13
13
|
- Graduate to `@astryxdesign/core` after thorough engineering review
|
|
14
14
|
|
|
15
|
-
See the **[Component Lifecycle](https://github.com/
|
|
15
|
+
See the **[Component Lifecycle](https://github.com/meta/astryx/wiki/Component-Lifecycle)** wiki for how a component moves from lab → core (and the promotion gates), and the **[Component Hardening Protocol](https://github.com/meta/astryx/wiki/Component-Hardening-Protocol)** for the bar a component must clear to graduate.
|
|
16
16
|
|
|
17
17
|
## What's here vs what's in core
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ See the **[Component Lifecycle](https://github.com/facebook/astryx/wiki/Componen
|
|
|
22
22
|
|
|
23
23
|
## Promotion gate: accessibility
|
|
24
24
|
|
|
25
|
-
The [Accessibility Checklist](https://github.com/
|
|
25
|
+
The [Accessibility Checklist](https://github.com/meta/astryx/wiki/Accessibility-Checklist) is a hard requirement for graduating to core — every item, verified in the promotion PR, alongside the hardening bar linked above.
|
|
26
26
|
|
|
27
27
|
Lab components get the same scan coverage as core (the `pr-a11y` axe audit and the weekly full scan run against lab too), but a11y findings on a lab component do not block lab merges — they block **promotion**. Iterate freely in lab; clear the checklist to graduate.
|
|
28
28
|
|
package/astryx.integration.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: 'Avatar-first annotations',
|
|
7
7
|
displayName: 'Avatar-first annotations',
|
|
8
8
|
description:
|
|
9
|
-
'Caller-positioned comment pins over media and in a content margin. Every coordinate maps to the pin’s logical bottom-start corner. The selected group caps its participants at three circles (two Avatars plus
|
|
9
|
+
'Caller-positioned comment pins over media and in a content margin. Every coordinate maps to the pin’s logical bottom-start corner. The selected group caps its participants at three circles (two Avatars plus an ellipsis) and ends with its total and an accent unread dot; the unread margin pin shows the dot too. Other pins dim without becoming disabled, activating the selected pin again clears the selection, and no pin dims while nothing is selected.',
|
|
10
10
|
exampleFor: 'CommentPin',
|
|
11
11
|
isReady: true,
|
|
12
12
|
isShowcase: true,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* participant/thread/unread counts, and controlled selected/dimmed state
|
|
8
8
|
* that may be empty
|
|
9
9
|
* @output A grouped pin with a three-circle participant cap and an unread
|
|
10
|
-
*
|
|
10
|
+
* dot, a single pin, and an unread margin pin; activating the selected
|
|
11
11
|
* pin clears the selection, and non-selected pins dim only while another pin
|
|
12
12
|
* is selected
|
|
13
13
|
* @position CommentPin docsite showcase and copyable Lab block
|
|
@@ -160,9 +160,8 @@ export default function CommentPinShowcase() {
|
|
|
160
160
|
xstyle={styles.groupedMarker}
|
|
161
161
|
/>
|
|
162
162
|
<CommentPin
|
|
163
|
-
label="Open
|
|
163
|
+
label="Open annotation from Mira"
|
|
164
164
|
participants={[PEOPLE.mira]}
|
|
165
|
-
isResolved
|
|
166
165
|
isSelected={selected === 'resolved'}
|
|
167
166
|
isDimmed={selected != null && selected !== 'resolved'}
|
|
168
167
|
onClick={() => toggle('resolved')}
|
|
@@ -106,15 +106,15 @@ const variantStyles = {
|
|
|
106
106
|
$$css: true
|
|
107
107
|
},
|
|
108
108
|
success: {
|
|
109
|
-
kjVXCG: "
|
|
109
|
+
kjVXCG: "x88o7k4",
|
|
110
110
|
$$css: true
|
|
111
111
|
},
|
|
112
112
|
warning: {
|
|
113
|
-
kjVXCG: "
|
|
113
|
+
kjVXCG: "x16d96h5",
|
|
114
114
|
$$css: true
|
|
115
115
|
},
|
|
116
116
|
error: {
|
|
117
|
-
kjVXCG: "
|
|
117
|
+
kjVXCG: "xqb94c9",
|
|
118
118
|
$$css: true
|
|
119
119
|
},
|
|
120
120
|
neutral: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { BaseProps } from '@astryxdesign/core';
|
|
2
|
+
/** Pin heights on the shared element-size scale: 28, 32, or 36px. */
|
|
3
|
+
export type CommentPinSize = 'sm' | 'md' | 'lg';
|
|
2
4
|
/** Identity data for one representative shown inside a CommentPin. */
|
|
3
5
|
export interface CommentPinParticipant {
|
|
4
6
|
/** Stable identity used to remove duplicate representatives. */
|
|
@@ -21,10 +23,17 @@ export interface CommentPinProps extends Omit<BaseProps<HTMLButtonElement>, 'chi
|
|
|
21
23
|
* Ordered participants, lead first. A single marker shows the first. A
|
|
22
24
|
* grouped marker shows distinct IDs as an AvatarGroup of at most three
|
|
23
25
|
* circles: every participant when three or fewer are distinct, otherwise the
|
|
24
|
-
* first two plus
|
|
25
|
-
* the overflow
|
|
26
|
+
* first two plus an ellipsis overflow circle. Pass every distinct
|
|
27
|
+
* participant so the overflow appears only when more than three people
|
|
28
|
+
* participate.
|
|
26
29
|
*/
|
|
27
30
|
participants: readonly [CommentPinParticipant, ...CommentPinParticipant[]];
|
|
31
|
+
/**
|
|
32
|
+
* Pin height on the element-size scale: `sm` 28px, `md` 32px, `lg` 36px,
|
|
33
|
+
* with 22px, 24px, and 28px participant circles.
|
|
34
|
+
* @default 'sm'
|
|
35
|
+
*/
|
|
36
|
+
size?: CommentPinSize;
|
|
28
37
|
/**
|
|
29
38
|
* Total number of threads represented by this marker. Values above one use
|
|
30
39
|
* the grouped presentation and show the exact total.
|
|
@@ -33,8 +42,9 @@ export interface CommentPinProps extends Omit<BaseProps<HTMLButtonElement>, 'chi
|
|
|
33
42
|
threadCount?: number;
|
|
34
43
|
/**
|
|
35
44
|
* Number of represented threads with unread activity. When above zero, an
|
|
36
|
-
* accent
|
|
37
|
-
*
|
|
45
|
+
* accent status dot appears at the end of the pin: after the thread total,
|
|
46
|
+
* or after the participant on a single pin. Values above `threadCount` are
|
|
47
|
+
* capped.
|
|
38
48
|
* @default 0
|
|
39
49
|
*/
|
|
40
50
|
unreadCount?: number;
|
|
@@ -45,7 +55,11 @@ export interface CommentPinProps extends Omit<BaseProps<HTMLButtonElement>, 'chi
|
|
|
45
55
|
* disabling it, so it remains available to switch selection.
|
|
46
56
|
*/
|
|
47
57
|
isDimmed?: boolean;
|
|
48
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Whether every thread represented by this pin is resolved. A resolved pin
|
|
60
|
+
* renders nothing unless it is selected, so resolved discussion leaves the
|
|
61
|
+
* content while a thread the reader opened keeps its anchor.
|
|
62
|
+
*/
|
|
49
63
|
isResolved?: boolean;
|
|
50
64
|
/** Whether activation is unavailable. */
|
|
51
65
|
isDisabled?: boolean;
|
|
@@ -56,7 +70,8 @@ export interface CommentPinProps extends Omit<BaseProps<HTMLButtonElement>, 'chi
|
|
|
56
70
|
* The caller owns grouping, representative selection, coordinates, collision
|
|
57
71
|
* handling, and the content opened by activation. Absolute placement maps the
|
|
58
72
|
* host anchor to the pin's logical bottom-start corner. The pin only owns its
|
|
59
|
-
* compact button surface and controlled visual states.
|
|
73
|
+
* compact button surface and controlled visual states. `size` sets its height
|
|
74
|
+
* on the element-size scale.
|
|
60
75
|
*
|
|
61
76
|
* @example
|
|
62
77
|
* ```
|
|
@@ -79,7 +94,7 @@ export interface CommentPinProps extends Omit<BaseProps<HTMLButtonElement>, 'chi
|
|
|
79
94
|
* />
|
|
80
95
|
* ```
|
|
81
96
|
*/
|
|
82
|
-
export declare function CommentPin({ label, participants, threadCount, unreadCount, isSelected, isDimmed, isResolved, isDisabled, ref, xstyle, className, style, ...rest }: CommentPinProps): React.ReactNode;
|
|
97
|
+
export declare function CommentPin({ label, participants, size, threadCount, unreadCount, isSelected, isDimmed, isResolved, isDisabled, ref, xstyle, className, style, ...rest }: CommentPinProps): React.ReactNode;
|
|
83
98
|
export declare namespace CommentPin {
|
|
84
99
|
var displayName: string;
|
|
85
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentPin.d.ts","sourceRoot":"","sources":["../../src/CommentPin/CommentPin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommentPin.d.ts","sourceRoot":"","sources":["../../src/CommentPin/CommentPin.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AA4BlD,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,sEAAsE;AACtE,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,iBAAiB,CAAC,EAC5B,UAAU,CACX;IACC,0CAA0C;IAC1C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,YAAY,EAAE,SAAS,CAAC,qBAAqB,EAAE,GAAG,qBAAqB,EAAE,CAAC,CAAC;IAC3E;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA8ND;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,YAAY,EACZ,IAAW,EACX,WAAe,EACf,WAAe,EACf,UAAkB,EAClB,QAAgB,EAChB,UAAkB,EAClB,UAAkB,EAClB,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,eAAe,GAAG,KAAK,CAAC,SAAS,CA4JnC;yBA3Ke,UAAU"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CommentPin.tsx
|
|
7
7
|
* @input Ordered participants (grouped pins show at most three circles),
|
|
8
|
-
* total and unread represented thread counts,
|
|
9
|
-
*
|
|
8
|
+
* total and unread represented thread counts (unread shows as a dot), a
|
|
9
|
+
* size on the element-size
|
|
10
|
+
* scale, controlled selected/dimmed/resolved/disabled state, and button DOM
|
|
11
|
+
* props
|
|
10
12
|
* @output Exports the avatar-first CommentPin button and its public types
|
|
11
13
|
* @position Lab collaboration primitive for annotation anchors over content or
|
|
12
14
|
* in content margins; callers own grouping, coordinates, and opened content
|
|
@@ -23,11 +25,15 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
23
25
|
import { Avatar } from '@astryxdesign/core/Avatar';
|
|
24
26
|
import { AvatarGroup, AvatarGroupOverflow } from '@astryxdesign/core/AvatarGroup';
|
|
25
27
|
import { useDevWarning, useMergedRefs, usePressFeedback } from '@astryxdesign/core/hooks';
|
|
28
|
+
import { Icon } from '@astryxdesign/core/Icon';
|
|
29
|
+
import { StatusDot } from '@astryxdesign/core/StatusDot';
|
|
26
30
|
import '@astryxdesign/core/theme/tokens.stylex';
|
|
27
|
-
import { borderVars, colorVars, fontWeightVars,
|
|
31
|
+
import { borderVars, colorVars, fontWeightVars, shadowVars, sizeVars, spacingVars, typeScaleVars, typographyVars } from '@astryxdesign/core/theme/tokens.stylex';
|
|
28
32
|
import { useTooltip } from '@astryxdesign/core/Tooltip';
|
|
29
33
|
import { focusOutlineProps, interactionOverlayStyles, mergeProps, themeProps } from '@astryxdesign/core/utils';
|
|
30
34
|
|
|
35
|
+
/** Pin heights on the shared element-size scale: 28, 32, or 36px. */
|
|
36
|
+
|
|
31
37
|
/** Identity data for one representative shown inside a CommentPin. */
|
|
32
38
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
39
|
const styles = {
|
|
@@ -41,17 +47,11 @@ const styles = {
|
|
|
41
47
|
kmuXW: "x2lah0s",
|
|
42
48
|
kXLuUW: "xxymvpz",
|
|
43
49
|
k3nNDw: "x1bd091l x173emx3",
|
|
44
|
-
k7Eaqz: "x1nkkqge",
|
|
45
|
-
kZKoxP: "x6k0iem",
|
|
46
50
|
kogj98: "x1ghz6dp",
|
|
47
|
-
kmVPX3: "x12nba7r",
|
|
48
51
|
kMzoRj: "x1litavf",
|
|
49
52
|
ksu8eU: "x1y0btm7",
|
|
50
53
|
kVAM5u: "x9r1u3d",
|
|
51
|
-
|
|
52
|
-
kfmiAY: "x8agd5o",
|
|
53
|
-
kT0f0o: "x1dgc8on",
|
|
54
|
-
kVL7Gh: "x1pczhz8",
|
|
54
|
+
kVL7Gh: "x6en5u8",
|
|
55
55
|
kWkggS: "x1prclbq",
|
|
56
56
|
kKwaWg: "x18o3ruo",
|
|
57
57
|
kGVxlE: "x14hfi27",
|
|
@@ -68,8 +68,6 @@ const styles = {
|
|
|
68
68
|
withCount: {
|
|
69
69
|
kjj79g: "x1nhvcw1",
|
|
70
70
|
kOIVth: "xzye2dw",
|
|
71
|
-
kZCmMZ: "x138rykx",
|
|
72
|
-
kwRFfy: "x1djylfy",
|
|
73
71
|
$$css: true
|
|
74
72
|
},
|
|
75
73
|
selected: {
|
|
@@ -81,15 +79,6 @@ const styles = {
|
|
|
81
79
|
kMwMTN: "xv1l7n4 x1k5gbb1",
|
|
82
80
|
$$css: true
|
|
83
81
|
},
|
|
84
|
-
resolved: {
|
|
85
|
-
kAXs8y: "x1kzknox",
|
|
86
|
-
kVAM5u: "x9r1u3d x1w1tqly",
|
|
87
|
-
kWkggS: "xwmxj5m x9yvj25",
|
|
88
|
-
kGVxlE: "x1gnnqk1",
|
|
89
|
-
kMwMTN: "xv1l7n4 xs5hli",
|
|
90
|
-
kSiTet: "xf9vgkq x1tbh5bv",
|
|
91
|
-
$$css: true
|
|
92
|
-
},
|
|
93
82
|
dimmed: {
|
|
94
83
|
kSiTet: "xti2d7y x1tbh5bv",
|
|
95
84
|
$$css: true
|
|
@@ -102,8 +91,69 @@ const styles = {
|
|
|
102
91
|
overflowCircle: {
|
|
103
92
|
kg3NbH: "xnjsko4",
|
|
104
93
|
$$css: true
|
|
94
|
+
},
|
|
95
|
+
unreadDot: {
|
|
96
|
+
kAXs8y: "x1kzknox",
|
|
97
|
+
kMwMTN: "x17wrial x1q73b31",
|
|
98
|
+
kWkggS: "x1ewilqj x438xzl",
|
|
99
|
+
$$css: true
|
|
105
100
|
}
|
|
106
101
|
};
|
|
102
|
+
|
|
103
|
+
// Each size pairs an element-size height with a participant circle diameter
|
|
104
|
+
// (see AVATAR_SIZE). The padding is the inset that centers that circle in the
|
|
105
|
+
// height, applied on every side: the avatars and overflow sit the same
|
|
106
|
+
// distance from all four edges. The three round corners are half the height,
|
|
107
|
+
// which is fully round: the 9999px full-radius token would make the browser
|
|
108
|
+
// scale every corner down to fit the box (the CSS corner-overlap rule) and
|
|
109
|
+
// shrink the 2px anchor corner to nothing.
|
|
110
|
+
const sizeStyles = {
|
|
111
|
+
sm: {
|
|
112
|
+
k7Eaqz: "x1nkkqge",
|
|
113
|
+
kZKoxP: "x6k0iem",
|
|
114
|
+
kmVPX3: "x5pt662",
|
|
115
|
+
krdFHd: "x404ayl",
|
|
116
|
+
kfmiAY: "x1096wwc",
|
|
117
|
+
kT0f0o: "xjc3rfe",
|
|
118
|
+
$$css: true
|
|
119
|
+
},
|
|
120
|
+
md: {
|
|
121
|
+
k7Eaqz: "x17ydmr0",
|
|
122
|
+
kZKoxP: "x1ueg155",
|
|
123
|
+
kmVPX3: "xnvfkzk",
|
|
124
|
+
krdFHd: "x17mafka",
|
|
125
|
+
kfmiAY: "x1fefpn5",
|
|
126
|
+
kT0f0o: "x11o29ay",
|
|
127
|
+
$$css: true
|
|
128
|
+
},
|
|
129
|
+
lg: {
|
|
130
|
+
k7Eaqz: "x1je4dsv",
|
|
131
|
+
kZKoxP: "xssyfek",
|
|
132
|
+
kmVPX3: "x1fx55se",
|
|
133
|
+
krdFHd: "xgwm7ou",
|
|
134
|
+
kfmiAY: "x7b04l7",
|
|
135
|
+
kT0f0o: "x9hxrvx",
|
|
136
|
+
$$css: true
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Participant circle diameter per pin size, matching the literals in
|
|
142
|
+
* `sizeStyles`. Avatar renders any pixel size; its typed scale lists neither
|
|
143
|
+
* 22 nor 28, hence the cast.
|
|
144
|
+
*/
|
|
145
|
+
const AVATAR_SIZE = {
|
|
146
|
+
sm: 22,
|
|
147
|
+
md: 24,
|
|
148
|
+
lg: 28
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/** The overflow ellipsis per pin size. */
|
|
152
|
+
const OVERFLOW_ICON_SIZE = {
|
|
153
|
+
sm: 'xsm',
|
|
154
|
+
md: 'xsm',
|
|
155
|
+
lg: 'sm'
|
|
156
|
+
};
|
|
107
157
|
function takeDistinctParticipants(participants, limit) {
|
|
108
158
|
const result = [];
|
|
109
159
|
const seen = new Set();
|
|
@@ -135,7 +185,8 @@ const MAX_GROUP_CIRCLES = 3;
|
|
|
135
185
|
* The caller owns grouping, representative selection, coordinates, collision
|
|
136
186
|
* handling, and the content opened by activation. Absolute placement maps the
|
|
137
187
|
* host anchor to the pin's logical bottom-start corner. The pin only owns its
|
|
138
|
-
* compact button surface and controlled visual states.
|
|
188
|
+
* compact button surface and controlled visual states. `size` sets its height
|
|
189
|
+
* on the element-size scale.
|
|
139
190
|
*
|
|
140
191
|
* @example
|
|
141
192
|
* ```
|
|
@@ -161,6 +212,7 @@ const MAX_GROUP_CIRCLES = 3;
|
|
|
161
212
|
export function CommentPin({
|
|
162
213
|
label,
|
|
163
214
|
participants,
|
|
215
|
+
size = 'sm',
|
|
164
216
|
threadCount = 1,
|
|
165
217
|
unreadCount = 0,
|
|
166
218
|
isSelected = false,
|
|
@@ -173,6 +225,8 @@ export function CommentPin({
|
|
|
173
225
|
style,
|
|
174
226
|
...rest
|
|
175
227
|
}) {
|
|
228
|
+
const resolvedSize = size === 'md' || size === 'lg' ? size : 'sm';
|
|
229
|
+
const avatarSize = AVATAR_SIZE[resolvedSize];
|
|
176
230
|
const validThreadCount = isValidThreadCount(threadCount);
|
|
177
231
|
const resolvedThreadCount = validThreadCount ? threadCount : 1;
|
|
178
232
|
const isGrouped = resolvedThreadCount > 1;
|
|
@@ -181,7 +235,7 @@ export function CommentPin({
|
|
|
181
235
|
const hasUnread = resolvedUnreadCount > 0;
|
|
182
236
|
|
|
183
237
|
// Grouped pins cap at MAX_GROUP_CIRCLES circles: every distinct participant
|
|
184
|
-
// when they fit, otherwise one fewer Avatar plus
|
|
238
|
+
// when they fit, otherwise one fewer Avatar plus an ellipsis overflow circle.
|
|
185
239
|
const distinctParticipants = takeDistinctParticipants(participants, isGrouped ? Number.POSITIVE_INFINITY : 1);
|
|
186
240
|
const hasOverflow = isGrouped && distinctParticipants.length > MAX_GROUP_CIRCLES;
|
|
187
241
|
const visibleParticipants = hasOverflow ? distinctParticipants.slice(0, MAX_GROUP_CIRCLES - 1) : distinctParticipants;
|
|
@@ -197,6 +251,13 @@ export function CommentPin({
|
|
|
197
251
|
isEnabled: hasTooltip
|
|
198
252
|
});
|
|
199
253
|
const mergedRef = useMergedRefs(ref, hasTooltip ? tooltip.ref : undefined);
|
|
254
|
+
|
|
255
|
+
// Resolved discussion leaves the content. A selected pin stays, so a thread
|
|
256
|
+
// the reader opened (or resolved from its popover) keeps its anchor until
|
|
257
|
+
// the host clears the selection.
|
|
258
|
+
if (isResolved && !isSelected) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
200
261
|
const avatarParticipants = visibleParticipants.length > 0 ? visibleParticipants : [{
|
|
201
262
|
id: '__anonymous__',
|
|
202
263
|
name: '',
|
|
@@ -211,46 +272,62 @@ export function CommentPin({
|
|
|
211
272
|
"aria-pressed": isSelected,
|
|
212
273
|
disabled: isDisabled,
|
|
213
274
|
...mergeProps(themeProps('comment-pin', {
|
|
275
|
+
size: resolvedSize,
|
|
214
276
|
grouped: isGrouped ? 'grouped' : null,
|
|
215
277
|
unread: hasUnread ? 'unread' : null,
|
|
216
278
|
selected: isSelected ? 'selected' : null,
|
|
217
279
|
dimmed: isDimmed ? 'dimmed' : null,
|
|
218
280
|
resolved: isResolved ? 'resolved' : null,
|
|
219
281
|
disabled: isDisabled ? 'disabled' : null
|
|
220
|
-
}), focusOutlineProps.focusVisible(styles.root, interactionOverlayStyles.backgroundImage, (isGrouped || hasUnread) && styles.withCount,
|
|
282
|
+
}), focusOutlineProps.focusVisible(styles.root, sizeStyles[resolvedSize], interactionOverlayStyles.backgroundImage, (isGrouped || hasUnread) && styles.withCount, isDimmed && !isSelected && styles.dimmed, isSelected && styles.selected, isDisabled && styles.disabled, xstyle), className, style),
|
|
221
283
|
children: [/*#__PURE__*/_jsx("span", {
|
|
222
284
|
"aria-hidden": "true",
|
|
223
285
|
...{
|
|
224
|
-
|
|
225
|
-
|
|
286
|
+
0: {
|
|
287
|
+
className: "x3nfvp2 x6s0dn4 x2lah0s"
|
|
288
|
+
},
|
|
289
|
+
1: {
|
|
290
|
+
className: "x3nfvp2 x6s0dn4 x2lah0s xe9ewy2"
|
|
291
|
+
}
|
|
292
|
+
}[!!isGrouped << 0],
|
|
226
293
|
children: isGrouped ? /*#__PURE__*/_jsxs(AvatarGroup, {
|
|
227
|
-
size:
|
|
294
|
+
size: avatarSize,
|
|
228
295
|
children: [avatarParticipants.map(participant => /*#__PURE__*/_jsx(Avatar, {
|
|
229
296
|
name: participant.name,
|
|
230
297
|
src: participant.avatarSrc,
|
|
231
298
|
tooltip: false
|
|
232
299
|
}, participant.id)), overflowCount > 0 ? /*#__PURE__*/_jsx(AvatarGroupOverflow, {
|
|
233
300
|
count: overflowCount,
|
|
234
|
-
xstyle: styles.overflowCircle
|
|
301
|
+
xstyle: styles.overflowCircle,
|
|
302
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
303
|
+
icon: "moreHorizontal",
|
|
304
|
+
size: OVERFLOW_ICON_SIZE[resolvedSize]
|
|
305
|
+
})
|
|
235
306
|
}) : null]
|
|
236
307
|
}) : avatarParticipants.map(participant => /*#__PURE__*/_jsx(Avatar, {
|
|
237
308
|
name: participant.name,
|
|
238
309
|
src: participant.avatarSrc,
|
|
239
|
-
size:
|
|
310
|
+
size: avatarSize,
|
|
240
311
|
tooltip: false
|
|
241
312
|
}, participant.id))
|
|
242
|
-
}), hasUnread ? /*#__PURE__*/
|
|
243
|
-
"aria-hidden": "true",
|
|
244
|
-
...{
|
|
245
|
-
className: "x1kzknox x3nfvp2 x6s0dn4 xl56j7k x9f619 x16asifk x1grt7ep x7a5moj xjspbzw x1ewilqj x1jzqe4 x17wrial x1k5gbb1 xss6m8b xo5v014"
|
|
246
|
-
},
|
|
247
|
-
children: resolvedUnreadCount
|
|
248
|
-
}) : isGrouped ? /*#__PURE__*/_jsx("span", {
|
|
313
|
+
}), hasUnread || isGrouped ? /*#__PURE__*/_jsxs("span", {
|
|
249
314
|
"aria-hidden": "true",
|
|
250
315
|
...{
|
|
251
|
-
className: "
|
|
316
|
+
className: "x3nfvp2 x6s0dn4 xzye2dw x1nryj5t"
|
|
252
317
|
},
|
|
253
|
-
children:
|
|
318
|
+
children: [isGrouped ? /*#__PURE__*/_jsx("span", {
|
|
319
|
+
...{
|
|
320
|
+
className: "x1heor9g xss6m8b"
|
|
321
|
+
},
|
|
322
|
+
children: resolvedThreadCount
|
|
323
|
+
}) : null, hasUnread ?
|
|
324
|
+
/*#__PURE__*/
|
|
325
|
+
// Decorative: the button's label carries the unread context.
|
|
326
|
+
_jsx(StatusDot, {
|
|
327
|
+
variant: "accent",
|
|
328
|
+
label: "",
|
|
329
|
+
xstyle: styles.unreadDot
|
|
330
|
+
}) : null]
|
|
254
331
|
}) : null]
|
|
255
332
|
});
|
|
256
333
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/Comments/icons.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAG9E,kEAAkE;AAClE,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/Comments/icons.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAG9E,kEAAkE;AAClE,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAkF7D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAmB,EACnB,IAAW,GACZ,EAAE;IACD,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC,+BASA"}
|
package/dist/Comments/icons.js
CHANGED
|
@@ -16,7 +16,7 @@ import { getExtendedIcon, Icon } from '@astryxdesign/core/Icon';
|
|
|
16
16
|
import { useThemeName } from '@astryxdesign/core/theme';
|
|
17
17
|
|
|
18
18
|
/** Stable icon-registry keys for the Comments family's glyphs. */
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
20
|
export const COMMENT_ICON_KEYS = {
|
|
21
21
|
addReaction: 'comment:addReaction',
|
|
22
22
|
reply: 'comment:reply',
|
|
@@ -72,6 +72,13 @@ const FALLBACK_GLYPHS = {
|
|
|
72
72
|
event: glyph(['M12 3v5.5M12 15.5V21', 'M12 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z'])
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The fallback `getExtendedIcon` returns only when no theme, registered, or
|
|
77
|
+
* built-in entry answers a key. A function entry that returns `null` still
|
|
78
|
+
* answers it: its result is final, so the glyph draws nothing.
|
|
79
|
+
*/
|
|
80
|
+
const NO_ENTRY = /*#__PURE__*/_jsx(_Fragment, {});
|
|
81
|
+
|
|
75
82
|
/**
|
|
76
83
|
* A comment glyph at the icon slot's size: the active theme's icon for its
|
|
77
84
|
* `comment:*` key when one is registered, else the bundled default.
|
|
@@ -83,7 +90,7 @@ export function CommentIcon({
|
|
|
83
90
|
}) {
|
|
84
91
|
const themeName = useThemeName();
|
|
85
92
|
const key = COMMENT_ICON_KEYS[name];
|
|
86
|
-
const hasOverride = getExtendedIcon(key,
|
|
93
|
+
const hasOverride = getExtendedIcon(key, NO_ENTRY, themeName) !== NO_ENTRY;
|
|
87
94
|
const fallback = name in REGISTRY_FALLBACKS ? REGISTRY_FALLBACKS[name] : FALLBACK_GLYPHS[name];
|
|
88
95
|
return /*#__PURE__*/_jsx(Icon, {
|
|
89
96
|
icon: hasOverride ? key : fallback,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MouseEvent, type ReactNode, type Ref } from 'react';
|
|
2
2
|
import type { BaseProps } from '@astryxdesign/core';
|
|
3
|
+
import { type CodeLanguage } from '@astryxdesign/core/CodeBlock';
|
|
3
4
|
import { type SyntaxThemeDefinition } from '@astryxdesign/core/theme/syntax';
|
|
4
5
|
import type { DiffViewerFile, DiffViewerLineRef } from './diffTypes.js';
|
|
5
6
|
/** How hunks are laid out: one column, or old and new side by side. */
|
|
@@ -34,10 +35,20 @@ export interface DiffViewerProps extends BaseProps<HTMLDivElement> {
|
|
|
34
35
|
*/
|
|
35
36
|
viewMode?: DiffViewerViewMode;
|
|
36
37
|
/**
|
|
37
|
-
* Syntax-highlighting language
|
|
38
|
-
*
|
|
38
|
+
* Syntax-highlighting language: a built-in identifier such as `'rust'`, or
|
|
39
|
+
* a language value — a module imported on its own, such as `graphql` from
|
|
40
|
+
* `@astryxdesign/core/CodeBlock/languages/graphql`, or one made with
|
|
41
|
+
* `createCodeLanguage`. Defaults to one inferred from the file's name or
|
|
42
|
+
* extension among the built-ins and `codeLanguages`; an unmatched file
|
|
43
|
+
* renders as plain text.
|
|
39
44
|
*/
|
|
40
|
-
language?: string;
|
|
45
|
+
language?: string | CodeLanguage;
|
|
46
|
+
/**
|
|
47
|
+
* Language values the file's name or extension may infer, such as
|
|
48
|
+
* `[graphql, dockerfile]`; a later entry wins. Pass the same list to every
|
|
49
|
+
* DiffViewer on a review page.
|
|
50
|
+
*/
|
|
51
|
+
codeLanguages?: ReadonlyArray<CodeLanguage>;
|
|
41
52
|
/**
|
|
42
53
|
* Show the old and new line-number gutters.
|
|
43
54
|
* @default true
|
|
@@ -125,7 +136,7 @@ export interface DiffViewerProps extends BaseProps<HTMLDivElement> {
|
|
|
125
136
|
* <DiffViewer file={file} viewMode="split" />
|
|
126
137
|
* ```
|
|
127
138
|
*/
|
|
128
|
-
export declare function DiffViewer({ ref, file, viewMode, language: languageProp, hasLineNumbers, isWrapped, changeIndicator, inlineHighlight, hasChangeBackground, isCollapsible, isCollapsed: isCollapsedProp, defaultIsCollapsed, onCollapsedChange, headerEnd, renderLineAnnotation, onLineNumberClick, maxHeight, syntaxTheme, xstyle, className, style, ...props }: DiffViewerProps): import("react").JSX.Element;
|
|
139
|
+
export declare function DiffViewer({ ref, file, viewMode, language: languageProp, codeLanguages, hasLineNumbers, isWrapped, changeIndicator, inlineHighlight, hasChangeBackground, isCollapsible, isCollapsed: isCollapsedProp, defaultIsCollapsed, onCollapsedChange, headerEnd, renderLineAnnotation, onLineNumberClick, maxHeight, syntaxTheme, xstyle, className, style, ...props }: DiffViewerProps): import("react").JSX.Element;
|
|
129
140
|
export declare namespace DiffViewer {
|
|
130
141
|
var displayName: string;
|
|
131
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiffViewer.d.ts","sourceRoot":"","sources":["../../src/DiffViewer/DiffViewer.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,GAAG,EAET,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"DiffViewer.d.ts","sourceRoot":"","sources":["../../src/DiffViewer/DiffViewer.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,GAAG,EAET,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAGL,KAAK,YAAY,EAGlB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,iCAAiC,CAAC;AAqBzC,OAAO,KAAK,EACV,cAAc,EAGd,iBAAiB,EAElB,MAAM,aAAa,CAAC;AAGrB,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,yCAAyC;IACzC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,cAAc,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC5C;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,SAAS,CAAC;IAC7D;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAClB,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KACjC,IAAI,CAAC;IACV,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAi2BD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,IAAI,EACJ,QAAoB,EACpB,QAAQ,EAAE,YAAY,EACtB,aAAa,EACb,cAAqB,EACrB,SAAiB,EACjB,eAA2B,EAC3B,eAAwB,EACxB,mBAA0B,EAC1B,aAAoB,EACpB,WAAW,EAAE,eAAe,EAC5B,kBAA0B,EAC1B,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,+BAopBjB;yBA5qBe,UAAU"}
|
|
@@ -92,18 +92,42 @@ const EXTENSION_LANGUAGES = {
|
|
|
92
92
|
yaml: 'yaml',
|
|
93
93
|
yml: 'yaml',
|
|
94
94
|
md: 'markdown',
|
|
95
|
-
markdown: 'markdown'
|
|
95
|
+
markdown: 'markdown',
|
|
96
|
+
c: 'c',
|
|
97
|
+
h: 'c',
|
|
98
|
+
cpp: 'cpp',
|
|
99
|
+
cc: 'cpp',
|
|
100
|
+
cxx: 'cpp',
|
|
101
|
+
hpp: 'cpp',
|
|
102
|
+
hh: 'cpp',
|
|
103
|
+
sql: 'sql',
|
|
104
|
+
rs: 'rust',
|
|
105
|
+
kt: 'kotlin',
|
|
106
|
+
kts: 'kotlin',
|
|
107
|
+
swift: 'swift',
|
|
108
|
+
go: 'go'
|
|
96
109
|
};
|
|
97
|
-
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The language a file's name or extension infers: a listed value first (a
|
|
113
|
+
* later entry wins), then a built-in, else plain text (CodeBlock FR13).
|
|
114
|
+
*/
|
|
115
|
+
function inferLanguage(path, codeLanguages) {
|
|
98
116
|
if (path == null) {
|
|
99
117
|
return 'plaintext';
|
|
100
118
|
}
|
|
101
119
|
const base = path.slice(path.lastIndexOf('/') + 1);
|
|
102
120
|
const dot = base.lastIndexOf('.');
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
const extension = dot > 0 ? base.slice(dot + 1).toLowerCase() : null;
|
|
122
|
+
if (codeLanguages != null) {
|
|
123
|
+
for (let i = codeLanguages.length - 1; i >= 0; i--) {
|
|
124
|
+
const language = codeLanguages[i];
|
|
125
|
+
if (language.fileNames.includes(base) || extension != null && language.fileExtensions.includes(extension)) {
|
|
126
|
+
return language;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
105
129
|
}
|
|
106
|
-
return EXTENSION_LANGUAGES[
|
|
130
|
+
return extension == null ? 'plaintext' : EXTENSION_LANGUAGES[extension] ?? 'plaintext';
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
// ---------------------------------------------------------------------------
|
|
@@ -698,6 +722,7 @@ export function DiffViewer({
|
|
|
698
722
|
file,
|
|
699
723
|
viewMode = 'unified',
|
|
700
724
|
language: languageProp,
|
|
725
|
+
codeLanguages,
|
|
701
726
|
hasLineNumbers = true,
|
|
702
727
|
isWrapped = false,
|
|
703
728
|
changeIndicator = 'classic',
|
|
@@ -723,7 +748,7 @@ export function DiffViewer({
|
|
|
723
748
|
ensureHighlightStyles();
|
|
724
749
|
}, []);
|
|
725
750
|
const path = file.newPath ?? file.oldPath;
|
|
726
|
-
const language = languageProp ?? inferLanguage(path);
|
|
751
|
+
const language = languageProp ?? inferLanguage(path, codeLanguages);
|
|
727
752
|
const displayPath = file.status === 'renamed' && file.oldPath != null && file.newPath != null ? t('@astryx.diffViewer.renamedPath', {
|
|
728
753
|
oldPath: file.oldPath,
|
|
729
754
|
newPath: file.newPath
|
|
@@ -399,19 +399,16 @@ export function EmojiPicker({
|
|
|
399
399
|
size: "sm",
|
|
400
400
|
label: t('@astryx.emojiPicker.loading')
|
|
401
401
|
})
|
|
402
|
-
}) : queryWords.length === 0 && categories === 'failed' ? /*#__PURE__*/_jsx(HStack, {
|
|
403
|
-
paddingInline: 3,
|
|
404
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
405
|
-
type: "supporting",
|
|
406
|
-
color: "secondary",
|
|
407
|
-
children: t('@astryx.emojiPicker.loadFailed')
|
|
408
|
-
})
|
|
409
402
|
}) : null, /*#__PURE__*/_jsx(HStack, {
|
|
410
403
|
role: "status",
|
|
411
404
|
"aria-atomic": "true",
|
|
412
405
|
paddingInline: 3,
|
|
413
406
|
"data-emoji-picker-search-status": "true",
|
|
414
|
-
children:
|
|
407
|
+
children: queryWords.length === 0 && categories === 'failed' ? /*#__PURE__*/_jsx(Text, {
|
|
408
|
+
type: "supporting",
|
|
409
|
+
color: "secondary",
|
|
410
|
+
children: t('@astryx.emojiPicker.loadFailed')
|
|
411
|
+
}) : noResultsMessage != null && /*#__PURE__*/_jsx(Text, {
|
|
415
412
|
type: "supporting",
|
|
416
413
|
color: "secondary",
|
|
417
414
|
children: noResultsMessage
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file InfoTip.tsx
|
|
3
3
|
* @input Uses React, stylex, Tooltip + Icon from @astryxdesign/core, color/spacing/radius/duration/ease tokens
|
|
4
4
|
* @output Exports InfoTip component, InfoTipProps, InfoTipSize types
|
|
5
|
-
* @position Lab experiment (RFC
|
|
5
|
+
* @position Lab experiment (RFC meta/astryx#3349); core implementation consumed by index.ts
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/lab/src/InfoTip/InfoTip.doc.mjs (props table, features)
|
package/dist/InfoTip/InfoTip.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @file InfoTip.tsx
|
|
7
7
|
* @input Uses React, stylex, Tooltip + Icon from @astryxdesign/core, color/spacing/radius/duration/ease tokens
|
|
8
8
|
* @output Exports InfoTip component, InfoTipProps, InfoTipSize types
|
|
9
|
-
* @position Lab experiment (RFC
|
|
9
|
+
* @position Lab experiment (RFC meta/astryx#3349); core implementation consumed by index.ts
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/lab/src/InfoTip/InfoTip.doc.mjs (props table, features)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file ListInput.tsx
|
|
3
3
|
* @input React, StyleX, Astryx field/list/button/icon/layer/empty-state primitives, the container-reveal hook, compact size context, browser scroll geometry, programmatic theme tokens, and shared Lab reorder styles
|
|
4
4
|
* @output Exports ListInput and its controlled data, column, renderer, and change types
|
|
5
|
-
* @position Lab experiment (RFC
|
|
5
|
+
* @position Lab experiment (RFC meta/astryx#4531) for editing compact repeated records
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/lab/src/ListInput/ListInput.doc.mjs
|