@mulmochat-plugin/quiz 0.2.0 → 0.2.1

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.ja.md CHANGED
@@ -11,9 +11,18 @@ MulmoChat用のクイズプラグイン。複数選択式のクイズをユー
11
11
 
12
12
  このプラグインは、MulmoChatのプラグインシステムのリファレンス実装です。サーバー通信不要なシンプルな構造のため、新しいプラグインを作成する際のテンプレートとして使用できます。
13
13
 
14
+ **フレームワーク非依存のcoreアーキテクチャ**と**VueおよびReact実装**を実現しています:
15
+ - **Core**: フレームワーク非依存のプラグインロジック(任意のUIフレームワークで使用可能)
16
+ - **Vue**: Vue専用のUIコンポーネント
17
+ - **React**: React専用のUIコンポーネント
18
+
19
+ ### 特徴
20
+
14
21
  - **Tailwind CSS 4** を使用したスタイリング
15
22
  - **TypeScript** による型安全な実装
16
23
  - **ESLint** による静的解析
24
+ - **フレームワーク非依存のcore** による移植性
25
+ - **マルチフレームワーク対応**(VueとReact)
17
26
 
18
27
  ## インストール
19
28
 
@@ -27,8 +36,7 @@ yarn add @mulmochat-plugin/quiz
27
36
 
28
37
  2. MulmoChatの`src/tools/index.ts`でインポート:
29
38
  ```typescript
30
- import QuizPlugin from "@mulmochat-plugin/quiz";
31
- import "@mulmochat-plugin/quiz/style.css";
39
+ import QuizPlugin from "@mulmochat-plugin/quiz/vue";
32
40
 
33
41
  // pluginListに追加
34
42
  const pluginList = [
@@ -37,6 +45,32 @@ const pluginList = [
37
45
  ];
38
46
  ```
39
47
 
48
+ 3. `src/main.ts`でスタイルをインポート:
49
+ ```typescript
50
+ import "@mulmochat-plugin/quiz/style.css";
51
+ ```
52
+
53
+ ## パッケージエクスポート
54
+
55
+ ```typescript
56
+ // デフォルト: Core(フレームワーク非依存)
57
+ import { pluginCore, TOOL_NAME, QuizData } from "@mulmochat-plugin/quiz";
58
+
59
+ // Vue実装
60
+ import QuizPlugin from "@mulmochat-plugin/quiz/vue";
61
+ import "@mulmochat-plugin/quiz/style.css";
62
+
63
+ // Vue名前付きエクスポート
64
+ import { plugin, View, Preview } from "@mulmochat-plugin/quiz/vue";
65
+
66
+ // React実装
67
+ import QuizPlugin from "@mulmochat-plugin/quiz/react";
68
+ import "@mulmochat-plugin/quiz/style.css";
69
+
70
+ // React名前付きエクスポート
71
+ import { plugin, View, Preview } from "@mulmochat-plugin/quiz/react";
72
+ ```
73
+
40
74
  ## 開発
41
75
 
42
76
  ### セットアップ
@@ -48,7 +82,11 @@ yarn install
48
82
  ### 開発サーバー
49
83
 
50
84
  ```bash
85
+ # Vueデモ
51
86
  yarn dev
87
+
88
+ # Reactデモ
89
+ yarn dev:react
52
90
  ```
53
91
 
54
92
  http://localhost:5173/ でデモページが表示されます。
@@ -76,31 +114,45 @@ yarn lint
76
114
  ```
77
115
  MulmoChatPluginQuiz/
78
116
  ├── src/
79
- │ ├── index.ts # エクスポート定義
117
+ │ ├── index.ts # デフォルトエクスポート(core)
80
118
  │ ├── style.css # Tailwind CSSエントリー
81
- │ ├── common/ # プラグイン非依存の共通コード
82
- │ │ ├── index.ts # 共通エクスポート
83
- │ │ └── types.ts # ToolPlugin, ToolResult など
84
- │ └── plugin/ # クイズ固有の実装
85
- ├── index.ts # プラグインインスタンスと実行ロジック
86
- ├── types.ts # クイズの型とTOOL_DEFINITION
87
- ├── samples.ts # テスト用サンプルデータ
88
- ├── View.vue # メインビューコンポーネント
89
- └── Preview.vue # サイドバープレビューコンポーネント
90
- ├── demo/ # 汎用プラグインデモ(どのプラグインでも動作)
91
- ├── App.vue # 動的コンポーネント描画
119
+ │ ├── core/ # フレームワーク非依存(Vue/React依存なし)
120
+ │ │ ├── index.ts # Coreエクスポート
121
+ │ │ ├── types.ts # ToolPluginCore, ToolResult, QuizData等
122
+ └── plugin.ts # Execute関数、ツール定義、サンプル
123
+ ├── vue/ # Vue固有の実装
124
+ ├── index.ts # Vueプラグイン(core + コンポーネント)
125
+ ├── types.ts # ToolPlugin(ToolPluginCoreを拡張)
126
+ ├── View.vue # メインビューコンポーネント
127
+ └── Preview.vue # サイドバープレビュー
128
+ │ └── react/ # React固有の実装
129
+ ├── index.ts # Reactプラグイン(core + コンポーネント)
130
+ │ ├── types.ts # ToolPlugin(ToolPluginCoreを拡張)
131
+ │ ├── View.tsx # メインビューコンポーネント
132
+ │ └── Preview.tsx # サイドバープレビュー
133
+ ├── demo/ # Vueデモ
134
+ │ ├── App.vue
92
135
  │ └── main.ts
136
+ ├── demo-react/ # Reactデモ
137
+ │ ├── App.tsx
138
+ │ ├── main.tsx
139
+ │ ├── style.css
140
+ │ ├── index.html
141
+ │ └── vite.config.ts
93
142
  ├── package.json
94
143
  ├── vite.config.ts
95
144
  ├── tsconfig.json
145
+ ├── tsconfig.react.json # React用TypeScript設定
96
146
  └── eslint.config.js
97
147
  ```
98
148
 
99
149
  ### ディレクトリの役割
100
150
 
