@oxy-hq/sdk 2.1.0 → 2.4.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/README.md CHANGED
@@ -98,6 +98,46 @@ Hooks fail loudly if called outside `<OxyAppProvider>`. The default fetcher
98
98
  sends `credentials: "include"` so same-origin (served-by-oxy) calls carry the
99
99
  session cookie automatically.
100
100
 
101
+ ### Workspace shell (`@oxy-hq/sdk/shell`)
102
+
103
+ The Oxygen workspace chrome — the 48px icon rail and universal top bar the
104
+ main web-app renders — as reusable components, so your app reads as part of
105
+ the same product. The main web-app consumes these exact components.
106
+
107
+ ```tsx
108
+ import { OxyAppProvider } from "@oxy-hq/sdk";
109
+ import { OxyShell } from "@oxy-hq/sdk/shell";
110
+ import "@oxy-hq/sdk/shell.css";
111
+
112
+ export function App() {
113
+ return (
114
+ <OxyAppProvider>
115
+ <OxyShell>
116
+ <Dashboard />
117
+ </OxyShell>
118
+ </OxyAppProvider>
119
+ );
120
+ }
121
+ ```
122
+
123
+ `OxyShell` bootstraps from `GET /api/projects/:id/shell-context` (workspace
124
+ identity, sibling apps, host-aware navigation URLs) and degrades gracefully:
125
+ if the endpoint is unavailable (older server), your app renders unchromed.
126
+
127
+ | Export | What it does |
128
+ | --- | --- |
129
+ | `OxyShell` | Wired frame: rail + top bar + content column around your app. Slots: `topBarExtra`, `railBottom`, `hideTopBar`, `pageLabel`. |
130
+ | `useShellContext()` | The raw shell bootstrap payload (`{ data, loading, error }`). |
131
+ | `ShellRail`, `RailItem` | Presentational icon rail — props only, router-free. |
132
+ | `TopBar`, `Breadcrumb`, `SystemIndicator`, `WorkspaceClock` | Presentational top bar pieces. |
133
+ | `WorkspaceTile`, `OxyMark`, `OxygenFactoryMark` | Branding primitives. |
134
+ | `workspaceLogoUrl(apiBaseUrl, wsId, version?)` | Workspace logo endpoint URL builder. |
135
+
136
+ Styling: `shell.css` is namespaced (`oxy-shell-*`) — no Tailwind required, no
137
+ global styles leak into your app. It follows your design tokens when present
138
+ (`--sidebar-background`, `--foreground`, …) and falls back to the Oxygen
139
+ defaults. Dark mode: put a `.dark` class on any ancestor.
140
+
101
141
  ## Docs
102
142
 
103
143
  - Hands-on dev + deploy guide: `docs/local-development.md` in the
package/dist/email.cjs ADDED
@@ -0,0 +1,14 @@
1
+ // @oxy/sdk - TypeScript SDK for Oxy data platform
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ let preact = require("preact");
4
+ let preact_render_to_string = require("preact-render-to-string");
5
+
6
+ //#region src/email.ts
7
+ /** Render an email template component to an HTML string. */
8
+ function render(Component, props) {
9
+ return (0, preact_render_to_string.render)((0, preact.h)(Component, props));
10
+ }
11
+
12
+ //#endregion
13
+ exports.render = render;
14
+ //# sourceMappingURL=email.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.cjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["// `@oxy-hq/sdk/email` — render an email template to an HTML string for use in\n// an Oxy Function's `ctx.email.send`.\n//\n// You write email templates as plain JSX components (point JSX at preact with\n// `jsxImportSource: \"preact\"` in the template's tsconfig — see the examples),\n// then:\n//\n// ```ts\n// import { render } from \"@oxy-hq/sdk/email\";\n// import { Welcome } from \"../emails/Welcome\";\n// await ctx.email.send({ to, subject, html: render(Welcome, { name }) });\n// ```\n//\n// Rendering uses preact-render-to-string — pure JS, no react-dom/server, no node\n// builtins, no Web Streams — so it bundles under esbuild `--platform=neutral`\n// and runs inside the Oxy Functions isolate (React Email / react-dom cannot).\n// Kept in a separate subpath entry so it never bloats the main SDK bundle.\n\nimport { type ComponentType, h } from \"preact\";\nimport { render as prerender } from \"preact-render-to-string\";\n\n/** Render an email template component to an HTML string. */\nexport function render<P extends Record<string, unknown>>(\n Component: ComponentType<P>,\n props: P\n): string {\n return prerender(h(Component, props));\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,OACd,WACA,OACQ;CACR,yDAAmB,WAAW,KAAK,CAAC;AACtC"}
@@ -0,0 +1,8 @@
1
+
2
+ import { ComponentType } from "preact";
3
+ //#region src/email.d.ts
4
+ /** Render an email template component to an HTML string. */
5
+ declare function render<P extends Record<string, unknown>>(Component: ComponentType<P>, props: P): string;
6
+ //#endregion
7
+ export { render };
8
+ //# sourceMappingURL=email.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;iBAsBgB,OAAO,UAAU,yBAC/B,WAAW,cAAc,IACzB,OAAO"}
@@ -0,0 +1,8 @@
1
+
2
+ import { ComponentType } from "preact";
3
+ //#region src/email.d.ts
4
+ /** Render an email template component to an HTML string. */
5
+ declare function render<P extends Record<string, unknown>>(Component: ComponentType<P>, props: P): string;
6
+ //#endregion
7
+ export { render };
8
+ //# sourceMappingURL=email.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;iBAsBgB,OAAO,UAAU,yBAC/B,WAAW,cAAc,IACzB,OAAO"}
package/dist/email.mjs ADDED
@@ -0,0 +1,13 @@
1
+ // @oxy/sdk - TypeScript SDK for Oxy data platform
2
+ import { h } from "preact";
3
+ import { render as render$1 } from "preact-render-to-string";
4
+
5
+ //#region src/email.ts
6
+ /** Render an email template component to an HTML string. */
7
+ function render(Component, props) {
8
+ return render$1(h(Component, props));
9
+ }
10
+
11
+ //#endregion
12
+ export { render };
13
+ //# sourceMappingURL=email.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.mjs","names":["prerender"],"sources":["../src/email.ts"],"sourcesContent":["// `@oxy-hq/sdk/email` — render an email template to an HTML string for use in\n// an Oxy Function's `ctx.email.send`.\n//\n// You write email templates as plain JSX components (point JSX at preact with\n// `jsxImportSource: \"preact\"` in the template's tsconfig — see the examples),\n// then:\n//\n// ```ts\n// import { render } from \"@oxy-hq/sdk/email\";\n// import { Welcome } from \"../emails/Welcome\";\n// await ctx.email.send({ to, subject, html: render(Welcome, { name }) });\n// ```\n//\n// Rendering uses preact-render-to-string — pure JS, no react-dom/server, no node\n// builtins, no Web Streams — so it bundles under esbuild `--platform=neutral`\n// and runs inside the Oxy Functions isolate (React Email / react-dom cannot).\n// Kept in a separate subpath entry so it never bloats the main SDK bundle.\n\nimport { type ComponentType, h } from \"preact\";\nimport { render as prerender } from \"preact-render-to-string\";\n\n/** Render an email template component to an HTML string. */\nexport function render<P extends Record<string, unknown>>(\n Component: ComponentType<P>,\n props: P\n): string {\n return prerender(h(Component, props));\n}\n"],"mappings":";;;;;;AAsBA,SAAgB,OACd,WACA,OACQ;CACR,OAAOA,SAAU,EAAE,WAAW,KAAK,CAAC;AACtC"}