@agent-native/toolkit 0.9.1 → 0.10.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/agent-native.eject.json +71 -0
- package/dist/chat-history/ChatHistoryRail.d.ts +15 -1
- package/dist/chat-history/ChatHistoryRail.d.ts.map +1 -1
- package/dist/chat-history/ChatHistoryRail.js +26 -13
- package/dist/chat-history/ChatHistoryRail.js.map +1 -1
- package/dist/chat-history/ChatHistoryRail.spec.js +77 -1
- package/dist/chat-history/ChatHistoryRail.spec.js.map +1 -1
- package/dist/chat-history/index.d.ts +2 -1
- package/dist/chat-history/index.d.ts.map +1 -1
- package/dist/chat-history/index.js +2 -1
- package/dist/chat-history/index.js.map +1 -1
- package/dist/chat-history/useChatHistoryRailController.d.ts +26 -0
- package/dist/chat-history/useChatHistoryRailController.d.ts.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.js +36 -0
- package/dist/chat-history/useChatHistoryRailController.js.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.spec.d.ts +2 -0
- package/dist/chat-history/useChatHistoryRailController.spec.d.ts.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.spec.js +101 -0
- package/dist/chat-history/useChatHistoryRailController.spec.js.map +1 -0
- package/dist/chat-history.css +2 -0
- package/dist/composer/ComposerPlusMenu.js +1 -1
- package/dist/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/composer/PromptComposer.d.ts +1 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +26 -5
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/PromptComposer.spec.js +8 -1
- package/dist/composer/PromptComposer.spec.js.map +1 -1
- package/dist/composer/RealtimeVoiceMode.d.ts.map +1 -1
- package/dist/composer/RealtimeVoiceMode.js +56 -11
- package/dist/composer/RealtimeVoiceMode.js.map +1 -1
- package/dist/composer/RealtimeVoiceMode.spec.js +59 -7
- package/dist/composer/RealtimeVoiceMode.spec.js.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.d.ts +7 -0
- package/dist/composer/useRealtimeVoiceMode.d.ts.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.js +110 -6
- package/dist/composer/useRealtimeVoiceMode.js.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.spec.js +74 -2
- package/dist/composer/useRealtimeVoiceMode.spec.js.map +1 -1
- package/dist/conformance/__fixtures__/css-in-js-adapter.d.ts +7 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.d.ts.map +1 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.js +84 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.js.map +1 -0
- package/dist/conformance/conformance.spec.d.ts +2 -0
- package/dist/conformance/conformance.spec.d.ts.map +1 -0
- package/dist/conformance/conformance.spec.js +87 -0
- package/dist/conformance/conformance.spec.js.map +1 -0
- package/dist/conformance/index.d.ts +4 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +4 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/conformance/runner.d.ts +12 -0
- package/dist/conformance/runner.d.ts.map +1 -0
- package/dist/conformance/runner.js +515 -0
- package/dist/conformance/runner.js.map +1 -0
- package/dist/conformance/types.d.ts +26 -0
- package/dist/conformance/types.d.ts.map +1 -0
- package/dist/conformance/types.js +13 -0
- package/dist/conformance/types.js.map +1 -0
- package/dist/conformance/version.d.ts +6 -0
- package/dist/conformance/version.d.ts.map +1 -0
- package/dist/conformance/version.js +14 -0
- package/dist/conformance/version.js.map +1 -0
- package/dist/design-system/components.d.ts +64 -0
- package/dist/design-system/components.d.ts.map +1 -0
- package/dist/design-system/components.js +50 -0
- package/dist/design-system/components.js.map +1 -0
- package/dist/design-system/context.d.ts +11 -0
- package/dist/design-system/context.d.ts.map +1 -0
- package/dist/design-system/context.js +17 -0
- package/dist/design-system/context.js.map +1 -0
- package/dist/design-system/default-adapter.d.ts +3 -0
- package/dist/design-system/default-adapter.d.ts.map +1 -0
- package/dist/design-system/default-adapter.js +166 -0
- package/dist/design-system/default-adapter.js.map +1 -0
- package/dist/design-system/default-adapter.spec.d.ts +2 -0
- package/dist/design-system/default-adapter.spec.d.ts.map +1 -0
- package/dist/design-system/default-adapter.spec.js +96 -0
- package/dist/design-system/default-adapter.spec.js.map +1 -0
- package/dist/design-system/definition.d.ts +9 -0
- package/dist/design-system/definition.d.ts.map +1 -0
- package/dist/design-system/definition.js +4 -0
- package/dist/design-system/definition.js.map +1 -0
- package/dist/design-system/design-system.spec.d.ts +2 -0
- package/dist/design-system/design-system.spec.d.ts.map +1 -0
- package/dist/design-system/design-system.spec.js +121 -0
- package/dist/design-system/design-system.spec.js.map +1 -0
- package/dist/design-system/error-boundary.d.ts +18 -0
- package/dist/design-system/error-boundary.d.ts.map +1 -0
- package/dist/design-system/error-boundary.js +16 -0
- package/dist/design-system/error-boundary.js.map +1 -0
- package/dist/design-system/index.d.ts +8 -0
- package/dist/design-system/index.d.ts.map +1 -0
- package/dist/design-system/index.js +8 -0
- package/dist/design-system/index.js.map +1 -0
- package/dist/design-system/theme.d.ts +30 -0
- package/dist/design-system/theme.d.ts.map +1 -0
- package/dist/design-system/theme.js +95 -0
- package/dist/design-system/theme.js.map +1 -0
- package/dist/design-system/theme.spec.d.ts +2 -0
- package/dist/design-system/theme.spec.d.ts.map +1 -0
- package/dist/design-system/theme.spec.js +43 -0
- package/dist/design-system/theme.spec.js.map +1 -0
- package/dist/design-system/types.d.ts +288 -0
- package/dist/design-system/types.d.ts.map +1 -0
- package/dist/design-system/types.js +2 -0
- package/dist/design-system/types.js.map +1 -0
- package/dist/editor/SharedRichEditor.d.ts.map +1 -1
- package/dist/editor/SharedRichEditor.js +3 -2
- package/dist/editor/SharedRichEditor.js.map +1 -1
- package/dist/editor/SlashCommandMenu.d.ts +8 -0
- package/dist/editor/SlashCommandMenu.d.ts.map +1 -1
- package/dist/editor/SlashCommandMenu.js +6 -0
- package/dist/editor/SlashCommandMenu.js.map +1 -1
- package/dist/editor/SlashCommandMenu.spec.d.ts +2 -0
- package/dist/editor/SlashCommandMenu.spec.d.ts.map +1 -0
- package/dist/editor/SlashCommandMenu.spec.js +20 -0
- package/dist/editor/SlashCommandMenu.spec.js.map +1 -0
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/editor/index.js.map +1 -1
- package/dist/provider.d.ts +4 -3
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +46 -4
- package/dist/provider.js.map +1 -1
- package/dist/styles.css +52 -23
- package/dist/ui/button.d.ts +5 -0
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +25 -4
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/dialog.d.ts +4 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/popover.d.ts +1 -0
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +2 -2
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/select.d.ts +3 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sidebar.d.ts +6 -2
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +12 -15
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/tooltip.d.ts +3 -1
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +2 -2
- package/dist/ui/tooltip.js.map +1 -1
- package/package.json +31 -1
- package/src/chat-history/ChatHistoryRail.spec.tsx +174 -0
- package/src/chat-history/ChatHistoryRail.tsx +100 -39
- package/src/chat-history/index.ts +9 -0
- package/src/chat-history/useChatHistoryRailController.spec.tsx +131 -0
- package/src/chat-history/useChatHistoryRailController.ts +76 -0
- package/src/chat-history.css +2 -0
- package/src/composer/ComposerPlusMenu.tsx +11 -8
- package/src/composer/PromptComposer.spec.ts +12 -1
- package/src/composer/PromptComposer.tsx +32 -7
- package/src/composer/RealtimeVoiceMode.spec.tsx +117 -9
- package/src/composer/RealtimeVoiceMode.tsx +119 -31
- package/src/composer/useRealtimeVoiceMode.spec.ts +101 -1
- package/src/composer/useRealtimeVoiceMode.tsx +124 -9
- package/src/conformance/__fixtures__/css-in-js-adapter.tsx +401 -0
- package/src/conformance/conformance.spec.tsx +143 -0
- package/src/conformance/index.ts +3 -0
- package/src/conformance/runner.tsx +862 -0
- package/src/conformance/types.ts +45 -0
- package/src/conformance/version.ts +22 -0
- package/src/design-system/components.tsx +146 -0
- package/src/design-system/context.tsx +31 -0
- package/src/design-system/default-adapter.spec.tsx +143 -0
- package/src/design-system/default-adapter.tsx +915 -0
- package/src/design-system/definition.ts +14 -0
- package/src/design-system/design-system.spec.tsx +183 -0
- package/src/design-system/error-boundary.tsx +37 -0
- package/src/design-system/index.ts +7 -0
- package/src/design-system/theme.spec.ts +61 -0
- package/src/design-system/theme.ts +145 -0
- package/src/design-system/types.ts +363 -0
- package/src/editor/SharedRichEditor.tsx +13 -2
- package/src/editor/SlashCommandMenu.spec.ts +33 -0
- package/src/editor/SlashCommandMenu.tsx +20 -0
- package/src/editor/index.ts +2 -0
- package/src/provider.tsx +98 -5
- package/src/styles.css +52 -23
- package/src/ui/button.tsx +95 -6
- package/src/ui/dialog.tsx +48 -23
- package/src/ui/popover.tsx +16 -2
- package/src/ui/select.tsx +7 -3
- package/src/ui/sidebar.tsx +47 -48
- package/src/ui/tooltip.tsx +7 -3
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import { defaultDesignSystemComponents } from "../design-system/default-adapter.js";
|
|
6
|
+
import {
|
|
7
|
+
DESIGN_SYSTEM_CONTRACT_VERSION,
|
|
8
|
+
type DesignSystemComponents,
|
|
9
|
+
} from "../design-system/types.js";
|
|
10
|
+
import { cssInJsFixtureAdapter } from "./__fixtures__/css-in-js-adapter.js";
|
|
11
|
+
import {
|
|
12
|
+
assertDesignSystemConformance,
|
|
13
|
+
DESIGN_SYSTEM_CONFORMANCE_CHECKS,
|
|
14
|
+
runDesignSystemConformance,
|
|
15
|
+
} from "./runner.js";
|
|
16
|
+
import {
|
|
17
|
+
assertDesignSystemContractVersion,
|
|
18
|
+
DESIGN_SYSTEM_CONTRACT_EVOLUTION_POLICY,
|
|
19
|
+
} from "./version.js";
|
|
20
|
+
|
|
21
|
+
class ResizeObserverStub {
|
|
22
|
+
observe() {}
|
|
23
|
+
unobserve() {}
|
|
24
|
+
disconnect() {}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe("design-system conformance kit", () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", false);
|
|
30
|
+
vi.stubGlobal("ResizeObserver", ResizeObserverStub);
|
|
31
|
+
HTMLElement.prototype.scrollIntoView = vi.fn();
|
|
32
|
+
HTMLElement.prototype.hasPointerCapture = vi.fn(() => false);
|
|
33
|
+
HTMLElement.prototype.setPointerCapture = vi.fn();
|
|
34
|
+
HTMLElement.prototype.releasePointerCapture = vi.fn();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
document.body.replaceChildren();
|
|
39
|
+
vi.restoreAllMocks();
|
|
40
|
+
vi.unstubAllGlobals();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("publishes named coverage for all seventeen components and overlay concerns", () => {
|
|
44
|
+
const covered = new Set(
|
|
45
|
+
DESIGN_SYSTEM_CONFORMANCE_CHECKS.flatMap((check) => check.components),
|
|
46
|
+
);
|
|
47
|
+
expect(covered.size).toBe(17);
|
|
48
|
+
expect(DESIGN_SYSTEM_CONFORMANCE_CHECKS.map((check) => check.id)).toEqual(
|
|
49
|
+
expect.arrayContaining([
|
|
50
|
+
"overlay.portal-and-z-index-stacking",
|
|
51
|
+
"overlay.focus-interoperability",
|
|
52
|
+
]),
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("enforces the published contract evolution policy", () => {
|
|
57
|
+
expect(DESIGN_SYSTEM_CONTRACT_EVOLUTION_POLICY.minor).toContain(
|
|
58
|
+
"optional props",
|
|
59
|
+
);
|
|
60
|
+
expect(DESIGN_SYSTEM_CONTRACT_EVOLUTION_POLICY.major).toContain(
|
|
61
|
+
"behavioral",
|
|
62
|
+
);
|
|
63
|
+
expect(() =>
|
|
64
|
+
assertDesignSystemContractVersion(DESIGN_SYSTEM_CONTRACT_VERSION),
|
|
65
|
+
).not.toThrow();
|
|
66
|
+
expect(() => assertDesignSystemContractVersion(2)).toThrow(/incompatible/);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("passes the styling-independent CSS-in-JS fixture", async () => {
|
|
70
|
+
const report = await assertDesignSystemConformance({
|
|
71
|
+
adapterName: "CSS-in-JS fixture",
|
|
72
|
+
components: cssInJsFixtureAdapter,
|
|
73
|
+
contractVersion: DESIGN_SYSTEM_CONTRACT_VERSION,
|
|
74
|
+
});
|
|
75
|
+
expect(report.passed).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("passes the default shadcn and Radix adapter", async () => {
|
|
79
|
+
const report = await runDesignSystemConformance({
|
|
80
|
+
adapterName: "Toolkit default",
|
|
81
|
+
components: defaultDesignSystemComponents,
|
|
82
|
+
contractVersion: DESIGN_SYSTEM_CONTRACT_VERSION,
|
|
83
|
+
});
|
|
84
|
+
expect(report.results.filter((result) => !result.passed)).toEqual([]);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("rejects tabs that stack an icon above its label", async () => {
|
|
88
|
+
const stackedTabsAdapter: DesignSystemComponents = {
|
|
89
|
+
...cssInJsFixtureAdapter,
|
|
90
|
+
Tabs: ({ items, value, onChange, orientation }) => (
|
|
91
|
+
<div>
|
|
92
|
+
<div role="tablist" aria-orientation={orientation}>
|
|
93
|
+
{items.map((item) => (
|
|
94
|
+
<button
|
|
95
|
+
key={String(item.value)}
|
|
96
|
+
role="tab"
|
|
97
|
+
aria-selected={item.value === value}
|
|
98
|
+
style={{ display: "flex", flexDirection: "column" }}
|
|
99
|
+
onClick={() => onChange(item.value)}
|
|
100
|
+
>
|
|
101
|
+
{item.icon}
|
|
102
|
+
{item.label}
|
|
103
|
+
</button>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
{items.find((item) => item.value === value)?.content}
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
const report = await runDesignSystemConformance({
|
|
111
|
+
adapterName: "stacked-tabs fixture",
|
|
112
|
+
components: stackedTabsAdapter,
|
|
113
|
+
contractVersion: DESIGN_SYSTEM_CONTRACT_VERSION,
|
|
114
|
+
});
|
|
115
|
+
const tabsResult = report.results.find(
|
|
116
|
+
(result) => result.id === "behavior.tabs",
|
|
117
|
+
);
|
|
118
|
+
expect(tabsResult?.passed).toBe(false);
|
|
119
|
+
expect(tabsResult?.message).toContain("same row");
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("rejects dialogs that render footer controls outside the dialog", async () => {
|
|
123
|
+
const detachedFooterAdapter: DesignSystemComponents = {
|
|
124
|
+
...cssInJsFixtureAdapter,
|
|
125
|
+
Dialog: ({ footer, ...props }) => (
|
|
126
|
+
<>
|
|
127
|
+
<cssInJsFixtureAdapter.Dialog {...props} />
|
|
128
|
+
{footer}
|
|
129
|
+
</>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
const report = await runDesignSystemConformance({
|
|
133
|
+
adapterName: "detached-footer fixture",
|
|
134
|
+
components: detachedFooterAdapter,
|
|
135
|
+
contractVersion: DESIGN_SYSTEM_CONTRACT_VERSION,
|
|
136
|
+
});
|
|
137
|
+
const dialogResult = report.results.find(
|
|
138
|
+
(result) => result.id === "behavior.dialog",
|
|
139
|
+
);
|
|
140
|
+
expect(dialogResult?.passed).toBe(false);
|
|
141
|
+
expect(dialogResult?.message).toContain("footer");
|
|
142
|
+
});
|
|
143
|
+
});
|