@usecontextlayer/sdk 0.14.1 → 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 +4 -4
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,11 +20,11 @@ The generated `app/root.tsx` re-exports the SDK's document Layout:
|
|
|
20
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 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
|
|
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
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
26
|
|
|
27
|
-
|
|
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.
|
|
28
28
|
|
|
29
29
|
## A loader that reads Gmail
|
|
30
30
|
|
|
@@ -74,8 +74,8 @@ The app retains its routes, `public/slate.json`, and thin Worker/configuration f
|
|
|
74
74
|
|
|
75
75
|
## App requirements and saved assignments
|
|
76
76
|
|
|
77
|
-
The platform frame loader
|
|
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
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.
|
|
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.
|
|
80
80
|
|
|
81
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/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
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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={{
|
|
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,CAA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AAA;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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"zod": "^4.4.3",
|
|
4
|
-
"@usecontextlayer/cli": "0.14.
|
|
4
|
+
"@usecontextlayer/cli": "0.14.2"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@cloudflare/vite-plugin": "^1.62.4",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"tsdown": "latest",
|
|
16
16
|
"typescript": "latest",
|
|
17
17
|
"vite": "^8.3.2",
|
|
18
|
-
"@usecontextlayer/shared": "0.14.
|
|
18
|
+
"@usecontextlayer/shared": "0.14.2"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"vite": "^8.3.2"
|
|
53
53
|
},
|
|
54
54
|
"type": "module",
|
|
55
|
-
"version": "0.14.
|
|
55
|
+
"version": "0.14.2",
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsdown",
|
|
58
58
|
"dev:watch": "tsdown --watch",
|