feat: add toolbox contract shell and testkit
This commit is contained in:
15
examples/react-app/README.md
Normal file
15
examples/react-app/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# React integration example
|
||||
|
||||
The source files show the intended integration points for an existing React
|
||||
application. Copy `public/toolbox-app.json` into the build unchanged (or inject
|
||||
the package version during the build), import the shell CSS once, and wrap the
|
||||
application in `AppShell`.
|
||||
|
||||
In the built application, run:
|
||||
|
||||
```sh
|
||||
toolbox-check dist
|
||||
```
|
||||
|
||||
The adjacent example catalog is illustrative. A production catalog normally
|
||||
lives at the toolbox home and points to each deployed app manifest.
|
||||
4
examples/react-app/public/icon.svg
Normal file
4
examples/react-app/public/icon.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Example Tool">
|
||||
<rect width="64" height="64" rx="14" fill="#3156d3" />
|
||||
<path d="M18 20h28v7H18zm0 12h28v7H18zm0 12h18v7H18z" fill="#fff" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 233 B |
32
examples/react-app/public/toolbox-app.json
Normal file
32
examples/react-app/public/toolbox-app.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"$schema": "https://git.add-ideas.de/zemion/toolbox-sdk/raw/branch/main/schemas/toolbox-app.v1.schema.json",
|
||||
"schemaVersion": 1,
|
||||
"id": "de.add-ideas.example-tool",
|
||||
"name": "Example Tool",
|
||||
"version": "0.1.0",
|
||||
"description": "A minimal toolbox-compatible React application.",
|
||||
"entry": "./",
|
||||
"icon": "./icon.svg",
|
||||
"categories": ["examples"],
|
||||
"tags": ["react", "toolbox"],
|
||||
"integration": {
|
||||
"contextVersion": 1,
|
||||
"launchModes": ["navigate", "new-tab"],
|
||||
"embedding": "unsupported"
|
||||
},
|
||||
"requirements": {
|
||||
"secureContext": false,
|
||||
"workers": false,
|
||||
"indexedDb": false,
|
||||
"crossOriginIsolated": false
|
||||
},
|
||||
"privacy": {
|
||||
"processing": "local",
|
||||
"fileUploads": false,
|
||||
"telemetry": false
|
||||
},
|
||||
"source": {
|
||||
"repository": "https://git.add-ideas.de/zemion/toolbox-sdk",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
}
|
||||
23
examples/react-app/public/toolbox.catalog.json
Normal file
23
examples/react-app/public/toolbox.catalog.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://git.add-ideas.de/zemion/toolbox-sdk/raw/branch/main/schemas/toolbox-catalog.v1.schema.json",
|
||||
"schemaVersion": 1,
|
||||
"id": "de.add-ideas.example-toolbox",
|
||||
"name": "Example Toolbox",
|
||||
"home": "./",
|
||||
"theme": {
|
||||
"mode": "system",
|
||||
"brand": "Example Toolbox"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"manifest": "./toolbox-app.json",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"name": "ADD Ideas",
|
||||
"entry": "https://add-ideas.de/",
|
||||
"launch": "new-tab",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
19
examples/react-app/src/App.tsx
Normal file
19
examples/react-app/src/App.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { AppShell } from "@add-ideas/toolbox-shell-react";
|
||||
import "@add-ideas/toolbox-shell-react/styles.css";
|
||||
|
||||
import { toolboxApp } from "./toolbox-app.js";
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<AppShell app={toolboxApp} appActions={<a href="./help/">Help</a>}>
|
||||
<section>
|
||||
<h2>Ready</h2>
|
||||
<p>
|
||||
Open this app directly for standalone mode, or add
|
||||
<code>?toolbox=/toolbox.catalog.json</code> to connect it to a
|
||||
same-origin catalog.
|
||||
</p>
|
||||
</section>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
13
examples/react-app/src/main.tsx
Normal file
13
examples/react-app/src/main.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
import { App } from "./App.js";
|
||||
|
||||
const root = document.querySelector("#root");
|
||||
if (!root) throw new Error("Missing #root element");
|
||||
|
||||
createRoot(root).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
);
|
||||
33
examples/react-app/src/toolbox-app.ts
Normal file
33
examples/react-app/src/toolbox-app.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { defineToolboxApp } from "@add-ideas/toolbox-contract";
|
||||
|
||||
export const toolboxApp = defineToolboxApp({
|
||||
schemaVersion: 1,
|
||||
id: "de.add-ideas.example-tool",
|
||||
name: "Example Tool",
|
||||
version: "0.1.0",
|
||||
description: "A minimal toolbox-compatible React application.",
|
||||
entry: "./",
|
||||
icon: "./icon.svg",
|
||||
categories: ["examples"],
|
||||
tags: ["react", "toolbox"],
|
||||
integration: {
|
||||
contextVersion: 1,
|
||||
launchModes: ["navigate", "new-tab"],
|
||||
embedding: "unsupported",
|
||||
},
|
||||
requirements: {
|
||||
secureContext: false,
|
||||
workers: false,
|
||||
indexedDb: false,
|
||||
crossOriginIsolated: false,
|
||||
},
|
||||
privacy: {
|
||||
processing: "local",
|
||||
fileUploads: false,
|
||||
telemetry: false,
|
||||
},
|
||||
source: {
|
||||
repository: "https://git.add-ideas.de/zemion/toolbox-sdk",
|
||||
license: "Apache-2.0",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user