@optiaxiom/globals 1.1.5 → 1.1.7
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/cjs/index.js +2 -2
- package/dist/esm/surface-context.js +1 -1
- package/dist/esm/tokens/colors.js +1 -1
- package/dist/index.d.ts +18 -12
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -19,7 +19,7 @@ const SurfaceProvider = ({
|
|
|
19
19
|
...props
|
|
20
20
|
}) => {
|
|
21
21
|
const suggestion = props.suggestions.find(
|
|
22
|
-
(s) =>
|
|
22
|
+
(s) => ("/" + props.path).endsWith("/" + s.surface) && (s.type === "message" || s.type === "value" && s.value !== props.value)
|
|
23
23
|
);
|
|
24
24
|
const store = react.useContext(SuggestionContext);
|
|
25
25
|
react.useEffect(() => {
|
|
@@ -289,7 +289,7 @@ const colors = {
|
|
|
289
289
|
"fg.avatar.purple": ld(palette["purple.700"], palette["purple.100"]),
|
|
290
290
|
"fg.default": ld(palette["neutral.800"], palette["neutral.75"]),
|
|
291
291
|
"fg.default.inverse": ld(palette["neutral.00"], palette["neutral.800"]),
|
|
292
|
-
"fg.disabled": ld(palette["neutral.
|
|
292
|
+
"fg.disabled": ld(palette["neutral.500"], palette["neutral.50/32"]),
|
|
293
293
|
"fg.error": ld(palette["red.500"], palette["red.300"]),
|
|
294
294
|
"fg.error.hovered": ld(palette["red.600"], palette["red.600"]),
|
|
295
295
|
"fg.error.light": ld(palette["red.300"], palette["red.500"]),
|
|
@@ -12,7 +12,7 @@ const SurfaceProvider = ({
|
|
|
12
12
|
...props
|
|
13
13
|
}) => {
|
|
14
14
|
const suggestion = props.suggestions.find(
|
|
15
|
-
(s) =>
|
|
15
|
+
(s) => ("/" + props.path).endsWith("/" + s.surface) && (s.type === "message" || s.type === "value" && s.value !== props.value)
|
|
16
16
|
);
|
|
17
17
|
const store = useContext(SuggestionContext);
|
|
18
18
|
useEffect(() => {
|
|
@@ -136,7 +136,7 @@ const colors = {
|
|
|
136
136
|
"fg.avatar.purple": ld(palette["purple.700"], palette["purple.100"]),
|
|
137
137
|
"fg.default": ld(palette["neutral.800"], palette["neutral.75"]),
|
|
138
138
|
"fg.default.inverse": ld(palette["neutral.00"], palette["neutral.800"]),
|
|
139
|
-
"fg.disabled": ld(palette["neutral.
|
|
139
|
+
"fg.disabled": ld(palette["neutral.500"], palette["neutral.50/32"]),
|
|
140
140
|
"fg.error": ld(palette["red.500"], palette["red.300"]),
|
|
141
141
|
"fg.error.hovered": ld(palette["red.600"], palette["red.600"]),
|
|
142
142
|
"fg.error.light": ld(palette["red.300"], palette["red.500"]),
|
package/dist/index.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ declare const useModalContext: (consumerName: string) => {
|
|
|
26
26
|
shardRef: RefObject<HTMLElement>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
type Surface
|
|
29
|
+
type Surface = {
|
|
30
30
|
/**
|
|
31
31
|
* Optional data associated with this surface.
|
|
32
32
|
*/
|
|
33
|
-
data?:
|
|
33
|
+
data?: Record<string, unknown>;
|
|
34
34
|
/**
|
|
35
35
|
* The surface name (used in surface path).
|
|
36
36
|
*/
|
|
@@ -39,8 +39,12 @@ type Surface<T extends Record<string, unknown> | undefined = Record<string, unkn
|
|
|
39
39
|
* The surface type.
|
|
40
40
|
*/
|
|
41
41
|
type: "action" | "cards" | "collection" | "dialog" | "page" | "product" | "property" | "resource" | "tab";
|
|
42
|
+
/**
|
|
43
|
+
* Optional value associated with this surface.
|
|
44
|
+
*/
|
|
45
|
+
value?: unknown;
|
|
42
46
|
};
|
|
43
|
-
type SurfaceContextValue = {
|
|
47
|
+
type SurfaceContextValue<V = unknown> = {
|
|
44
48
|
accept: (suggestionId: string) => void;
|
|
45
49
|
executeTool: (name: string, parameters: unknown) => Promise<void> | void;
|
|
46
50
|
metadata: Record<string, Omit<Surface, "name">>;
|
|
@@ -48,7 +52,7 @@ type SurfaceContextValue = {
|
|
|
48
52
|
pageViewId: string | undefined;
|
|
49
53
|
path: string;
|
|
50
54
|
reject: (suggestionId: string) => void;
|
|
51
|
-
renderSuggestionValue?: (value:
|
|
55
|
+
renderSuggestionValue?: (value: V) => React.ReactNode;
|
|
52
56
|
suggestionAlert: {
|
|
53
57
|
register: () => () => void;
|
|
54
58
|
registered: boolean;
|
|
@@ -58,8 +62,9 @@ type SurfaceContextValue = {
|
|
|
58
62
|
registered: boolean;
|
|
59
63
|
};
|
|
60
64
|
suggestions: SurfaceSuggestion[];
|
|
61
|
-
track: (interaction: SurfaceInteraction,
|
|
65
|
+
track: (interaction: SurfaceInteraction, surfaces?: Surface[]) => void;
|
|
62
66
|
type: Surface["type"];
|
|
67
|
+
value?: V;
|
|
63
68
|
};
|
|
64
69
|
type SurfaceInteraction = {
|
|
65
70
|
id?: string;
|
|
@@ -73,6 +78,7 @@ type SurfaceInteraction = {
|
|
|
73
78
|
name: "blurred";
|
|
74
79
|
} | {
|
|
75
80
|
name: "changed";
|
|
81
|
+
previousValue?: unknown;
|
|
76
82
|
value: unknown;
|
|
77
83
|
} | {
|
|
78
84
|
name: "focused";
|
|
@@ -109,15 +115,15 @@ type SurfaceSuggestion = {
|
|
|
109
115
|
};
|
|
110
116
|
type: "message";
|
|
111
117
|
});
|
|
112
|
-
declare function useSurfaceContext(): SurfaceContextValue | null;
|
|
118
|
+
declare function useSurfaceContext(): SurfaceContextValue<unknown> | null;
|
|
113
119
|
declare const unstable_SuggestionContext: react.Context<{
|
|
114
|
-
add: (suggestion: Extract<SurfaceSuggestion, {
|
|
120
|
+
add: <V = unknown>(suggestion: Extract<SurfaceSuggestion, {
|
|
115
121
|
type: "message" | "value";
|
|
116
|
-
}>, surface: Pick<SurfaceContextValue
|
|
122
|
+
}>, surface: Pick<SurfaceContextValue<V>, "accept" | "executeTool" | "reject" | "renderSuggestionValue">) => () => void;
|
|
117
123
|
} | null>;
|
|
118
|
-
declare const unstable_SurfaceProvider: ({ accept, children, executeTool, reject, renderSuggestionValue, ...props }: SurfaceContextValue & {
|
|
124
|
+
declare const unstable_SurfaceProvider: <V = unknown>({ accept, children, executeTool, reject, renderSuggestionValue, ...props }: SurfaceContextValue<V> & {
|
|
119
125
|
children?: ReactNode;
|
|
120
|
-
}) => react.FunctionComponentElement<react.ProviderProps<SurfaceContextValue | null>>;
|
|
126
|
+
}) => react.FunctionComponentElement<react.ProviderProps<SurfaceContextValue<unknown> | null>>;
|
|
121
127
|
declare const unstable_useSurfaceContext: typeof useSurfaceContext;
|
|
122
128
|
|
|
123
129
|
declare const theme: MapLeafNodes<{
|
|
@@ -192,7 +198,7 @@ declare const theme: MapLeafNodes<{
|
|
|
192
198
|
readonly "fg.avatar.purple": "light-dark(#412470, #E5DCF4)";
|
|
193
199
|
readonly "fg.default": "light-dark(#2E3442, #F5F6FA)";
|
|
194
200
|
readonly "fg.default.inverse": "light-dark(#FFFFFF, #2E3442)";
|
|
195
|
-
readonly "fg.disabled": "light-dark(#
|
|
201
|
+
readonly "fg.disabled": "light-dark(#838DA4, #F9FAFC52)";
|
|
196
202
|
readonly "fg.error": "light-dark(#CC1616, #FC8B8B)";
|
|
197
203
|
readonly "fg.error.hovered": "light-dark(#B21313, #B21313)";
|
|
198
204
|
readonly "fg.error.light": "light-dark(#FC8B8B, #CC1616)";
|
|
@@ -411,7 +417,7 @@ declare const tokens: {
|
|
|
411
417
|
readonly "fg.avatar.purple": "light-dark(#412470, #E5DCF4)";
|
|
412
418
|
readonly "fg.default": "light-dark(#2E3442, #F5F6FA)";
|
|
413
419
|
readonly "fg.default.inverse": "light-dark(#FFFFFF, #2E3442)";
|
|
414
|
-
readonly "fg.disabled": "light-dark(#
|
|
420
|
+
readonly "fg.disabled": "light-dark(#838DA4, #F9FAFC52)";
|
|
415
421
|
readonly "fg.error": "light-dark(#CC1616, #FC8B8B)";
|
|
416
422
|
readonly "fg.error.hovered": "light-dark(#B21313, #B21313)";
|
|
417
423
|
readonly "fg.error.light": "light-dark(#FC8B8B, #CC1616)";
|