@ewjdev/anyclick-react 3.0.0 → 4.0.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/dist/chunk-7KW4HSJM.mjs +35 -0
- package/dist/chunk-7KW4HSJM.mjs.map +1 -0
- package/dist/chunk-YBHJXEH6.mjs +305 -0
- package/dist/chunk-YBHJXEH6.mjs.map +1 -0
- package/dist/index.css +23 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +55 -18
- package/dist/index.d.ts +55 -18
- package/dist/index.js +1077 -485
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +942 -352
- package/dist/index.mjs.map +1 -1
- package/dist/token-EXBG54PO.mjs +66 -0
- package/dist/token-EXBG54PO.mjs.map +1 -0
- package/dist/token-util-4XOQ3GFX.mjs +6 -0
- package/dist/token-util-4XOQ3GFX.mjs.map +1 -0
- package/package.json +16 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// <define:process>
|
|
21
|
+
var define_process_default;
|
|
22
|
+
var init_define_process = __esm({
|
|
23
|
+
"<define:process>"() {
|
|
24
|
+
define_process_default = {};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
__require,
|
|
30
|
+
__commonJS,
|
|
31
|
+
__export,
|
|
32
|
+
init_define_process,
|
|
33
|
+
define_process_default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-7KW4HSJM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["<define:process>"],"sourcesContent":["{}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,8BAAC;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__require,
|
|
4
|
+
define_process_default,
|
|
5
|
+
init_define_process
|
|
6
|
+
} from "./chunk-7KW4HSJM.mjs";
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/@vercel/oidc/dist/token-error.js
|
|
9
|
+
var require_token_error = __commonJS({
|
|
10
|
+
"../../node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
|
|
11
|
+
"use strict";
|
|
12
|
+
init_define_process();
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var token_error_exports = {};
|
|
31
|
+
__export(token_error_exports, {
|
|
32
|
+
VercelOidcTokenError: () => VercelOidcTokenError
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(token_error_exports);
|
|
35
|
+
var VercelOidcTokenError = class extends Error {
|
|
36
|
+
constructor(message, cause) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.name = "VercelOidcTokenError";
|
|
39
|
+
this.cause = cause;
|
|
40
|
+
}
|
|
41
|
+
toString() {
|
|
42
|
+
if (this.cause) {
|
|
43
|
+
return `${this.name}: ${this.message}: ${this.cause}`;
|
|
44
|
+
}
|
|
45
|
+
return `${this.name}: ${this.message}`;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/@vercel/oidc/dist/token-io.js
|
|
52
|
+
var require_token_io = __commonJS({
|
|
53
|
+
"../../node_modules/@vercel/oidc/dist/token-io.js"(exports, module) {
|
|
54
|
+
"use strict";
|
|
55
|
+
init_define_process();
|
|
56
|
+
var __create = Object.create;
|
|
57
|
+
var __defProp = Object.defineProperty;
|
|
58
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
59
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
60
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
61
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
62
|
+
var __export = (target, all) => {
|
|
63
|
+
for (var name in all)
|
|
64
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
65
|
+
};
|
|
66
|
+
var __copyProps = (to, from, except, desc) => {
|
|
67
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
68
|
+
for (let key of __getOwnPropNames(from))
|
|
69
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
70
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
71
|
+
}
|
|
72
|
+
return to;
|
|
73
|
+
};
|
|
74
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
75
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
76
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
77
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
78
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
79
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
80
|
+
mod
|
|
81
|
+
));
|
|
82
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
83
|
+
var token_io_exports = {};
|
|
84
|
+
__export(token_io_exports, {
|
|
85
|
+
findRootDir: () => findRootDir,
|
|
86
|
+
getUserDataDir: () => getUserDataDir
|
|
87
|
+
});
|
|
88
|
+
module.exports = __toCommonJS(token_io_exports);
|
|
89
|
+
var import_path = __toESM(__require("path"));
|
|
90
|
+
var import_fs = __toESM(__require("fs"));
|
|
91
|
+
var import_os = __toESM(__require("os"));
|
|
92
|
+
var import_token_error = require_token_error();
|
|
93
|
+
function findRootDir() {
|
|
94
|
+
try {
|
|
95
|
+
let dir = define_process_default.cwd();
|
|
96
|
+
while (dir !== import_path.default.dirname(dir)) {
|
|
97
|
+
const pkgPath = import_path.default.join(dir, ".vercel");
|
|
98
|
+
if (import_fs.default.existsSync(pkgPath)) {
|
|
99
|
+
return dir;
|
|
100
|
+
}
|
|
101
|
+
dir = import_path.default.dirname(dir);
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {
|
|
104
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
105
|
+
"Token refresh only supported in node server environments"
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
|
|
109
|
+
}
|
|
110
|
+
function getUserDataDir() {
|
|
111
|
+
if (define_process_default.env.XDG_DATA_HOME) {
|
|
112
|
+
return define_process_default.env.XDG_DATA_HOME;
|
|
113
|
+
}
|
|
114
|
+
switch (import_os.default.platform()) {
|
|
115
|
+
case "darwin":
|
|
116
|
+
return import_path.default.join(import_os.default.homedir(), "Library/Application Support");
|
|
117
|
+
case "linux":
|
|
118
|
+
return import_path.default.join(import_os.default.homedir(), ".local/share");
|
|
119
|
+
case "win32":
|
|
120
|
+
if (define_process_default.env.LOCALAPPDATA) {
|
|
121
|
+
return define_process_default.env.LOCALAPPDATA;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
default:
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/@vercel/oidc/dist/token-util.js
|
|
132
|
+
var require_token_util = __commonJS({
|
|
133
|
+
"../../node_modules/@vercel/oidc/dist/token-util.js"(exports, module) {
|
|
134
|
+
init_define_process();
|
|
135
|
+
var __create = Object.create;
|
|
136
|
+
var __defProp = Object.defineProperty;
|
|
137
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
138
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
139
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
140
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
141
|
+
var __export = (target, all) => {
|
|
142
|
+
for (var name in all)
|
|
143
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
144
|
+
};
|
|
145
|
+
var __copyProps = (to, from, except, desc) => {
|
|
146
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
147
|
+
for (let key of __getOwnPropNames(from))
|
|
148
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
149
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
150
|
+
}
|
|
151
|
+
return to;
|
|
152
|
+
};
|
|
153
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
154
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
155
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
156
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
157
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
158
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
159
|
+
mod
|
|
160
|
+
));
|
|
161
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
162
|
+
var token_util_exports = {};
|
|
163
|
+
__export(token_util_exports, {
|
|
164
|
+
assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
|
|
165
|
+
findProjectInfo: () => findProjectInfo,
|
|
166
|
+
getTokenPayload: () => getTokenPayload,
|
|
167
|
+
getVercelCliToken: () => getVercelCliToken,
|
|
168
|
+
getVercelDataDir: () => getVercelDataDir,
|
|
169
|
+
getVercelOidcToken: () => getVercelOidcToken,
|
|
170
|
+
isExpired: () => isExpired,
|
|
171
|
+
loadToken: () => loadToken,
|
|
172
|
+
saveToken: () => saveToken
|
|
173
|
+
});
|
|
174
|
+
module.exports = __toCommonJS(token_util_exports);
|
|
175
|
+
var path = __toESM(__require("path"));
|
|
176
|
+
var fs = __toESM(__require("fs"));
|
|
177
|
+
var import_token_error = require_token_error();
|
|
178
|
+
var import_token_io = require_token_io();
|
|
179
|
+
function getVercelDataDir() {
|
|
180
|
+
const vercelFolder = "com.vercel.cli";
|
|
181
|
+
const dataDir = (0, import_token_io.getUserDataDir)();
|
|
182
|
+
if (!dataDir) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return path.join(dataDir, vercelFolder);
|
|
186
|
+
}
|
|
187
|
+
function getVercelCliToken() {
|
|
188
|
+
const dataDir = getVercelDataDir();
|
|
189
|
+
if (!dataDir) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const tokenPath = path.join(dataDir, "auth.json");
|
|
193
|
+
if (!fs.existsSync(tokenPath)) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const token = fs.readFileSync(tokenPath, "utf8");
|
|
197
|
+
if (!token) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
return JSON.parse(token).token;
|
|
201
|
+
}
|
|
202
|
+
async function getVercelOidcToken(authToken, projectId, teamId) {
|
|
203
|
+
try {
|
|
204
|
+
const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
|
|
205
|
+
const res = await fetch(url, {
|
|
206
|
+
method: "POST",
|
|
207
|
+
headers: {
|
|
208
|
+
Authorization: `Bearer ${authToken}`
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
if (!res.ok) {
|
|
212
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
213
|
+
`Failed to refresh OIDC token: ${res.statusText}`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
const tokenRes = await res.json();
|
|
217
|
+
assertVercelOidcTokenResponse(tokenRes);
|
|
218
|
+
return tokenRes;
|
|
219
|
+
} catch (e) {
|
|
220
|
+
throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function assertVercelOidcTokenResponse(res) {
|
|
224
|
+
if (!res || typeof res !== "object") {
|
|
225
|
+
throw new TypeError("Expected an object");
|
|
226
|
+
}
|
|
227
|
+
if (!("token" in res) || typeof res.token !== "string") {
|
|
228
|
+
throw new TypeError("Expected a string-valued token property");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function findProjectInfo() {
|
|
232
|
+
const dir = (0, import_token_io.findRootDir)();
|
|
233
|
+
if (!dir) {
|
|
234
|
+
throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
const prjPath = path.join(dir, ".vercel", "project.json");
|
|
238
|
+
if (!fs.existsSync(prjPath)) {
|
|
239
|
+
throw new import_token_error.VercelOidcTokenError("project.json not found");
|
|
240
|
+
}
|
|
241
|
+
const prj = JSON.parse(fs.readFileSync(prjPath, "utf8"));
|
|
242
|
+
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
243
|
+
throw new TypeError("Expected a string-valued projectId property");
|
|
244
|
+
}
|
|
245
|
+
return { projectId: prj.projectId, teamId: prj.orgId };
|
|
246
|
+
} catch (e) {
|
|
247
|
+
throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function saveToken(token, projectId) {
|
|
251
|
+
try {
|
|
252
|
+
const dir = (0, import_token_io.getUserDataDir)();
|
|
253
|
+
if (!dir) {
|
|
254
|
+
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory");
|
|
255
|
+
}
|
|
256
|
+
const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
257
|
+
const tokenJson = JSON.stringify(token);
|
|
258
|
+
fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });
|
|
259
|
+
fs.writeFileSync(tokenPath, tokenJson);
|
|
260
|
+
fs.chmodSync(tokenPath, 432);
|
|
261
|
+
return;
|
|
262
|
+
} catch (e) {
|
|
263
|
+
throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function loadToken(projectId) {
|
|
267
|
+
try {
|
|
268
|
+
const dir = (0, import_token_io.getUserDataDir)();
|
|
269
|
+
if (!dir) {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
273
|
+
if (!fs.existsSync(tokenPath)) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const token = JSON.parse(fs.readFileSync(tokenPath, "utf8"));
|
|
277
|
+
assertVercelOidcTokenResponse(token);
|
|
278
|
+
return token;
|
|
279
|
+
} catch (e) {
|
|
280
|
+
throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function getTokenPayload(token) {
|
|
284
|
+
const tokenParts = token.split(".");
|
|
285
|
+
if (tokenParts.length !== 3) {
|
|
286
|
+
throw new import_token_error.VercelOidcTokenError("Invalid token");
|
|
287
|
+
}
|
|
288
|
+
const base64 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
289
|
+
const padded = base64.padEnd(
|
|
290
|
+
base64.length + (4 - base64.length % 4) % 4,
|
|
291
|
+
"="
|
|
292
|
+
);
|
|
293
|
+
return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
|
|
294
|
+
}
|
|
295
|
+
function isExpired(token) {
|
|
296
|
+
return token.exp * 1e3 < Date.now();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
export {
|
|
302
|
+
require_token_error,
|
|
303
|
+
require_token_util
|
|
304
|
+
};
|
|
305
|
+
//# sourceMappingURL=chunk-YBHJXEH6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@vercel/oidc/dist/token-error.js","../../../node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nfunction getVercelCliToken() {\n const dataDir = getVercelDataDir();\n if (!dataDir) {\n return null;\n }\n const tokenPath = path.join(dataDir, \"auth.json\");\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = fs.readFileSync(tokenPath, \"utf8\");\n if (!token) {\n return null;\n }\n return JSON.parse(token).token;\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n try {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);\n }\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\"Expected an object\");\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\"Expected a string-valued token property\");\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n }\n try {\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\"project.json not found\");\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\"Expected a string-valued projectId property\");\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);\n }\n}\nfunction saveToken(token, projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find user data directory\");\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);\n }\n}\nfunction loadToken(projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n return null;\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);\n }\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\"Invalid token\");\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now();\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AACA,QAAI,YAAY,OAAO;AACvB,QAAI,mBAAmB,OAAO;AAC9B,QAAI,oBAAoB,OAAO;AAC/B,QAAI,eAAe,OAAO,UAAU;AACpC,QAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,eAAS,QAAQ;AACf,kBAAU,QAAQ,MAAM,EAAE,KAAK,IAAI,IAAI,GAAG,YAAY,KAAK,CAAC;AAAA,IAChE;AACA,QAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,UAAI,QAAQ,OAAO,SAAS,YAAY,O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,GAAG;AAClC,UAAI,WAAW,WAAW,GAAG;AAC3B,cAAM,IAAI,mBAAmB,qBAAqB,eAAe;AAAA,MACnE;AACA,YAAM,SAAS,WAAW,CAAC,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AACjE,YAAM,SAAS,OAAO;AAAA,QACpB,OAAO,UAAU,IAAI,OAAO,SAAS,KAAK;AAAA,QAC1C;AAAA,MACF;AACA,aAAO,KAAK,MAAM,OAAO,KAAK,QAAQ,QAAQ,EAAE,SAAS,MAAM,CAAC;AAAA,IAClE;AACA,aAAS,UAAU,OAAO;AACxB,aAAO,MAAM,MAAM,MAAM,KAAK,IAAI;AAAA,IACpC;AAAA;AAAA;","names":[]}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
/* src/styles/tokens.css */
|
|
4
|
+
[data-anyclick-root] {
|
|
5
|
+
--ac-surface: #0f172a;
|
|
6
|
+
--ac-surface-muted: #111827;
|
|
7
|
+
--ac-border: #1f2937;
|
|
8
|
+
--ac-text: #e5e7eb;
|
|
9
|
+
--ac-text-muted: #9ca3af;
|
|
10
|
+
--ac-accent: #22d3ee;
|
|
11
|
+
--ac-accent-muted: #0ea5e9;
|
|
12
|
+
--ac-accent-foreground: #0b1020;
|
|
13
|
+
--ac-destructive: #ef4444;
|
|
14
|
+
--ac-gap: 0.5rem;
|
|
15
|
+
--ac-pad: 0.75rem;
|
|
16
|
+
--ac-shadow-menu: 0 10px 40px rgba(0, 0, 0, 0.35);
|
|
17
|
+
--ac-radius-md: 8px;
|
|
18
|
+
--ac-radius-lg: 12px;
|
|
19
|
+
--ac-radius-full: 9999px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* src/styles/tailwind.css */
|
|
23
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/styles/tokens.css"],"sourcesContent":["[data-anyclick-root] {\n /* Base surface and text */\n --ac-surface: #0f172a;\n --ac-surface-muted: #111827;\n --ac-border: #1f2937;\n --ac-text: #e5e7eb;\n --ac-text-muted: #9ca3af;\n\n /* Accents */\n --ac-accent: #22d3ee;\n --ac-accent-muted: #0ea5e9;\n --ac-accent-foreground: #0b1020;\n --ac-destructive: #ef4444;\n\n /* Layout */\n --ac-gap: 0.5rem;\n --ac-pad: 0.75rem;\n --ac-shadow-menu: 0 10px 40px rgba(0, 0, 0, 0.35);\n\n /* Radius */\n --ac-radius-md: 8px;\n --ac-radius-lg: 12px;\n --ac-radius-full: 9999px;\n}\n"],"mappings":";;;AAAA,CAAC;AAEC,gBAAc;AACd,sBAAoB;AACpB,eAAa;AACb,aAAW;AACX,mBAAiB;AAGjB,eAAa;AACb,qBAAmB;AACnB,0BAAwB;AACxB,oBAAkB;AAGlB,YAAU;AACV,YAAU;AACV,oBAAkB,EAAE,KAAK,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAG5C,kBAAgB;AAChB,kBAAgB;AAChB,oBAAkB;AACpB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default, { CSSProperties, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes } from 'react';
|
|
4
4
|
import { AnyclickAdapter, AnyclickType, AnyclickPayload, ScreenshotConfig, AnyclickTriggerEvent, ScreenshotData, AnyclickMenuEvent } from '@ewjdev/anyclick-core';
|
|
5
5
|
export { ALL_CURATED_PROPERTIES, AccessibilityInfo, AnyclickAdapter, AnyclickPayload, AnyclickType, BoxModelInfo, CURATED_STYLE_PROPERTIES, ComputedStylesInfo, DEFAULT_SCREENSHOT_CONFIG, DEFAULT_SENSITIVE_SELECTORS, ElementContext, ElementInspectInfo, PageContext, ScreenshotCapture, ScreenshotCaptureMode, ScreenshotConfig, ScreenshotData, captureAllScreenshots, captureScreenshot, estimateTotalSize, formatBoxModel, formatBytes, formatStylesAsCSS, getAccessibilityInfo, getAttributes, getBoxModelInfo, getComputedStyles, getElementInspectInfo, isScreenshotSupported } from '@ewjdev/anyclick-core';
|
|
6
6
|
import * as zustand from 'zustand';
|
|
@@ -130,7 +130,7 @@ interface InspectSimpleProps {
|
|
|
130
130
|
onClose: () => void;
|
|
131
131
|
onSelectElement?: (element: Element) => void;
|
|
132
132
|
ideConfig?: Partial<IDEConfig>;
|
|
133
|
-
style?:
|
|
133
|
+
style?: react__default.CSSProperties;
|
|
134
134
|
className?: string;
|
|
135
135
|
highlightColors?: HighlightColors;
|
|
136
136
|
showBoxModelOverlay?: boolean;
|
|
@@ -792,7 +792,7 @@ declare function ContextMenu({ className, containerElement, footer, header, high
|
|
|
792
792
|
*
|
|
793
793
|
* @since 1.0.0
|
|
794
794
|
*/
|
|
795
|
-
declare const ScreenshotPreview:
|
|
795
|
+
declare const ScreenshotPreview: react__default.NamedExoticComponent<ScreenshotPreviewProps>;
|
|
796
796
|
|
|
797
797
|
/**
|
|
798
798
|
* React context for anyclick functionality.
|
|
@@ -812,12 +812,12 @@ declare const ScreenshotPreview: React__default.NamedExoticComponent<ScreenshotP
|
|
|
812
812
|
* @see {@link useAnyclick} for the recommended way to access this context
|
|
813
813
|
* @since 1.0.0
|
|
814
814
|
*/
|
|
815
|
-
declare const AnyclickContext:
|
|
815
|
+
declare const AnyclickContext: react.Context<AnyclickContextValue | null>;
|
|
816
816
|
/**
|
|
817
817
|
* @deprecated Use {@link AnyclickContext} instead. Will be removed in v2.0.0.
|
|
818
818
|
* @see {@link AnyclickContext}
|
|
819
819
|
*/
|
|
820
|
-
declare const FeedbackContext:
|
|
820
|
+
declare const FeedbackContext: react.Context<AnyclickContextValue | null>;
|
|
821
821
|
/**
|
|
822
822
|
* Hook to access anyclick context values and methods.
|
|
823
823
|
*
|
|
@@ -1010,6 +1010,14 @@ declare const useProviderStore: zustand.UseBoundStore<zustand.StoreApi<ProviderS
|
|
|
1010
1010
|
*/
|
|
1011
1011
|
declare function dispatchContextMenuEvent(event: MouseEvent, element: Element): void;
|
|
1012
1012
|
|
|
1013
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1014
|
+
variant?: "default" | "ghost" | "outline" | "destructive";
|
|
1015
|
+
size?: "sm" | "md" | "lg";
|
|
1016
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1017
|
+
|
|
1018
|
+
type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
1019
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
1020
|
+
|
|
1013
1021
|
/**
|
|
1014
1022
|
* Available preset role identifiers.
|
|
1015
1023
|
*
|
|
@@ -1545,7 +1553,7 @@ interface InspectDialogManagerProps {
|
|
|
1545
1553
|
/** IDE configuration for "Open in IDE" feature */
|
|
1546
1554
|
ideConfig?: Partial<IDEConfig>;
|
|
1547
1555
|
/** Custom styles for the dialog */
|
|
1548
|
-
dialogStyle?:
|
|
1556
|
+
dialogStyle?: react__default.CSSProperties;
|
|
1549
1557
|
/** Custom class name for the dialog */
|
|
1550
1558
|
dialogClassName?: string;
|
|
1551
1559
|
/** Custom highlight colors for the element highlight */
|
|
@@ -1585,7 +1593,7 @@ interface AnyclickLogoProps {
|
|
|
1585
1593
|
/** Custom class name */
|
|
1586
1594
|
className?: string;
|
|
1587
1595
|
/** Custom styles */
|
|
1588
|
-
style?:
|
|
1596
|
+
style?: react__default.CSSProperties;
|
|
1589
1597
|
/** Click handler */
|
|
1590
1598
|
onClick?: () => void;
|
|
1591
1599
|
}
|
|
@@ -1600,10 +1608,45 @@ declare function AnyclickLogo({ size, borderWidth, primaryColor, backgroundColor
|
|
|
1600
1608
|
*/
|
|
1601
1609
|
declare function QuickChat({ visible, targetElement, containerElement, onClose, onPin, isPinned: isPinnedProp, config, style, className, initialInput, onInitialInputConsumed, }: QuickChatProps): react_jsx_runtime.JSX.Element | null;
|
|
1602
1610
|
|
|
1611
|
+
type DebugInfo = {
|
|
1612
|
+
status: number;
|
|
1613
|
+
ok: boolean;
|
|
1614
|
+
contentType: string | null;
|
|
1615
|
+
rawTextPreview: string;
|
|
1616
|
+
parsedKeys?: string[];
|
|
1617
|
+
contentPreview?: string;
|
|
1618
|
+
payloadPreview?: string;
|
|
1619
|
+
timestamp: number;
|
|
1620
|
+
error?: string;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
type RateLimitNotice = {
|
|
1624
|
+
status: 429;
|
|
1625
|
+
message: string;
|
|
1626
|
+
retryAt?: number;
|
|
1627
|
+
retryAfterSeconds?: number;
|
|
1628
|
+
requestId?: string;
|
|
1629
|
+
endpoint?: string;
|
|
1630
|
+
raw?: string;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1603
1633
|
/**
|
|
1604
1634
|
* Hook for managing QuickChat state and interactions.
|
|
1635
|
+
* Uses ai-sdk-ui for streaming and zustand for persistence.
|
|
1605
1636
|
*/
|
|
1606
1637
|
declare function useQuickChat(targetElement: Element | null, containerElement: Element | null, config?: QuickChatConfig): {
|
|
1638
|
+
input: string;
|
|
1639
|
+
messages: ChatMessage[];
|
|
1640
|
+
isLoadingSuggestions: boolean;
|
|
1641
|
+
isSending: boolean;
|
|
1642
|
+
isStreaming: boolean;
|
|
1643
|
+
suggestedPrompts: SuggestedPrompt[];
|
|
1644
|
+
contextChunks: ContextChunk[];
|
|
1645
|
+
error: string | null;
|
|
1646
|
+
debugInfo: DebugInfo | null;
|
|
1647
|
+
rateLimitNotice: RateLimitNotice | null;
|
|
1648
|
+
isPinned: boolean;
|
|
1649
|
+
lastSyncedAt: number | null;
|
|
1607
1650
|
config: {
|
|
1608
1651
|
endpoint: string;
|
|
1609
1652
|
model: string;
|
|
@@ -1616,20 +1659,14 @@ declare function useQuickChat(targetElement: Element | null, containerElement: E
|
|
|
1616
1659
|
title: string;
|
|
1617
1660
|
t3chat: T3ChatIntegrationConfig;
|
|
1618
1661
|
};
|
|
1619
|
-
setInput: (
|
|
1662
|
+
setInput: (input: string) => void;
|
|
1620
1663
|
toggleChunk: (chunkId: string) => void;
|
|
1621
1664
|
toggleAllChunks: (included: boolean) => void;
|
|
1622
1665
|
selectSuggestion: (prompt: SuggestedPrompt) => void;
|
|
1623
1666
|
sendMessage: (messageText?: string) => Promise<void>;
|
|
1624
1667
|
clearMessages: () => void;
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
isLoadingSuggestions: boolean;
|
|
1628
|
-
isSending: boolean;
|
|
1629
|
-
isStreaming: boolean;
|
|
1630
|
-
suggestedPrompts: SuggestedPrompt[];
|
|
1631
|
-
contextChunks: ContextChunk[];
|
|
1632
|
-
error: string | null;
|
|
1668
|
+
setIsPinned: (pinned: boolean) => void;
|
|
1669
|
+
clearRateLimitNotice: () => void;
|
|
1633
1670
|
};
|
|
1634
1671
|
|
|
1635
1672
|
/**
|
|
@@ -1648,4 +1685,4 @@ declare const quickChatStyles: Record<string, CSSProperties>;
|
|
|
1648
1685
|
*/
|
|
1649
1686
|
declare const quickChatKeyframes = "\n@keyframes blink {\n 0%, 50% { opacity: 1; }\n 51%, 100% { opacity: 0; }\n}\n\n@keyframes bounce {\n 0%, 80%, 100% { transform: scale(0); }\n 40% { transform: scale(1); }\n}\n\n@keyframes slideIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideInFromRight {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutToRight {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n@keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n}\n";
|
|
1650
1687
|
|
|
1651
|
-
export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, type ChatMessage, type CompactModeConfig, type ContextChunk, ContextMenu, type ContextMenuItem, type ContextMenuProps, type CreatePresetMenuOptions, DEFAULT_COMPACT_CONFIG, DEFAULT_QUICK_CHAT_CONFIG, FeedbackContext, type FeedbackMenuBadge, type FeedbackMenuStatus, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, type HighlightColors, type HighlightConfig, type IDEConfig, type IDEProtocol, INSPECT_DIALOG_EVENT, type InspectDialogEventDetail, InspectDialogManager, type InspectDialogManagerProps, InspectSimple, type InspectSimpleProps, type MenuPositionMode, type PinnedPosition, type PresetConfig, type PresetRole, type ProviderInstance, type QuickAction, QuickChat, type QuickChatConfig, type QuickChatProps, type QuickChatState, ScreenshotPreview, type ScreenshotPreviewProps, type SourceLocation, type SuggestedPrompt, type T3ChatIntegrationConfig, applyHighlights, buildIDEUrl, clearHighlights, createIDEOpener, createPresetMenu, createT3ChatMenuItem, createUploadScreenshotMenuItem, createUploadThingMenuItem, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectImageElement, detectPreferredIDE, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateProviderId, getBadgeStyle, getSelectedText, getSourceLocationFromElement, hasTextSelection, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, openInIDE, openInspectDialog, presetDefaults, quickChatKeyframes, quickChatStyles, useAnyclick, useFeedback, useProviderStore, useQuickChat };
|
|
1688
|
+
export { AnyclickContext, type AnyclickContextValue, AnyclickLogo, type AnyclickLogoProps, AnyclickProvider, type AnyclickProviderProps, type AnyclickTheme, type AnyclickUserContext, Button, type ChatMessage, type CompactModeConfig, type ContextChunk, ContextMenu, type ContextMenuItem, type ContextMenuProps, type CreatePresetMenuOptions, DEFAULT_COMPACT_CONFIG, DEFAULT_QUICK_CHAT_CONFIG, FeedbackContext, type FeedbackMenuBadge, type FeedbackMenuStatus, FeedbackProvider, FunModeBridge, type FunModeThemeConfig, type HighlightColors, type HighlightConfig, type IDEConfig, type IDEProtocol, INSPECT_DIALOG_EVENT, Input, type InspectDialogEventDetail, InspectDialogManager, type InspectDialogManagerProps, InspectSimple, type InspectSimpleProps, type MenuPositionMode, type PinnedPosition, type PresetConfig, type PresetRole, type ProviderInstance, type QuickAction, QuickChat, type QuickChatConfig, type QuickChatProps, type QuickChatState, ScreenshotPreview, type ScreenshotPreviewProps, type SourceLocation, type SuggestedPrompt, type T3ChatIntegrationConfig, applyHighlights, buildIDEUrl, clearHighlights, createIDEOpener, createPresetMenu, createT3ChatMenuItem, createUploadScreenshotMenuItem, createUploadThingMenuItem, darkMenuStyles, defaultContainerSelectors, defaultHighlightColors, detectImageElement, detectPreferredIDE, dispatchContextMenuEvent, filterMenuItemsByRole, findContainerParent, findSourceLocationInAncestors, formatSourceLocation, generateProviderId, getBadgeStyle, getSelectedText, getSourceLocationFromElement, hasTextSelection, highlightContainer, highlightTarget, isIDEProtocolSupported, listPresets, menuCSSVariables, menuStyles, openInIDE, openInspectDialog, presetDefaults, quickChatKeyframes, quickChatStyles, useAnyclick, useFeedback, useProviderStore, useQuickChat };
|