Skip to content

Commit 46e30e2

Browse files
committed
refactor: relocate demo samples and stabilize svelte element builds
Move element-demo sample configs into src/lib/samples with updated loaders/tooling, and harden Svelte element compatibility by fixing custom-element compile paths and modernizing mc-populated-blank delivery markup/typing. Made-with: Cursor
1 parent ca88dc7 commit 46e30e2

64 files changed

Lines changed: 2424 additions & 475 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/mc-populated-blank.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@pie-element/mc-populated-blank': minor
3+
---
4+
5+
Initial publish of `@pie-element/mc-populated-blank`: Svelte 5 element for multiple-choice answers that populate a `{{blank}}` slot in an HTML template, with optional audio/transcript, author UI, controller, and print surface. Synthetic demos in element-demo and pie-players item-demos.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ esm-compatible-elements.json
6262
apps/element-demo/src/lib/element-imports.js
6363
apps/element-demo/src/lib/element-imports.d.ts
6464
apps/element-demo/src/lib/elements/registry.ts
65-
apps/element-demo/src/lib/data/sample-configs/
6665

6766
# Demo server lock file
6867
.demo-server.lock

UPSTREAM_SYNC_COMMIT_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ These are regenerated automatically on every `upstream:sync` and should NOT be c
4242
- **Contains timestamp** that changes on every sync
4343
- Regenerated from scanning `packages/elements-react/`
4444

45-
- **`apps/element-demo/src/lib/data/sample-configs/react/`**
45+
- **`apps/element-demo/src/lib/samples/`**
4646
- Sample config/session JSON files
4747
- Copied from each element's `docs/demo/` directory
4848
- Redundant since source configs are already committed in element packages

apps/element-demo/convert-demo.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import config from './packages/elements-react/multiple-choice/docs/demo/config.m
22
import { writeFileSync } from 'node:fs';
33

44
writeFileSync(
5-
'./apps/element-demo/src/lib/data/sample-configs/react/multiple-choice.json',
5+
'./apps/element-demo/src/lib/samples/multiple-choice.json',
66
JSON.stringify(config, null, 2)
77
);
88

apps/element-demo/src/lib/elements/registry.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ export const ELEMENT_REGISTRY: readonly ElementMetadata[] = [
298298
"hasConfig": true,
299299
"hasSession": true,
300300
"demoCount": 1
301+
},
302+
{
303+
"name": "mc-populated-blank",
304+
"title": "MC Populated Blank",
305+
"packageName": "@pie-element/mc-populated-blank",
306+
"hasAuthor": true,
307+
"hasPrint": true,
308+
"hasConfig": true,
309+
"hasSession": true,
310+
"demoCount": 8
301311
}
302312
];
303313

apps/element-demo/src/lib/data/sample-configs/react/categorize.json renamed to apps/element-demo/src/lib/samples/categorize.json

