@kaifusion/widget 1.0.4 → 1.0.5

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
@@ -69,3 +69,51 @@ export default App;
69
69
  | `position` | `"left" \| "right"` | No | `"right"` | Position of the widget on the screen (bottom-left or bottom-right). |
70
70
  | `color` | `string` | No | `"#526cfe"` | Main theme color of the widget (Hex code). |
71
71
  | `icon` | `ReactNode` | No | `MessageSquare` | Custom icon for the toggle button. |
72
+
73
+ ## Standalone Usage (HTML / MkDocs)
74
+
75
+ You can also use the widget in non-React projects or static sites (like MkDocs) by including the standalone script.
76
+
77
+ ### HTML Integration
78
+
79
+ Add the following script tag to your HTML file:
80
+
81
+ ```html
82
+ <script
83
+ src="/widget.iife.js"
84
+ data-title="KAI Fusion Assistant"
85
+ data-auth-token="your-auth-token"
86
+ data-workflow-id="your-workflow-id"
87
+ data-target-url="http://localhost:8000"
88
+ data-position="right"
89
+ data-color="#526cfe"
90
+ defer
91
+ ></script>
92
+ ```
93
+
94
+ ### MkDocs Integration
95
+
96
+ For MkDocs, you can inject the script dynamically using JavaScript.
97
+
98
+ 1. Create a javascript file (e.g `docs/js/kai-widget.js`) with the following content:
99
+
100
+ ```javascript
101
+ document.addEventListener("DOMContentLoaded", function () {
102
+ const script = document.createElement("script");
103
+ script.src = "/widget.iife.js"; // Adjust URL to your source
104
+ script.dataset.title = "KAI Fusion Assistant";
105
+ script.dataset.authToken = "your-auth-token";
106
+ script.dataset.workflowId = "your-workflow-id";
107
+ script.dataset.targetUrl = "http://localhost:8000";
108
+ script.dataset.position = "right";
109
+ script.dataset.color = "#526cfe";
110
+ document.body.appendChild(script);
111
+ });
112
+ ```
113
+
114
+ 2. Register the script in your `mkdocs.yml`:
115
+
116
+ ```yaml
117
+ extra_javascript:
118
+ - js/kai-widget.js
119
+ ```