eat-js-sdk 1.4.6 → 2.0.0

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.
@@ -0,0 +1,9 @@
1
+ # Package Managers
2
+ package-lock.json
3
+ pnpm-lock.yaml
4
+ yarn.lock
5
+ bun.lock
6
+ bun.lockb
7
+
8
+ # Miscellaneous
9
+ /static/
package/.prettierrc ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "arrowParens": "always",
3
+ "bracketSameLine": false,
4
+ "bracketSpacing": true,
5
+ "htmlWhitespaceSensitivity": "css",
6
+ "printWidth": 120,
7
+ "quoteProps": "as-needed",
8
+ "semi": false,
9
+ "singleQuote": true,
10
+ "tabWidth": 2,
11
+ "trailingComma": "es5",
12
+ "useTabs": false,
13
+ "plugins": ["prettier-plugin-svelte"],
14
+ "overrides": [
15
+ {
16
+ "files": "*.svelte",
17
+ "options": {
18
+ "parser": "svelte"
19
+ }
20
+ }
21
+ ]
22
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,121 @@
1
+ # 2.0.0
2
+
3
+ ## 1.4.0
4
+
5
+ - [EAT-179](https://cambridgeorg.atlassian.net/browse/EAT-179) As a student/teacher I want to open an image stimulus within a question item in an image viewer
6
+
7
+ - [EAT-350](https://cambridgeorg.atlassian.net/browse/EAT-350) As a student/teacher I want to open image answers within MCQ items in an image viewer
8
+
9
+ - [EAT-353](https://cambridgeorg.atlassian.net/browse/EAT-353) As an author I want to view my MCQs with image answers using an image viewer when creating the item/As a teacher I want to preview MCQs with image answers using an image viewer before assigning
10
+
11
+ - [EAT-354](https://cambridgeorg.atlassian.net/browse/EAT-354) As an author I want to view my interactions with an image stimulus using an image viewer when creating the item/As a teacher I want to preview my interactions with an image stimulus using an image viewer before assigning
12
+
13
+ ## 1.3.0
14
+
15
+ - [EAT-221](https://cambridgeorg.atlassian.net/browse/EAT-221) Update configuration in EAT SDK for question items with inline tables
16
+
17
+ ## 1.2.0
18
+
19
+ - [EAT-305](https://cambridgeorg.atlassian.net/browse/EAT-305) [Review Mode] Display the "incorrect" feedback for partially correct partially skipped items
20
+
21
+ - [EAT-306](https://cambridgeorg.atlassian.net/browse/EAT-306) [Contentful Preview] Display the "incorrect" feedback for partially correct partially skipped items
22
+
23
+ ## 1.1.0
24
+
25
+ - [EAT-320](https://cambridgeorg.atlassian.net/browse/EAT-320) Remove static skipped feedback alert
26
+
27
+ - [EAT-324](https://cambridgeorg.atlassian.net/browse/EAT-324) Implement <p> tag for inline dropdown to fix new line display issue
28
+
29
+ - [EAT-325](https://cambridgeorg.atlassian.net/browse/EAT-325) Update the logic for the correct answer that is shown for long type in questions
30
+
31
+ ## 1.0.10
32
+
33
+ - [EAT-318](https://cambridgeorg.atlassian.net/browse/EAT-318) Implement designs for long description field for image stimulus with rich text formatting so that they appear correctly in SDK
34
+
35
+ - [EAT-319](https://cambridgeorg.atlassian.net/browse/EAT-319) As an author I want to view my interactions with an image stimulus with a long description field when creating the item/As a teacher I want to preview interactions with an image stimulus with a long description field before assigning
36
+
37
+ ## 1.0.9
38
+
39
+ - [EAT-292](https://btsservice.atlassian.net/browse/EAT-292) As an author I want to view my Categorise interactions with an image stimulus when creating the item/As a teacher I want to preview Categorise interactions with an image stimulus before assigning
40
+
41
+ - [EAT-293](https://btsservice.atlassian.net/browse/EAT-293) Implement designs for Categorise interactions with image stimulus so that they appear correctly in SDK
42
+
43
+ - [EAT-308](https://cambridgeorg.atlassian.net/browse/EAT-308) Add a "class" attribute in svg
44
+
45
+ ## 1.0.8
46
+
47
+ - [EAT-274](https://btsservice.atlassian.net/browse/EAT-274) As an author I want to view my MCQ with images in answers when creating the item/As a teacher I want to preview MCQ with images in answers items before assigning
48
+
49
+ ## 1.0.7
50
+
51
+ - [EAT-262](https://btsservice.atlassian.net/browse/EAT-262) Implement designs for images in MCQ answers so that they appear correctly in SDK
52
+
53
+ ## 1.0.6
54
+
55
+ - [EAT-263](https://btsservice.atlassian.net/browse/EAT-263) Implement designs for MCQ feedback fields with rich text formatting (including design for interactive preview and review pages)
56
+
57
+ - [EAT-264](https://btsservice.atlassian.net/browse/EAT-264) Implement designs for categorise feedback fields with rich text formatting (including design for interactive preview and review pages)
58
+
59
+ - [EAT-265](https://btsservice.atlassian.net/browse/EAT-265) Implement designs for type in feedback fields with rich text formatting (including design for interactive preview and review pages)
60
+
61
+ ## 1.0.5
62
+
63
+ - [EAT-36](https://btsservice.atlassian.net/browse/EAT-36) Implement designs for dropdown so that it appears correctly in SDK
64
+
65
+ - [EAT-247](https://btsservice.atlassian.net/browse/EAT-247) As an author I want to view my inline dropdown when creating the item/As a teacher I want to preview inline dropdown items before assigning
66
+
67
+ ## 1.0.4
68
+
69
+ - [EAT-249](https://btsservice.atlassian.net/browse/EAT-249) [MCQ Single-select] Fix Contentful preview accessibility issues
70
+
71
+ - [EAT-250](https://btsservice.atlassian.net/browse/EAT-250) [MCQ Single-select] Remove the options' hover state in review mode and static preview
72
+
73
+ ## 1.0.3
74
+
75
+ - [EAT-188](https://btsservice.atlassian.net/browse/EAT-188) Implement designs for MCQ multi select individual report pages so it appears correct for end users
76
+
77
+ - [EAT-223](https://btsservice.atlassian.net/browse/EAT-223) Implement answer feedbacks for Inline Type-in
78
+
79
+ - [EAT-231](https://btsservice.atlassian.net/browse/EAT-231) As an author I want to view my MCQ multi-select when creating the item/As a teacher I want to preview multi-select items before assigning
80
+
81
+ - [EAT-234](https://btsservice.atlassian.net/browse/EAT-234) Update designs for MCQ single select individual report pages so it appears correctly for end users
82
+
83
+ ## 1.0.2
84
+
85
+ - [EAT-229](https://btsservice.atlassian.net/browse/EAT-229) Implement designs for MCQ multi select so it appears correct for end users
86
+
87
+ ## 1.0.1
88
+
89
+ - [EAT-195](https://btsservice.atlassian.net/browse/EAT-195) As an author I want to view my inline typein when creating the item/As a teacher I want to preview inline typein items before assigning
90
+ - [EAT-220](https://btsservice.atlassian.net/browse/EAT-220) Implement designs for scoring for inline typein so that it appears correctly in SDK
91
+ - [EAT-216](https://btsservice.atlassian.net/browse/EAT-216) Update SDK after changes to long typein item scoring for interactive preview
92
+
93
+ ## 1.0.0
94
+
95
+ - [EAT-4](https://btsservice.atlassian.net/browse/EAT-4) As an author I want to be able to preview my activity in content: No session in SDK
96
+ - [EAT-12](https://btsservice.atlassian.net/browse/EAT-12) Styling and layouts for categorise (drag and drop) - small screens
97
+ - [EAT-31](https://btsservice.atlassian.net/browse/EAT-31) Build authoring tool SDK
98
+ - [EAT-33](https://btsservice.atlassian.net/browse/EAT-33) Styling and layouts for MCQ
99
+ - [EAT-35](https://btsservice.atlassian.net/browse/EAT-35) Styling and layouts for categorise (drag and drop) - Medium/Large screens
100
+ - [EAT-34](https://btsservice.atlassian.net/browse/EAT-34) Styling and layouts for typein questions
101
+ - [EAT-45](https://btsservice.atlassian.net/browse/EAT-45) As a student/teacher I want to see image stimulus in my question item
102
+ - [EAT-70](https://btsservice.atlassian.net/browse/EAT-70) As a user, I want to view MCQ Question using EAT SDK
103
+ - [EAT-71](https://btsservice.atlassian.net/browse/EAT-71) As a user, I want to save my answer when MCQ option is clicked
104
+ - [EAT-73](https://btsservice.atlassian.net/browse/EAT-73) As a teacher or student I want to view typein questions using EAT SDK
105
+ - [EAT-74](https://btsservice.atlassian.net/browse/EAT-74) As a teacher or student I want to save my answer when I type answer in to a typein field
106
+ - [EAT-76](https://btsservice.atlassian.net/browse/EAT-76) As a user, I want to view categorise questions using EAT SDK
107
+ - [EAT-92](https://btsservice.atlassian.net/browse/EAT-92) MCQ: Update designs with correct/incorrect answer states and feedback
108
+ - [EAT-98](https://btsservice.atlassian.net/browse/EAT-98) As an author I want to preview my categorise item in contentful and consuming platform so I know I have authored the item the way I intended
109
+ - [EAT-99](https://btsservice.atlassian.net/browse/EAT-99) Styling and layouts for categorise (drag and drop) - accessibility
110
+ - [EAT-100](https://btsservice.atlassian.net/browse/EAT-100) Review and test in/correct answer and feedback designs
111
+ - [EAT-113](https://btsservice.atlassian.net/browse/EAT-113) As a student user, I want to save my categorise answers to the SDK
112
+ - [EAT-121](https://btsservice.atlassian.net/browse/EAT-121) As a teacher I want to see how my student has fared in a Categorise item type
113
+ - [EAT-155](https://btsservice.atlassian.net/browse/EAT-155) Implement designs for text stimulus to include rich text formatting
114
+ - [EAT-156](https://btsservice.atlassian.net/browse/EAT-156) Implement designs for text stimulus for static/interactive preview
115
+ - [EAT-164](https://btsservice.atlassian.net/browse/EAT-164) Updating designs for MCQ answers with rich text formatting
116
+ - [EAT-165](https://btsservice.atlassian.net/browse/EAT-165) Implement designs for Categorise groups and word item with rich text formatting
117
+ - [EAT-166](https://btsservice.atlassian.net/browse/EAT-166) Implement designs for MCQ answers to include rich text formatting for static/interactive preview
118
+ - [EAT-167](https://btsservice.atlassian.net/browse/EAT-167) Implement designs for categorise to include rich text formatting for static/interactive preview
119
+ - [EAT-174](https://btsservice.atlassian.net/browse/EAT-174) Implement designs for Rubric/Prompt with rich text formatting(including design for static/interactive preview)
120
+ - [EAT-193](https://btsservice.atlassian.net/browse/EAT-193) Implement designs for inline typein so that it appears correctly in SDK
121
+ - [EAT-201](https://btsservice.atlassian.net/browse/EAT-201) Update SDK config
package/README.md CHANGED
@@ -1,40 +1,129 @@
1
- # eat-js-sdk
1
+ # EAT UI
2
2
 
3
- Education Authoring Tool SDK built with SvelteKIt
3
+ A Svelte-based UI component library for educational assessment tools (EAT). This library provides interactive components for multiple choice questions (MCQ), type-in interactions, categorisation, and dropdown interactions.
4
4
 
5
- ## Requirements
5
+ ## Features
6
6
 
7
- - NodeJs 18
7
+ - 🎯 **Multiple Interaction Types**: MCQ, Type-in, Categorise, and Dropdown interactions
8
+ - 📱 **Responsive Design**: Mobile-first approach with desktop optimizations
9
+ - 🎨 **Customizable Templates**: Flexible template system with two-column and single-column layouts
10
+ - 🖼️ **Rich Media Support**: Images, videos, and audio with captions and accessibility features
11
+ - ♿ **Accessible**: Built with accessibility in mind
12
+ - 🎭 **Feedback System**: Comprehensive feedback with comparison tables and result displays
13
+ - 💅 **Styled with Tailwind CSS**: Easily customizable styling
8
14
 
9
15
  ## Installation
10
16
 
11
- Use the package manager [npm](https://www.npmjs.com/) to install.
17
+ ```sh
18
+ # Install dependencies using bun
19
+ bun install
20
+ ```
21
+
22
+ ## Developing
23
+
24
+ Start the development server:
25
+
26
+ ```sh
27
+ bun run dev
12
28
 
13
- ```bash
14
- #install dependencies
15
- npm install
29
+ # or start the server and open the app in a new browser tab
30
+ bun run dev --open
16
31
  ```
17
32
 
18
- ## Usage
33
+ ## Building
19
34
 
20
- ```bash
21
- #convert tailwind css to native css and build JS app
22
- npm run build
35
+ To create a production version of the library:
23
36
 
24
- ## Test in local
37
+ ```sh
38
+ bun run build
39
+ ```
25
40
 
26
- #add script
27
- <script src="<path/dist/eat-prompt-builder.mjs>" type="module">
41
+ Preview the production build:
28
42
 
29
- #add the component
30
- <prompt-builder />
43
+ ```sh
44
+ bun run preview
31
45
  ```
32
46
 
33
- ## Publish
34
- ```bash
35
- #publish app
36
- npm publish
47
+ ## Testing
48
+
49
+ Run tests with Vitest:
50
+
51
+ ```sh
52
+ bun run test
53
+ ```
54
+
55
+ ## Project Structure
56
+
57
+ ```
58
+ src/
59
+ ├── lib/
60
+ │ ├── components/ # Reusable UI components
61
+ │ │ ├── common/ # Common components (Media, Modal, Skeleton, etc.)
62
+ │ │ ├── interaction/ # Interaction-specific components (MCQ, etc.)
63
+ │ │ └── template/ # Template components (PromptContainer, Feedback, etc.)
64
+ │ ├── composables/ # Composition functions for shared logic
65
+ │ ├── constants/ # Application constants and enums
66
+ │ ├── core/ # Core functionality (factory, registry, data loading)
67
+ │ ├── stores/ # Svelte stores for state management
68
+ │ └── types/ # TypeScript type definitions
69
+ ```
70
+
71
+ ## Usage Example
72
+
73
+ ```svelte
74
+ <script>
75
+ import { InteractionBuilder } from 'eat-ui'
76
+
77
+ const interactionData = {
78
+ interactionType: 'multipleChoiceInteraction',
79
+ rubric: 'Select the correct answer',
80
+ prompt: 'What is 2 + 2?',
81
+ // ... other interaction properties
82
+ }
83
+ </script>
37
84
 
38
- #Package url
39
- https://unpkg.com/eat-js-sdk@<version>/dist/eat-prompt-builder.mjs
85
+ <InteractionBuilder {...interactionData} />
40
86
  ```
87
+
88
+ ## Key Components
89
+
90
+ ### PromptContainer
91
+
92
+ Orchestrates template sections with clean separation of concerns. Handles rubric, prompt, stimulus (text/media), and interaction layout.
93
+
94
+ ### InteractionBuilder
95
+
96
+ Main entry point for building interactions. Automatically selects the appropriate interaction type based on configuration.
97
+
98
+ ### Composables
99
+
100
+ - `useMCQ` - MCQ interaction logic
101
+ - `useStimulusData` - Stimulus data processing
102
+ - `useFeedbackData` - Feedback display logic
103
+ - `usePrompt` - Prompt state management
104
+
105
+ ## TypeScript Support
106
+
107
+ This project is fully typed with TypeScript. Key types include:
108
+
109
+ - `InteractionType` - Supported interaction types
110
+ - `Stimulus` - Media and text stimulus configuration
111
+ - `FeedbackData` - Feedback structure
112
+ - `ViewTemplate` - Template configuration
113
+
114
+ ## Contributing
115
+
116
+ 1. Follow the existing code structure and patterns
117
+ 2. Maintain type safety with TypeScript
118
+ 3. Write tests for new features
119
+ 4. Keep components focused and composable
120
+ 5. Document complex logic with comments
121
+
122
+ ## Tech Stack
123
+
124
+ - **Framework**: SvelteKit
125
+ - **Language**: TypeScript
126
+ - **Styling**: Tailwind CSS + SCSS
127
+ - **Testing**: Vitest + Playwright
128
+ - **Package Manager**: Bun
129
+ - **Linting**: ESLint
package/package.json CHANGED
@@ -1,85 +1,83 @@
1
1
  {
2
- "name": "eat-js-sdk",
3
- "version": "1.4.6",
4
- "change version": "1.4.0",
5
- "description": "Authoring tool frontend SDK",
6
- "contributors": [
7
- {
8
- "name": "Michael Christopher Abrigos",
9
- "email": "michael.abrigos`@cambridge.org"
10
- },
11
- {
12
- "name": "Earl Anthony Bequillo",
13
- "email": "earl.bequillo@cambridge.org"
14
- },
15
- {
16
- "name": "Carl Lewi Godoy",
17
- "email": "carl.godoy@cambridge.org"
18
- },
19
- {
20
- "name": "Joven Ferdinand Miclat",
21
- "email": "joven.miclat@cambridge.org"
22
- },
23
- {
24
- "name": "Ramer Mellizas",
25
- "email": "ramer.mellizas@cambridge.org"
26
- },
27
- {
28
- "name": "Aimer Jay Pedrozo",
29
- "email": "aimer.pedrozo@cambridge.org"
30
- }
31
- ],
32
- "scripts": {
33
- "dev": "vite dev",
34
- "build": "npm run build:css && node esbuild-bundle.js",
35
- "preview": "vite preview",
36
- "package": "svelte-kit sync && svelte-package && publint",
37
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
38
- "prepublishOnly": "npm run build",
39
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
40
- "lint": "prettier --check . && eslint .",
41
- "format": "prettier --write .",
42
- "build:css": "postcss src/assets/css/tailwind.css -o src/assets/css/main.scss"
2
+ "name": "eat-js-sdk",
3
+ "version": "2.0.0",
4
+ "change version": "2.0.0",
5
+ "description": "Authoring tool frontend SDK",
6
+ "contributors": [
7
+ {
8
+ "name": "Michael Christopher Abrigos",
9
+ "email": "michael.abrigos@cambridge.org"
43
10
  },
44
- "files": [
45
- "README.md",
46
- "package.json",
47
- "./dist/**/*"
48
- ],
49
- "peerDependencies": {
50
- "svelte": "4.0.0"
11
+ {
12
+ "name": "Earl Anthony Bequillo",
13
+ "email": "earl.bequillo@cambridge.org"
51
14
  },
52
- "devDependencies": {
53
- "@sveltejs/adapter-auto": "2.1.1",
54
- "@sveltejs/kit": "1.27.6",
55
- "@sveltejs/package": "2.2.3",
56
- "@typescript-eslint/eslint-plugin": "6.12.0",
57
- "@typescript-eslint/parser": "6.12.0",
58
- "autoprefixer": "10.4.16",
59
- "cssnano": "6.0.1",
60
- "esbuild": "0.19.7",
61
- "esbuild-svelte": "0.8.0",
62
- "eslint": "8.54.0",
63
- "eslint-config-prettier": "9.0.0",
64
- "eslint-plugin-svelte": "2.35.1",
65
- "postcss": "8.4.31",
66
- "postcss-cli": "10.1.0",
67
- "postcss-load-config": "4.0.2",
68
- "prettier": "3.1.0",
69
- "prettier-plugin-tailwindcss": "0.4.1",
70
- "publint": "0.1.16",
71
- "sass": "1.69.5",
72
- "svelte": "4.2.7",
73
- "svelte-check": "3.6.2",
74
- "svelte-dnd-action": "0.9.43",
75
- "tailwindcss": "3.3.5",
76
- "tslib": "2.6.2",
77
- "typescript": "5.3.2",
78
- "vite": "4.5.0"
15
+ {
16
+ "name": "Carl Lewi Godoy",
17
+ "email": "carl.godoy@cambridge.org"
79
18
  },
80
- "type": "module",
81
- "dependencies": {
82
- "svelte-autosize": "1.1.0",
83
- "svelte-viewport-info": "1.0.1"
19
+ {
20
+ "name": "Joven Ferdinand Miclat",
21
+ "email": "joven.miclat@cambridge.org"
22
+ },
23
+ {
24
+ "name": "Ramer Mellizas",
25
+ "email": "ramer.mellizas@cambridge.org"
26
+ },
27
+ {
28
+ "name": "Aimer Jay Pedrozo",
29
+ "email": "aimer.pedrozo@cambridge.org"
84
30
  }
31
+ ],
32
+ "scripts": {
33
+ "dev": "vite dev",
34
+ "build": "npm run build:css && vite build",
35
+ "build:css": "postcss src/lib/assets/css/app.css -o src/lib/assets/css/main.scss",
36
+ "watch:css": "postcss src/lib/assets/css/app.css -o src/lib/assets/css/main.scss --watch",
37
+ "preview": "vite preview",
38
+ "prepare": "svelte-kit sync || echo ''",
39
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
40
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
41
+ "format": "prettier --write .",
42
+ "lint": "prettier --check . && eslint .",
43
+ "test:unit": "vitest",
44
+ "test": "npm run test:unit -- --run"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/compat": "^1.4.0",
48
+ "@eslint/js": "^9.36.0",
49
+ "@sveltejs/adapter-auto": "^6.1.0",
50
+ "@sveltejs/kit": "^2.43.2",
51
+ "@sveltejs/vite-plugin-svelte": "^6.2.0",
52
+ "@types/node": "^22",
53
+ "@vitest/browser": "^3.2.4",
54
+ "autoprefixer": "^10.4.21",
55
+ "cssnano": "^7.1.1",
56
+ "eslint": "^9.36.0",
57
+ "eslint-config-prettier": "^10.1.8",
58
+ "eslint-plugin-svelte": "^3.12.4",
59
+ "globals": "^16.4.0",
60
+ "playwright": "^1.55.1",
61
+ "postcss": "^8.5.6",
62
+ "postcss-cli": "^11.0.1",
63
+ "prettier": "^3.6.2",
64
+ "prettier-plugin-svelte": "^3.4.0",
65
+ "sass-embedded": "^1.93.2",
66
+ "svelte": "^5.39.5",
67
+ "svelte-check": "^4.3.2",
68
+ "tailwindcss": "3",
69
+ "typescript": "^5.9.2",
70
+ "typescript-eslint": "^8.44.1",
71
+ "vite": "^7.1.7",
72
+ "vite-plugin-css-injected-by-js": "^3.5.2",
73
+ "vite-plugin-devtools-json": "^1.0.0",
74
+ "vitest": "^3.2.4",
75
+ "vitest-browser-svelte": "^1.1.0"
76
+ },
77
+ "type": "module",
78
+ "dependencies": {
79
+ "svelte-autosize": "^1.1.5",
80
+ "svelte-dnd-action": "^0.9.65",
81
+ "svelte-viewport-info": "^1.0.3"
82
+ }
85
83
  }
@@ -0,0 +1,20 @@
1
+ import adapter from '@sveltejs/adapter-auto'
2
+ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
3
+
4
+ /** @type {import('@sveltejs/kit').Config} */
5
+ const config = {
6
+ // Consult https://svelte.dev/docs/kit/integrations
7
+ // for more information about preprocessors
8
+ preprocess: vitePreprocess(),
9
+
10
+ customElement: true,
11
+
12
+ kit: {
13
+ // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
14
+ // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
15
+ // See https://svelte.dev/docs/kit/adapters for more information about adapters.
16
+ adapter: adapter(),
17
+ },
18
+ }
19
+
20
+ export default config