@usecontextlayer/sdk 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -24
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/local.d.ts +31 -26
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +8 -47
- package/dist/local.js.map +1 -1
- package/dist/react.d.ts +0 -8
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +49 -163
- package/dist/react.js.map +1 -1
- package/dist/vite.d.ts +10 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +13 -8
- package/dist/vite.js.map +1 -1
- package/dist/worker.d.ts +9 -10
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +1 -3
- package/dist/worker.js.map +1 -1
- package/package.json +4 -13
- package/dist/index-DbuYj6qS.d.ts +0 -24
- package/dist/index-DbuYj6qS.d.ts.map +0 -1
- package/styles.css +0 -136
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @usecontextlayer/sdk
|
|
2
2
|
|
|
3
|
-
ContextLayer integration for React Router apps: the shared document Layout and Tools
|
|
3
|
+
ContextLayer integration for React Router apps: the shared document Layout and Tools capability. In local development, tool calls execute through the ContextLayer platform using the manifest-selected viewer or app Owner's assigned Composio Platform connections.
|
|
4
4
|
|
|
5
5
|
Create an app with `npx @usecontextlayer/cli init my-app`. The CLI installs this package and configures a development-only Cloudflare Worker and native service binding. Use the generated app's normal `pnpm dev` command. First-party `@usecontextlayer/*` packages are exempt from pnpm's release-age policy in generated projects.
|
|
6
6
|
|
|
@@ -10,19 +10,21 @@ Run `ctx login` to save your ContextLayer login. Declare `work-email` as a viewe
|
|
|
10
10
|
|
|
11
11
|
For an organization-owned app's owner-mode requirement, authorize and list the account under the organization before assigning it. The connection commands' `--help` owns organization selection. The member completes OAuth for that Owner, and the platform uses the same organization's Composio identity when executing the requirement.
|
|
12
12
|
|
|
13
|
-
When `pnpm dev` starts, `contextlayer(env)` from `@usecontextlayer/sdk/vite` configures the Cloudflare Vite plugin and calls the CLI-owned `getLocalToolsBindings` helper. This Node helper reads the AppID from Git origin, validates `public/slate.json`, and obtains a current access token using the same saved login as the CLI. The AppID,
|
|
13
|
+
When `pnpm dev` starts, `contextlayer(env)` from `@usecontextlayer/sdk/vite` configures the Cloudflare Vite plugin and calls the CLI-owned `getLocalToolsBindings` helper. This Node helper reads the AppID from Git origin, validates `public/slate.json`, and obtains a current access token using the same saved login as the CLI. The AppID, typed CLI credential, and parsed manifest startup snapshot become native props on the Tools service binding. Only the platform URL enters the auxiliary Worker’s environment. The Worker re-exports the same Tools implementation used by dispatcher. The refresh token stays in `~/.contextlayer/auth.json`; the Composio project key stays on the platform. Restart `pnpm dev` when the access token expires or the manifest changes.
|
|
14
14
|
|
|
15
15
|
## App Layout
|
|
16
16
|
|
|
17
|
-
The generated `app/root.tsx` re-exports the SDK's document Layout
|
|
17
|
+
The generated `app/root.tsx` re-exports the SDK's document Layout:
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
|
-
export { Layout
|
|
20
|
+
export { Layout } from "@usecontextlayer/sdk/react"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
The Layout owns the HTML document, React Router's metadata, links, scripts, scroll restoration, and the shared ContextLayer header. The app owns its routes, root component, error boundary, stylesheet, and font links. The thin, full-width header
|
|
23
|
+
The Layout owns the HTML document, React Router's metadata, links, scripts, scroll restoration, and the shared ContextLayer header. The app owns its routes, root component, error boundary, stylesheet, and font links. The thin, full-width header has separate wordmark, connected-services, and viewer sections. The entire connected-services section toggles its inline connection tray, moving the app content down. The wordmark and identity are plain content; anonymous viewers see “Not signed in” without services controls. The tray lists required services and saved accounts, with account controls for Owners the viewer can manage.
|
|
24
24
|
|
|
25
|
-
The header and
|
|
25
|
+
The header and tray are served by platform in a cross-origin iframe on slate.usecontextlayer.com. Platform owns their styles, Fugaz One font, and data loading. Layout receives only a height message and resizes the frame to keep the expanding tray in document flow. The app's Tailwind/shadcn setup is independent; there is no SDK stylesheet export or chrome root loader.
|
|
26
|
+
|
|
27
|
+
The frame authenticates directly with the native web session. Its cookie always uses Secure, HttpOnly, and SameSite=None, in every environment. When browser third-party-cookie policy permits delivery, the existing web login authenticates the header automatically, without a separate sign-in or frame cookie. Web logout revokes subsequent frame authentication. The surrounding authored page receives neither credentials nor chrome data. S4 remains incomplete pending deployed private-app acceptance.
|
|
26
28
|
|
|
27
29
|
## A loader that reads Gmail
|
|
28
30
|
|
|
@@ -44,24 +46,9 @@ export async function loader({ context }: LoaderFunctionArgs) {
|
|
|
44
46
|
|
|
45
47
|
Calls return `{ data, logId }`. Validate the tool-specific `data` in your loader. The complete [Gmail example](examples/gmail.tsx) validates the response with Zod and renders a message list. Copy it to `app/routes/home.tsx` in a generated app and assign your Gmail connection to `work-email`.
|
|
46
48
|
|
|
47
|
-
## Current viewer
|
|
48
|
-
|
|
49
|
-
Read the safe profile in a loader through the request-scoped Viewer capability:
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
import { viewerContext } from "@usecontextlayer/sdk"
|
|
53
|
-
import type { LoaderFunctionArgs } from "react-router"
|
|
54
|
-
|
|
55
|
-
export async function loader({ context }: LoaderFunctionArgs) {
|
|
56
|
-
return context.get(viewerContext).getCurrentUser()
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The result is `{ id, name, image }` with nullable image, or `null` for an anonymous viewer. Local Viewer sends the saved CLI access token directly to web's `/api/me`; hosted Viewer sends the existing viewer cookie to that same endpoint. `CTX_AUTH_ISSUER` determines web's origin. Web verifies identity; the capability validates its response with Zod. The app receives only profile data through RPC. No access token, session cookie, refresh token, or platform profile proxy is exposed. The SDK root loader reads this profile once and Layout consumes the root route data to show the avatar and name in the always-visible header. Anonymous viewers see “Not signed in”. The installed local loader has been verified through the native development Worker. Hosted WfP verification remains pending.
|
|
61
|
-
|
|
62
49
|
## Runtime ownership
|
|
63
50
|
|
|
64
|
-
The package root exports the `Tools`
|
|
51
|
+
The package root exports the `Tools` interface and `toolsContext`. `@usecontextlayer/sdk/react` exports the shared document Layout, which mounts platform’s chrome iframe. `@usecontextlayer/sdk/local` bundles and re-exports the shared `Tools` Worker entrypoint, also used by dispatcher. `@usecontextlayer/sdk/worker` exports `createApp`, which creates the React Router request handler and supplies Tools from local bindings or production request props. `@usecontextlayer/sdk/vite` owns the `contextlayer` integration. The CLI package owns the Node startup helper and saved-login handling. The generated application supplies its virtual server-build import, mode, and development flag through thin Worker wiring. The Cloudflare Vite plugin runs the auxiliary Worker only in development; production bundles exclude it and its service binding. Profile and connection reads belong to the trusted chrome frame; the SDK exposes no Viewer or Connections capability.
|
|
65
52
|
|
|
66
53
|
In hosted apps, the dispatcher supplies `ctx.props.tools` as a request-scoped RPC handle. Its methods call the same platform execution API using the viewer session; the app cannot read the underlying viewer credential. That session authenticates the caller, while the deployed manifest's mode selects the viewer or app Owner's assignment for the app and slug. For viewer-mode requirements, a viewer using the same account as the CLI uses the same saved assignment. Owner-mode requirements use the app Owner's configured account. Local access-token bindings are not included in production builds.
|
|
67
54
|
|
|
@@ -81,6 +68,14 @@ export default defineConfig((env) => ({
|
|
|
81
68
|
}))
|
|
82
69
|
```
|
|
83
70
|
|
|
84
|
-
This integration supplies the Cloudflare plugin; do not add a second instance. It uses the generated `workers/local-tools/wrangler.jsonc` to start the local Tools Worker and provides its development-only Tools
|
|
71
|
+
This integration supplies the Cloudflare plugin; do not add a second instance. It uses the generated `workers/local-tools/wrangler.jsonc` to start the local Tools Worker and provides its development-only Tools service binding. At development startup, the CLI reads the app's Git origin, saved ContextLayer login, and validated manifest snapshot. The restart prerequisites are described under [Local login and assignment](#local-login-and-assignment). Production builds exclude local credentials and the auxiliary Worker.
|
|
72
|
+
|
|
73
|
+
The app retains its routes, `public/slate.json`, and thin Worker/configuration files. `@usecontextlayer/sdk/worker` owns the React Router request handler and capability context setup.
|
|
74
|
+
|
|
75
|
+
## App requirements and saved assignments
|
|
76
|
+
|
|
77
|
+
The platform frame loader reads the browser viewer's profile and requirement/assignment rows through the shared app-connection listing operation. Signed-in viewers can inspect their required services and select accounts through each row's controls. The connected-services status counts missing assignments; it does not validate provider status. Anonymous frames show “Not signed in” without a connection status or tray. These data stay in the frame.
|
|
78
|
+
|
|
79
|
+
The canonical manifest and viewer/owner requirements live in `@usecontextlayer/shared/slate`. The neutral requirement/assignment response in `@usecontextlayer/shared/app-connections` is shared by platform and CLI. Selecting an account saves the assignment and React Router revalidates the tray automatically. Connect account opens authorization in a new tab; refresh the app page afterward to select the new account. Changes made elsewhere appear on the next frame load. The tray does not refresh the app's route data. The local Vite integration exposes the AppID, platform URL, and validated manifest snapshot as non-secret browser configuration; credentials remain behind the Tools service binding. Tools uses that same manifest startup snapshot. Restart development after editing requirements.
|
|
85
80
|
|
|
86
|
-
|
|
81
|
+
`createApp` returns the exported `App` type from `@usecontextlayer/sdk/worker`, derived from Cloudflare's native `ExportedHandler` fetch contract. The SDK owns its local binding and request-props types. This gives the generated Worker a portable public declaration under the Cloudflare scaffold's composite TypeScript configuration.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
//#region index.d.ts
|
|
2
|
+
export interface Tools {
|
|
3
|
+
call(slug: string, toolSlug: string, args: Record<string, unknown>): Promise<{
|
|
4
|
+
data: unknown;
|
|
5
|
+
logId: string;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
export declare const toolsContext: import("react-router").RouterContext<Tools>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../index.ts"],"mappings":";iBAEiB;EAChB,KACC,cACA,kBACA,MAAM,0BACJ;IAAU;IAAe;;;qBAGhB,qCAAY,cAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createContext } from "react-router";
|
|
2
2
|
//#region index.ts
|
|
3
3
|
const toolsContext = createContext();
|
|
4
|
-
const viewerContext = createContext({ getCurrentUser: async () => null });
|
|
5
4
|
//#endregion
|
|
6
|
-
export { toolsContext
|
|
5
|
+
export { toolsContext };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import { createContext } from \"react-router\"\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import { createContext } from \"react-router\"\n\nexport interface Tools {\n\tcall(\n\t\tslug: string,\n\t\ttoolSlug: string,\n\t\targs: Record<string, unknown>,\n\t): Promise<{ data: unknown; logId: string }>\n}\n\nexport const toolsContext = createContext<Tools>()\n"],"mappings":";;AAUA,MAAa,eAAe,cAAqB"}
|
package/dist/local.d.ts
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { a as Viewer$1, t as Tools$1 } from "./index-DbuYj6qS.js";
|
|
2
|
-
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
1
|
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
toolkit: string;
|
|
2
|
+
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
|
+
//#region ../shared/dist/slate.d.mts
|
|
4
|
+
declare const slateSchema: z.ZodObject<{
|
|
5
|
+
connections: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
6
|
+
mode: z.ZodEnum<{
|
|
7
|
+
owner: "owner";
|
|
8
|
+
viewer: "viewer";
|
|
12
9
|
}>;
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
toolkit: z.ZodString;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
secrets: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
mode: z.ZodEnum<{
|
|
14
|
+
owner: "owner";
|
|
15
|
+
viewer: "viewer";
|
|
15
16
|
}>;
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type Bindings = z.input<typeof schema>;
|
|
17
|
+
}, z.core.$strict>>>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
type Slate = z.infer<typeof slateSchema>;
|
|
20
|
+
//#endregion
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region
|
|
23
|
-
|
|
22
|
+
//#region ../shared/dist/tools-worker.d.mts
|
|
23
|
+
//#region lib/tools-worker.d.ts
|
|
24
|
+
interface ToolsProps {
|
|
25
|
+
appId: string;
|
|
26
|
+
credential: {
|
|
27
|
+
token: string;
|
|
28
|
+
type: "access-token" | "session";
|
|
29
|
+
};
|
|
30
|
+
manifest?: Slate;
|
|
31
|
+
}
|
|
32
|
+
export declare class Tools extends WorkerEntrypoint<{
|
|
33
|
+
CTX_PLATFORM_URL: string;
|
|
34
|
+
}, ToolsProps> {
|
|
24
35
|
call(slug: string, toolSlug: string, args: Record<string, unknown>): Promise<{
|
|
25
36
|
data: Record<string, unknown>;
|
|
26
37
|
logId: string;
|
|
27
38
|
}>;
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
getCurrentUser(): Promise<{
|
|
31
|
-
id: string;
|
|
32
|
-
image: string | null;
|
|
33
|
-
name: string;
|
|
34
|
-
} | null>;
|
|
35
|
-
}
|
|
40
|
+
//#endregion
|
|
36
41
|
//#endregion
|
|
37
42
|
//# sourceMappingURL=local.d.ts.map
|
package/dist/local.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"local.d.ts","names":[],"sources":["../../shared/dist/slate.d.mts","../../shared/dist/tools-worker.d.mts"],"mappings":";;;cAqBqB,aAAa,EAAE;EAClC,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE;IACtC,MAAM,EAAE;MACN;MACA;;IAEF,SAAS,EAAE;KACV,EAAE,KAAK;EACV,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;IAC/C,MAAM,EAAE;MACN;MACA;;KAED,EAAE,KAAK;GACT,EAAE,KAAK;KACE,QAAQ,EAAE,aAAa;;;;;UCjClB;EACf;EACA;IACE;IACA;;EAEF,WAAW;;qBAEQ,cAAc;EACjC;GACC;EACD,KAAK,cAAc,kBAAkB,MAAM,0BAA0B;IACnE,MAAM;IACN"}
|
package/dist/local.js
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const connectionRequirementSchema = z.strictObject({
|
|
6
|
-
mode: credentialModeSchema,
|
|
7
|
-
toolkit: z.string().min(1)
|
|
8
|
-
});
|
|
9
|
-
const secretNameSchema = z.string().regex(/^[A-Z_][A-Z0-9_]*$/);
|
|
10
|
-
const secretRequirementSchema = z.strictObject({ mode: credentialModeSchema });
|
|
11
|
-
const slateSchema = z.strictObject({
|
|
12
|
-
connections: z.record(z.string().min(1), connectionRequirementSchema),
|
|
13
|
-
secrets: z.record(secretNameSchema, secretRequirementSchema).default({})
|
|
14
|
-
});
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region env.ts
|
|
17
|
-
const schema = z.object({
|
|
18
|
-
CTX_ACCESS_TOKEN: z.string().min(1),
|
|
19
|
-
CTX_APP_ID: z.uuid(),
|
|
20
|
-
CTX_APP_MANIFEST: z.string().transform((value) => slateSchema.parse(JSON.parse(value))),
|
|
21
|
-
CTX_AUTH_ISSUER: z.url(),
|
|
22
|
-
CTX_PLATFORM_URL: z.url()
|
|
23
|
-
});
|
|
24
|
-
const parseEnv = (bindings) => schema.parse(bindings);
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region viewer.ts
|
|
27
|
-
const userSchema = z.object({
|
|
28
|
-
id: z.string().min(1),
|
|
29
|
-
image: z.string().nullable(),
|
|
30
|
-
name: z.string()
|
|
31
|
-
});
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region local.ts
|
|
2
|
+
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
|
+
//#region ../shared/dist/tools-worker.mjs
|
|
34
4
|
const execution = z.object({
|
|
35
5
|
data: z.record(z.string(), z.unknown()),
|
|
36
6
|
error: z.string().nullable(),
|
|
@@ -38,17 +8,17 @@ const execution = z.object({
|
|
|
38
8
|
});
|
|
39
9
|
var Tools = class extends WorkerEntrypoint {
|
|
40
10
|
async call(slug, toolSlug, args) {
|
|
41
|
-
const
|
|
42
|
-
const response = await fetch(new URL(`/api/apps/${
|
|
11
|
+
const { appId, credential, manifest } = this.ctx.props;
|
|
12
|
+
const response = await fetch(new URL(`/api/apps/${appId}/tools/call`, this.env.CTX_PLATFORM_URL), {
|
|
43
13
|
body: JSON.stringify({
|
|
44
14
|
arguments: args,
|
|
45
|
-
manifest
|
|
15
|
+
manifest,
|
|
46
16
|
slug,
|
|
47
17
|
tool: toolSlug
|
|
48
18
|
}),
|
|
49
19
|
headers: {
|
|
50
|
-
|
|
51
|
-
"
|
|
20
|
+
"content-type": "application/json",
|
|
21
|
+
...credential.type === "access-token" ? { authorization: `Bearer ${credential.token}` } : { cookie: `ctx-viewer-auth=${credential.token}` }
|
|
52
22
|
},
|
|
53
23
|
method: "POST"
|
|
54
24
|
});
|
|
@@ -61,16 +31,7 @@ var Tools = class extends WorkerEntrypoint {
|
|
|
61
31
|
};
|
|
62
32
|
}
|
|
63
33
|
};
|
|
64
|
-
var Viewer = class extends WorkerEntrypoint {
|
|
65
|
-
async getCurrentUser() {
|
|
66
|
-
const env = parseEnv(this.env);
|
|
67
|
-
const response = await fetch(new URL("/api/me", env.CTX_AUTH_ISSUER), { headers: { authorization: `Bearer ${env.CTX_ACCESS_TOKEN}` } });
|
|
68
|
-
if (response.status === 401) return null;
|
|
69
|
-
if (!response.ok) throw new Error(`Identity request failed: HTTP ${response.status}`);
|
|
70
|
-
return userSchema.parse(await response.json());
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
34
|
//#endregion
|
|
74
|
-
export { Tools
|
|
35
|
+
export { Tools };
|
|
75
36
|
|
|
76
37
|
//# sourceMappingURL=local.js.map
|
package/dist/local.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","names":[],"sources":["../../shared/dist/
|
|
1
|
+
{"version":3,"file":"local.js","names":[],"sources":["../../shared/dist/tools-worker.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { WorkerEntrypoint } from \"cloudflare:workers\";\n\n//#region lib/tools-worker.ts\nconst execution = z.object({\n\tdata: z.record(z.string(), z.unknown()),\n\terror: z.string().nullable(),\n\tlogId: z.string()\n});\nvar Tools = class extends WorkerEntrypoint {\n\tasync call(slug, toolSlug, args) {\n\t\tconst { appId, credential, manifest } = this.ctx.props;\n\t\tconst response = await fetch(new URL(`/api/apps/${appId}/tools/call`, this.env.CTX_PLATFORM_URL), {\n\t\t\tbody: JSON.stringify({\n\t\t\t\targuments: args,\n\t\t\t\tmanifest,\n\t\t\t\tslug,\n\t\t\t\ttool: toolSlug\n\t\t\t}),\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t\t...credential.type === \"access-token\" ? { authorization: `Bearer ${credential.token}` } : { cookie: `ctx-viewer-auth=${credential.token}` }\n\t\t\t},\n\t\t\tmethod: \"POST\"\n\t\t});\n\t\tif (!response.ok) throw new Error(`Tool call failed: HTTP ${response.status}`);\n\t\tconst result = execution.parse(await response.json());\n\t\tif (result.error !== null) throw new Error(`${result.error} (log: ${result.logId})`);\n\t\treturn {\n\t\t\tdata: result.data,\n\t\t\tlogId: result.logId\n\t\t};\n\t}\n};\n\n//#endregion\nexport { Tools };"],"mappings":";;;AAIA,MAAM,YAAY,EAAE,OAAO;CAC1B,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;CACtC,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,OAAO,EAAE,OAAO;AACjB,CAAC;AACD,IAAI,QAAQ,cAAc,iBAAiB;CAC1C,MAAM,KAAK,MAAM,UAAU,MAAM;EAChC,MAAM,EAAE,OAAO,YAAY,aAAa,KAAK,IAAI;EACjD,MAAM,WAAW,MAAM,MAAM,IAAI,IAAI,aAAa,MAAM,cAAc,KAAK,IAAI,gBAAgB,GAAG;GACjG,MAAM,KAAK,UAAU;IACpB,WAAW;IACX;IACA;IACA,MAAM;GACP,CAAC;GACD,SAAS;IACR,gBAAgB;IAChB,GAAG,WAAW,SAAS,iBAAiB,EAAE,eAAe,UAAU,WAAW,QAAQ,IAAI,EAAE,QAAQ,mBAAmB,WAAW,QAAQ;GAC3I;GACA,QAAQ;EACT,CAAC;EACD,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM,0BAA0B,SAAS,QAAQ;EAC7E,MAAM,SAAS,UAAU,MAAM,MAAM,SAAS,KAAK,CAAC;EACpD,IAAI,OAAO,UAAU,MAAM,MAAM,IAAI,MAAM,GAAG,OAAO,MAAM,SAAS,OAAO,MAAM,EAAE;EACnF,OAAO;GACN,MAAM,OAAO;GACb,OAAO,OAAO;EACf;CACD;AACD"}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { LoaderFunctionArgs } from "react-router";
|
|
2
1
|
import { ReactNode } from "react";
|
|
3
2
|
//#region react.d.ts
|
|
4
|
-
export declare function loader({ context }: LoaderFunctionArgs): Promise<{
|
|
5
|
-
user: {
|
|
6
|
-
id: string;
|
|
7
|
-
image: string | null;
|
|
8
|
-
name: string;
|
|
9
|
-
} | null;
|
|
10
|
-
}>;
|
|
11
3
|
export declare function Layout({ children }: {
|
|
12
4
|
children: ReactNode;
|
|
13
5
|
}): import("react").JSX.Element;
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","names":[],"sources":["../react.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":[],"sources":["../react.tsx"],"mappings":";;wBA6CgB,SAAS;EAAc,UAAU;oBAAW,IAAA"}
|
package/dist/react.js
CHANGED
|
@@ -1,173 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { Button } from "@base-ui/react/button";
|
|
11
|
-
import { cva } from "class-variance-authority";
|
|
12
|
-
import { Collapsible } from "@base-ui/react/collapsible";
|
|
13
|
-
//#region components/ui/avatar.tsx
|
|
14
|
-
function Avatar$1({ className, size = "default", ...props }) {
|
|
15
|
-
return /* @__PURE__ */ jsx(Avatar.Root, {
|
|
16
|
-
"data-slot": "avatar",
|
|
17
|
-
"data-size": size,
|
|
18
|
-
className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
|
|
19
|
-
...props
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function AvatarImage({ className, ...props }) {
|
|
23
|
-
return /* @__PURE__ */ jsx(Avatar.Image, {
|
|
24
|
-
"data-slot": "avatar-image",
|
|
25
|
-
className: cn("aspect-square size-full rounded-full object-cover", className),
|
|
26
|
-
...props
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function AvatarFallback({ className, ...props }) {
|
|
30
|
-
return /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
31
|
-
"data-slot": "avatar-fallback",
|
|
32
|
-
className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className),
|
|
33
|
-
...props
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region components/ui/button.tsx
|
|
38
|
-
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
size: "default",
|
|
41
|
-
variant: "default"
|
|
42
|
-
},
|
|
43
|
-
variants: {
|
|
44
|
-
size: {
|
|
45
|
-
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
46
|
-
icon: "size-8",
|
|
47
|
-
"icon-lg": "size-9",
|
|
48
|
-
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
49
|
-
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
50
|
-
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
51
|
-
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
52
|
-
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3"
|
|
53
|
-
},
|
|
54
|
-
variant: {
|
|
55
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
56
|
-
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
57
|
-
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
58
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
59
|
-
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
60
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
import { Links, Meta, Scripts, ScrollRestoration } from "react-router";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region ../shared/dist/chrome.mjs
|
|
6
|
+
const chromePath = "/dashboard/chrome";
|
|
7
|
+
const chromeHeightSchema = z.object({
|
|
8
|
+
height: z.number().finite().nonnegative(),
|
|
9
|
+
type: z.literal("ctx:chrome:height")
|
|
63
10
|
});
|
|
64
|
-
function Button$1({ className, variant = "default", size = "default", ...props }) {
|
|
65
|
-
return /* @__PURE__ */ jsx(Button, {
|
|
66
|
-
"data-slot": "button",
|
|
67
|
-
className: cn(buttonVariants({
|
|
68
|
-
className,
|
|
69
|
-
size,
|
|
70
|
-
variant
|
|
71
|
-
})),
|
|
72
|
-
...props
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
11
|
//#endregion
|
|
76
|
-
//#region
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...props
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function CollapsibleContent({ ...props }) {
|
|
90
|
-
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
91
|
-
"data-slot": "collapsible-content",
|
|
92
|
-
...props
|
|
93
|
-
});
|
|
94
|
-
}
|
|
12
|
+
//#region browser-env.ts
|
|
13
|
+
const browserEnv = z.object({
|
|
14
|
+
CTX_APP_ID: z.uuid().optional(),
|
|
15
|
+
CTX_APP_MANIFEST: z.string().optional(),
|
|
16
|
+
CTX_PLATFORM_URL: z.url().default("https://slate.usecontextlayer.com")
|
|
17
|
+
}).parse({
|
|
18
|
+
CTX_APP_ID: import.meta.env.CTX_APP_ID,
|
|
19
|
+
CTX_APP_MANIFEST: import.meta.env.CTX_APP_MANIFEST,
|
|
20
|
+
CTX_PLATFORM_URL: import.meta.env.CTX_PLATFORM_URL
|
|
21
|
+
});
|
|
95
22
|
//#endregion
|
|
96
23
|
//#region react.tsx
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const [shadowRoot, setShadowRoot] = useState(null);
|
|
102
|
-
const attach = useCallback((host) => {
|
|
103
|
-
if (host) setShadowRoot(host.shadowRoot ?? host.attachShadow({ mode: "open" }));
|
|
104
|
-
}, []);
|
|
24
|
+
function Chrome() {
|
|
25
|
+
const frame = useRef(null);
|
|
26
|
+
const [src, setSrc] = useState();
|
|
27
|
+
const [height, setHeight] = useState(30);
|
|
105
28
|
useEffect(() => {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
29
|
+
const target = browserEnv.CTX_APP_ID ?? window.location.hostname;
|
|
30
|
+
const url = new URL(`${chromePath}/apps/${encodeURIComponent(target)}`, browserEnv.CTX_PLATFORM_URL);
|
|
31
|
+
url.searchParams.set("parentOrigin", window.location.origin);
|
|
32
|
+
if (browserEnv.CTX_APP_MANIFEST) url.searchParams.set("manifest", browserEnv.CTX_APP_MANIFEST);
|
|
33
|
+
function resize(event) {
|
|
34
|
+
if (event.origin !== url.origin || event.source !== frame.current?.contentWindow) return;
|
|
35
|
+
const message = chromeHeightSchema.safeParse(event.data);
|
|
36
|
+
if (message.success) setHeight(message.data.height);
|
|
37
|
+
}
|
|
38
|
+
window.addEventListener("message", resize);
|
|
39
|
+
setSrc(url.href);
|
|
40
|
+
return () => window.removeEventListener("message", resize);
|
|
115
41
|
}, []);
|
|
116
|
-
return /* @__PURE__ */ jsx("
|
|
117
|
-
ref:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
children: "contextlayer"
|
|
129
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
130
|
-
className: "flex min-w-0 self-stretch",
|
|
131
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
132
|
-
className: "flex shrink-0 items-center px-3 text-[13px]/4 font-normal text-slate-400",
|
|
133
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
134
|
-
className: "group-data-open/chrome:hidden",
|
|
135
|
-
children: "click to open"
|
|
136
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
137
|
-
className: "hidden group-data-open/chrome:inline",
|
|
138
|
-
children: "click to close"
|
|
139
|
-
})]
|
|
140
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
141
|
-
className: "flex min-w-0 items-center gap-2 border-l border-slate-200 py-[3px] pr-3 pl-[3px] text-[13px]/4 font-normal",
|
|
142
|
-
children: user ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Avatar$1, {
|
|
143
|
-
className: "size-[23px] rounded-[3px] after:rounded-[3px]",
|
|
144
|
-
children: [/* @__PURE__ */ jsx(AvatarImage, {
|
|
145
|
-
className: "rounded-[3px]",
|
|
146
|
-
src: user.image ?? void 0,
|
|
147
|
-
alt: ""
|
|
148
|
-
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
149
|
-
className: "rounded-[3px] text-[13px]",
|
|
150
|
-
children: user.name.slice(0, 1)
|
|
151
|
-
})]
|
|
152
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
153
|
-
className: "max-w-40 truncate",
|
|
154
|
-
title: user.name,
|
|
155
|
-
children: user.name
|
|
156
|
-
})] }) : /* @__PURE__ */ jsx("span", {
|
|
157
|
-
className: "truncate pl-[9px]",
|
|
158
|
-
children: "Not signed in"
|
|
159
|
-
})
|
|
160
|
-
})]
|
|
161
|
-
})]
|
|
162
|
-
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
163
|
-
className: "h-(--collapsible-panel-height) overflow-hidden bg-slate-100 transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none",
|
|
164
|
-
children: /* @__PURE__ */ jsx("div", { className: "min-h-40 border-b border-slate-200" })
|
|
165
|
-
})]
|
|
166
|
-
})] }), shadowRoot)
|
|
42
|
+
return /* @__PURE__ */ jsx("iframe", {
|
|
43
|
+
ref: frame,
|
|
44
|
+
src,
|
|
45
|
+
title: "ContextLayer",
|
|
46
|
+
style: {
|
|
47
|
+
backgroundColor: "oklch(96.8% 0.007 247.896)",
|
|
48
|
+
border: 0,
|
|
49
|
+
borderBottom: "1px solid oklch(92.9% 0.013 255.508)",
|
|
50
|
+
display: "block",
|
|
51
|
+
height,
|
|
52
|
+
width: "100%"
|
|
53
|
+
}
|
|
167
54
|
});
|
|
168
55
|
}
|
|
169
56
|
function Layout({ children }) {
|
|
170
|
-
const data = useRouteLoaderData("root");
|
|
171
57
|
return /* @__PURE__ */ jsxs("html", {
|
|
172
58
|
lang: "en",
|
|
173
59
|
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
@@ -179,7 +65,7 @@ function Layout({ children }) {
|
|
|
179
65
|
/* @__PURE__ */ jsx(Meta, {}),
|
|
180
66
|
/* @__PURE__ */ jsx(Links, {})
|
|
181
67
|
] }), /* @__PURE__ */ jsxs("body", { children: [
|
|
182
|
-
/* @__PURE__ */ jsx(Chrome, {
|
|
68
|
+
/* @__PURE__ */ jsx(Chrome, {}),
|
|
183
69
|
children,
|
|
184
70
|
/* @__PURE__ */ jsx(ScrollRestoration, {}),
|
|
185
71
|
/* @__PURE__ */ jsx(Scripts, {})
|
|
@@ -187,6 +73,6 @@ function Layout({ children }) {
|
|
|
187
73
|
});
|
|
188
74
|
}
|
|
189
75
|
//#endregion
|
|
190
|
-
export { Layout
|
|
76
|
+
export { Layout };
|
|
191
77
|
|
|
192
78
|
//# sourceMappingURL=react.js.map
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","names":["Avatar","AvatarPrimitive","Button","ButtonPrimitive","Collapsible","CollapsiblePrimitive","Collapsible","Button","Avatar"],"sources":["../components/ui/avatar.tsx","../components/ui/button.tsx","../components/ui/collapsible.tsx","../react.tsx"],"sourcesContent":["import { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\"\nimport { cn } from \"cn\"\nimport type * as React from \"react\"\n\nfunction Avatar({\n\tclassName,\n\tsize = \"default\",\n\t...props\n}: AvatarPrimitive.Root.Props & {\n\tsize?: \"default\" | \"sm\" | \"lg\"\n}) {\n\treturn (\n\t\t<AvatarPrimitive.Root\n\t\t\tdata-slot=\"avatar\"\n\t\t\tdata-size={size}\n\t\t\tclassName={cn(\n\t\t\t\t\"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {\n\treturn (\n\t\t<AvatarPrimitive.Image\n\t\t\tdata-slot=\"avatar-image\"\n\t\t\tclassName={cn(\"aspect-square size-full rounded-full object-cover\", className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {\n\treturn (\n\t\t<AvatarPrimitive.Fallback\n\t\t\tdata-slot=\"avatar-fallback\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarBadge({ className, ...props }: React.ComponentProps<\"span\">) {\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"avatar-badge\"\n\t\t\tclassName={cn(\n\t\t\t\t\"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none\",\n\t\t\t\t\"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden\",\n\t\t\t\t\"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2\",\n\t\t\t\t\"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"avatar-group\"\n\t\t\tclassName={cn(\n\t\t\t\t\"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarGroupCount({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"avatar-group-count\"\n\t\t\tclassName={cn(\n\t\t\t\t\"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage }\n","import { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"cn\"\n\nconst buttonVariants = cva(\n\t\"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n\t{\n\t\tdefaultVariants: {\n\t\t\tsize: \"default\",\n\t\t\tvariant: \"default\",\n\t\t},\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\ticon: \"size-8\",\n\t\t\t\t\"icon-lg\": \"size-9\",\n\t\t\t\t\"icon-sm\":\n\t\t\t\t\t\"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n\t\t\t\t\"icon-xs\":\n\t\t\t\t\t\"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\tlg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\tsm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\txs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t},\n\t\t\tvariant: {\n\t\t\t\tdefault: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n\t\t\t\tghost:\n\t\t\t\t\t\"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n\t\t\t},\n\t\t},\n\t},\n)\n\nfunction Button({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"default\",\n\t...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n\treturn (\n\t\t<ButtonPrimitive\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={cn(buttonVariants({ className, size, variant }))}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Button, buttonVariants }\n","import { Collapsible as CollapsiblePrimitive } from \"@base-ui/react/collapsible\"\n\nfunction Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {\n\treturn (\n\t\t<CollapsiblePrimitive.Root\n\t\t\tdata-slot=\"collapsible\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {\n\treturn (\n\t\t<CollapsiblePrimitive.Trigger\n\t\t\tdata-slot=\"collapsible-trigger\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {\n\treturn (\n\t\t<CollapsiblePrimitive.Panel\n\t\t\tdata-slot=\"collapsible-content\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger }\n","import logoFont from \"@fontsource/fugaz-one/files/fugaz-one-latin-400-normal.woff2?url\"\nimport chromeStyles from \"@usecontextlayer/sdk/styles.css?inline\"\nimport { type ReactNode, useCallback, useEffect, useState } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport {\n\tLinks,\n\ttype LoaderFunctionArgs,\n\tMeta,\n\tScripts,\n\tScrollRestoration,\n\tuseRouteLoaderData,\n} from \"react-router\"\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n\tCollapsible,\n\tCollapsibleContent,\n\tCollapsibleTrigger,\n} from \"@/components/ui/collapsible\"\nimport { viewerContext } from \"@/index\"\nimport type { User } from \"@/viewer\"\n\nexport async function loader({ context }: LoaderFunctionArgs) {\n\treturn { user: await context.get(viewerContext).getCurrentUser() }\n}\n\nfunction Chrome({ user }: { user: User | null }) {\n\tconst [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null)\n\tconst attach = useCallback((host: HTMLElement | null) => {\n\t\tif (host) setShadowRoot(host.shadowRoot ?? host.attachShadow({ mode: \"open\" }))\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst font = new FontFace(\"ContextLayer Logo\", `url(\"${logoFont}\")`, {\n\t\t\tdisplay: \"swap\",\n\t\t\tweight: \"400\",\n\t\t})\n\t\tdocument.fonts.add(font)\n\t\tvoid font.load()\n\t\treturn () => {\n\t\t\tdocument.fonts.delete(font)\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<header ref={attach}>\n\t\t\t{shadowRoot &&\n\t\t\t\tcreatePortal(\n\t\t\t\t\t<>\n\t\t\t\t\t\t<style>{chromeStyles}</style>\n\t\t\t\t\t\t<Collapsible className=\"group/chrome\">\n\t\t\t\t\t\t\t<CollapsibleTrigger\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tuser\n\t\t\t\t\t\t\t\t\t\t? `Toggle ContextLayer settings for ${user.name}`\n\t\t\t\t\t\t\t\t\t\t: \"Toggle ContextLayer settings\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"h-auto w-full justify-between gap-0 rounded-none border-x-0 border-t-0 border-b-slate-200 bg-slate-100 p-0 text-slate-600 hover:bg-slate-200 hover:text-slate-600 aria-expanded:bg-slate-100 aria-expanded:hover:bg-slate-200\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className=\"shrink-0 px-4 py-[6.5px] font-logo text-[13px]/4 font-normal text-slate-500\">\n\t\t\t\t\t\t\t\t\tcontextlayer\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"flex min-w-0 self-stretch\">\n\t\t\t\t\t\t\t\t\t<span className=\"flex shrink-0 items-center px-3 text-[13px]/4 font-normal text-slate-400\">\n\t\t\t\t\t\t\t\t\t\t<span className=\"group-data-open/chrome:hidden\">click to open</span>\n\t\t\t\t\t\t\t\t\t\t<span className=\"hidden group-data-open/chrome:inline\">\n\t\t\t\t\t\t\t\t\t\t\tclick to close\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"flex min-w-0 items-center gap-2 border-l border-slate-200 py-[3px] pr-3 pl-[3px] text-[13px]/4 font-normal\">\n\t\t\t\t\t\t\t\t\t\t{user ? (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<Avatar className=\"size-[23px] rounded-[3px] after:rounded-[3px]\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AvatarImage\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"rounded-[3px]\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsrc={user.image ?? undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AvatarFallback className=\"rounded-[3px] text-[13px]\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{user.name.slice(0, 1)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</AvatarFallback>\n\t\t\t\t\t\t\t\t\t\t\t\t</Avatar>\n\t\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"max-w-40 truncate\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={user.name}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{user.name}\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"truncate pl-[9px]\">Not signed in</span>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</CollapsibleTrigger>\n\t\t\t\t\t\t\t<CollapsibleContent className=\"h-(--collapsible-panel-height) overflow-hidden bg-slate-100 transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none\">\n\t\t\t\t\t\t\t\t<div className=\"min-h-40 border-b border-slate-200\" />\n\t\t\t\t\t\t\t</CollapsibleContent>\n\t\t\t\t\t\t</Collapsible>\n\t\t\t\t\t</>,\n\t\t\t\t\tshadowRoot,\n\t\t\t\t)}\n\t\t</header>\n\t)\n}\n\nexport function Layout({ children }: { children: ReactNode }) {\n\tconst data = useRouteLoaderData<typeof loader>(\"root\")\n\treturn (\n\t\t<html lang=\"en\">\n\t\t\t<head>\n\t\t\t\t<meta charSet=\"utf-8\" />\n\t\t\t\t<meta\n\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\tcontent=\"width=device-width, initial-scale=1\"\n\t\t\t\t/>\n\t\t\t\t<Meta />\n\t\t\t\t<Links />\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<Chrome user={data?.user ?? null} />\n\t\t\t\t{children}\n\t\t\t\t<ScrollRestoration />\n\t\t\t\t<Scripts />\n\t\t\t</body>\n\t\t</html>\n\t)\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"react.js","names":[],"sources":["../../shared/dist/chrome.mjs","../browser-env.ts","../react.tsx"],"sourcesContent":["import { z } from \"zod\";\n\n//#region lib/chrome.ts\nconst chromePath = \"/dashboard/chrome\";\nconst chromeHeightSchema = z.object({\n\theight: z.number().finite().nonnegative(),\n\ttype: z.literal(\"ctx:chrome:height\")\n});\n\n//#endregion\nexport { chromeHeightSchema, chromePath };","import { z } from \"zod\"\n\nexport const browserEnv = z\n\t.object({\n\t\tCTX_APP_ID: z.uuid().optional(),\n\t\tCTX_APP_MANIFEST: z.string().optional(),\n\t\tCTX_PLATFORM_URL: z.url().default(\"https://slate.usecontextlayer.com\"),\n\t})\n\t.parse({\n\t\tCTX_APP_ID: import.meta.env.CTX_APP_ID,\n\t\tCTX_APP_MANIFEST: import.meta.env.CTX_APP_MANIFEST,\n\t\tCTX_PLATFORM_URL: import.meta.env.CTX_PLATFORM_URL,\n\t})\n","import { chromeHeightSchema, chromePath } from \"@usecontextlayer/shared/chrome\"\nimport { type ReactNode, useEffect, useRef, useState } from \"react\"\nimport { Links, Meta, Scripts, ScrollRestoration } from \"react-router\"\nimport { browserEnv } from \"@/browser-env\"\n\nfunction Chrome() {\n\tconst frame = useRef<HTMLIFrameElement>(null)\n\tconst [src, setSrc] = useState<string>()\n\tconst [height, setHeight] = useState(30)\n\tuseEffect(() => {\n\t\tconst target = browserEnv.CTX_APP_ID ?? window.location.hostname\n\t\tconst url = new URL(\n\t\t\t`${chromePath}/apps/${encodeURIComponent(target)}`,\n\t\t\tbrowserEnv.CTX_PLATFORM_URL,\n\t\t)\n\t\turl.searchParams.set(\"parentOrigin\", window.location.origin)\n\t\tif (browserEnv.CTX_APP_MANIFEST)\n\t\t\turl.searchParams.set(\"manifest\", browserEnv.CTX_APP_MANIFEST)\n\t\tfunction resize(event: MessageEvent) {\n\t\t\tif (event.origin !== url.origin || event.source !== frame.current?.contentWindow)\n\t\t\t\treturn\n\t\t\tconst message = chromeHeightSchema.safeParse(event.data)\n\t\t\tif (message.success) setHeight(message.data.height)\n\t\t}\n\t\twindow.addEventListener(\"message\", resize)\n\t\tsetSrc(url.href)\n\t\treturn () => window.removeEventListener(\"message\", resize)\n\t}, [])\n\treturn (\n\t\t<iframe\n\t\t\tref={frame}\n\t\t\tsrc={src}\n\t\t\ttitle=\"ContextLayer\"\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: \"oklch(96.8% 0.007 247.896)\",\n\t\t\t\tborder: 0,\n\t\t\t\tborderBottom: \"1px solid oklch(92.9% 0.013 255.508)\",\n\t\t\t\tdisplay: \"block\",\n\t\t\t\theight,\n\t\t\t\twidth: \"100%\",\n\t\t\t}}\n\t\t/>\n\t)\n}\n\nexport function Layout({ children }: { children: ReactNode }) {\n\treturn (\n\t\t<html lang=\"en\">\n\t\t\t<head>\n\t\t\t\t<meta charSet=\"utf-8\" />\n\t\t\t\t<meta\n\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\tcontent=\"width=device-width, initial-scale=1\"\n\t\t\t\t/>\n\t\t\t\t<Meta />\n\t\t\t\t<Links />\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<Chrome />\n\t\t\t\t{children}\n\t\t\t\t<ScrollRestoration />\n\t\t\t\t<Scripts />\n\t\t\t</body>\n\t\t</html>\n\t)\n}\n"],"mappings":";;;;;AAGA,MAAM,aAAa;AACnB,MAAM,qBAAqB,EAAE,OAAO;CACnC,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;CACxC,MAAM,EAAE,QAAQ,mBAAmB;AACpC,CAAC;;;ACLD,MAAa,aAAa,EACxB,OAAO;CACP,YAAY,EAAE,KAAK,CAAC,CAAC,SAAS;CAC9B,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;CACtC,kBAAkB,EAAE,IAAI,CAAC,CAAC,QAAQ,mCAAmC;AACtE,CAAC,CAAC,CACD,MAAM;CACN,YAAY,YAAY,IAAI;CAC5B,kBAAkB,YAAY,IAAI;CAClC,kBAAkB,YAAY,IAAI;AACnC,CAAC;;;ACPF,SAAS,SAAS;CACjB,MAAM,QAAQ,OAA0B,IAAI;CAC5C,MAAM,CAAC,KAAK,UAAU,SAAiB;CACvC,MAAM,CAAC,QAAQ,aAAa,SAAS,EAAE;CACvC,gBAAgB;EACf,MAAM,SAAS,WAAW,cAAc,OAAO,SAAS;EACxD,MAAM,MAAM,IAAI,IACf,GAAG,WAAW,QAAQ,mBAAmB,MAAM,KAC/C,WAAW,gBACZ;EACA,IAAI,aAAa,IAAI,gBAAgB,OAAO,SAAS,MAAM;EAC3D,IAAI,WAAW,kBACd,IAAI,aAAa,IAAI,YAAY,WAAW,gBAAgB;EAC7D,SAAS,OAAO,OAAqB;GACpC,IAAI,MAAM,WAAW,IAAI,UAAU,MAAM,WAAW,MAAM,SAAS,eAClE;GACD,MAAM,UAAU,mBAAmB,UAAU,MAAM,IAAI;GACvD,IAAI,QAAQ,SAAS,UAAU,QAAQ,KAAK,MAAM;EACnD;EACA,OAAO,iBAAiB,WAAW,MAAM;EACzC,OAAO,IAAI,IAAI;EACf,aAAa,OAAO,oBAAoB,WAAW,MAAM;CAC1D,GAAG,CAAC,CAAC;CACL,OACC,oBAAC,UAAD;EACC,KAAK;EACA;EACL,OAAM;EACN,OAAO;GACN,iBAAiB;GACjB,QAAQ;GACR,cAAc;GACd,SAAS;GACT;GACA,OAAO;EACR;CACA,CAAA;AAEH;AAEA,SAAgB,OAAO,EAAE,YAAqC;CAC7D,OACC,qBAAC,QAAD;EAAM,MAAK;EAAX,UAAA,CACC,qBAAC,QAAD,EAAA,UAAA;GACC,oBAAC,QAAD,EAAM,SAAQ,QAAS,CAAA;GACvB,oBAAC,QAAD;IACC,MAAK;IACL,SAAQ;GACR,CAAA;GACD,oBAAC,MAAD,CAAO,CAAA;GACP,oBAAC,OAAD,CAAQ,CAAA;EACH,EAAA,CAAA,GACN,qBAAC,QAAD,EAAA,UAAA;GACC,oBAAC,QAAD,CAAS,CAAA;GACR;GACD,oBAAC,mBAAD,CAAoB,CAAA;GACpB,oBAAC,SAAD,CAAU,CAAA;EACL,EAAA,CAAA,CACD;;AAER"}
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { ConfigEnv } from "vite";
|
|
2
2
|
//#region vite.d.ts
|
|
3
|
-
export declare function contextlayer({ command }: ConfigEnv): Promise<import("vite").Plugin<any>[]
|
|
3
|
+
export declare function contextlayer({ command }: ConfigEnv): Promise<(import("vite").Plugin<any>[] | {
|
|
4
|
+
config: () => {
|
|
5
|
+
define: {
|
|
6
|
+
"import.meta.env.CTX_APP_ID": string;
|
|
7
|
+
"import.meta.env.CTX_APP_MANIFEST": string;
|
|
8
|
+
"import.meta.env.CTX_PLATFORM_URL": string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
name: string;
|
|
12
|
+
})[]>;
|
|
4
13
|
//#endregion
|
|
5
14
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","names":[],"sources":["../vite.ts"],"mappings":";;wBAIsB,eAAe,WAAW,YAAS,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","names":[],"sources":["../vite.ts"],"mappings":";;wBAIsB,eAAe,WAAW,YAAS,wBAAA;;IAKrD;MACC;MAEA;MAEA"}
|
package/dist/vite.js
CHANGED
|
@@ -2,23 +2,28 @@ import { cloudflare } from "@cloudflare/vite-plugin";
|
|
|
2
2
|
import { getLocalToolsBindings } from "@usecontextlayer/cli/vite";
|
|
3
3
|
//#region vite.ts
|
|
4
4
|
async function contextlayer({ command }) {
|
|
5
|
-
|
|
5
|
+
const bindings = command === "serve" ? await getLocalToolsBindings() : void 0;
|
|
6
|
+
return [{
|
|
7
|
+
config: () => ({ define: {
|
|
8
|
+
"import.meta.env.CTX_APP_ID": JSON.stringify(bindings?.props.appId) ?? "undefined",
|
|
9
|
+
"import.meta.env.CTX_APP_MANIFEST": JSON.stringify(JSON.stringify(bindings?.props.manifest)) ?? "undefined",
|
|
10
|
+
"import.meta.env.CTX_PLATFORM_URL": JSON.stringify(bindings?.vars.CTX_PLATFORM_URL) ?? "undefined"
|
|
11
|
+
} }),
|
|
12
|
+
name: "contextlayer-chrome"
|
|
13
|
+
}, cloudflare({
|
|
6
14
|
auxiliaryWorkers: [{
|
|
7
|
-
config:
|
|
15
|
+
config: bindings ? { vars: bindings.vars } : {},
|
|
8
16
|
configPath: "workers/local-tools/wrangler.jsonc",
|
|
9
17
|
devOnly: true
|
|
10
18
|
}],
|
|
11
|
-
config:
|
|
19
|
+
config: bindings ? { services: [{
|
|
12
20
|
binding: "TOOLS",
|
|
13
21
|
entrypoint: "Tools",
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
binding: "VIEWER",
|
|
17
|
-
entrypoint: "Viewer",
|
|
22
|
+
props: bindings.props,
|
|
18
23
|
service: "ctx-local-tools"
|
|
19
24
|
}] } : {},
|
|
20
25
|
viteEnvironment: { name: "ssr" }
|
|
21
|
-
});
|
|
26
|
+
})];
|
|
22
27
|
}
|
|
23
28
|
//#endregion
|
|
24
29
|
export { contextlayer };
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../vite.ts"],"sourcesContent":["import { cloudflare } from \"@cloudflare/vite-plugin\"\nimport { getLocalToolsBindings } from \"@usecontextlayer/cli/vite\"\nimport type { ConfigEnv } from \"vite\"\n\nexport async function contextlayer({ command }: ConfigEnv) {\n\treturn
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../vite.ts"],"sourcesContent":["import { cloudflare } from \"@cloudflare/vite-plugin\"\nimport { getLocalToolsBindings } from \"@usecontextlayer/cli/vite\"\nimport type { ConfigEnv } from \"vite\"\n\nexport async function contextlayer({ command }: ConfigEnv) {\n\tconst bindings = command === \"serve\" ? await getLocalToolsBindings() : undefined\n\treturn [\n\t\t{\n\t\t\tconfig: () => ({\n\t\t\t\tdefine: {\n\t\t\t\t\t\"import.meta.env.CTX_APP_ID\":\n\t\t\t\t\t\tJSON.stringify(bindings?.props.appId) ?? \"undefined\",\n\t\t\t\t\t\"import.meta.env.CTX_APP_MANIFEST\":\n\t\t\t\t\t\tJSON.stringify(JSON.stringify(bindings?.props.manifest)) ?? \"undefined\",\n\t\t\t\t\t\"import.meta.env.CTX_PLATFORM_URL\":\n\t\t\t\t\t\tJSON.stringify(bindings?.vars.CTX_PLATFORM_URL) ?? \"undefined\",\n\t\t\t\t},\n\t\t\t}),\n\t\t\tname: \"contextlayer-chrome\",\n\t\t},\n\t\tcloudflare({\n\t\t\tauxiliaryWorkers: [\n\t\t\t\t{\n\t\t\t\t\tconfig: bindings ? { vars: bindings.vars } : {},\n\t\t\t\t\tconfigPath: \"workers/local-tools/wrangler.jsonc\",\n\t\t\t\t\tdevOnly: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\tconfig: bindings\n\t\t\t\t? {\n\t\t\t\t\t\tservices: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbinding: \"TOOLS\",\n\t\t\t\t\t\t\t\tentrypoint: \"Tools\",\n\t\t\t\t\t\t\t\tprops: bindings.props,\n\t\t\t\t\t\t\t\tservice: \"ctx-local-tools\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}\n\t\t\t\t: {},\n\t\t\tviteEnvironment: { name: \"ssr\" },\n\t\t}),\n\t]\n}\n"],"mappings":";;;AAIA,eAAsB,aAAa,EAAE,WAAsB;CAC1D,MAAM,WAAW,YAAY,UAAU,MAAM,sBAAsB,IAAI,KAAA;CACvE,OAAO,CACN;EACC,eAAe,EACd,QAAQ;GACP,8BACC,KAAK,UAAU,UAAU,MAAM,KAAK,KAAK;GAC1C,oCACC,KAAK,UAAU,KAAK,UAAU,UAAU,MAAM,QAAQ,CAAC,KAAK;GAC7D,oCACC,KAAK,UAAU,UAAU,KAAK,gBAAgB,KAAK;EACrD,EACD;EACA,MAAM;CACP,GACA,WAAW;EACV,kBAAkB,CACjB;GACC,QAAQ,WAAW,EAAE,MAAM,SAAS,KAAK,IAAI,CAAC;GAC9C,YAAY;GACZ,SAAS;EACV,CACD;EACA,QAAQ,WACL,EACA,UAAU,CACT;GACC,SAAS;GACT,YAAY;GACZ,OAAO,SAAS;GAChB,SAAS;EACV,CACD,EACD,IACC,CAAC;EACJ,iBAAiB,EAAE,MAAM,MAAM;CAChC,CAAC,CACF;AACD"}
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tools } from "./index.js";
|
|
2
2
|
import { createRequestHandler } from "react-router";
|
|
3
3
|
//#region worker.d.ts
|
|
4
|
+
interface LocalBindings {
|
|
5
|
+
TOOLS: Tools;
|
|
6
|
+
}
|
|
7
|
+
interface AppProps {
|
|
8
|
+
tools: Tools;
|
|
9
|
+
}
|
|
10
|
+
export type App = Required<Pick<ExportedHandler<LocalBindings, unknown, unknown, AppProps>, "fetch">>;
|
|
4
11
|
export declare function createApp({ build, mode, development }: {
|
|
5
12
|
build: Parameters<typeof createRequestHandler>[0];
|
|
6
13
|
mode: string;
|
|
7
14
|
development: boolean;
|
|
8
|
-
}):
|
|
9
|
-
fetch(request: Request, env: {
|
|
10
|
-
TOOLS: Tools;
|
|
11
|
-
VIEWER: Viewer;
|
|
12
|
-
}, ctx: ExecutionContext<{
|
|
13
|
-
tools: Tools;
|
|
14
|
-
viewer?: Viewer;
|
|
15
|
-
}>): Promise<Response>;
|
|
16
|
-
};
|
|
15
|
+
}): App;
|
|
17
16
|
//#endregion
|
|
18
17
|
//# sourceMappingURL=worker.d.ts.map
|
package/dist/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","names":[],"sources":["../worker.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"worker.d.ts","names":[],"sources":["../worker.ts"],"mappings":";;;UAGU;EACT,OAAO;;UAGE;EACT,OAAO;;YAGI,MAAM,SACjB,KAAK,gBAAgB,iCAAiC;wBAGvC,YACf,OACA,MACA;EAEA,OAAO,kBAAkB;EACzB;EACA;IACG"}
|
package/dist/worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toolsContext
|
|
1
|
+
import { toolsContext } from "./index.js";
|
|
2
2
|
import { RouterContextProvider, createRequestHandler } from "react-router";
|
|
3
3
|
//#region worker.ts
|
|
4
4
|
function createApp({ build, mode, development }) {
|
|
@@ -6,8 +6,6 @@ function createApp({ build, mode, development }) {
|
|
|
6
6
|
return { async fetch(request, env, ctx) {
|
|
7
7
|
const context = new RouterContextProvider();
|
|
8
8
|
context.set(toolsContext, development ? env.TOOLS : ctx.props.tools);
|
|
9
|
-
const viewer = development ? env.VIEWER : ctx.props.viewer;
|
|
10
|
-
if (viewer) context.set(viewerContext, viewer);
|
|
11
9
|
return requestHandler(request, context);
|
|
12
10
|
} };
|
|
13
11
|
}
|
package/dist/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","names":[],"sources":["../worker.ts"],"sourcesContent":["import { createRequestHandler, RouterContextProvider } from \"react-router\"\nimport { type Tools, toolsContext
|
|
1
|
+
{"version":3,"file":"worker.js","names":[],"sources":["../worker.ts"],"sourcesContent":["import { createRequestHandler, RouterContextProvider } from \"react-router\"\nimport { type Tools, toolsContext } from \"@/index\"\n\ninterface LocalBindings {\n\tTOOLS: Tools\n}\n\ninterface AppProps {\n\ttools: Tools\n}\n\nexport type App = Required<\n\tPick<ExportedHandler<LocalBindings, unknown, unknown, AppProps>, \"fetch\">\n>\n\nexport function createApp({\n\tbuild,\n\tmode,\n\tdevelopment,\n}: {\n\tbuild: Parameters<typeof createRequestHandler>[0]\n\tmode: string\n\tdevelopment: boolean\n}): App {\n\tconst requestHandler = createRequestHandler(build, mode)\n\treturn {\n\t\tasync fetch(request, env, ctx) {\n\t\t\tconst context = new RouterContextProvider()\n\t\t\tcontext.set(toolsContext, development ? env.TOOLS : ctx.props.tools)\n\t\t\treturn requestHandler(request, context)\n\t\t},\n\t}\n}\n"],"mappings":";;;AAeA,SAAgB,UAAU,EACzB,OACA,MACA,eAKO;CACP,MAAM,iBAAiB,qBAAqB,OAAO,IAAI;CACvD,OAAO,EACN,MAAM,MAAM,SAAS,KAAK,KAAK;EAC9B,MAAM,UAAU,IAAI,sBAAsB;EAC1C,QAAQ,IAAI,cAAc,cAAc,IAAI,QAAQ,IAAI,MAAM,KAAK;EACnE,OAAO,eAAe,SAAS,OAAO;CACvC,EACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@base-ui/react": "^1.8.0",
|
|
4
|
-
"@fontsource/fugaz-one": "^5.3.0",
|
|
5
|
-
"class-variance-authority": "^0.7.1",
|
|
6
|
-
"cn": "^0.4.0",
|
|
7
|
-
"shadcn": "^4.21.1",
|
|
8
|
-
"tailwindcss": "^4.3.3",
|
|
9
|
-
"tw-animate-css": "^1.4.0",
|
|
10
3
|
"zod": "^4.4.3",
|
|
11
|
-
"@usecontextlayer/cli": "0.14.
|
|
4
|
+
"@usecontextlayer/cli": "0.14.2"
|
|
12
5
|
},
|
|
13
6
|
"devDependencies": {
|
|
14
7
|
"@cloudflare/vite-plugin": "^1.62.4",
|
|
@@ -22,7 +15,7 @@
|
|
|
22
15
|
"tsdown": "latest",
|
|
23
16
|
"typescript": "latest",
|
|
24
17
|
"vite": "^8.3.2",
|
|
25
|
-
"@usecontextlayer/shared": "0.14.
|
|
18
|
+
"@usecontextlayer/shared": "0.14.2"
|
|
26
19
|
},
|
|
27
20
|
"exports": {
|
|
28
21
|
".": {
|
|
@@ -37,7 +30,6 @@
|
|
|
37
30
|
"import": "./dist/react.js",
|
|
38
31
|
"types": "./dist/react.d.ts"
|
|
39
32
|
},
|
|
40
|
-
"./styles.css": "./styles.css",
|
|
41
33
|
"./vite": {
|
|
42
34
|
"import": "./dist/vite.js",
|
|
43
35
|
"types": "./dist/vite.d.ts"
|
|
@@ -49,8 +41,7 @@
|
|
|
49
41
|
},
|
|
50
42
|
"files": [
|
|
51
43
|
"dist",
|
|
52
|
-
"examples"
|
|
53
|
-
"styles.css"
|
|
44
|
+
"examples"
|
|
54
45
|
],
|
|
55
46
|
"name": "@usecontextlayer/sdk",
|
|
56
47
|
"peerDependencies": {
|
|
@@ -61,7 +52,7 @@
|
|
|
61
52
|
"vite": "^8.3.2"
|
|
62
53
|
},
|
|
63
54
|
"type": "module",
|
|
64
|
-
"version": "0.14.
|
|
55
|
+
"version": "0.14.2",
|
|
65
56
|
"scripts": {
|
|
66
57
|
"build": "tsdown",
|
|
67
58
|
"dev:watch": "tsdown --watch",
|
package/dist/index-DbuYj6qS.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region viewer.d.ts
|
|
3
|
-
declare const userSchema: z.ZodObject<{
|
|
4
|
-
id: z.ZodString;
|
|
5
|
-
image: z.ZodNullable<z.ZodString>;
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
type User = z.infer<typeof userSchema>;
|
|
9
|
-
interface Viewer {
|
|
10
|
-
getCurrentUser(): Promise<User | null>;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region index.d.ts
|
|
14
|
-
interface Tools {
|
|
15
|
-
call(slug: string, toolSlug: string, args: Record<string, unknown>): Promise<{
|
|
16
|
-
data: unknown;
|
|
17
|
-
logId: string;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
declare const toolsContext: import("react-router").RouterContext<Tools>;
|
|
21
|
-
declare const viewerContext: import("react-router").RouterContext<Viewer>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { Viewer as a, User as i, toolsContext as n, viewerContext as r, Tools as t };
|
|
24
|
-
//# sourceMappingURL=index-DbuYj6qS.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DbuYj6qS.d.ts","names":[],"sources":["../viewer.ts","../index.ts"],"mappings":";;cAEa,YAAU,EAAA;;;;GAIrB,EAAA,KAAA;KAEU,OAAO,EAAE,aAAa;UAEjB;EAChB,kBAAkB,QAAQ;;;;UCNV;EAChB,KACC,cACA,kBACA,MAAM,0BACJ;IAAU;IAAe;;;cAGhB,qCAAY,cAAA;cACZ,sCAAa,cAAA"}
|
package/styles.css
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss" source(none);
|
|
2
|
-
@import "tw-animate-css";
|
|
3
|
-
@import "shadcn/tailwind.css";
|
|
4
|
-
@source "./dist";
|
|
5
|
-
|
|
6
|
-
@custom-variant dark (&:is(.dark *));
|
|
7
|
-
|
|
8
|
-
@theme inline {
|
|
9
|
-
--font-heading: var(--font-sans);
|
|
10
|
-
--font-sans: ui-sans-serif, system-ui, sans-serif;
|
|
11
|
-
--font-logo: "ContextLayer Logo", sans-serif;
|
|
12
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
13
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
14
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
15
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
16
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
17
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
18
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
19
|
-
--color-sidebar: var(--sidebar);
|
|
20
|
-
--color-chart-5: var(--chart-5);
|
|
21
|
-
--color-chart-4: var(--chart-4);
|
|
22
|
-
--color-chart-3: var(--chart-3);
|
|
23
|
-
--color-chart-2: var(--chart-2);
|
|
24
|
-
--color-chart-1: var(--chart-1);
|
|
25
|
-
--color-ring: var(--ring);
|
|
26
|
-
--color-input: var(--input);
|
|
27
|
-
--color-border: var(--border);
|
|
28
|
-
--color-destructive: var(--destructive);
|
|
29
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
30
|
-
--color-accent: var(--accent);
|
|
31
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
32
|
-
--color-muted: var(--muted);
|
|
33
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
34
|
-
--color-secondary: var(--secondary);
|
|
35
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
36
|
-
--color-primary: var(--primary);
|
|
37
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
38
|
-
--color-popover: var(--popover);
|
|
39
|
-
--color-card-foreground: var(--card-foreground);
|
|
40
|
-
--color-card: var(--card);
|
|
41
|
-
--color-foreground: var(--foreground);
|
|
42
|
-
--color-background: var(--background);
|
|
43
|
-
--radius-sm: calc(var(--radius) * 0.6);
|
|
44
|
-
--radius-md: calc(var(--radius) * 0.8);
|
|
45
|
-
--radius-lg: var(--radius);
|
|
46
|
-
--radius-xl: calc(var(--radius) * 1.4);
|
|
47
|
-
--radius-2xl: calc(var(--radius) * 1.8);
|
|
48
|
-
--radius-3xl: calc(var(--radius) * 2.2);
|
|
49
|
-
--radius-4xl: calc(var(--radius) * 2.6);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host {
|
|
53
|
-
--background: oklch(1 0 0);
|
|
54
|
-
--foreground: oklch(0.145 0 0);
|
|
55
|
-
--card: oklch(1 0 0);
|
|
56
|
-
--card-foreground: oklch(0.145 0 0);
|
|
57
|
-
--popover: oklch(1 0 0);
|
|
58
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
59
|
-
--primary: oklch(0.205 0 0);
|
|
60
|
-
--primary-foreground: oklch(0.985 0 0);
|
|
61
|
-
--secondary: oklch(0.97 0 0);
|
|
62
|
-
--secondary-foreground: oklch(0.205 0 0);
|
|
63
|
-
--muted: oklch(0.97 0 0);
|
|
64
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
65
|
-
--accent: oklch(0.97 0 0);
|
|
66
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
67
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
68
|
-
--border: oklch(0.922 0 0);
|
|
69
|
-
--input: oklch(0.922 0 0);
|
|
70
|
-
--ring: oklch(0.708 0 0);
|
|
71
|
-
--chart-1: oklch(0.87 0 0);
|
|
72
|
-
--chart-2: oklch(0.556 0 0);
|
|
73
|
-
--chart-3: oklch(0.439 0 0);
|
|
74
|
-
--chart-4: oklch(0.371 0 0);
|
|
75
|
-
--chart-5: oklch(0.269 0 0);
|
|
76
|
-
--radius: 0.625rem;
|
|
77
|
-
--sidebar: oklch(0.985 0 0);
|
|
78
|
-
--sidebar-foreground: oklch(0.145 0 0);
|
|
79
|
-
--sidebar-primary: oklch(0.205 0 0);
|
|
80
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
81
|
-
--sidebar-accent: oklch(0.97 0 0);
|
|
82
|
-
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
83
|
-
--sidebar-border: oklch(0.922 0 0);
|
|
84
|
-
--sidebar-ring: oklch(0.708 0 0);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:host(.dark) {
|
|
88
|
-
--background: oklch(0.145 0 0);
|
|
89
|
-
--foreground: oklch(0.985 0 0);
|
|
90
|
-
--card: oklch(0.205 0 0);
|
|
91
|
-
--card-foreground: oklch(0.985 0 0);
|
|
92
|
-
--popover: oklch(0.205 0 0);
|
|
93
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
94
|
-
--primary: oklch(0.922 0 0);
|
|
95
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
96
|
-
--secondary: oklch(0.269 0 0);
|
|
97
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
98
|
-
--muted: oklch(0.269 0 0);
|
|
99
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
100
|
-
--accent: oklch(0.269 0 0);
|
|
101
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
102
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
103
|
-
--border: oklch(1 0 0 / 10%);
|
|
104
|
-
--input: oklch(1 0 0 / 15%);
|
|
105
|
-
--ring: oklch(0.556 0 0);
|
|
106
|
-
--chart-1: oklch(0.87 0 0);
|
|
107
|
-
--chart-2: oklch(0.556 0 0);
|
|
108
|
-
--chart-3: oklch(0.439 0 0);
|
|
109
|
-
--chart-4: oklch(0.371 0 0);
|
|
110
|
-
--chart-5: oklch(0.269 0 0);
|
|
111
|
-
--sidebar: oklch(0.205 0 0);
|
|
112
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
113
|
-
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
114
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
115
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
116
|
-
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
117
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
118
|
-
--sidebar-ring: oklch(0.556 0 0);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@layer base {
|
|
122
|
-
:host {
|
|
123
|
-
all: initial;
|
|
124
|
-
display: block;
|
|
125
|
-
background: var(--background);
|
|
126
|
-
color: var(--foreground);
|
|
127
|
-
font:
|
|
128
|
-
14px / 1.5 ui-sans-serif,
|
|
129
|
-
system-ui,
|
|
130
|
-
sans-serif;
|
|
131
|
-
color-scheme: light;
|
|
132
|
-
}
|
|
133
|
-
* {
|
|
134
|
-
@apply border-border outline-ring/50;
|
|
135
|
-
}
|
|
136
|
-
}
|