@actioneer/ads 0.1.0
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/LICENSE +21 -0
- package/bin/ads-init.mjs +314 -0
- package/components/accordion.d.ts +13 -0
- package/components/accordion.js +91 -0
- package/components/agents-ui/agent-audio-visualizer-aura.d.ts +11 -0
- package/components/agents-ui/agent-audio-visualizer-aura.js +277 -0
- package/components/agents-ui/agent-audio-visualizer-wave.d.ts +12 -0
- package/components/agents-ui/agent-audio-visualizer-wave.js +203 -0
- package/components/agents-ui/react-shader-toy.d.ts +87 -0
- package/components/agents-ui/react-shader-toy.js +531 -0
- package/components/ai-elements/chain-of-thought.d.ts +30 -0
- package/components/ai-elements/chain-of-thought.js +182 -0
- package/components/ai-elements/index.d.ts +11 -0
- package/components/ai-elements/inline-citation.d.ts +44 -0
- package/components/ai-elements/inline-citation.js +314 -0
- package/components/ai-elements/message.d.ts +96 -0
- package/components/ai-elements/message.js +308 -0
- package/components/ai-elements/queue.d.ts +60 -0
- package/components/ai-elements/queue.js +193 -0
- package/components/ai-elements/reasoning.d.ts +26 -0
- package/components/ai-elements/reasoning.js +131 -0
- package/components/ai-elements/shimmer.d.ts +25 -0
- package/components/ai-elements/shimmer.js +44 -0
- package/components/ai-elements/speech-input.d.ts +16 -0
- package/components/ai-elements/speech-input.js +151 -0
- package/components/ai-elements/task-progress.d.ts +41 -0
- package/components/ai-elements/task-progress.js +211 -0
- package/components/ai-elements/task.d.ts +35 -0
- package/components/ai-elements/task.js +73 -0
- package/components/ai-elements/tool.d.ts +53 -0
- package/components/ai-elements/tool.js +116 -0
- package/components/ai-elements/voice.d.ts +74 -0
- package/components/ai-elements/voice.js +875 -0
- package/components/alert.d.ts +21 -0
- package/components/alert.js +76 -0
- package/components/answer.d.ts +984 -0
- package/components/answer.js +543 -0
- package/components/assistant-ui/action-bar.d.ts +3 -0
- package/components/assistant-ui/action-bar.js +57 -0
- package/components/assistant-ui/answer-tool-ui.d.ts +5 -0
- package/components/assistant-ui/answer-tool-ui.js +42 -0
- package/components/assistant-ui/attachment.d.ts +50 -0
- package/components/assistant-ui/attachment.js +353 -0
- package/components/assistant-ui/badge.d.ts +11 -0
- package/components/assistant-ui/badge.js +54 -0
- package/components/assistant-ui/branch-picker.d.ts +3 -0
- package/components/assistant-ui/branch-picker.js +36 -0
- package/components/assistant-ui/chain-of-thought.d.ts +46 -0
- package/components/assistant-ui/composer-add-context.d.ts +50 -0
- package/components/assistant-ui/composer-add-context.js +209 -0
- package/components/assistant-ui/composer-deep-research.d.ts +16 -0
- package/components/assistant-ui/composer-deep-research.js +38 -0
- package/components/assistant-ui/composer-harness.d.ts +18 -0
- package/components/assistant-ui/composer-harness.js +186 -0
- package/components/assistant-ui/composer-trigger-popover.d.ts +47 -0
- package/components/assistant-ui/composer-trigger-popover.js +147 -0
- package/components/assistant-ui/composer.d.ts +8 -0
- package/components/assistant-ui/composer.js +276 -0
- package/components/assistant-ui/directive-text.d.ts +16 -0
- package/components/assistant-ui/directive-text.js +40 -0
- package/components/assistant-ui/error.d.ts +6 -0
- package/components/assistant-ui/error.js +39 -0
- package/components/assistant-ui/file.d.ts +37 -0
- package/components/assistant-ui/file.js +159 -0
- package/components/assistant-ui/follow-up-suggestions.d.ts +7 -0
- package/components/assistant-ui/follow-up-suggestions.js +44 -0
- package/components/assistant-ui/image.d.ts +46 -0
- package/components/assistant-ui/image.js +351 -0
- package/components/assistant-ui/index.d.ts +28 -0
- package/components/assistant-ui/markdown-text.d.ts +1 -0
- package/components/assistant-ui/markdown-text.js +242 -0
- package/components/assistant-ui/message-timing.d.ts +25 -0
- package/components/assistant-ui/message-timing.js +56 -0
- package/components/assistant-ui/message.d.ts +4 -0
- package/components/assistant-ui/message.js +159 -0
- package/components/assistant-ui/primitives.d.ts +2 -0
- package/components/assistant-ui/quote.d.ts +37 -0
- package/components/assistant-ui/quote.js +150 -0
- package/components/assistant-ui/reasoning.d.ts +44 -0
- package/components/assistant-ui/reasoning.js +261 -0
- package/components/assistant-ui/selection-toolbar.d.ts +29 -0
- package/components/assistant-ui/selection-toolbar.js +91 -0
- package/components/assistant-ui/smart-message-text.d.ts +15 -0
- package/components/assistant-ui/smart-message-text.js +29 -0
- package/components/assistant-ui/sources.d.ts +17 -0
- package/components/assistant-ui/sources.js +121 -0
- package/components/assistant-ui/suggestions.d.ts +7 -0
- package/components/assistant-ui/suggestions.js +19 -0
- package/components/assistant-ui/thread-context.d.ts +37 -0
- package/components/assistant-ui/thread-context.js +8 -0
- package/components/assistant-ui/thread.d.ts +5 -0
- package/components/assistant-ui/thread.js +77 -0
- package/components/assistant-ui/tool-fallback.d.ts +36 -0
- package/components/assistant-ui/tool-fallback.js +428 -0
- package/components/assistant-ui/tool-group.d.ts +33 -0
- package/components/assistant-ui/tool-group.js +173 -0
- package/components/assistant-ui/tooltip-icon-button.d.ts +7 -0
- package/components/assistant-ui/tooltip-icon-button.js +31 -0
- package/components/assistant-ui/voice.d.ts +18 -0
- package/components/autocomplete.d.ts +18 -0
- package/components/autocomplete.js +162 -0
- package/components/avatar.d.ts +26 -0
- package/components/avatar.js +92 -0
- package/components/badge.d.ts +10 -0
- package/components/badge.js +83 -0
- package/components/brand-loader.d.ts +16 -0
- package/components/brand-loader.js +64 -0
- package/components/breadcrumbs.d.ts +8 -0
- package/components/breadcrumbs.js +58 -0
- package/components/button.d.ts +13 -0
- package/components/button.js +100 -0
- package/components/card.d.ts +19 -0
- package/components/card.js +82 -0
- package/components/carousel.d.ts +31 -0
- package/components/carousel.js +351 -0
- package/components/chart.d.ts +165 -0
- package/components/chart.js +841 -0
- package/components/checkbox.d.ts +13 -0
- package/components/checkbox.js +84 -0
- package/components/chip.d.ts +13 -0
- package/components/chip.js +112 -0
- package/components/collapsible.d.ts +5 -0
- package/components/collapsible.js +31 -0
- package/components/connector-card.d.ts +62 -0
- package/components/connector-card.js +154 -0
- package/components/divider.d.ts +23 -0
- package/components/divider.js +69 -0
- package/components/drawer.d.ts +45 -0
- package/components/drawer.js +234 -0
- package/components/dropdown.d.ts +33 -0
- package/components/dropdown.js +198 -0
- package/components/empty-state.d.ts +8 -0
- package/components/empty-state.js +30 -0
- package/components/field.d.ts +20 -0
- package/components/field.js +74 -0
- package/components/index.d.ts +56 -0
- package/components/index.js +444 -0
- package/components/input-field.d.ts +22 -0
- package/components/input-field.js +91 -0
- package/components/input.d.ts +8 -0
- package/components/input.js +61 -0
- package/components/kbd.d.ts +6 -0
- package/components/kbd.js +26 -0
- package/components/link.d.ts +14 -0
- package/components/link.js +72 -0
- package/components/modal.d.ts +18 -0
- package/components/modal.js +156 -0
- package/components/navbar.d.ts +15 -0
- package/components/navbar.js +68 -0
- package/components/number-field.d.ts +11 -0
- package/components/number-field.js +89 -0
- package/components/pagination.d.ts +28 -0
- package/components/pagination.js +179 -0
- package/components/panel.d.ts +14 -0
- package/components/panel.js +71 -0
- package/components/pixel-blast-svg.d.ts +22 -0
- package/components/pixel-blast-svg.js +154 -0
- package/components/popover.d.ts +20 -0
- package/components/popover.js +101 -0
- package/components/progress-circle.d.ts +11 -0
- package/components/progress-circle.js +75 -0
- package/components/progress.d.ts +22 -0
- package/components/progress.js +66 -0
- package/components/radio.d.ts +16 -0
- package/components/radio.js +101 -0
- package/components/segmented.d.ts +16 -0
- package/components/segmented.js +103 -0
- package/components/select.d.ts +28 -0
- package/components/select.js +180 -0
- package/components/selection-action-bar.d.ts +11 -0
- package/components/selection-action-bar.js +59 -0
- package/components/sidebar.d.ts +118 -0
- package/components/sidebar.js +375 -0
- package/components/skeleton.d.ts +6 -0
- package/components/skeleton.js +26 -0
- package/components/slider.d.ts +11 -0
- package/components/slider.js +62 -0
- package/components/spinner.d.ts +11 -0
- package/components/spinner.js +62 -0
- package/components/switch.d.ts +7 -0
- package/components/switch.js +61 -0
- package/components/table.d.ts +59 -0
- package/components/table.js +254 -0
- package/components/tabs.d.ts +29 -0
- package/components/tabs.js +371 -0
- package/components/textarea.d.ts +5 -0
- package/components/textarea.js +24 -0
- package/components/timeline.d.ts +7 -0
- package/components/timeline.js +47 -0
- package/components/toast.d.ts +74 -0
- package/components/toast.js +211 -0
- package/components/tooltip.d.ts +11 -0
- package/components/tooltip.js +143 -0
- package/components/tree.d.ts +42 -0
- package/components/tree.js +86 -0
- package/components/typography.d.ts +33 -0
- package/components/typography.js +65 -0
- package/components/ui/avatar.d.ts +11 -0
- package/components/ui/avatar.js +56 -0
- package/components/ui/button.d.ts +10 -0
- package/components/ui/button.js +57 -0
- package/components/ui/collapsible.d.ts +5 -0
- package/components/ui/collapsible.js +35 -0
- package/components/ui/dialog.d.ts +17 -0
- package/components/ui/dialog.js +93 -0
- package/components/ui/tabs.d.ts +22 -0
- package/components/ui/tooltip.d.ts +7 -0
- package/components/ui/tooltip.js +56 -0
- package/fonts/aribau-grotesk-400.otf +0 -0
- package/fonts/aribau-grotesk-700.otf +0 -0
- package/fonts.css +21 -0
- package/hooks/agents-ui/use-agent-audio-visualizer-aura.d.ts +8 -0
- package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +62 -0
- package/hooks/agents-ui/use-agent-audio-visualizer-wave.d.ts +7 -0
- package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +60 -0
- package/hooks/agents-ui/voice-visualizer-types.d.ts +9 -0
- package/lib/cn.d.ts +3 -0
- package/lib/cn.js +9 -0
- package/lib/icons.d.ts +378 -0
- package/lib/icons.js +119 -0
- package/lib/interactive.d.ts +24 -0
- package/lib/interactive.js +36 -0
- package/lib/motion.d.ts +58 -0
- package/lib/motion.js +70 -0
- package/lib/router.d.ts +3 -0
- package/lib/utils.d.ts +6 -0
- package/llms.txt +537 -0
- package/manifest.json +5085 -0
- package/package.json +60 -0
- package/styles.css +653 -0
- package/theme.css +273 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Glitchcraft, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/ads-init.mjs
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `npx @actioneer/ads init` — idempotent bootstrap for a consumer repo.
|
|
4
|
+
*
|
|
5
|
+
* Modeled as a PURE write-plan (`repo state → ordered list of edits`) plus a
|
|
6
|
+
* thin applier that performs the IO. The plan does the deciding; the applier
|
|
7
|
+
* does the doing. A second run on an already-configured repo yields an empty
|
|
8
|
+
* plan and reports "nothing to do."
|
|
9
|
+
*
|
|
10
|
+
* Edits it plans:
|
|
11
|
+
* • install `@actioneer/ads` (+ `motion` for the reduced-motion provider)
|
|
12
|
+
* • inject `@import "@actioneer/ads/styles.css";` right after
|
|
13
|
+
* `@import "tailwindcss";` in the global stylesheet
|
|
14
|
+
* • scaffold the three required providers (TooltipProvider, ToastProvider,
|
|
15
|
+
* <MotionConfig reducedMotion="user">) as `app/providers.tsx` and wrap the
|
|
16
|
+
* root layout's children with them
|
|
17
|
+
* • drop a consumer-mode `ads-lint.config.mjs`
|
|
18
|
+
* (`libraryPackage: "@actioneer/ads"`, `libraryRoot: null`)
|
|
19
|
+
*
|
|
20
|
+
* Per the DES-13 testing decision, the write-plan is exercised end-to-end by a
|
|
21
|
+
* manual run rather than dedicated unit tests this pass.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import fs from "node:fs";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
import { execFileSync } from "node:child_process";
|
|
27
|
+
|
|
28
|
+
const PKG = "@actioneer/ads";
|
|
29
|
+
const STYLE_IMPORT = `@import "${PKG}/styles.css";`;
|
|
30
|
+
|
|
31
|
+
// ── pure write-plan ──────────────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {Object} RepoState
|
|
35
|
+
* @property {Record<string,string>} dependencies merged deps+devDeps of the consumer
|
|
36
|
+
* @property {string|null} globalCssPath repo-relative path to the global stylesheet (or null)
|
|
37
|
+
* @property {string|null} globalCssContent
|
|
38
|
+
* @property {string|null} layoutPath repo-relative path to the root layout (or null)
|
|
39
|
+
* @property {string|null} layoutContent
|
|
40
|
+
* @property {boolean} hasAdsLintConfig
|
|
41
|
+
*
|
|
42
|
+
* @typedef {Object} Edit
|
|
43
|
+
* @property {"install"|"write-file"|"edit-file"|"manual"} type
|
|
44
|
+
* @property {string} title human-readable description (idempotency = title uniqueness)
|
|
45
|
+
* @property {string} [path]
|
|
46
|
+
* @property {string} [content] write-file: full file content
|
|
47
|
+
* @property {string} [find] edit-file: substring to replace
|
|
48
|
+
* @property {string} [replace] edit-file: replacement text
|
|
49
|
+
* @property {number} [findIndex] edit-file: positional replace offset (disambiguates repeated tokens)
|
|
50
|
+
* @property {string} [addImport] edit-file: import line to prepend if absent
|
|
51
|
+
* @property {string[]} [packages] install: package specifiers
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/** @param {RepoState} state @returns {Edit[]} */
|
|
55
|
+
export function planInit(state) {
|
|
56
|
+
const edits = [];
|
|
57
|
+
|
|
58
|
+
// 1. Install the package (+ motion peer for the reduced-motion provider).
|
|
59
|
+
const missing = ["@actioneer/ads", "motion"].filter((p) => !state.dependencies?.[p]);
|
|
60
|
+
if (missing.length) {
|
|
61
|
+
edits.push({ type: "install", title: `install ${missing.join(", ")}`, packages: missing });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 2. Inject the styles.css import IMMEDIATELY AFTER `@import "tailwindcss"`.
|
|
65
|
+
// Order is load-bearing: styles.css before tailwindcss leaves its @theme
|
|
66
|
+
// inert (see CONSUMING.md §2). If there's no tailwindcss import to anchor
|
|
67
|
+
// to, we do NOT guess a position — we emit a manual instruction so we never
|
|
68
|
+
// write the broken order.
|
|
69
|
+
if (state.globalCssPath != null && state.globalCssContent != null) {
|
|
70
|
+
if (!state.globalCssContent.includes(STYLE_IMPORT)) {
|
|
71
|
+
const twMatch = state.globalCssContent.match(/@import\s+["']tailwindcss["'][^;]*;/);
|
|
72
|
+
if (twMatch) {
|
|
73
|
+
edits.push({
|
|
74
|
+
type: "edit-file",
|
|
75
|
+
title: `inject ${PKG}/styles.css import into ${state.globalCssPath}`,
|
|
76
|
+
path: state.globalCssPath,
|
|
77
|
+
find: twMatch[0],
|
|
78
|
+
replace: `${twMatch[0]}\n${STYLE_IMPORT}`,
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
edits.push({
|
|
82
|
+
type: "manual",
|
|
83
|
+
title: `add \`@import "tailwindcss";\` then \`${STYLE_IMPORT}\` (in that order) to ${state.globalCssPath}`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
edits.push({
|
|
89
|
+
type: "manual",
|
|
90
|
+
title: `add \`@import "tailwindcss";\` then \`${STYLE_IMPORT}\` to your global stylesheet`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 3. Scaffold the providers file + wrap the layout.
|
|
95
|
+
if (state.layoutPath != null) {
|
|
96
|
+
const dir = path.posix.dirname(toPosix(state.layoutPath));
|
|
97
|
+
const providersPath = path.posix.join(dir, "providers.tsx");
|
|
98
|
+
if (!fileExistsInState(state, providersPath)) {
|
|
99
|
+
edits.push({
|
|
100
|
+
type: "write-file",
|
|
101
|
+
title: `scaffold providers at ${providersPath}`,
|
|
102
|
+
path: providersPath,
|
|
103
|
+
content: PROVIDERS_FILE,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (state.layoutContent != null && !state.layoutContent.includes("<Providers>")) {
|
|
107
|
+
const child = findJsxChildren(state.layoutContent);
|
|
108
|
+
if (child) {
|
|
109
|
+
edits.push({
|
|
110
|
+
type: "edit-file",
|
|
111
|
+
title: `wrap the root layout children with <Providers> in ${state.layoutPath}`,
|
|
112
|
+
path: state.layoutPath,
|
|
113
|
+
find: child,
|
|
114
|
+
findIndex: state.layoutContent.indexOf(child, state.layoutContent.indexOf("return")),
|
|
115
|
+
replace: `<Providers>${child}</Providers>`,
|
|
116
|
+
addImport: `import { Providers } from "./providers";`,
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
edits.push({
|
|
120
|
+
type: "manual",
|
|
121
|
+
title: `wrap your app root's children with <Providers> (from ./providers)`,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
edits.push({
|
|
127
|
+
type: "write-file",
|
|
128
|
+
title: "scaffold providers at app/providers.tsx",
|
|
129
|
+
path: "app/providers.tsx",
|
|
130
|
+
content: PROVIDERS_FILE,
|
|
131
|
+
});
|
|
132
|
+
edits.push({
|
|
133
|
+
type: "manual",
|
|
134
|
+
title: "wrap your app root's children with <Providers> (from ./providers)",
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 4. Drop a consumer-mode ads-lint config.
|
|
139
|
+
if (!state.hasAdsLintConfig) {
|
|
140
|
+
edits.push({
|
|
141
|
+
type: "write-file",
|
|
142
|
+
title: "drop consumer-mode ads-lint.config.mjs",
|
|
143
|
+
path: "ads-lint.config.mjs",
|
|
144
|
+
content: ADS_LINT_CONFIG,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return edits;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Locate the JSX `{children}` render expression in a root layout — NOT the
|
|
153
|
+
* destructuring parameter `({ children }: …)` or a type annotation. Returns the
|
|
154
|
+
* exact token text, or null if none is safely identifiable.
|
|
155
|
+
*/
|
|
156
|
+
export function findJsxChildren(source) {
|
|
157
|
+
for (const m of source.matchAll(/\{\s*children\s*\}/g)) {
|
|
158
|
+
const start = m.index;
|
|
159
|
+
const end = start + m[0].length;
|
|
160
|
+
// Nearest non-space neighbors.
|
|
161
|
+
let b = start - 1;
|
|
162
|
+
while (b >= 0 && /\s/.test(source[b])) b--;
|
|
163
|
+
let a = end;
|
|
164
|
+
while (a < source.length && /\s/.test(source[a])) a++;
|
|
165
|
+
const prev = source[b];
|
|
166
|
+
const next = source[a];
|
|
167
|
+
// Skip the destructuring param `({ children }` and any `{ children }:` type.
|
|
168
|
+
if (prev === "(" || prev === "," || next === ":") continue;
|
|
169
|
+
return m[0];
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const PROVIDERS_FILE = `"use client";
|
|
175
|
+
|
|
176
|
+
// Required ADS providers — wrap the app root once. Without TooltipProvider the
|
|
177
|
+
// vendored tooltip/attachment chips crash; ToastProvider is needed to render
|
|
178
|
+
// toasts; MotionConfig reducedMotion="user" honors the OS setting everywhere.
|
|
179
|
+
import { TooltipProvider, ToastProvider } from "${PKG}";
|
|
180
|
+
import { MotionConfig } from "motion/react";
|
|
181
|
+
|
|
182
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
183
|
+
return (
|
|
184
|
+
<MotionConfig reducedMotion="user">
|
|
185
|
+
<ToastProvider>
|
|
186
|
+
<TooltipProvider>{children}</TooltipProvider>
|
|
187
|
+
</ToastProvider>
|
|
188
|
+
</MotionConfig>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
const ADS_LINT_CONFIG = `// @actioneer/ads-lint — consumer mode. Every file is a consumer, so the
|
|
194
|
+
// barrel / deep-import / external-UI rules apply everywhere. See the ADS
|
|
195
|
+
// import contract: import the exact named export from "${PKG}"; never
|
|
196
|
+
// deep-import, alias, or hand-roll a copy.
|
|
197
|
+
export default {
|
|
198
|
+
imports: {
|
|
199
|
+
libraryPackage: "${PKG}",
|
|
200
|
+
libraryRoot: null,
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
// ── thin applier (IO) ────────────────────────────────────────────────────────
|
|
206
|
+
|
|
207
|
+
const CANDIDATE_CSS = [
|
|
208
|
+
"app/globals.css",
|
|
209
|
+
"src/app/globals.css",
|
|
210
|
+
"styles/globals.css",
|
|
211
|
+
"app/global.css",
|
|
212
|
+
"src/styles/globals.css",
|
|
213
|
+
];
|
|
214
|
+
const CANDIDATE_LAYOUT = ["app/layout.tsx", "src/app/layout.tsx", "app/layout.jsx", "src/app/layout.jsx"];
|
|
215
|
+
|
|
216
|
+
function toPosix(p) {
|
|
217
|
+
return p.split(path.sep).join("/");
|
|
218
|
+
}
|
|
219
|
+
function fileExistsInState(state, relPosix) {
|
|
220
|
+
return state._existing?.has(relPosix) ?? false;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function readRepoState(cwd) {
|
|
224
|
+
const read = (rel) => {
|
|
225
|
+
const abs = path.join(cwd, rel);
|
|
226
|
+
return fs.existsSync(abs) ? fs.readFileSync(abs, "utf8") : null;
|
|
227
|
+
};
|
|
228
|
+
const pkgRaw = read("package.json");
|
|
229
|
+
const pkg = pkgRaw ? JSON.parse(pkgRaw) : {};
|
|
230
|
+
const dependencies = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
|
|
231
|
+
|
|
232
|
+
const globalCssPath = CANDIDATE_CSS.find((p) => fs.existsSync(path.join(cwd, p))) ?? null;
|
|
233
|
+
const layoutPath = CANDIDATE_LAYOUT.find((p) => fs.existsSync(path.join(cwd, p))) ?? null;
|
|
234
|
+
|
|
235
|
+
const _existing = new Set();
|
|
236
|
+
for (const p of [...CANDIDATE_CSS, ...CANDIDATE_LAYOUT, "ads-lint.config.mjs", "app/providers.tsx", "src/app/providers.tsx"]) {
|
|
237
|
+
if (fs.existsSync(path.join(cwd, p))) _existing.add(p);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
dependencies,
|
|
242
|
+
globalCssPath,
|
|
243
|
+
globalCssContent: globalCssPath ? read(globalCssPath) : null,
|
|
244
|
+
layoutPath,
|
|
245
|
+
layoutContent: layoutPath ? read(layoutPath) : null,
|
|
246
|
+
hasAdsLintConfig:
|
|
247
|
+
fs.existsSync(path.join(cwd, "ads-lint.config.mjs")) || fs.existsSync(path.join(cwd, "ads-lint.config.js")),
|
|
248
|
+
_existing,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function applyEdit(cwd, edit) {
|
|
253
|
+
const abs = edit.path ? path.join(cwd, edit.path) : null;
|
|
254
|
+
switch (edit.type) {
|
|
255
|
+
case "install": {
|
|
256
|
+
console.log(` → npm install ${edit.packages.join(" ")}`);
|
|
257
|
+
execFileSync("npm", ["install", ...edit.packages], { cwd, stdio: "inherit" });
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
case "write-file": {
|
|
261
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
262
|
+
fs.writeFileSync(abs, edit.content);
|
|
263
|
+
console.log(` → wrote ${edit.path}`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
case "edit-file": {
|
|
267
|
+
let content = fs.readFileSync(abs, "utf8");
|
|
268
|
+
if (typeof edit.findIndex === "number" && edit.findIndex >= 0) {
|
|
269
|
+
// Positional replace — avoids clobbering an earlier identical token
|
|
270
|
+
// (e.g. the layout's `{ children }` destructuring parameter).
|
|
271
|
+
content =
|
|
272
|
+
content.slice(0, edit.findIndex) +
|
|
273
|
+
edit.replace +
|
|
274
|
+
content.slice(edit.findIndex + edit.find.length);
|
|
275
|
+
} else {
|
|
276
|
+
content = content.replace(edit.find, edit.replace);
|
|
277
|
+
}
|
|
278
|
+
if (edit.addImport && !content.includes(edit.addImport)) content = `${edit.addImport}\n${content}`;
|
|
279
|
+
fs.writeFileSync(abs, content);
|
|
280
|
+
console.log(` → edited ${edit.path}`);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
case "manual": {
|
|
284
|
+
console.log(` → manual: ${edit.title}`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function main() {
|
|
291
|
+
const cmd = process.argv[2];
|
|
292
|
+
const cwd = process.cwd();
|
|
293
|
+
if (cmd && cmd !== "init") {
|
|
294
|
+
console.error(`ads: unknown command "${cmd}". Usage: npx ${PKG} init`);
|
|
295
|
+
process.exit(1);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const state = readRepoState(cwd);
|
|
299
|
+
const edits = planInit(state);
|
|
300
|
+
|
|
301
|
+
if (edits.length === 0) {
|
|
302
|
+
console.log(`${PKG} init: nothing to do — already configured.`);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
console.log(`${PKG} init: applying ${edits.length} edit(s)…`);
|
|
307
|
+
for (const edit of edits) applyEdit(cwd, edit);
|
|
308
|
+
console.log(`\n${PKG} init: done. Import components with \`import { Button } from "${PKG}";\``);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Only run the applier when invoked as a CLI (keeps planInit importable/pure).
|
|
312
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
313
|
+
main();
|
|
314
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type AccordionType = "single" | "multiple";
|
|
3
|
+
export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
type?: AccordionType;
|
|
5
|
+
defaultValue?: string | string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export interface AccordionItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
9
|
+
value: string;
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { ChevronDown as I } from "../lib/icons.js";
|
|
5
|
+
import { cn as c } from "../lib/cn.js";
|
|
6
|
+
const b = r.createContext(
|
|
7
|
+
null
|
|
8
|
+
);
|
|
9
|
+
function A(s) {
|
|
10
|
+
const e = r.useContext(b);
|
|
11
|
+
if (!e)
|
|
12
|
+
throw new Error(`<${s}> must be used within <Accordion>`);
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
const N = r.forwardRef(
|
|
16
|
+
({ className: s, type: e = "single", defaultValue: t, children: u, ...f }, g) => {
|
|
17
|
+
const d = r.useId(), [a, l] = r.useState(() => t === void 0 ? [] : Array.isArray(t) ? t : [t]), i = r.useCallback(
|
|
18
|
+
(o) => {
|
|
19
|
+
l((x) => {
|
|
20
|
+
const p = x.includes(o);
|
|
21
|
+
return e === "single" ? p ? [] : [o] : p ? x.filter((w) => w !== o) : [...x, o];
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
[e]
|
|
25
|
+
), m = r.useMemo(
|
|
26
|
+
() => ({ openItems: a, toggle: i, baseId: d }),
|
|
27
|
+
[a, i, d]
|
|
28
|
+
);
|
|
29
|
+
return /* @__PURE__ */ n(b.Provider, { value: m, children: /* @__PURE__ */ n(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
ref: g,
|
|
33
|
+
className: c(s),
|
|
34
|
+
...f,
|
|
35
|
+
children: u
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
N.displayName = "Accordion";
|
|
41
|
+
const y = r.forwardRef(({ className: s, value: e, title: t, children: u, ...f }, g) => {
|
|
42
|
+
const { openItems: d, toggle: a, baseId: l } = A("AccordionItem"), i = d.includes(e), m = `${l}-trigger-${e}`, o = `${l}-panel-${e}`;
|
|
43
|
+
return /* @__PURE__ */ h("div", { ref: g, className: c(s), ...f, children: [
|
|
44
|
+
/* @__PURE__ */ n("h3", { className: "flex", children: /* @__PURE__ */ h(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
id: m,
|
|
49
|
+
"aria-expanded": i,
|
|
50
|
+
"aria-controls": o,
|
|
51
|
+
onClick: () => a(e),
|
|
52
|
+
className: c(
|
|
53
|
+
"flex w-full items-center justify-between py-4 text-left font-medium",
|
|
54
|
+
"outline-none focus-visible:ring-3 focus-visible:ring-ring rounded-sm",
|
|
55
|
+
"transition-colors hover:text-foreground"
|
|
56
|
+
),
|
|
57
|
+
children: [
|
|
58
|
+
t,
|
|
59
|
+
/* @__PURE__ */ n(
|
|
60
|
+
I,
|
|
61
|
+
{
|
|
62
|
+
"aria-hidden": !0,
|
|
63
|
+
className: c(
|
|
64
|
+
"size-4 shrink-0 text-muted-foreground transition-transform duration-(--duration-normal) ease-out motion-reduce:transition-none",
|
|
65
|
+
i && "rotate-180"
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) }),
|
|
72
|
+
/* @__PURE__ */ n(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
id: o,
|
|
76
|
+
role: "region",
|
|
77
|
+
"aria-labelledby": m,
|
|
78
|
+
className: c(
|
|
79
|
+
"grid",
|
|
80
|
+
i ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
81
|
+
),
|
|
82
|
+
children: /* @__PURE__ */ n("div", { className: "overflow-hidden", children: /* @__PURE__ */ n("div", { className: "pb-4 text-xs text-muted-foreground", children: u }) })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
});
|
|
87
|
+
y.displayName = "AccordionItem";
|
|
88
|
+
export {
|
|
89
|
+
N as Accordion,
|
|
90
|
+
y as AccordionItem
|
|
91
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VoiceVisualizerColor, VoiceVisualizerDriver } from '../../hooks/agents-ui/voice-visualizer-types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface AgentAudioVisualizerAuraProps extends Omit<React.ComponentPropsWithoutRef<"div">, "color">, VoiceVisualizerDriver {
|
|
4
|
+
/** Normalized RGB shader color. */
|
|
5
|
+
color?: VoiceVisualizerColor;
|
|
6
|
+
/** Hue variation across aura layers. */
|
|
7
|
+
colorShift?: number;
|
|
8
|
+
themeMode?: "dark" | "light";
|
|
9
|
+
}
|
|
10
|
+
/** Internal ADS port of LiveKit Agents UI's Aura visualizer. */
|
|
11
|
+
export declare const AgentAudioVisualizerAura: React.ForwardRefExoticComponent<AgentAudioVisualizerAuraProps & React.RefAttributes<HTMLDivElement>>;
|