@theaiplatform/miniapp-sdk 0.0.0 → 0.0.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 CHANGED
@@ -8,8 +8,9 @@ pnpm add @theaiplatform/miniapp-sdk
8
8
  ```
9
9
 
10
10
  The package provides the host-injected SDK API, isolated surface lifecycle
11
- types, browser helpers, manifest schema, and the Rspack/Rslib integration used
12
- to produce descriptor-backed Module Federation targets.
11
+ types, browser helpers, portable React UI components, manifest schema, and the
12
+ Rspack/Rslib integration used to produce descriptor-backed Module Federation
13
+ targets.
13
14
 
14
15
  Start with the [Miniapp SDK documentation](https://docs.theaiplatform.app/miniapps/).
15
16
 
@@ -18,6 +19,11 @@ Start with the [Miniapp SDK documentation](https://docs.theaiplatform.app/miniap
18
19
  - `@theaiplatform/miniapp-sdk`
19
20
  - `@theaiplatform/miniapp-sdk/sdk`
20
21
  - `@theaiplatform/miniapp-sdk/web`
22
+ - `@theaiplatform/miniapp-sdk/ui`
23
+ - `@theaiplatform/miniapp-sdk/ui/wasm`
24
+ - `@theaiplatform/miniapp-sdk/ui/styles.css`
25
+ - `@theaiplatform/miniapp-sdk/ui/tailwind.css`
26
+ - `@theaiplatform/miniapp-sdk/ui-components.json`
21
27
  - `@theaiplatform/miniapp-sdk/surface`
22
28
  - `@theaiplatform/miniapp-sdk/config`
23
29
  - `@theaiplatform/miniapp-sdk/rspack`
@@ -25,6 +31,100 @@ Start with the [Miniapp SDK documentation](https://docs.theaiplatform.app/miniap
25
31
 
26
32
  The host API is injected at runtime. Importing an entry point is safe in build
27
33
  tools and tests; host-backed calls fail when used outside a supported runtime.
34
+ `sdk.storage` provides revisioned non-secret JSON scoped by the host to the
35
+ active workspace and exact package. `sdk.presence` provides host-stamped,
36
+ ephemeral room membership and state; package code never supplies participant
37
+ identity. On supported desktop surfaces, `sdk.http` sends bounded HTTP(S)
38
+ requests through host consent instead of browser `fetch`, and
39
+ `sdk.credentials` lists metadata-only HTTP credential references. Credential
40
+ secrets remain in the host vault and are injected only by the native request
41
+ authority.
42
+
43
+ ## Discovery metadata
44
+
45
+ Descriptor-backed packages may assign up to three unique
46
+ `presentation.categories`. Import the `MiniAppCategory` type from the package
47
+ root or `/config`; accepted values are `productivity`, `developer-tools`,
48
+ `creativity`, `communication`, `data-and-analytics`, `business`, `education`,
49
+ `media-and-entertainment`, `utilities`, and `other`.
50
+
51
+ Do not add an authored `includes` field. The host derives the package's stable,
52
+ counted capability summary from its verified `contributions`, so Marketplace
53
+ details cannot drift from the code the descriptor is allowed to expose.
54
+
55
+ ## Portable UI
56
+
57
+ Import the precompiled stylesheet once at the miniapp entry point, then use
58
+ components from the public UI entry. React 19 is a peer dependency.
59
+
60
+ ```tsx
61
+ import '@theaiplatform/miniapp-sdk/ui/styles.css';
62
+
63
+ import {
64
+ Button,
65
+ Card,
66
+ CardContent,
67
+ CardHeader,
68
+ CardTitle,
69
+ } from '@theaiplatform/miniapp-sdk/ui';
70
+
71
+ export function WelcomeCard() {
72
+ return (
73
+ <Card>
74
+ <CardHeader>
75
+ <CardTitle>Ready to build</CardTitle>
76
+ </CardHeader>
77
+ <CardContent>
78
+ <Button>Continue</Button>
79
+ </CardContent>
80
+ </Card>
81
+ );
82
+ }
83
+ ```
84
+
85
+ Tailwind v4 miniapps can instead import the source integration after
86
+ `tailwindcss` and `tw-animate-css`; it supplies the platform theme and scans the
87
+ SDK's UI bundle for component classes.
88
+
89
+ ```css
90
+ @import 'tailwindcss' source(none);
91
+ @import 'tw-animate-css';
92
+ @import '@theaiplatform/miniapp-sdk/ui/tailwind.css';
93
+
94
+ @source './src';
95
+ ```
96
+
97
+ Use `installMiniAppAppearanceSync()` from the `/web` entry to apply the host's
98
+ light/dark theme and bounded UI scale. Tools and agents can read the exported
99
+ `ui-components.json` catalog to discover the supported component families and
100
+ style entry points without importing application-private packages.
101
+
102
+ ### Rust/WASM UI
103
+
104
+ Rust/WASM miniapps can render the same public component library through the
105
+ imperative `/ui/wasm` entry. It accepts a bounded serializable model, owns its
106
+ React root and providers, and emits serializable actions with stable control
107
+ IDs, entity IDs, model revisions, and unique event IDs.
108
+
109
+ ```ts
110
+ import '@theaiplatform/miniapp-sdk/ui/styles.css';
111
+ import { createMiniAppUiRoot } from '@theaiplatform/miniapp-sdk/ui/wasm';
112
+
113
+ const ui = createMiniAppUiRoot(element, model, (action) => {
114
+ wasm.onUiAction(action);
115
+ });
116
+
117
+ ui.update(nextModel);
118
+ ui.focus('project-name');
119
+ ui.unmount();
120
+ ```
121
+
122
+ The bridge synchronizes theme and UI scale, restores focus for controlled
123
+ dialogs, exposes a live-announcement method, rejects malformed or stale models,
124
+ reports render and dispatch failures explicitly, and makes teardown idempotent.
125
+ See [`examples/wasm-ui`](./examples/wasm-ui) for a clean wasm-bindgen consumer
126
+ that maps JavaScript exceptions to Rust `Result` values and rejects stale or
127
+ replayed actions.
28
128
 
29
129
  ## License and public policies
30
130
 
@@ -2,26 +2,54 @@
2
2
 
3
3
  ## Scope
4
4
 
5
- The `@theaiplatform/miniapp-sdk` package tarball does not embed third-party
6
- package code. Its `./rspack` entry imports separately installed runtime
7
- dependencies. Optional peer dependencies are not distributed with this package
8
- and remain subject to their own licenses.
5
+ The `@theaiplatform/miniapp-sdk` JavaScript entries import separately installed
6
+ runtime dependencies. Its precompiled UI stylesheet is generated with
7
+ Tailwind CSS and `tw-animate-css`; the Tailwind integration stylesheet is
8
+ distributed as source. Optional peer dependencies are not distributed with
9
+ this package and remain subject to their own licenses.
9
10
 
10
11
  The inventory below records the direct and transitive runtime dependency
11
- versions resolved by the release workspace lockfile on July 15, 2026. A
12
+ versions resolved by the release workspace lockfile on July 18, 2026. A
12
13
  downstream application may resolve a different compatible transitive version
13
14
  and is responsible for reviewing the notices required by its own lockfile and
14
15
  distribution artifact.
15
16
 
16
- | Relationship | Package | Version | License |
17
- | ---------------- | ---------------------- | ------: | ------------ |
18
- | Direct | `ajv` | 8.20.0 | MIT |
19
- | Ajv transitive | `fast-deep-equal` | 3.1.3 | MIT |
20
- | Ajv transitive | `fast-uri` | 3.1.2 | BSD-3-Clause |
21
- | Ajv transitive | `json-schema-traverse` | 1.0.0 | MIT |
22
- | Ajv transitive | `require-from-string` | 2.0.2 | MIT |
23
- | Direct | `saxes` | 6.0.0 | ISC |
24
- | Saxes transitive | `xmlchars` | 2.2.0 | MIT |
17
+ | Relationship | Package | Version | License |
18
+ | ---------------- | ------------------------------ | ------: | ------------ |
19
+ | Direct UI | `@radix-ui/react-alert-dialog` | 1.1.15 | MIT |
20
+ | Direct UI | `@radix-ui/react-avatar` | 1.1.11 | MIT |
21
+ | Direct UI | `@radix-ui/react-checkbox` | 1.3.3 | MIT |
22
+ | Direct UI | `@radix-ui/react-compose-refs` | 1.1.2 | MIT |
23
+ | Direct UI | `@radix-ui/react-dialog` | 1.1.15 | MIT |
24
+ | Direct UI | `@radix-ui/react-label` | 2.1.8 | MIT |
25
+ | Direct UI | `@radix-ui/react-progress` | 1.1.8 | MIT |
26
+ | Direct UI | `@radix-ui/react-radio-group` | 1.3.8 | MIT |
27
+ | Direct UI | `@radix-ui/react-scroll-area` | 1.2.10 | MIT |
28
+ | Direct UI | `@radix-ui/react-select` | 2.2.6 | MIT |
29
+ | Direct UI | `@radix-ui/react-separator` | 1.1.8 | MIT |
30
+ | Direct UI | `@radix-ui/react-slider` | 1.3.6 | MIT |
31
+ | Direct UI | `@radix-ui/react-slot` | 1.2.4 | MIT |
32
+ | Direct UI | `@radix-ui/react-tabs` | 1.1.13 | MIT |
33
+ | Direct UI | `@radix-ui/react-toggle` | 1.1.10 | MIT |
34
+ | Direct UI | `@radix-ui/react-toggle-group` | 1.1.11 | MIT |
35
+ | Direct UI | `@radix-ui/react-tooltip` | 1.2.8 | MIT |
36
+ | Direct UI | `class-variance-authority` | 0.7.1 | Apache-2.0 |
37
+ | Direct UI | `clsx` | 2.1.1 | MIT |
38
+ | Direct UI | `lucide-react` | 1.20.0 | ISC |
39
+ | Direct UI | `prism-react-renderer` | 2.4.1 | MIT |
40
+ | Direct UI | `react-resizable-panels` | 4.11.1 | MIT |
41
+ | Direct UI | `tailwind-merge` | 3.6.0 | MIT |
42
+ | Styles build | `@tailwindcss/postcss` | 4.3.0 | MIT |
43
+ | Styles build | `tailwindcss` | 4.3.0 | MIT |
44
+ | Styles build | `tw-animate-css` | 1.4.0 | MIT |
45
+ | Direct | `ajv` | 8.20.0 | MIT |
46
+ | Ajv transitive | `fast-deep-equal` | 3.1.3 | MIT |
47
+ | Ajv transitive | `fast-uri` | 3.1.2 | BSD-3-Clause |
48
+ | Ajv transitive | `json-schema-traverse` | 1.0.0 | MIT |
49
+ | Ajv transitive | `require-from-string` | 2.0.2 | MIT |
50
+ | Direct | `saxes` | 6.0.0 | ISC |
51
+ | Direct | `zod` | 4.4.3 | MIT |
52
+ | Saxes transitive | `xmlchars` | 2.2.0 | MIT |
25
53
 
26
54
  ## License texts
27
55