Lines changed: 18 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
"id": "math-equations",
55
"title": "Math Equations Classification",
66
"description": "Categorize equations as true or false with LaTeX math rendering",
7-
"tags": [
8-
"math",
9-
"equations",
10-
"true-false",
11-
"latex"
12-
],
7+
"tags": ["math", "equations", "true-false", "latex"],
138
"model": {
149
"id": "1",
1510
"element": "categorize",
@@ -69,19 +64,11 @@
6964
"correctResponse": [
7065
{
7166
"category": "0",
72-
"choices": [
73-
"3",
74-
"4",
75-
"5"
76-
]
67+
"choices": ["3", "4", "5"]
7768
},
7869
{
7970
"category": "1",
80-
"choices": [
81-
"0",
82-
"1",
83-
"2"
84-
]
71+
"choices": ["0", "1", "2"]
8572
}
8673
],
8774
"lockChoiceOrder": true,
@@ -102,13 +89,7 @@
10289
"id": "geometry-shapes",
10390
"title": "Geometric Shapes by Dimensions",
10491
"description": "Sort shapes with math formulas into 2D and 3D categories",
105-
"tags": [
106-
"math",
107-
"geometry",
108-
"shapes",
109-
"2d",
110-
"3d"
111-
],
92+
"tags": ["math", "geometry", "shapes", "2d", "3d"],
11293
"model": {
11394
"id": "2",
11495
"element": "categorize",
@@ -168,19 +149,11 @@
168149
"correctResponse": [
169150
{
170151
"category": "0",
171-
"choices": [
172-
"0",
173-
"2",
174-
"4"
175-
]
152+
"choices": ["0", "2", "4"]
176153
},
177154
{
178155
"category": "1",
179-
"choices": [
180-
"1",
181-
"3",
182-
"5"
183-
]
156+
"choices": ["1", "3", "5"]
184157
}
185158
],
186159
"lockChoiceOrder": false,
@@ -201,13 +174,7 @@
201174
"id": "algebra-operations",
202175
"title": "Algebraic Operations with Alternates",
203176
"description": "Categorize expressions by operation type with multiple correct arrangements",
204-
"tags": [
205-
"math",
206-
"algebra",
207-
"operations",
208-
"alternates",
209-
"advanced"
210-
],
177+
"tags": ["math", "algebra", "operations", "alternates", "advanced"],
211178
"model": {
212179
"id": "3",
213180
"element": "categorize",
@@ -265,41 +232,18 @@
265232
"correctResponse": [
266233
{
267234
"category": "0",
268-
"choices": [
269-
"0"
270-
],
271-
"alternateResponses": [
272-
[
273-
"0",
274-
"3"
275-
]
276-
]
235+
"choices": ["0"],
236+
"alternateResponses": [["0", "3"]]
277237
},
278238
{
279239
"category": "1",
280-
"choices": [
281-
"2",
282-
"4"
283-
],
284-
"alternateResponses": [
285-
[
286-
"1",
287-
"2",
288-
"4"
289-
]
290-
]
240+
"choices": ["2", "4"],
241+
"alternateResponses": [["1", "2", "4"]]
291242
},
292243
{
293244
"category": "2",
294-
"choices": [
295-
"1",
296-
"3"
297-
],
298-
"alternateResponses": [
299-
[
300-
"3"
301-
]
302-
]
245+
"choices": ["1", "3"],
246+
"alternateResponses": [["3"]]
303247
}
304248
],
305249
"lockChoiceOrder": true,
@@ -320,13 +264,7 @@
320264
"id": "calculus-concepts",
321265
"title": "Calculus: Derivatives vs Integrals",
322266
"description": "Four-category grid with calculus formulas and multiple placements",
323-
"tags": [
324-
"math",
325-
"calculus",
326-
"derivatives",
327-
"integrals",
328-
"grid"
329-
],
267+
"tags": ["math", "calculus", "derivatives", "integrals", "grid"],
330268
"model": {
331269
"id": "4",
332270
"element": "categorize",
@@ -394,29 +332,19 @@
394332
"correctResponse": [
395333
{
396334
"category": "0",
397-
"choices": [
398-
"0"
399-
]
335+
"choices": ["0"]
400336
},
401337
{
402338
"category": "1",
403-
"choices": [
404-
"1"
405-
]
339+
"choices": ["1"]
406340
},
407341
{
408342
"category": "2",
409-
"choices": [
410-
"2",
411-
"4"
412-
]
343+
"choices": ["2", "4"]
413344
},
414345
{
415346
"category": "3",
416-
"choices": [
417-
"3",
418-
"5"
419-
]
347+
"choices": ["3", "5"]
420348
}
421349
],
422350
"lockChoiceOrder": true,

apps/element-demo/src/lib/data/sample-configs/react/charting.json renamed to apps/element-demo/src/lib/samples/charting.json

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
"id": "bar-chart-statistics",
55
"title": "Bar Chart - Test Score Distribution",
66
"description": "Interactive bar chart for analyzing student test scores with editable values",
7-
"tags": [
8-
"bar",
9-
"statistics",
10-
"data-analysis",
11-
"interactive"
12-
],
7+
"tags": ["bar", "statistics", "data-analysis", "interactive"],
138
"model": {
149
"id": "1",
1510
"element": "charting",
@@ -104,13 +99,7 @@
10499
"id": "line-chart-growth",
105100
"title": "Line Chart - Plant Growth with Math",
106101
"description": "Line chart with cross markers showing exponential plant growth over time",
107-
"tags": [
108-
"line",
109-
"lineCross",
110-
"growth",
111-
"math",
112-
"science"
113-
],
102+
"tags": ["line", "lineCross", "growth", "math", "science"],
114103
"model": {
115104
"id": "2",
116105
"element": "charting",
@@ -203,13 +192,7 @@
203192
"id": "histogram-frequency",
204193
"title": "Histogram - Survey Response Frequencies",
205194
"description": "Histogram showing frequency distribution with all editable categories",
206-
"tags": [
207-
"histogram",
208-
"frequency",
209-
"survey",
210-
"statistics",
211-
"editable"
212-
],
195+
"tags": ["histogram", "frequency", "survey", "statistics", "editable"],
213196
"model": {
214197
"id": "3",
215198
"element": "charting",

apps/element-demo/src/lib/data/sample-configs/react/complex-rubric.json renamed to apps/element-demo/src/lib/samples/complex-rubric.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@
1111
"rubricType": "simpleRubric",
1212
"rubrics": {
1313
"simpleRubric": {
14-
"points": [
15-
"nothing right",
16-
"a teeny bit right",
17-
"mostly right",
18-
"bingo"
19-
],
20-
"sampleAnswers": [
21-
null,
22-
"just right",
23-
"not left",
24-
null
25-
],
14+
"points": ["nothing right", "a teeny bit right", "mostly right", "bingo"],
15+
"sampleAnswers": [null, "just right", "not left", null],
2616
"maxPoints": 3,
2717
"excludeZero": false
2818
},
@@ -126,11 +116,7 @@
126116
},
127117
{
128118
"maxPoints": 5,
129-
"scorePointsLabels": [
130-
"Non-Scorable",
131-
"Unsatisfactory",
132-
"Satisfactory"
133-
],
119+
"scorePointsLabels": ["Non-Scorable", "Unsatisfactory", "Satisfactory"],
134120
"traitLabel": "Category",
135121
"traits": [
136122
{

apps/element-demo/src/lib/data/sample-configs/react/drag-in-the-blank.json renamed to apps/element-demo/src/lib/samples/drag-in-the-blank.json

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
"id": "basic-sentence",
55
"title": "Basic Sentence Completion",
66
"description": "Simple fill-in-the-blank sentence with text choices",
7-
"tags": [
8-
"basic",
9-
"text",
10-
"sentence"
11-
],
7+
"tags": ["basic", "text", "sentence"],
128
"model": {
139
"id": "1",
1410
"element": "drag-in-the-blank",
@@ -55,11 +51,7 @@
5551
"id": "math-equations",
5652
"title": "Mathematical Equations",
5753
"description": "Complete equations with mathematical expressions and symbols",
58-
"tags": [
59-
"math",
60-
"equations",
61-
"algebra"
62-
],
54+
"tags": ["math", "equations", "algebra"],
6355
"model": {
6456
"id": "2",
6557
"element": "drag-in-the-blank",
@@ -112,12 +104,7 @@
112104
"id": "word-problems-images",
113105
"title": "Word Problems with Arrays",
114106
"description": "Match word problems to visual array representations",
115-
"tags": [
116-
"images",
117-
"arrays",
118-
"word-problems",
119-
"multiplication"
120-
],
107+
"tags": ["images", "arrays", "word-problems", "multiplication"],
121108
"model": {
122109
"id": "3",
123110
"element": "drag-in-the-blank",
@@ -161,12 +148,7 @@
161148
"id": "chemistry-duplicates",
162149
"title": "Chemistry Balance with Duplicates",
163150
"description": "Balance chemical equations allowing duplicate use of coefficients",
164-
"tags": [
165-
"chemistry",
166-
"duplicates",
167-
"math",
168-
"equations"
169-
],
151+
"tags": ["chemistry", "duplicates", "math", "equations"],
170152
"model": {
171153
"id": "4",
172154
"element": "drag-in-the-blank",

apps/element-demo/src/lib/data/sample-configs/react/drawing-response.json renamed to apps/element-demo/src/lib/samples/drawing-response.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
"id": "default",
55
"title": "Default Demo",
66
"description": "Basic drawing response configuration",
7-
"tags": [
8-
"drawing",
9-
"default"
10-
],
7+
"tags": ["drawing", "default"],
118
"model": {
129
"id": "1",
1310
"element": "drawing-response",

0 commit comments

Comments
 (0)