101
- - **src/common/**: プラグイン非依存の型とユーティリティ。新しいプラグインにコピーするか、このパッケージからインポート。
102
- - **src/plugin/**: クイズ固有の実装。独自のプラグインロジックに置き換える。
103
- - **demo/**: 任意のToolPluginで動作する汎用デモ。インポートを変更するだけで使用可能。
151
+ - **src/core/**: フレームワーク非依存の型とプラグインロジック。Vue/React依存なし。
152
+ - **src/vue/**: Vue専用UIコンポーネントとVueプラグインエクスポート。
153
+ - **src/react/**: React専用UIコンポーネントとReactプラグインエクスポート。
154
+ - **demo/**: Vueデモ。
155
+ - **demo-react/**: Reactデモ。
104
156
 
105
157
  ## 新しいプラグインの作成
106
158
 
@@ -121,35 +173,46 @@ yarn dev
121
173
  ### 手動セットアップ
122
174
 
123
175
  詳細な手順は [TEMPLATE.md](./TEMPLATE.md) を参照:
176
+ - Core/Vue/Reactアーキテクチャ
124
177
  - そのままコピーできるファイル
125
- - 変更が必要なファイル(`package.json` のみ)
126
178
  - プラグイン固有の実装要件
127
- - 重要なパターン(View.vue のリアクティビティ)
179
+ - 重要なパターン(View.vueのリアクティビティ)
180
+
181
+ ## Core型定義
128
182
 
129
- ## ToolPlugin インターフェース
183
+ ### ToolPluginCore(フレームワーク非依存)
130
184
 
131
185
  ```typescript
132
- interface ToolPlugin<T, J, A> {
133
- toolDefinition: {
134
- type: "function";
135
- name: string;
136
- description: string;
137
- parameters?: {
138
- type: "object";
139
- properties: Record<string, JsonSchemaProperty>;
140
- required: string[];
141
- };
142
- };
186
+ interface ToolPluginCore<T, J, A> {
187
+ toolDefinition: ToolDefinition;
143
188
  execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
144
189
  generatingMessage: string;
145
190
  isEnabled: (startResponse?: StartApiResponse | null) => boolean;
146
- viewComponent?: Component;
147
- previewComponent?: Component;
148
191
  // Optional
149
192
  systemPrompt?: string;
150
- fileUpload?: FileUploadConfig;
151
- config?: ToolPluginConfig;
152
- samples?: ToolSample[]; // テスト用サンプルデータ
193
+ inputHandlers?: InputHandler[];
194
+ configSchema?: PluginConfigSchema;
195
+ samples?: ToolSample[];
196
+ backends?: BackendType[];
197
+ }
198
+ ```
199
+
200
+ ### ToolPlugin(Vue固有、ToolPluginCoreを拡張)
201
+
202
+ ```typescript
203
+ interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
204
+ viewComponent?: Component; // Vue Component
205
+ previewComponent?: Component; // Vue Component
206
+ config?: ToolPluginConfig; // レガシーVueコンポーネントベースの設定
207
+ }
208
+ ```
209
+
210
+ ### ToolPlugin(React固有、ToolPluginCoreを拡張)
211
+
212
+ ```typescript
213
+ interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
214
+ viewComponent?: ComponentType; // React ComponentType
215
+ previewComponent?: ComponentType; // React ComponentType
153
216
  }
154
217
  ```
155
218
 
package/README.md CHANGED
@@ -9,11 +9,20 @@ A quiz plugin for MulmoChat. Presents multiple choice quizzes to users.
9
9
 
10
10
  ## Overview
11
11
 
12
- This plugin is a reference implementation of the MulmoChat plugin system. Its simple structure with no server communication makes it an ideal template for creating new plugins.
12
+ This plugin is the reference implementation of the MulmoChat plugin system. With its simple structure requiring no server communication, it can be used as a template for creating new plugins.
13
+
14
+ It demonstrates the **framework-agnostic core architecture** with **Vue and React implementations**:
15
+ - **Core**: Framework-agnostic plugin logic (can be used with any UI framework)
16
+ - **Vue**: Vue-specific UI components
17
+ - **React**: React-specific UI components
18
+
19
+ ### Features
13
20
 
14
21
  - **Tailwind CSS 4** for styling
15
22
  - **TypeScript** for type-safe implementation
16
23
  - **ESLint** for static analysis
24
+ - **Framework-agnostic core** for portability
25
+ - **Multi-framework support** (Vue and React)
17
26
 
18
27
  ## Installation
19
28
 
@@ -27,8 +36,7 @@ yarn add @mulmochat-plugin/quiz
27
36
 
28
37
  2. Import in MulmoChat's `src/tools/index.ts`:
29
38
  ```typescript
30
- import QuizPlugin from "@mulmochat-plugin/quiz";
31
- import "@mulmochat-plugin/quiz/style.css";
39
+ import QuizPlugin from "@mulmochat-plugin/quiz/vue";
32
40
 
33
41
  // Add to pluginList
34
42
  const pluginList = [
@@ -37,6 +45,32 @@ const pluginList = [
37
45
  ];
38
46
  ```
39
47
 
48
+ 3. Import styles in `src/main.ts`:
49
+ ```typescript
50
+ import "@mulmochat-plugin/quiz/style.css";
51
+ ```
52
+
53
+ ## Package Exports
54
+
55
+ ```typescript
56
+ // Default: Core (framework-agnostic)
57
+ import { pluginCore, TOOL_NAME, QuizData } from "@mulmochat-plugin/quiz";
58
+
59
+ // Vue implementation
60
+ import QuizPlugin from "@mulmochat-plugin/quiz/vue";
61
+ import "@mulmochat-plugin/quiz/style.css";
62
+
63
+ // Named Vue exports
64
+ import { plugin, View, Preview } from "@mulmochat-plugin/quiz/vue";
65
+
66
+ // React implementation
67
+ import QuizPlugin from "@mulmochat-plugin/quiz/react";
68
+ import "@mulmochat-plugin/quiz/style.css";
69
+
70
+ // Named React exports
71
+ import { plugin, View, Preview } from "@mulmochat-plugin/quiz/react";
72
+ ```
73
+
40
74
  ## Development
41
75
 
42
76
  ### Setup
@@ -48,7 +82,11 @@ yarn install
48
82
  ### Development Server
49
83
 
50
84
  ```bash
85
+ # Vue demo
51
86
  yarn dev
87
+
88
+ # React demo
89
+ yarn dev:react
52
90
  ```
53
91
 
54
92
  Demo page will be available at http://localhost:5173/
@@ -76,31 +114,45 @@ yarn lint
76
114
  ```
77
115
  MulmoChatPluginQuiz/
78
116
  ├── src/
79
- │ ├── index.ts # Export definitions
117
+ │ ├── index.ts # Default export (core)
80
118
  │ ├── style.css # Tailwind CSS entry
81
- │ ├── common/ # Plugin-agnostic shared code
82
- │ │ ├── index.ts # Common exports
83
- │ │ └── types.ts # ToolPlugin, ToolResult, etc.
84
- │ └── plugin/ # Quiz-specific implementation
85
- ├── index.ts # Plugin instance and execute logic
86
- ├── types.ts # Quiz types and TOOL_DEFINITION
87
- ├── samples.ts # Sample data for testing
88
- ├── View.vue # Main view component
89
- └── Preview.vue # Sidebar preview component
90
- ├── demo/ # Generic plugin demo (works with any plugin)
91
- ├── App.vue # Dynamic component rendering
119
+ │ ├── core/ # Framework-agnostic (no Vue/React dependencies)
120
+ │ │ ├── index.ts # Core exports
121
+ │ │ ├── types.ts # ToolPluginCore, ToolResult, QuizData, etc.
122
+ └── plugin.ts # Execute function, tool definition, samples
123
+ ├── vue/ # Vue-specific implementation
124
+ ├── index.ts # Vue plugin (combines core + components)
125
+ ├── types.ts # ToolPlugin (extends ToolPluginCore)
126
+ ├── View.vue # Main view component
127
+ └── Preview.vue # Sidebar preview component
128
+ │ └── react/ # React-specific implementation
129
+ ├── index.ts # React plugin (combines core + components)
130
+ │ ├── types.ts # ToolPlugin (extends ToolPluginCore)
131
+ │ ├── View.tsx # Main view component
132
+ │ └── Preview.tsx # Sidebar preview component
133
+ ├── demo/ # Vue demo
134
+ │ ├── App.vue
92
135
  │ └── main.ts
136
+ ├── demo-react/ # React demo
137
+ │ ├── App.tsx
138
+ │ ├── main.tsx
139
+ │ ├── style.css
140
+ │ ├── index.html
141
+ │ └── vite.config.ts
93
142
  ├── package.json
94
143
  ├── vite.config.ts
95
144
  ├── tsconfig.json
145
+ ├── tsconfig.react.json # React-specific TypeScript config
96
146
  └── eslint.config.js
97
147
  ```
98
148
 
99
149
  ### Directory Purpose
100
150
 
101
- - **src/common/**: Plugin-agnostic types and utilities. Copy this to your new plugin or import from this package.
102
- - **src/plugin/**: Quiz-specific implementation. Replace with your plugin logic.
103
- - **demo/**: Generic demo that works with any ToolPlugin. Just change the import.
151
+ - **src/core/**: Framework-agnostic types and plugin logic. No Vue/React dependencies.
152
+ - **src/vue/**: Vue-specific UI components and the full Vue plugin export.
153
+ - **src/react/**: React-specific UI components and the full React plugin export.
154
+ - **demo/**: Vue demo.
155
+ - **demo-react/**: React demo.
104
156
 
105
157
  ## Creating a New Plugin
106
158
 
@@ -121,35 +173,46 @@ yarn dev
121
173
  ### Manual Setup
122
174
 
123
175
  See [TEMPLATE.md](./TEMPLATE.md) for detailed instructions on:
176
+ - Core/Vue architecture
124
177
  - Files that can be copied as-is
125
- - Files requiring modification (only `package.json`)
126
178
  - Plugin-specific implementation requirements
127
179
  - Important patterns (View.vue reactivity)
128
180
 
129
- ## ToolPlugin Interface
181
+ ## Core Types
182
+
183
+ ### ToolPluginCore (Framework-agnostic)
130
184
 
131
185
  ```typescript
132
- interface ToolPlugin<T, J, A> {
133
- toolDefinition: {
134
- type: "function";
135
- name: string;
136
- description: string;
137
- parameters?: {
138
- type: "object";
139
- properties: Record<string, JsonSchemaProperty>;
140
- required: string[];
141
- };
142
- };
186
+ interface ToolPluginCore<T, J, A> {
187
+ toolDefinition: ToolDefinition;
143
188
  execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
144
189
  generatingMessage: string;
145
190
  isEnabled: (startResponse?: StartApiResponse | null) => boolean;
146
- viewComponent?: Component;
147
- previewComponent?: Component;
148
191
  // Optional
149
192
  systemPrompt?: string;
150
- fileUpload?: FileUploadConfig;
151
- config?: ToolPluginConfig;
152
- samples?: ToolSample[]; // Sample data for testing
193
+ inputHandlers?: InputHandler[];
194
+ configSchema?: PluginConfigSchema;
195
+ samples?: ToolSample[];
196
+ backends?: BackendType[];
197
+ }
198
+ ```
199
+
200
+ ### ToolPlugin (Vue-specific, extends ToolPluginCore)
201
+
202
+ ```typescript
203
+ interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
204
+ viewComponent?: Component; // Vue Component
205
+ previewComponent?: Component; // Vue Component
206
+ config?: ToolPluginConfig; // Legacy Vue component-based config
207
+ }
208
+ ```
209
+
210
+ ### ToolPlugin (React-specific, extends ToolPluginCore)
211
+
212
+ ```typescript
213
+ interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
214
+ viewComponent?: ComponentType; // React ComponentType
215
+ previewComponent?: ComponentType; // React ComponentType
153
216
  }
154
217
  ```
155
218
 
package/README.npm.md CHANGED
@@ -1,4 +1,4 @@
1
- # MulmoChat Plugin
1
+ # @mulmochat-plugin/{plugin-name}
2
2
 
3
3
  A plugin for [MulmoChat](https://github.com/receptron/MulmoChat) - a multi-modal voice chat application with OpenAI's GPT-4 Realtime API.
4
4
 
@@ -14,26 +14,60 @@ yarn add @mulmochat-plugin/{plugin-name}
14
14
 
15
15
  ## Usage
16
16
 
17
+ ### Vue Implementation (for MulmoChat)
18
+
17
19
  ```typescript
18
- import Plugin from "@mulmochat-plugin/{plugin-name}";
19
- import "@mulmochat-plugin/{plugin-name}/style.css";
20
+ // In src/tools/index.ts
21
+ import Plugin from "@mulmochat-plugin/{plugin-name}/vue";
20
22
 
21
- // Add to pluginList
22
23
  const pluginList = [
23
24
  // ... other plugins
24
25
  Plugin,
25
26
  ];
27
+
28
+ // In src/main.ts
29
+ import "@mulmochat-plugin/{plugin-name}/style.css";
26
30
  ```
27
31
 
32
+ ### React Implementation
33
+
34
+ ```typescript
35
+ import Plugin from "@mulmochat-plugin/{plugin-name}/react";
36
+ import "@mulmochat-plugin/{plugin-name}/style.css";
37
+
38
+ // Named exports
39
+ import { plugin, View, Preview } from "@mulmochat-plugin/{plugin-name}/react";
40
+ ```
41
+
42
+ ### Core Only (Framework-agnostic)
43
+
44
+ ```typescript
45
+ import { pluginCore, TOOL_NAME } from "@mulmochat-plugin/{plugin-name}";
46
+ // or
47
+ import pluginCore from "@mulmochat-plugin/{plugin-name}";
48
+ ```
49
+
50
+ ## Package Exports
51
+
52
+ | Export | Description |
53
+ |--------|-------------|
54
+ | `@mulmochat-plugin/{plugin-name}` | Core (framework-agnostic) |
55
+ | `@mulmochat-plugin/{plugin-name}/vue` | Vue implementation with UI components |
56
+ | `@mulmochat-plugin/{plugin-name}/react` | React implementation with UI components |
57
+ | `@mulmochat-plugin/{plugin-name}/style.css` | Tailwind CSS styles |
58
+
28
59
  ## Development
29
60
 
30
61
  ```bash
31
62
  # Install dependencies
32
63
  yarn install
33
64
 
34
- # Start dev server (http://localhost:5173/)
65
+ # Start dev server - Vue (http://localhost:5173/)
35
66
  yarn dev
36
67
 
68
+ # Start dev server - React (http://localhost:5173/)
69
+ yarn dev:react
70
+
37
71
  # Build
38
72
  yarn build
39
73
 
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Quiz Preview Component (React)
3
+ */
4
+ import type { ToolResult } from "../core/types";
5
+ interface PreviewProps {
6
+ result: ToolResult;
7
+ }
8
+ export declare function Preview({ result }: PreviewProps): import("react/jsx-runtime").JSX.Element | null;
9
+ export default Preview;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Quiz View Component (React)
3
+ */
4
+ import type { ToolResult } from "../core/types";
5
+ interface ViewProps {
6
+ selectedResult: ToolResult;
7
+ sendTextMessage: (text?: string) => void;
8
+ onUpdateResult?: (result: ToolResult) => void;
9
+ }
10
+ export declare function View({ selectedResult, sendTextMessage, onUpdateResult }: ViewProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export default View;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * MulmoChat Quiz Plugin - React Implementation
3
+ *
4
+ * Full React plugin with UI components.
5
+ * Import from "@mulmochat-plugin/quiz/react"
6
+ */
7
+ import "../style.css";
8
+ import type { ToolPlugin, QuizData, QuizArgs } from "./types";
9
+ import { View } from "./View";
10
+ import { Preview } from "./Preview";
11
+ /**
12
+ * Quiz plugin instance with React components
13
+ */
14
+ export declare const plugin: ToolPlugin<never, QuizData, QuizArgs>;
15
+ export type { ToolPlugin } from "./types";
16
+ export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, QuizQuestion, QuizData, QuizArgs, } from "./types";
17
+ export { TOOL_NAME, TOOL_DEFINITION, SAMPLES, executeQuiz, pluginCore } from "../core/plugin";
18
+ export { View, Preview };
19
+ declare const _default: {
20
+ plugin: ToolPlugin<never, QuizData, QuizArgs>;
21
+ };
22
+ export default _default;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * MulmoChat Plugin React Types
3
+ *
4
+ * React-specific types that extend the core plugin interface.
5
+ */
6
+ import type { ComponentType } from "react";
7
+ import type { ToolPluginCore } from "../core/types";
8
+ type ReactComponent = ComponentType<any>;
9
+ /**
10
+ * React plugin interface - extends core with React components
11
+ */
12
+ export interface ToolPlugin<T = unknown, J = unknown, A extends object = object> extends ToolPluginCore<T, J, A> {
13
+ /** React component for full view */
14
+ viewComponent?: ReactComponent;
15
+ /** React component for preview/thumbnail */
16
+ previewComponent?: ReactComponent;
17
+ }
18
+ export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileInputHandler, ClipboardImageInputHandler, UrlInputHandler, TextInputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, QuizQuestion, QuizData, QuizArgs, } from "../core/types";
package/dist/react.cjs ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */const h=require("./core.cjs"),w=require("react");var S={exports:{}},g={};var V;function ae(){if(V)return g;V=1;var a=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function x(i,d,u){var p=null;if(u!==void 0&&(p=""+u),d.key!==void 0&&(p=""+d.key),"key"in d){u={};for(var v in d)v!=="key"&&(u[v]=d[v])}else u=d;return d=u.ref,{$$typeof:a,type:i,key:p,ref:d!==void 0?d:null,props:u}}return g.Fragment=c,g.jsx=x,g.jsxs=x,g}var T={};var Q;function oe(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&(function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case k:return"Profiler";case y:return"StrictMode";case Z:return"Suspense";case K:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return"Portal";case H:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case B:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case C:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function c(e){return""+e}function x(e){try{c(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),c(e)}}function i(e){if(e===b)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var r=a(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function d(){var e=$.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function p(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function n(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function O(){var e=a(this.type);return F[e]||(F[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function j(e,r,n,o,A,D){var l=n.ref;return e={$$typeof:f,type:e,key:r,props:n,_owner:o},(l!==void 0?l:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:O}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,n,o,A,D){var l=r.children;if(l!==void 0)if(o)if(ne(l)){for(o=0;o<l.length;o++)N(l[o]);Object.freeze&&Object.freeze(l)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(l);if(L.call(r,"key")){l=a(e);var E=Object.keys(r).filter(function(se){return se!=="key"});o=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",W[l+o]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,o,l,E,l),W[l+o]=!0)}if(l=null,n!==void 0&&(x(n),l=""+n),p(r)&&(x(r.key),l=""+r.key),"key"in r){n={};for(var Y in r)Y!=="key"&&(n[Y]=r[Y])}else n=r;return l&&v(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),j(e,l,n,d(),A,D)}function N(e){R(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===C&&(e._payload.status==="fulfilled"?R(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function R(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}var s=w,f=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),$=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ne=Array.isArray,q=console.createTask?console.createTask:function(){return null};s={react_stack_bottom_frame:function(e){return e()}};var M,F={},z=s.react_stack_bottom_frame.bind(s,u)(),I=q(i(u)),W={};T.Fragment=b,T.jsx=function(e,r,n){var o=1e4>$.recentlyCreatedOwnerStacks++;return _(e,r,n,!1,o?Error("react-stack-top-frame"):z,o?q(i(e)):I)},T.jsxs=function(e,r,n){var o=1e4>$.recentlyCreatedOwnerStacks++;return _(e,r,n,!0,o?Error("react-stack-top-frame"):z,o?q(i(e)):I)}})()),T}var U;function le(){return U||(U=1,process.env.NODE_ENV==="production"?S.exports=ae():S.exports=oe()),S.exports}var t=le();function J({selectedResult:a,sendTextMessage:c,onUpdateResult:x}){const[i,d]=w.useState(null),[u,p]=w.useState([]);w.useEffect(()=>{if(a?.toolName===h.TOOL_NAME&&a.jsonData){const s=a.jsonData;d(s),a.viewState?.userAnswers?p(a.viewState.userAnswers):p(new Array(s.questions.length).fill(null))}},[a]);const v=w.useCallback(s=>{p(s),x&&a&&x({...a,viewState:{userAnswers:s}})},[x,a]),O=(s,f)=>{const m=[...u];m[s]=f,v(m)},j=u.filter(s=>s!==null).length,_=i&&j===i.questions.length,N=(s,f)=>u[s]===f?"border-blue-500 bg-blue-500/20":"border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20",R=()=>{if(!i||!_)return;const f=`Here are my answers:
7
+ ${u.map((m,b)=>{if(m===null)return null;const y=b+1,k=String.fromCharCode(65+m),P=i.questions[b].choices[m];return`Q${y}: ${k} - ${P}`}).filter(m=>m!==null).join(`
8
+ `)}`;c(f)};return i?t.jsx("div",{className:"w-full min-h-[400px] overflow-y-auto p-8 bg-[#1a1a2e] rounded-lg",children:t.jsxs("div",{className:"max-w-3xl mx-auto",children:[i.title&&t.jsx("h2",{className:"text-[#f0f0f0] text-3xl font-bold mb-8 text-center",children:i.title}),t.jsx("div",{className:"flex flex-col gap-6",children:i.questions.map((s,f)=>t.jsxs("div",{className:"bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]",children:[t.jsxs("div",{className:"text-white text-lg font-semibold mb-4",children:[t.jsxs("span",{className:"text-blue-400 mr-2",children:[f+1,"."]}),s.question]}),t.jsx("div",{className:"flex flex-col gap-3",children:s.choices.map((m,b)=>t.jsxs("label",{className:`flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${N(f,b)}`,children:[t.jsx("input",{type:"radio",name:`question-${f}`,value:b,checked:u[f]===b,onChange:()=>O(f,b),className:"mt-1 mr-3 size-4 shrink-0"}),t.jsxs("span",{className:"text-white flex-1",children:[t.jsxs("span",{className:"font-semibold mr-2",children:[String.fromCharCode(65+b),"."]}),m]})]},b))})]},f))}),t.jsx("div",{className:"mt-8 flex justify-center",children:t.jsx("button",{onClick:R,disabled:!_,className:`py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${_?"bg-blue-600 hover:bg-blue-700":"bg-gray-600 cursor-not-allowed opacity-50"}`,children:"Submit Answers"})}),t.jsxs("div",{className:"mt-4 text-center text-gray-400 text-sm",children:[j," / ",i.questions.length," questions answered"]})]})}):null}function G({result:a}){const c=a.jsonData;return c?t.jsx("div",{className:"p-3 bg-blue-50 rounded-md",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("div",{className:"text-sm font-semibold text-gray-800 text-center",children:c.title||"Quiz"}),t.jsx("div",{className:"text-center",children:t.jsxs("span",{className:"inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full",children:[c.questions.length," ",c.questions.length===1?"Question":"Questions"]})}),t.jsx("div",{className:"text-xs text-gray-600 overflow-hidden line-clamp-2",children:c.questions[0]?.question}),t.jsxs("div",{className:"flex justify-center gap-1",children:[Array.from({length:Math.min(c.questions[0]?.choices.length||0,4)}).map((x,i)=>t.jsx("div",{className:"size-2 bg-gray-400 rounded-full"},i)),(c.questions[0]?.choices.length||0)>4&&t.jsxs("span",{className:"text-xs text-gray-500",children:["+",c.questions[0].choices.length-4]})]})]})}):null}const X={...h.pluginCore,viewComponent:J,previewComponent:G},ie={plugin:X};exports.SAMPLES=h.SAMPLES;exports.TOOL_DEFINITION=h.TOOL_DEFINITION;exports.TOOL_NAME=h.TOOL_NAME;exports.executeQuiz=h.executeQuiz;exports.pluginCore=h.pluginCore;exports.Preview=G;exports.View=J;exports.default=ie;exports.plugin=X;
package/dist/react.js ADDED
@@ -0,0 +1,399 @@
1
+ /* empty css */
2
+ import { TOOL_NAME as re, pluginCore as te } from "./core.js";
3
+ import { SAMPLES as ve, TOOL_DEFINITION as Ee, executeQuiz as _e } from "./core.js";
4
+ import ne, { useState as W, useEffect as se, useCallback as ae } from "react";
5
+ var R = { exports: {} }, _ = {};
6
+ var U;
7
+ function oe() {
8
+ if (U) return _;
9
+ U = 1;
10
+ var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
11
+ function x(i, d, c) {
12
+ var p = null;
13
+ if (c !== void 0 && (p = "" + c), d.key !== void 0 && (p = "" + d.key), "key" in d) {
14
+ c = {};
15
+ for (var h in d)
16
+ h !== "key" && (c[h] = d[h]);
17
+ } else c = d;
18
+ return d = c.ref, {
19
+ $$typeof: a,
20
+ type: i,
21
+ key: p,
22
+ ref: d !== void 0 ? d : null,
23
+ props: c
24
+ };
25
+ }
26
+ return _.Fragment = u, _.jsx = x, _.jsxs = x, _;
27
+ }
28
+ var g = {};
29
+ var V;
30
+ function le() {
31
+ return V || (V = 1, process.env.NODE_ENV !== "production" && (function() {
32
+ function a(e) {
33
+ if (e == null) return null;
34
+ if (typeof e == "function")
35
+ return e.$$typeof === Z ? null : e.displayName || e.name || null;
36
+ if (typeof e == "string") return e;
37
+ switch (e) {
38
+ case b:
39
+ return "Fragment";
40
+ case k:
41
+ return "Profiler";
42
+ case y:
43
+ return "StrictMode";
44
+ case G:
45
+ return "Suspense";
46
+ case X:
47
+ return "SuspenseList";
48
+ case B:
49
+ return "Activity";
50
+ }
51
+ if (typeof e == "object")
52
+ switch (typeof e.tag == "number" && console.error(
53
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
54
+ ), e.$$typeof) {
55
+ case m:
56
+ return "Portal";
57
+ case J:
58
+ return e.displayName || "Context";
59
+ case S:
60
+ return (e._context.displayName || "Context") + ".Consumer";
61
+ case Q:
62
+ var r = e.render;
63
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
64
+ case H:
65
+ return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
66
+ case O:
67
+ r = e._payload, e = e._init;
68
+ try {
69
+ return a(e(r));
70
+ } catch {
71
+ }
72
+ }
73
+ return null;
74
+ }
75
+ function u(e) {
76
+ return "" + e;
77
+ }
78
+ function x(e) {
79
+ try {
80
+ u(e);
81
+ var r = !1;
82
+ } catch {
83
+ r = !0;
84
+ }
85
+ if (r) {
86
+ r = console;
87
+ var n = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
88
+ return n.call(
89
+ r,
90
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
91
+ o
92
+ ), u(e);
93
+ }
94
+ }
95
+ function i(e) {
96
+ if (e === b) return "<>";
97
+ if (typeof e == "object" && e !== null && e.$$typeof === O)
98
+ return "<...>";
99
+ try {
100
+ var r = a(e);
101
+ return r ? "<" + r + ">" : "<...>";
102
+ } catch {
103
+ return "<...>";
104
+ }
105
+ }
106
+ function d() {
107
+ var e = P.A;
108
+ return e === null ? null : e.getOwner();
109
+ }
110
+ function c() {
111
+ return Error("react-stack-top-frame");
112
+ }
113
+ function p(e) {
114
+ if (D.call(e, "key")) {
115
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
116
+ if (r && r.isReactWarning) return !1;
117
+ }
118
+ return e.key !== void 0;
119
+ }
120
+ function h(e, r) {
121
+ function n() {
122
+ Y || (Y = !0, console.error(
123
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
124
+ r
125
+ ));
126
+ }
127
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
128
+ get: n,
129
+ configurable: !0
130
+ });
131
+ }
132
+ function A() {
133
+ var e = a(this.type);
134
+ return F[e] || (F[e] = !0, console.error(
135
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
136
+ )), e = this.props.ref, e !== void 0 ? e : null;
137
+ }
138
+ function w(e, r, n, o, N, $) {
139
+ var l = n.ref;
140
+ return e = {
141
+ $$typeof: f,
142
+ type: e,
143
+ key: r,
144
+ props: n,
145
+ _owner: o
146
+ }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
147
+ enumerable: !1,
148
+ get: A
149
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
150
+ configurable: !1,
151
+ enumerable: !1,
152
+ writable: !0,
153
+ value: 0
154
+ }), Object.defineProperty(e, "_debugInfo", {
155
+ configurable: !1,
156
+ enumerable: !1,
157
+ writable: !0,
158
+ value: null
159
+ }), Object.defineProperty(e, "_debugStack", {
160
+ configurable: !1,
161
+ enumerable: !1,
162
+ writable: !0,
163
+ value: N
164
+ }), Object.defineProperty(e, "_debugTask", {
165
+ configurable: !1,
166
+ enumerable: !1,
167
+ writable: !0,
168
+ value: $
169
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
170
+ }
171
+ function v(e, r, n, o, N, $) {
172
+ var l = r.children;
173
+ if (l !== void 0)
174
+ if (o)
175
+ if (K(l)) {
176
+ for (o = 0; o < l.length; o++)
177
+ j(l[o]);
178
+ Object.freeze && Object.freeze(l);
179
+ } else
180
+ console.error(
181
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
182
+ );
183
+ else j(l);
184
+ if (D.call(r, "key")) {
185
+ l = a(e);
186
+ var E = Object.keys(r).filter(function(ee) {
187
+ return ee !== "key";
188
+ });
189
+ o = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", M[l + o] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ `A props object containing a "key" prop is being spread into JSX:
191
+ let props = %s;
192
+ <%s {...props} />
193
+ React keys must be passed directly to JSX without using spread:
194
+ let props = %s;
195
+ <%s key={someKey} {...props} />`,
196
+ o,
197
+ l,
198
+ E,
199
+ l
200
+ ), M[l + o] = !0);
201
+ }
202
+ if (l = null, n !== void 0 && (x(n), l = "" + n), p(r) && (x(r.key), l = "" + r.key), "key" in r) {
203
+ n = {};
204
+ for (var q in r)
205
+ q !== "key" && (n[q] = r[q]);
206
+ } else n = r;
207
+ return l && h(
208
+ n,
209
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
210
+ ), w(
211
+ e,
212
+ l,
213
+ n,
214
+ d(),
215
+ N,
216
+ $
217
+ );
218
+ }
219
+ function j(e) {
220
+ T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
221
+ }
222
+ function T(e) {
223
+ return typeof e == "object" && e !== null && e.$$typeof === f;
224
+ }
225
+ var s = ne, f = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), b = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), k = /* @__PURE__ */ Symbol.for("react.profiler"), S = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), Q = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), B = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), P = s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, K = Array.isArray, C = console.createTask ? console.createTask : function() {
226
+ return null;
227
+ };
228
+ s = {
229
+ react_stack_bottom_frame: function(e) {
230
+ return e();
231
+ }
232
+ };
233
+ var Y, F = {}, L = s.react_stack_bottom_frame.bind(
234
+ s,
235
+ c
236
+ )(), z = C(i(c)), M = {};
237
+ g.Fragment = b, g.jsx = function(e, r, n) {
238
+ var o = 1e4 > P.recentlyCreatedOwnerStacks++;
239
+ return v(
240
+ e,
241
+ r,
242
+ n,
243
+ !1,
244
+ o ? Error("react-stack-top-frame") : L,
245
+ o ? C(i(e)) : z
246
+ );
247
+ }, g.jsxs = function(e, r, n) {
248
+ var o = 1e4 > P.recentlyCreatedOwnerStacks++;
249
+ return v(
250
+ e,
251
+ r,
252
+ n,
253
+ !0,
254
+ o ? Error("react-stack-top-frame") : L,
255
+ o ? C(i(e)) : z
256
+ );
257
+ };
258
+ })()), g;
259
+ }
260
+ var I;
261
+ function ie() {
262
+ return I || (I = 1, process.env.NODE_ENV === "production" ? R.exports = oe() : R.exports = le()), R.exports;
263
+ }
264
+ var t = ie();
265
+ function ce({ selectedResult: a, sendTextMessage: u, onUpdateResult: x }) {
266
+ const [i, d] = W(null), [c, p] = W([]);
267
+ se(() => {
268
+ if (a?.toolName === re && a.jsonData) {
269
+ const s = a.jsonData;
270
+ d(s), a.viewState?.userAnswers ? p(a.viewState.userAnswers) : p(new Array(s.questions.length).fill(null));
271
+ }
272
+ }, [a]);
273
+ const h = ae(
274
+ (s) => {
275
+ p(s), x && a && x({
276
+ ...a,
277
+ viewState: { userAnswers: s }
278
+ });
279
+ },
280
+ [x, a]
281
+ ), A = (s, f) => {
282
+ const m = [...c];
283
+ m[s] = f, h(m);
284
+ }, w = c.filter((s) => s !== null).length, v = i && w === i.questions.length, j = (s, f) => c[s] === f ? "border-blue-500 bg-blue-500/20" : "border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20", T = () => {
285
+ if (!i || !v) return;
286
+ const f = `Here are my answers:
287
+ ${c.map((m, b) => {
288
+ if (m === null) return null;
289
+ const y = b + 1, k = String.fromCharCode(65 + m), S = i.questions[b].choices[m];
290
+ return `Q${y}: ${k} - ${S}`;
291
+ }).filter((m) => m !== null).join(`
292
+ `)}`;
293
+ u(f);
294
+ };
295
+ return i ? /* @__PURE__ */ t.jsx("div", { className: "w-full min-h-[400px] overflow-y-auto p-8 bg-[#1a1a2e] rounded-lg", children: /* @__PURE__ */ t.jsxs("div", { className: "max-w-3xl mx-auto", children: [
296
+ i.title && /* @__PURE__ */ t.jsx("h2", { className: "text-[#f0f0f0] text-3xl font-bold mb-8 text-center", children: i.title }),
297
+ /* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-6", children: i.questions.map((s, f) => /* @__PURE__ */ t.jsxs(
298
+ "div",
299
+ {
300
+ className: "bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]",
301
+ children: [
302
+ /* @__PURE__ */ t.jsxs("div", { className: "text-white text-lg font-semibold mb-4", children: [
303
+ /* @__PURE__ */ t.jsxs("span", { className: "text-blue-400 mr-2", children: [
304
+ f + 1,
305
+ "."
306
+ ] }),
307
+ s.question
308
+ ] }),
309
+ /* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-3", children: s.choices.map((m, b) => /* @__PURE__ */ t.jsxs(
310
+ "label",
311
+ {
312
+ className: `flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${j(f, b)}`,
313
+ children: [
314
+ /* @__PURE__ */ t.jsx(
315
+ "input",
316
+ {
317
+ type: "radio",
318
+ name: `question-${f}`,
319
+ value: b,
320
+ checked: c[f] === b,
321
+ onChange: () => A(f, b),
322
+ className: "mt-1 mr-3 size-4 shrink-0"
323
+ }
324
+ ),
325
+ /* @__PURE__ */ t.jsxs("span", { className: "text-white flex-1", children: [
326
+ /* @__PURE__ */ t.jsxs("span", { className: "font-semibold mr-2", children: [
327
+ String.fromCharCode(65 + b),
328
+ "."
329
+ ] }),
330
+ m
331
+ ] })
332
+ ]
333
+ },
334
+ b
335
+ )) })
336
+ ]
337
+ },
338
+ f
339
+ )) }),
340
+ /* @__PURE__ */ t.jsx("div", { className: "mt-8 flex justify-center", children: /* @__PURE__ */ t.jsx(
341
+ "button",
342
+ {
343
+ onClick: T,
344
+ disabled: !v,
345
+ className: `py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${v ? "bg-blue-600 hover:bg-blue-700" : "bg-gray-600 cursor-not-allowed opacity-50"}`,
346
+ children: "Submit Answers"
347
+ }
348
+ ) }),
349
+ /* @__PURE__ */ t.jsxs("div", { className: "mt-4 text-center text-gray-400 text-sm", children: [
350
+ w,
351
+ " / ",
352
+ i.questions.length,
353
+ " questions answered"
354
+ ] })
355
+ ] }) }) : null;
356
+ }
357
+ function ue({ result: a }) {
358
+ const u = a.jsonData;
359
+ return u ? /* @__PURE__ */ t.jsx("div", { className: "p-3 bg-blue-50 rounded-md", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2", children: [
360
+ /* @__PURE__ */ t.jsx("div", { className: "text-sm font-semibold text-gray-800 text-center", children: u.title || "Quiz" }),
361
+ /* @__PURE__ */ t.jsx("div", { className: "text-center", children: /* @__PURE__ */ t.jsxs("span", { className: "inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full", children: [
362
+ u.questions.length,
363
+ " ",
364
+ u.questions.length === 1 ? "Question" : "Questions"
365
+ ] }) }),
366
+ /* @__PURE__ */ t.jsx("div", { className: "text-xs text-gray-600 overflow-hidden line-clamp-2", children: u.questions[0]?.question }),
367
+ /* @__PURE__ */ t.jsxs("div", { className: "flex justify-center gap-1", children: [
368
+ Array.from({
369
+ length: Math.min(u.questions[0]?.choices.length || 0, 4)
370
+ }).map((x, i) => /* @__PURE__ */ t.jsx(
371
+ "div",
372
+ {
373
+ className: "size-2 bg-gray-400 rounded-full"
374
+ },
375
+ i
376
+ )),
377
+ (u.questions[0]?.choices.length || 0) > 4 && /* @__PURE__ */ t.jsxs("span", { className: "text-xs text-gray-500", children: [
378
+ "+",
379
+ u.questions[0].choices.length - 4
380
+ ] })
381
+ ] })
382
+ ] }) }) : null;
383
+ }
384
+ const fe = {
385
+ ...te,
386
+ viewComponent: ce,
387
+ previewComponent: ue
388
+ }, xe = { plugin: fe };
389
+ export {
390
+ ue as Preview,
391
+ ve as SAMPLES,
392
+ Ee as TOOL_DEFINITION,
393
+ re as TOOL_NAME,
394
+ ce as View,
395
+ xe as default,
396
+ _e as executeQuiz,
397
+ fe as plugin,
398
+ te as pluginCore
399
+ };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.inline-block{display:inline-block}.size-2{width:calc(var(--spacing)*2);height:calc(var(--spacing)*2)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-full{width:100%;height:100%}.h-32{height:calc(var(--spacing)*32)}.h-full{height:100%}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.shrink-0{flex-shrink:0}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-6{gap:calc(var(--spacing)*6)}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\[\#3d3d5c\]{border-color:#3d3d5c}.border-\[\#4b4b6b\]{border-color:#4b4b6b}.border-blue-500{border-color:var(--color-blue-500)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-\[\#1a1a2e\]{background-color:#1a1a2e}.bg-\[\#2d2d44\]{background-color:#2d2d44}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#f0f0f0\]{color:#f0f0f0}.text-blue-400{color:var(--color-blue-400)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.opacity-50{opacity:.5}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}@media(hover:hover){.hover\:border-\[\#6b6b8b\]:hover{border-color:#6b6b8b}.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-\[\#6b6b8b\]\/20:hover{background-color:#6b6b8b33}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}body{margin:calc(var(--spacing)*0);background-color:var(--color-gray-100);padding:calc(var(--spacing)*5);font-family:var(--font-sans)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.inline-block{display:inline-block}.size-2{width:calc(var(--spacing)*2);height:calc(var(--spacing)*2)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-full{width:100%;height:100%}.h-32{height:calc(var(--spacing)*32)}.h-full{height:100%}.min-h-\[400px\]{min-height:400px}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.shrink-0{flex-shrink:0}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-6{gap:calc(var(--spacing)*6)}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\[\#3d3d5c\]{border-color:#3d3d5c}.border-\[\#4b4b6b\]{border-color:#4b4b6b}.border-blue-500{border-color:var(--color-blue-500)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-\[\#1a1a2e\]{background-color:#1a1a2e}.bg-\[\#2d2d44\]{background-color:#2d2d44}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#f0f0f0\]{color:#f0f0f0}.text-blue-400{color:var(--color-blue-400)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.opacity-50{opacity:.5}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}@media(hover:hover){.hover\:border-\[\#6b6b8b\]:hover{border-color:#6b6b8b}.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-\[\#6b6b8b\]\/20:hover{background-color:#6b6b8b33}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}body{margin:calc(var(--spacing)*0);background-color:var(--color-gray-100);padding:calc(var(--spacing)*5);font-family:var(--font-sans)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}
package/dist/vue.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./core.cjs"),e=require("vue"),k={class:"size-full overflow-y-auto p-8 bg-[#1a1a2e]"},E={key:0,class:"max-w-3xl w-full mx-auto"},N={key:0,class:"text-[#f0f0f0] text-3xl font-bold mb-8 text-center"},S={class:"flex flex-col gap-6"},w={class:"text-white text-lg font-semibold mb-4"},V={class:"text-blue-400 mr-2"},B={class:"flex flex-col gap-3"},C=["name","value","onUpdate:modelValue"],D={class:"text-white flex-1"},T={class:"font-semibold mr-2"},q={class:"mt-8 flex justify-center"},$=["disabled"],O={class:"mt-4 text-center text-gray-400 text-sm"},h=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},emits:["updateResult"],setup(d,{emit:m}){const o=d,_=m,s=e.ref(null),l=e.ref([]);e.watch(()=>o.selectedResult,t=>{t?.toolName===a.TOOL_NAME&&t.jsonData&&(s.value=t.jsonData,t.viewState?.userAnswers?l.value=t.viewState.userAnswers:l.value=new Array(s.value.questions.length).fill(null))},{immediate:!0}),e.watch(l,t=>{if(o.selectedResult&&t){const i={...o.selectedResult,viewState:{userAnswers:t}};_("updateResult",i)}},{deep:!0});const u=e.computed(()=>l.value.filter(t=>t!==null).length),p=e.computed(()=>s.value&&u.value===s.value.questions.length);function x(t,i){return l.value[t]===i?"border-blue-500 bg-blue-500/20":"border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20"}function y(){if(!s.value||!p.value)return;const i=`Here are my answers:
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */const a=require("./core.cjs"),e=require("vue"),k={class:"size-full overflow-y-auto p-8 bg-[#1a1a2e]"},E={key:0,class:"max-w-3xl w-full mx-auto"},N={key:0,class:"text-[#f0f0f0] text-3xl font-bold mb-8 text-center"},S={class:"flex flex-col gap-6"},w={class:"text-white text-lg font-semibold mb-4"},V={class:"text-blue-400 mr-2"},B={class:"flex flex-col gap-3"},C=["name","value","onUpdate:modelValue"],D={class:"text-white flex-1"},q={class:"font-semibold mr-2"},T={class:"mt-8 flex justify-center"},$=["disabled"],O={class:"mt-4 text-center text-gray-400 text-sm"},h=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},emits:["updateResult"],setup(d,{emit:m}){const o=d,_=m,s=e.ref(null),l=e.ref([]);e.watch(()=>o.selectedResult,t=>{t?.toolName===a.TOOL_NAME&&t.jsonData&&(s.value=t.jsonData,t.viewState?.userAnswers?l.value=t.viewState.userAnswers:l.value=new Array(s.value.questions.length).fill(null))},{immediate:!0}),e.watch(l,t=>{if(o.selectedResult&&t){const i={...o.selectedResult,viewState:{userAnswers:t}};_("updateResult",i)}},{deep:!0});const u=e.computed(()=>l.value.filter(t=>t!==null).length),p=e.computed(()=>s.value&&u.value===s.value.questions.length);function x(t,i){return l.value[t]===i?"border-blue-500 bg-blue-500/20":"border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20"}function y(){if(!s.value||!p.value)return;const i=`Here are my answers:
2
2
  ${l.value.map((n,r)=>{if(n===null)return null;const v=r+1,c=String.fromCharCode(65+n),g=s.value.questions[r].choices[n];return`Q${v}: ${c} - ${g}`}).filter(n=>n!==null).join(`
3
- `)}`;o.sendTextMessage(i)}return(t,i)=>(e.openBlock(),e.createElementBlock("div",k,[s.value?(e.openBlock(),e.createElementBlock("div",E,[s.value.title?(e.openBlock(),e.createElementBlock("h2",N,e.toDisplayString(s.value.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.questions,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]"},[e.createElementVNode("div",w,[e.createElementVNode("span",V,e.toDisplayString(r+1)+".",1),e.createTextVNode(" "+e.toDisplayString(n.question),1)]),e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.choices,(v,c)=>(e.openBlock(),e.createElementBlock("label",{key:c,class:e.normalizeClass([x(r,c),"flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2"])},[e.withDirectives(e.createElementVNode("input",{type:"radio",name:`question-${r}`,value:c,"onUpdate:modelValue":g=>l.value[r]=g,class:"mt-1 mr-3 size-4 shrink-0"},null,8,C),[[e.vModelRadio,l.value[r]]]),e.createElementVNode("span",D,[e.createElementVNode("span",T,e.toDisplayString(String.fromCharCode(65+c))+".",1),e.createTextVNode(" "+e.toDisplayString(v),1)])],2))),128))])]))),128))]),e.createElementVNode("div",q,[e.createElementVNode("button",{onClick:y,disabled:!p.value,class:e.normalizeClass([p.value?"bg-blue-600 hover:bg-blue-700":"bg-gray-600 cursor-not-allowed opacity-50","py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer"])}," Submit Answers ",10,$)]),e.createElementVNode("div",O,e.toDisplayString(u.value)+" / "+e.toDisplayString(s.value.questions.length)+" questions answered ",1)])):e.createCommentVNode("",!0)]))}}),A={class:"p-3 bg-blue-50 rounded-md"},L={key:0,class:"flex flex-col gap-2"},M={class:"text-sm font-semibold text-gray-800 text-center"},z={class:"text-center"},j={class:"inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full"},Q={class:"text-xs text-gray-600 overflow-hidden line-clamp-2"},F={class:"flex justify-center gap-1"},P={key:0,class:"text-xs text-gray-500"},b=e.defineComponent({__name:"Preview",props:{result:{}},setup(d){const m=d,o=e.computed(()=>m.result.jsonData);return(_,s)=>(e.openBlock(),e.createElementBlock("div",A,[o.value?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",M,e.toDisplayString(o.value.title||"Quiz"),1),e.createElementVNode("div",z,[e.createElementVNode("span",j,e.toDisplayString(o.value.questions.length)+" "+e.toDisplayString(o.value.questions.length===1?"Question":"Questions"),1)]),e.createElementVNode("div",Q,e.toDisplayString(o.value.questions[0]?.question),1),e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.min(o.value.questions[0]?.choices.length||0,4),(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"size-2 bg-gray-400 rounded-full"}))),128)),(o.value.questions[0]?.choices.length||0)>4?(e.openBlock(),e.createElementBlock("div",P," +"+e.toDisplayString(o.value.questions[0].choices.length-4),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]))}}),f={...a.pluginCore,viewComponent:h,previewComponent:b},R={plugin:f};exports.SAMPLES=a.SAMPLES;exports.TOOL_DEFINITION=a.TOOL_DEFINITION;exports.TOOL_NAME=a.TOOL_NAME;exports.executeQuiz=a.executeQuiz;exports.pluginCore=a.pluginCore;exports.Preview=b;exports.View=h;exports.default=R;exports.plugin=f;
3
+ `)}`;o.sendTextMessage(i)}return(t,i)=>(e.openBlock(),e.createElementBlock("div",k,[s.value?(e.openBlock(),e.createElementBlock("div",E,[s.value.title?(e.openBlock(),e.createElementBlock("h2",N,e.toDisplayString(s.value.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.questions,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]"},[e.createElementVNode("div",w,[e.createElementVNode("span",V,e.toDisplayString(r+1)+".",1),e.createTextVNode(" "+e.toDisplayString(n.question),1)]),e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.choices,(v,c)=>(e.openBlock(),e.createElementBlock("label",{key:c,class:e.normalizeClass([x(r,c),"flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2"])},[e.withDirectives(e.createElementVNode("input",{type:"radio",name:`question-${r}`,value:c,"onUpdate:modelValue":g=>l.value[r]=g,class:"mt-1 mr-3 size-4 shrink-0"},null,8,C),[[e.vModelRadio,l.value[r]]]),e.createElementVNode("span",D,[e.createElementVNode("span",q,e.toDisplayString(String.fromCharCode(65+c))+".",1),e.createTextVNode(" "+e.toDisplayString(v),1)])],2))),128))])]))),128))]),e.createElementVNode("div",T,[e.createElementVNode("button",{onClick:y,disabled:!p.value,class:e.normalizeClass([p.value?"bg-blue-600 hover:bg-blue-700":"bg-gray-600 cursor-not-allowed opacity-50","py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer"])}," Submit Answers ",10,$)]),e.createElementVNode("div",O,e.toDisplayString(u.value)+" / "+e.toDisplayString(s.value.questions.length)+" questions answered ",1)])):e.createCommentVNode("",!0)]))}}),A={class:"p-3 bg-blue-50 rounded-md"},L={key:0,class:"flex flex-col gap-2"},M={class:"text-sm font-semibold text-gray-800 text-center"},z={class:"text-center"},j={class:"inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full"},Q={class:"text-xs text-gray-600 overflow-hidden line-clamp-2"},F={class:"flex justify-center gap-1"},P={key:0,class:"text-xs text-gray-500"},b=e.defineComponent({__name:"Preview",props:{result:{}},setup(d){const m=d,o=e.computed(()=>m.result.jsonData);return(_,s)=>(e.openBlock(),e.createElementBlock("div",A,[o.value?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",M,e.toDisplayString(o.value.title||"Quiz"),1),e.createElementVNode("div",z,[e.createElementVNode("span",j,e.toDisplayString(o.value.questions.length)+" "+e.toDisplayString(o.value.questions.length===1?"Question":"Questions"),1)]),e.createElementVNode("div",Q,e.toDisplayString(o.value.questions[0]?.question),1),e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.min(o.value.questions[0]?.choices.length||0,4),(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"size-2 bg-gray-400 rounded-full"}))),128)),(o.value.questions[0]?.choices.length||0)>4?(e.openBlock(),e.createElementBlock("div",P," +"+e.toDisplayString(o.value.questions[0].choices.length-4),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]))}}),f={...a.pluginCore,viewComponent:h,previewComponent:b},R={plugin:f};exports.SAMPLES=a.SAMPLES;exports.TOOL_DEFINITION=a.TOOL_DEFINITION;exports.TOOL_NAME=a.TOOL_NAME;exports.executeQuiz=a.executeQuiz;exports.pluginCore=a.pluginCore;exports.Preview=b;exports.View=h;exports.default=R;exports.plugin=f;
package/dist/vue.js CHANGED
@@ -1,5 +1,6 @@
1
+ /* empty css */
1
2
  import { TOOL_NAME as A, pluginCore as D } from "./core.js";
2
- import { SAMPLES as ue, TOOL_DEFINITION as ce, executeQuiz as de } from "./core.js";
3
+ import { SAMPLES as ce, TOOL_DEFINITION as de, executeQuiz as ve } from "./core.js";
3
4
  import { defineComponent as S, ref as C, watch as $, computed as g, createElementBlock as l, openBlock as n, createCommentVNode as m, createElementVNode as e, toDisplayString as i, Fragment as x, renderList as w, createTextVNode as k, normalizeClass as q, withDirectives as N, vModelRadio as V } from "vue";
4
5
  const j = { class: "size-full overflow-y-auto p-8 bg-[#1a1a2e]" }, M = {
5
6
  key: 0,
@@ -131,15 +132,15 @@ ${a.value.map((r, u) => {
131
132
  ...D,
132
133
  viewComponent: J,
133
134
  previewComponent: se
134
- }, ie = { plugin: oe };
135
+ }, ae = { plugin: oe };
135
136
  export {
136
137
  se as Preview,
137
- ue as SAMPLES,
138
- ce as TOOL_DEFINITION,
138
+ ce as SAMPLES,
139
+ de as TOOL_DEFINITION,
139
140
  A as TOOL_NAME,
140
141
  J as View,
141
- ie as default,
142
- de as executeQuiz,
142
+ ae as default,
143
+ ve as executeQuiz,
143
144
  oe as plugin,
144
145
  D as pluginCore
145
146
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulmochat-plugin/quiz",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Quiz plugin for MulmoChat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,6 +22,11 @@
22
22
  "import": "./dist/vue.js",
23
23
  "require": "./dist/vue.cjs"
24
24
  },
25
+ "./react": {
26
+ "types": "./dist/react/index.d.ts",
27
+ "import": "./dist/react.js",
28
+ "require": "./dist/react.cjs"
29
+ },
25
30
  "./style.css": "./dist/style.css"
26
31
  },
27
32
  "files": [
@@ -29,21 +34,40 @@
29
34
  ],
30
35
  "scripts": {
31
36
  "dev": "vite",
32
- "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
33
- "typecheck": "vue-tsc --noEmit",
34
- "lint": "eslint src demo"
37
+ "dev:react": "vite --config demo-react/vite.config.ts",
38
+ "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly && tsc -p tsconfig.react.json --emitDeclarationOnly",
39
+ "typecheck": "vue-tsc --noEmit && tsc -p tsconfig.react.json --noEmit",
40
+ "lint": "eslint src demo demo-react"
35
41
  },
36
42
  "peerDependencies": {
43
+ "react": "^18.0.0 || ^19.0.0",
44
+ "react-dom": "^18.0.0 || ^19.0.0",
37
45
  "vue": "^3.5.0"
38
46
  },
47
+ "peerDependenciesMeta": {
48
+ "vue": {
49
+ "optional": true
50
+ },
51
+ "react": {
52
+ "optional": true
53
+ },
54
+ "react-dom": {
55
+ "optional": true
56
+ }
57
+ },
39
58
  "devDependencies": {
40
59
  "@tailwindcss/vite": "^4.1.18",
60
+ "@types/react": "^19.0.0",
61
+ "@types/react-dom": "^19.0.0",
41
62
  "@typescript-eslint/eslint-plugin": "^8.53.0",
42
63
  "@typescript-eslint/parser": "^8.53.0",
64
+ "@vitejs/plugin-react": "^4.5.0",
43
65
  "@vitejs/plugin-vue": "^6.0.3",
44
66
  "eslint": "^9.39.2",
45
67
  "eslint-plugin-vue": "^10.6.2",
46
68
  "globals": "^17.0.0",
69
+ "react": "^19.0.0",
70
+ "react-dom": "^19.0.0",
47
71
  "tailwindcss": "^4.1.18",
48
72
  "typescript": "~5.9.3",
49
73
  "vite": "^7.3.1",
@@ -54,7 +78,9 @@
54
78
  "keywords": [
55
79
  "mulmochat",
56
80
  "plugin",
57
- "quiz"
81
+ "quiz",
82
+ "react",
83
+ "vue"
58
84
  ],
59
85
  "license": "MIT"
60
86
  }