Skip to content

Commit 88b6224

Browse files
authored
Merge pull request #7 from agencyenterprise/sandbox
Sandbox
2 parents 466ceda + 64583c6 commit 88b6224

File tree

3 files changed

+87
-42
lines changed

3 files changed

+87
-42
lines changed

README.md

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,91 @@
1-
# QTI 3.x Renderer - Proof of Concept
1+
# QTI 3.x Renderer
22

3-
A framework-agnostic QTI 3.x renderer with a React demo application.
3+
[**Live Sandbox Demo**](https://agencyenterprise.github.io/qti-3-player/)
4+
5+
A framework-agnostic QTI 3.x renderer with support for multiple frontend frameworks.
46

57
## Structure
68

79
```
810
qti-3-player/
911
├── packages/
10-
│ └── qti-renderer/ # Core renderer library (TypeScript, framework-agnostic)
11-
└── apps/
12-
└── react-demo/ # React sample application
12+
│ ├── qti-renderer/ # Core renderer library (TypeScript, framework-agnostic)
13+
│ ├── qti-react/ # React wrapper component
14+
│ ├── qti-vue/ # Vue wrapper component
15+
│ └── qti-vanilla/ # Vanilla JS wrapper
16+
├── sandbox/ # Standalone demo application
17+
└── stories/ # Storybook examples and stories
1318
```
1419

15-
## Core Library (`packages/qti-renderer`)
16-
17-
Framework-agnostic npm package that renders QTI 3.x assessment items to HTML.
20+
## Packages
1821

19-
### Supported QTI Elements
22+
### Core Library (`packages/qti-renderer`)
2023

21-
- `<assessmentItem>` - Root element
22-
- `<itemBody>` - Question content container
23-
- `<choiceInteraction>` - Multiple choice interaction
24-
- `<prompt>` - Question text
25-
- `<simpleChoice>` - Individual choice options
24+
Framework-agnostic npm package that renders QTI 3.x assessment items to HTML with full response processing support.
2625

27-
### API
26+
**API:**
2827

2928
```typescript
3029
import { QtiRenderer } from '@qti-renderer/core';
3130

3231
const renderer = new QtiRenderer(qtiXmlString);
33-
renderer.mount(containerElement);
34-
const responses = renderer.getResponses(); // Record<string, string | string[]>
32+
renderer.render(containerElement);
3533
```
3634

37-
### Design Decisions
35+
**Features:**
36+
37+
- XML validation against QTI 3.0 schema
38+
- Response processing with conditional logic
39+
- Outcome variable management (RESPONSE)
40+
- Feedback display (inline and modal)
41+
- Response state management
42+
43+
## Supported QTI Elements
44+
45+
See [QTI Support Documentation](docs/qti_support/README.md) for a complete checklist of supported elements and attributes.
46+
47+
## Design Decisions
3848

3949
- Uses `DOMParser` for XML parsing (no external dependencies)
4050
- Renders to vanilla DOM elements (framework-agnostic)
4151
- Maintains response state internally
4252
- Uses semantic HTML (`fieldset`, `legend`, `label`) for accessibility
4353
- Registry pattern for extensible element rendering
54+
- Event-driven response processing
4455

45-
## React Demo (`apps/react-demo`)
56+
## Development
4657

47-
Sample React application demonstrating QTI renderer usage.
58+
### Running Storybook
4859

49-
### Usage
60+
```bash
61+
npm install
62+
npm run dev
63+
```
64+
65+
This will start Storybook on `http://localhost:6006` with examples for React, Vue, and Vanilla JS.
5066

51-
```tsx
52-
import { QtiItem } from './QtiItem';
67+
### Building
5368

54-
<QtiItem xml={qtiXmlString} onResponseChange={(responses) => console.log(responses)} />
69+
```bash
70+
npm run build
5571
```
5672

57-
### Running
73+
Builds all packages in the monorepo.
74+
75+
### Sandbox
76+
77+
The sandbox provides a standalone demo application:
5878

5979
```bash
80+
cd sandbox
6081
npm install
6182
npm run dev
6283
```
6384

64-
## Limitations
65-
66-
This is a proof of concept with the following limitations:
85+
## Current Limitations
6786

68-
- **No response processing** - Only renders questions, doesn't grade them
6987
- **No scoring** - No calculation or evaluation of responses
70-
- **No adaptive behavior** - Static rendering only
71-
- **No feedback** - No correct/incorrect feedback display
72-
- **No test structure** - Only single items, no tests/sections
73-
74-
## QTI 3.x Support
75-
76-
Targets QTI 3.x specification structure and syntax. Uses `responseIdentifier` and supports `maxChoices` attribute for single/multiple selection.
88+
- **No test structure** - Only single assessment items, no tests/sections
89+
- **Limited interaction types** - Currently supports `choice-interaction` (single and multiple choice)
90+
- **Partial expression support** - Basic expressions like `match` and `correct` are supported, but not all QTI expressions
91+
- **No adaptive behavior** - Static rendering only, no adaptive item selection

sandbox/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
</head>
88
<body>
99
<div id="app">
10+
<header class="app-header">
11+
<h1>QTI 3 Player Sandbox</h1>
12+
<a href="https://github.com/agencyenterprise/qti-3-player/tree/main/docs/qti_support" target="_blank">QTI Support Docs</a>
13+
</header>
1014
<div class="container">
1115
<div class="editor-pane">
1216
<h2>QTI XML Input</h2>

sandbox/src/style.css

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,39 @@ body {
2121
padding: 0;
2222
}
2323

24+
.app-header {
25+
display: flex;
26+
justify-content: space-between;
27+
align-items: center;
28+
padding: 0 20px;
29+
background-color: #1a1a1a;
30+
border-bottom: 1px solid #444;
31+
height: 60px;
32+
box-sizing: border-box;
33+
}
34+
35+
.app-header h1 {
36+
font-size: 1.2rem;
37+
margin: 0;
38+
}
39+
40+
.app-header a {
41+
color: #646cff;
42+
text-decoration: none;
43+
}
44+
45+
.app-header a:hover {
46+
text-decoration: underline;
47+
}
48+
2449
.container {
2550
display: flex;
26-
height: 100%;
51+
height: calc(100% - 60px);
2752
width: 100%;
2853
}
2954

30-
.editor-pane, .preview-pane {
55+
.editor-pane,
56+
.preview-pane {
3157
flex: 1;
3258
padding: 20px;
3359
display: flex;
@@ -57,7 +83,6 @@ body {
5783

5884
.editor-pane textarea {
5985
flex: 1;
60-
width: 100%;
6186
resize: none;
6287
background-color: #2d2d2d;
6388
color: #e0e0e0;
@@ -107,14 +132,15 @@ body {
107132
#qti-container {
108133
width: 100%;
109134
height: 100%;
110-
135+
111136
/* Strong reset to isolate from outer styles */
112137
all: initial;
113138
display: block; /* Restore block display after all: initial */
114-
139+
115140
/* Re-apply desired base styles for the player */
116141
text-align: left;
117-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
142+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
143+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
118144
font-size: 16px;
119145
line-height: 1.5;
120146
color: #212529;

0 commit comments

Comments
 (0)