@pie-element/drag-in-the-blank 10.2.2-beta.2 → 10.2.2
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/CHANGELOG.md +53 -26
- package/configure/CHANGELOG.md +49 -25
- package/configure/lib/choice.js +4 -3
- package/configure/lib/choice.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +6 -38
- package/controller/package.json +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
- package/configure/lib/__tests__/choice.test.js +0 -114
- package/configure/lib/__tests__/choices.test.js +0 -157
- package/configure/lib/__tests__/main.test.js +0 -167
- package/configure/lib/__tests__/markupUtils.test.js +0 -105
- package/controller/lib/__tests__/index.test.js +0 -775
- package/docs/demo/pie.manifest.json +0 -11
- package/lib/__tests__/index.test.js +0 -118
- package/lib/__tests__/main.test.js +0 -139
package/CHANGELOG.md
CHANGED
|
@@ -3,63 +3,90 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [10.2.2
|
|
6
|
+
## [10.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.2.1...@pie-element/drag-in-the-blank@10.2.2) (2026-09-04)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
### Bug Fixes
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- bump libs PIE-978, PIE-980 ([96489ba](https://github.com/pie-framework/pie-elements/commit/96489ba3c220604f21c3ce4500d79f4389266e9e))
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## [10.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.2.0...@pie-element/drag-in-the-blank@10.2.1) (2026-08-26)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Bug Fixes
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- PIE-518 ([f19ac71](https://github.com/pie-framework/pie-elements/commit/f19ac7145e5daf9dde0377ac6d634b44c9201973))
|
|
17
17
|
|
|
18
|
-
# [10.
|
|
18
|
+
# [10.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.11...@pie-element/drag-in-the-blank@10.2.0) (2026-08-21)
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Bug Fixes
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
- move [@pie-lib](https://github.com/pie-lib) deps back to latest, off next prereleases PIE-927 ([a53e012](https://github.com/pie-framework/pie-elements/commit/a53e0127eb4ac95ece54e1e2bd669ae4974f4251))
|
|
23
|
+
- read the prompt container by class, not by the id pie-lib removed PIE-927 ([aaaf6c2](https://github.com/pie-framework/pie-elements/commit/aaaf6c2f189de3b39f9de85969aeb2e50376c548))
|
|
24
|
+
- **theming:** move the grey palette reads onto --pie-\* tokens PIE-856 ([d7d005b](https://github.com/pie-framework/pie-elements/commit/d7d005bf081843335b4b0377852f2ecd075cb62d)), closes [#000000](https://github.com/pie-framework/pie-elements/issues/000000) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#646464](https://github.com/pie-framework/pie-elements/issues/646464) [#616161](https://github.com/pie-framework/pie-elements/issues/616161) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#C0C3](https://github.com/pie-framework/pie-elements/issues/C0C3)
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
### Features
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
- bump libs PIE-856, PIE-681, PIE-927 ([cb26d7a](https://github.com/pie-framework/pie-elements/commit/cb26d7afa6c99522533c321d5ff8ce3148a66e9e))
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
## [10.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.10...@pie-element/drag-in-the-blank@10.1.11) (2026-08-19)
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
### Bug Fixes
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
- bump libs and shared modules PIE-681, PIE-708 ([08af8b5](https://github.com/pie-framework/pie-elements/commit/08af8b5802aecc8ee5454a1b6d60277d7ec94204))
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
## [10.1.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.8...@pie-element/drag-in-the-blank@10.1.10) (2026-08-13)
|
|
35
37
|
|
|
36
38
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
## [10.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.7...@pie-element/drag-in-the-blank@10.1.9) (2026-08-11)
|
|
39
41
|
|
|
40
42
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
## [10.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.7...@pie-element/drag-in-the-blank@10.1.8) (2026-07-31)
|
|
43
45
|
|
|
44
46
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
## [10.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.6...@pie-element/drag-in-the-blank@10.1.7) (2026-07-08)
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
## [10.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.5...@pie-element/drag-in-the-blank@10.1.6) (2026-07-02)
|
|
51
55
|
|
|
52
56
|
### Bug Fixes
|
|
53
57
|
|
|
54
|
-
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
55
|
-
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
56
|
-
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
57
|
-
- bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
|
|
58
58
|
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
59
|
-
-
|
|
59
|
+
- sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
|
|
60
|
+
|
|
61
|
+
## [10.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.4...@pie-element/drag-in-the-blank@10.1.5) (2026-06-22)
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
- bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
|
|
60
66
|
- **drag-in-the-blank:** update onChoiceDone to pass latest value from editor PIE-701 ([40b5dc6](https://github.com/pie-framework/pie-elements/commit/40b5dc6dbdf659db2adcfdfb139c4dd4fa06a2f9))
|
|
61
67
|
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
62
|
-
|
|
68
|
+
|
|
69
|
+
## [10.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.3...@pie-element/drag-in-the-blank@10.1.4) (2026-06-17)
|
|
70
|
+
|
|
71
|
+
### Bug Fixes
|
|
72
|
+
|
|
73
|
+
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
74
|
+
|
|
75
|
+
## [10.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.2...@pie-element/drag-in-the-blank@10.1.3) (2026-06-12)
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
80
|
+
|
|
81
|
+
## [10.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.1...@pie-element/drag-in-the-blank@10.1.2) (2026-06-04)
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
86
|
+
|
|
87
|
+
## [10.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.0...@pie-element/drag-in-the-blank@10.1.1) (2026-05-21)
|
|
88
|
+
|
|
89
|
+
**Note:** Version bump only for package @pie-element/drag-in-the-blank
|
|
63
90
|
|
|
64
91
|
# [10.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@10.1.0-next.1...@pie-element/drag-in-the-blank@10.1.0) (2026-05-21)
|
|
65
92
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,63 +3,87 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [9.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.2.1...@pie-element/drag-in-the-blank-configure@9.2.2) (2026-09-04)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- bump libs PIE-978, PIE-980 ([96489ba](https://github.com/pie-framework/pie-elements/commit/96489ba3c220604f21c3ce4500d79f4389266e9e))
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## [9.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.2.0...@pie-element/drag-in-the-blank-configure@9.2.1) (2026-08-26)
|
|
11
13
|
|
|
12
14
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
13
15
|
|
|
14
|
-
# [9.
|
|
16
|
+
# [9.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.11...@pie-element/drag-in-the-blank-configure@9.2.0) (2026-08-21)
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
### Bug Fixes
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
- move [@pie-lib](https://github.com/pie-lib) deps back to latest, off next prereleases PIE-927 ([a53e012](https://github.com/pie-framework/pie-elements/commit/a53e0127eb4ac95ece54e1e2bd669ae4974f4251))
|
|
21
|
+
- **theming:** move the grey palette reads onto --pie-\* tokens PIE-856 ([d7d005b](https://github.com/pie-framework/pie-elements/commit/d7d005bf081843335b4b0377852f2ecd075cb62d)), closes [#000000](https://github.com/pie-framework/pie-elements/issues/000000) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#646464](https://github.com/pie-framework/pie-elements/issues/646464) [#616161](https://github.com/pie-framework/pie-elements/issues/616161) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#C0C3](https://github.com/pie-framework/pie-elements/issues/C0C3)
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
### Features
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
- bump libs PIE-856, PIE-681, PIE-927 ([cb26d7a](https://github.com/pie-framework/pie-elements/commit/cb26d7afa6c99522533c321d5ff8ce3148a66e9e))
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
## [9.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.10...@pie-element/drag-in-the-blank-configure@9.1.11) (2026-08-19)
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
### Bug Fixes
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
- bump libs and shared modules PIE-681, PIE-708 ([08af8b5](https://github.com/pie-framework/pie-elements/commit/08af8b5802aecc8ee5454a1b6d60277d7ec94204))
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
## [9.1.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.8...@pie-element/drag-in-the-blank-configure@9.1.10) (2026-08-13)
|
|
31
34
|
|
|
32
35
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
## [9.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.7...@pie-element/drag-in-the-blank-configure@9.1.9) (2026-08-11)
|
|
35
38
|
|
|
36
39
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
## [9.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.7...@pie-element/drag-in-the-blank-configure@9.1.8) (2026-07-31)
|
|
39
42
|
|
|
40
43
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
## [9.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.6...@pie-element/drag-in-the-blank-configure@9.1.7) (2026-07-08)
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
### Bug Fixes
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
## [9.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.5...@pie-element/drag-in-the-blank-configure@9.1.6) (2026-07-02)
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
56
|
+
- sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
|
|
57
|
+
|
|
58
|
+
## [9.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.4...@pie-element/drag-in-the-blank-configure@9.1.5) (2026-06-22)
|
|
51
59
|
|
|
52
60
|
### Bug Fixes
|
|
53
61
|
|
|
54
|
-
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
55
|
-
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
56
|
-
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
57
62
|
- bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
|
|
58
|
-
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
59
|
-
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
60
63
|
- **drag-in-the-blank:** update onChoiceDone to pass latest value from editor PIE-701 ([40b5dc6](https://github.com/pie-framework/pie-elements/commit/40b5dc6dbdf659db2adcfdfb139c4dd4fa06a2f9))
|
|
61
64
|
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
62
|
-
|
|
65
|
+
|
|
66
|
+
## [9.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.3...@pie-element/drag-in-the-blank-configure@9.1.4) (2026-06-17)
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
71
|
+
|
|
72
|
+
## [9.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.2...@pie-element/drag-in-the-blank-configure@9.1.3) (2026-06-12)
|
|
73
|
+
|
|
74
|
+
### Bug Fixes
|
|
75
|
+
|
|
76
|
+
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
77
|
+
|
|
78
|
+
## [9.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.1...@pie-element/drag-in-the-blank-configure@9.1.2) (2026-06-04)
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
83
|
+
|
|
84
|
+
## [9.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.0...@pie-element/drag-in-the-blank-configure@9.1.1) (2026-05-21)
|
|
85
|
+
|
|
86
|
+
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
63
87
|
|
|
64
88
|
# [9.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@9.1.0-next.1...@pie-element/drag-in-the-blank-configure@9.1.0) (2026-05-21)
|
|
65
89
|
|
package/configure/lib/choice.js
CHANGED
|
@@ -12,6 +12,7 @@ var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
|
|
|
12
12
|
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
13
13
|
var _core = require("@dnd-kit/core");
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
15
16
|
var _markupUtils = require("./markupUtils");
|
|
16
17
|
const GripIcon = ({
|
|
17
18
|
style
|
|
@@ -41,7 +42,7 @@ const StyledChoice = (0, _styles.styled)('div', {
|
|
|
41
42
|
position: 'relative',
|
|
42
43
|
padding: '8px 35px 8px 35px',
|
|
43
44
|
cursor: 'grab',
|
|
44
|
-
border: `1px solid ${error ? '#f44336' :
|
|
45
|
+
border: `1px solid ${error ? '#f44336' : _renderUi.color.border()}`,
|
|
45
46
|
'& img': {
|
|
46
47
|
display: 'flex'
|
|
47
48
|
},
|
|
@@ -59,7 +60,7 @@ const StyledDeleteIcon = (0, _styles.styled)(_Delete.default)(({
|
|
|
59
60
|
position: 'absolute',
|
|
60
61
|
top: '6px',
|
|
61
62
|
right: '0',
|
|
62
|
-
color:
|
|
63
|
+
color: _renderUi.color.text(),
|
|
63
64
|
zIndex: 2,
|
|
64
65
|
'&:hover': {
|
|
65
66
|
cursor: 'pointer',
|
|
@@ -109,7 +110,7 @@ const BlankContent = props => {
|
|
|
109
110
|
position: 'absolute',
|
|
110
111
|
top: '6px',
|
|
111
112
|
left: '15px',
|
|
112
|
-
color:
|
|
113
|
+
color: _renderUi.color.borderGray(),
|
|
113
114
|
zIndex: 2
|
|
114
115
|
}
|
|
115
116
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_MoreVert","_Delete","_core","_styles","_markupUtils","GripIcon","style","default","createElement","margin","propTypes","PropTypes","object","StyledChoice","styled","shouldForwardProp","prop","includes","theme","error","display","minWidth","minHeight","background","palette","common","white","boxSizing","borderRadius","overflow","position","padding","cursor","border","fontSize","StyledDeleteIcon","Delete","top","right","
|
|
1
|
+
{"version":3,"file":"choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_MoreVert","_Delete","_core","_styles","_renderUi","_markupUtils","GripIcon","style","default","createElement","margin","propTypes","PropTypes","object","StyledChoice","styled","shouldForwardProp","prop","includes","theme","error","display","minWidth","minHeight","background","palette","common","white","boxSizing","borderRadius","overflow","position","padding","cursor","border","color","fontSize","StyledDeleteIcon","Delete","top","right","text","zIndex","black","BlankContent","props","choice","onClick","onRemoveChoice","instanceId","disabled","attributes","listeners","setNodeRef","isDragging","useDraggable","id","data","type","value","choiceIsEmpty","handleDragStart","e","preventDefault","alert","_extends2","ref","onDragStart","left","borderGray","dangerouslySetInnerHTML","__html","stopPropagation","exports","isRequired","func","bool","string","_default"],"sources":["../src/choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport MoreVert from '@mui/icons-material/MoreVert';\nimport Delete from '@mui/icons-material/Delete';\nimport { useDraggable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\nimport { choiceIsEmpty } from './markupUtils';\n\nconst GripIcon = ({ style }) => (\n <span style={style}>\n <MoreVert style={{ margin: '0 -16px' }} />\n <MoreVert />\n </span>\n);\n\nGripIcon.propTypes = {\n style: PropTypes.object,\n};\n\nconst StyledChoice = styled('div', {\n shouldForwardProp: (prop) => !['error', 'isDragging'].includes(prop),\n})(({ theme, error }) => ({\n display: 'inline-flex',\n minWidth: '178px',\n minHeight: '36px',\n background: theme.palette.common.white,\n boxSizing: 'border-box',\n borderRadius: '3px',\n overflow: 'hidden',\n position: 'relative',\n padding: '8px 35px 8px 35px',\n cursor: 'grab',\n border: `1px solid ${error ? '#f44336' : color.border()}`,\n '& img': {\n display: 'flex',\n },\n // browser adds extra marrgin for p tags by default\n '& p': {\n margin: 0,\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n}));\n\nconst StyledDeleteIcon = styled(Delete)(({ theme }) => ({\n position: 'absolute',\n top: '6px',\n right: '0',\n color: color.text(),\n zIndex: 2,\n '&:hover': {\n cursor: 'pointer',\n color: theme.palette.common.black,\n },\n}));\n\nexport const BlankContent = (props) => {\n const { choice, onClick, onRemoveChoice, error, instanceId, disabled } = props;\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: `choice-${choice.id}-${instanceId || 'default'}`,\n data: {\n type: 'drag-in-the-blank-choice',\n id: choice.id,\n value: choice,\n instanceId: instanceId,\n },\n disabled: disabled || choiceIsEmpty(choice),\n });\n\n const handleDragStart = (e) => {\n if (choiceIsEmpty(choice)) {\n e.preventDefault();\n alert('You need to define a value for an answer choice before it can be associated with a response area.');\n return;\n }\n };\n\n return (\n <StyledChoice\n ref={setNodeRef}\n error={error}\n isDragging={isDragging}\n onClick={onClick}\n {...attributes}\n {...listeners}\n onDragStart={handleDragStart}\n >\n <GripIcon\n style={{\n position: 'absolute',\n top: '6px',\n left: '15px',\n color: color.borderGray(),\n zIndex: 2,\n }}\n />\n\n <span dangerouslySetInnerHTML={{ __html: choice.value }} />\n\n <StyledDeleteIcon\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n\n onRemoveChoice(e);\n }}\n />\n </StyledChoice>\n );\n};\n\nBlankContent.propTypes = {\n choice: PropTypes.object.isRequired,\n onClick: PropTypes.func,\n onRemoveChoice: PropTypes.func.isRequired,\n error: PropTypes.bool,\n instanceId: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nexport default BlankContent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAEA,MAAMQ,QAAQ,GAAGA,CAAC;EAAEC;AAAM,CAAC,kBACzBX,MAAA,CAAAY,OAAA,CAAAC,aAAA;EAAMF,KAAK,EAAEA;AAAM,gBACjBX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACT,SAAA,CAAAQ,OAAQ;EAAC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,EAAE,KAAK;MACV6B,IAAI,EAAE,MAAM;MACZjC,KAAK,EAAEA,eAAK,CAACkC,UAAU,CAAC,CAAC;MACzB3B,MAAM,EAAE;IACV;EAAE,CACH,CAAC,eAEF9C,MAAA,CAAAY,OAAA,CAAAC,aAAA;IAAM6D,uBAAuB,EAAE;MAAEC,MAAM,EAAEzB,MAAM,CAACa;IAAM;EAAE,CAAE,CAAC,eAE3D/D,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAAC4B,gBAAgB;IACfU,OAAO,EAAGe,CAAC,IAAK;MACdA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBD,CAAC,CAACU,eAAe,CAAC,CAAC;MAEnBxB,cAAc,CAACc,CAAC,CAAC;IACnB;EAAE,CACH,CACW,CAAC;AAEnB,CAAC;AAACW,OAAA,CAAA7B,YAAA,GAAAA,YAAA;AAEFA,YAAY,CAACjC,SAAS,GAAG;EACvBmC,MAAM,EAAElC,kBAAS,CAACC,MAAM,CAAC6D,UAAU;EACnC3B,OAAO,EAAEnC,kBAAS,CAAC+D,IAAI;EACvB3B,cAAc,EAAEpC,kBAAS,CAAC+D,IAAI,CAACD,UAAU;EACzCtD,KAAK,EAAER,kBAAS,CAACgE,IAAI;EACrB3B,UAAU,EAAErC,kBAAS,CAACiE,MAAM;EAC5B3B,QAAQ,EAAEtC,kBAAS,CAACgE;AACtB,CAAC;AAAC,IAAAE,QAAA,GAAAL,OAAA,CAAAjE,OAAA,GAEaoC,YAAY","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/drag-in-the-blank-configure",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"@mui/icons-material": "^7.3.4",
|
|
13
13
|
"@mui/material": "^7.3.4",
|
|
14
14
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
15
|
-
"@pie-lib/config-ui": "13.
|
|
16
|
-
"@pie-lib/drag": "4.
|
|
17
|
-
"@pie-lib/editable-html-tip-tap": "2.
|
|
15
|
+
"@pie-lib/config-ui": "13.0.19",
|
|
16
|
+
"@pie-lib/drag": "4.1.3",
|
|
17
|
+
"@pie-lib/editable-html-tip-tap": "2.1.17",
|
|
18
18
|
"@pie-lib/math-rendering": "5.1.0",
|
|
19
19
|
"debug": "^4.1.1",
|
|
20
20
|
"lodash-es": "^4.17.23",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,56 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [9.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.2...@pie-element/drag-in-the-blank-controller@9.1.4) (2026-08-13)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## [9.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.2...@pie-element/drag-in-the-blank-controller@9.1.3) (2026-08-11)
|
|
11
11
|
|
|
12
12
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## [9.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.1...@pie-element/drag-in-the-blank-controller@9.1.2) (2026-07-02)
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# [9.4.0-beta.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.4.0-beta.4...@pie-element/drag-in-the-blank-controller@9.4.0-beta.5) (2026-08-11)
|
|
19
|
-
|
|
20
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
21
|
-
|
|
22
|
-
# [9.4.0-beta.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.4.0-beta.3...@pie-element/drag-in-the-blank-controller@9.4.0-beta.4) (2026-08-11)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
25
|
-
|
|
26
|
-
# [9.4.0-beta.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.4.0-beta.2...@pie-element/drag-in-the-blank-controller@9.4.0-beta.3) (2026-08-11)
|
|
27
|
-
|
|
28
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
29
|
-
|
|
30
|
-
# [9.4.0-beta.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.4.0-beta.1...@pie-element/drag-in-the-blank-controller@9.4.0-beta.2) (2026-08-11)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
33
|
-
|
|
34
|
-
# [9.4.0-beta.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.4.0-beta.0...@pie-element/drag-in-the-blank-controller@9.4.0-beta.1) (2026-08-07)
|
|
35
|
-
|
|
36
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
37
|
-
|
|
38
|
-
# [9.4.0-beta.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.3.0-beta.0...@pie-element/drag-in-the-blank-controller@9.4.0-beta.0) (2026-08-07)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
41
|
-
|
|
42
|
-
# [9.3.0-beta.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.3.0-beta.0...@pie-element/drag-in-the-blank-controller@9.3.0-beta.1) (2026-08-07)
|
|
16
|
+
### Bug Fixes
|
|
43
17
|
|
|
44
|
-
|
|
18
|
+
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
45
19
|
|
|
46
|
-
|
|
20
|
+
## [9.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.0...@pie-element/drag-in-the-blank-controller@9.1.1) (2026-05-21)
|
|
47
21
|
|
|
48
22
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
|
49
23
|
|
|
50
|
-
# [9.2.0-beta.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.0...@pie-element/drag-in-the-blank-controller@9.2.0-beta.0) (2026-08-07)
|
|
51
|
-
|
|
52
|
-
### Bug Fixes
|
|
53
|
-
|
|
54
|
-
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
55
|
-
|
|
56
24
|
# [9.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@9.1.0-next.1...@pie-element/drag-in-the-blank-controller@9.1.0) (2026-05-21)
|
|
57
25
|
|
|
58
26
|
### Bug Fixes
|
package/controller/package.json
CHANGED
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const isComplete = (session, model, audioComplete, elementContext) => {
|
|
|
21
21
|
if (autoplayAudioEnabled && completeAudioEnabled && !audioComplete) {
|
|
22
22
|
if (elementContext) {
|
|
23
23
|
const audio = elementContext.querySelector('audio');
|
|
24
|
-
const isInsidePrompt = audio && audio.closest('
|
|
24
|
+
const isInsidePrompt = audio && audio.closest('.preview-prompt');
|
|
25
25
|
|
|
26
26
|
// only require audio completion if audio exists and is inside the prompt
|
|
27
27
|
if (audio && isInsidePrompt) {
|
|
@@ -116,7 +116,7 @@ class DragInTheBlank extends HTMLElement {
|
|
|
116
116
|
if (mutation.type === 'childList') {
|
|
117
117
|
if (this._audioInitialized) return;
|
|
118
118
|
const audio = this.querySelector('audio');
|
|
119
|
-
const isInsidePrompt = audio && audio.closest('
|
|
119
|
+
const isInsidePrompt = audio && audio.closest('.preview-prompt');
|
|
120
120
|
if (!this._model) return;
|
|
121
121
|
if (!this._model.autoplayAudioEnabled) return;
|
|
122
122
|
if (audio && !isInsidePrompt) return;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_mathRendering","_renderUi","_piePlayerEvents","_main","isComplete","session","model","audioComplete","elementContext","autoplayAudioEnabled","completeAudioEnabled","responseAreasToBeFilled","audio","querySelector","isInsidePrompt","closest","value","filledResponseAreas","Object","values","filter","val","length","exports","DragInTheBlank","HTMLElement","constructor","_defineProperty2","default","_model","_session","elem","React","createElement","Main","onChange","changeSession","_root","createRoot","render","setTimeout","renderMath","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","selector","dispatchChangedEvent","_render","_audioInitialized","m","ModelSetEvent","s","_createAudioInfoToast","info","document","id","assign","style","position","top","width","height","display","justifyContent","alignItems","background","zIndex","cursor","img","src","EnableAudioAutoplayImage","alt","appendChild","connectedCallback","observer","MutationObserver","mutationsList","forEach","mutation","type","container","enableAudio","play","removeChild","removeEventListener","paused","addEventListener","handlePlaying","audioStartTime","Date","getTime","handleEnded","audioEndTime","waitTime","_audio","_handlePlaying","_handleEnded","_enableAudio","disconnect","observe","childList","subtree","disconnectedCallback","unmount"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { EnableAudioAutoplayImage } from '@pie-lib/render-ui';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\n\nexport const isComplete = (session, model, audioComplete, elementContext) => {\n const { autoplayAudioEnabled, completeAudioEnabled, responseAreasToBeFilled } = model || {};\n\n if (autoplayAudioEnabled && completeAudioEnabled && !audioComplete) {\n if (elementContext) {\n const audio = elementContext.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('#preview-prompt');\n\n // only require audio completion if audio exists and is inside the prompt\n if (audio && isInsidePrompt) {\n return false;\n }\n }\n }\n\n if (!session || !session.value) {\n return false;\n }\n\n const filledResponseAreas = Object.values(session.value || {}).filter((val) => !!val).length;\n\n return filledResponseAreas >= responseAreasToBeFilled;\n};\n\nexport default class DragInTheBlank extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n this._audioInitialized = false;\n this.audioComplete = false;\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(\n this.tagName.toLowerCase(),\n isComplete(this._session, this._model, this.audioComplete, this),\n !!this._model,\n ),\n );\n // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio\n this._audioInitialized = false;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n value: this._session.value,\n onChange: this.changeSession,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n setTimeout(() => renderMath(this), 0);\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n isComplete(this._session, this._model, this.audioComplete, this),\n ),\n );\n };\n\n changeSession = (value) => {\n this.session.value = value;\n this.session.selector = 'Mouse';\n\n this.dispatchChangedEvent();\n this._render();\n };\n\n _createAudioInfoToast() {\n const info = document.createElement('div');\n info.id = 'play-audio-info';\n\n Object.assign(info.style, {\n position: 'absolute',\n top: 0,\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n background: 'white',\n zIndex: '1000',\n cursor: 'pointer',\n });\n\n const img = document.createElement('img');\n img.src = EnableAudioAutoplayImage;\n img.alt = 'Click anywhere to enable audio autoplay';\n img.width = 500;\n img.height = 300;\n\n info.appendChild(img);\n return info;\n }\n\n connectedCallback() {\n this._render();\n\n // Observation: audio in Chrome will have the autoplay attribute,\n // while other browsers will not have the autoplay attribute and will need a user interaction to play the audio\n // This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox\n const observer = new MutationObserver((mutationsList, observer) => {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n if (this._audioInitialized) return;\n const audio = this.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('#preview-prompt');\n\n if (!this._model) return;\n if (!this._model.autoplayAudioEnabled) return;\n if (audio && !isInsidePrompt) return;\n if (!audio) return;\n\n const info = this._createAudioInfoToast();\n const container = this.querySelector('#main-container');\n const enableAudio = () => {\n if (this.querySelector('#play-audio-info')) {\n audio.play();\n container.removeChild(info);\n }\n\n document.removeEventListener('click', enableAudio);\n };\n\n // if the audio is paused, it means the user has not interacted with the page yet and the audio will not play\n // FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked\n setTimeout(() => {\n if (audio.paused && !this.querySelector('#play-audio-info')) {\n // add info message as a toast to enable audio playback\n container.appendChild(info);\n document.addEventListener('click', enableAudio);\n } else {\n document.removeEventListener('click', enableAudio);\n }\n }, 500);\n\n // we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering\n const handlePlaying = () => {\n //timestamp when auto-played audio started playing\n this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();\n\n const info = this.querySelector('#play-audio-info');\n if (info) {\n container.removeChild(info);\n }\n\n audio.removeEventListener('playing', handlePlaying);\n };\n\n audio.addEventListener('playing', handlePlaying);\n\n // we need to listen for the ended event to update the isComplete state\n const handleEnded = () => {\n //timestamp when auto-played audio completed playing\n this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();\n\n let { audioStartTime, audioEndTime, waitTime } = this._session;\n if (!waitTime && audioStartTime && audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n this._session.waitTime = audioEndTime - audioStartTime;\n }\n\n this.audioComplete = true;\n this.dispatchChangedEvent();\n audio.removeEventListener('ended', handleEnded);\n };\n\n audio.addEventListener('ended', handleEnded);\n\n // store references to remove later\n this._audio = audio;\n this._handlePlaying = handlePlaying;\n this._handleEnded = handleEnded;\n this._enableAudio = enableAudio;\n // set to true to prevent multiple initializations\n this._audioInitialized = true;\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe(this, { childList: true, subtree: true });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this._enableAudio);\n\n if (this._audio) {\n this._audio.removeEventListener('playing', this._handlePlaying);\n this._audio.removeEventListener('ended', this._handleEnded);\n this._audio = null;\n }\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEO,MAAMM,UAAU,GAAGA,CAACC,OAAO,EAAEC,KAAK,EAAEC,aAAa,EAAEC,cAAc,KAAK;EAC3E,MAAM;IAAEC,oBAAoB;IAAEC,oBAAoB;IAAEC;EAAwB,CAAC,GAAGL,KAAK,IAAI,CAAC,CAAC;EAE3F,IAAIG,oBAAoB,IAAIC,oBAAoB,IAAI,CAACH,aAAa,EAAE;IAClE,IAAIC,cAAc,EAAE;MAClB,MAAMI,KAAK,GAAGJ,cAAc,CAACK,aAAa,CAAC,OAAO,CAAC;MACnD,MAAMC,cAAc,GAAGF,KAAK,IAAIA,KAAK,CAACG,OAAO,CAAC,iBAA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IAAI,IAAI,CAACH,MAAM,EAAE;MACf,IAAI,CAACA,MAAM,CAACV,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAACW,cAAc,CAAC;MAC/D,IAAI,CAACD,MAAM,CAACV,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAACY,YAAY,CAAC;MAC3D,IAAI,CAACF,MAAM,GAAG,IAAI;IACpB;IAEA,IAAI,IAAI,CAAC1D,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACmE,OAAO,CAAC,CAAC;MACpB,IAAI,CAACnE,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACd,OAAA,CAAAK,OAAA,GAAAJ,cAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_mathRendering","_renderUi","_piePlayerEvents","_main","isComplete","session","model","audioComplete","elementContext","autoplayAudioEnabled","completeAudioEnabled","responseAreasToBeFilled","audio","querySelector","isInsidePrompt","closest","value","filledResponseAreas","Object","values","filter","val","length","exports","DragInTheBlank","HTMLElement","constructor","_defineProperty2","default","_model","_session","elem","React","createElement","Main","onChange","changeSession","_root","createRoot","render","setTimeout","renderMath","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","selector","dispatchChangedEvent","_render","_audioInitialized","m","ModelSetEvent","s","_createAudioInfoToast","info","document","id","assign","style","position","top","width","height","display","justifyContent","alignItems","background","zIndex","cursor","img","src","EnableAudioAutoplayImage","alt","appendChild","connectedCallback","observer","MutationObserver","mutationsList","forEach","mutation","type","container","enableAudio","play","removeChild","removeEventListener","paused","addEventListener","handlePlaying","audioStartTime","Date","getTime","handleEnded","audioEndTime","waitTime","_audio","_handlePlaying","_handleEnded","_enableAudio","disconnect","observe","childList","subtree","disconnectedCallback","unmount"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { EnableAudioAutoplayImage } from '@pie-lib/render-ui';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\n\nexport const isComplete = (session, model, audioComplete, elementContext) => {\n const { autoplayAudioEnabled, completeAudioEnabled, responseAreasToBeFilled } = model || {};\n\n if (autoplayAudioEnabled && completeAudioEnabled && !audioComplete) {\n if (elementContext) {\n const audio = elementContext.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('.preview-prompt');\n\n // only require audio completion if audio exists and is inside the prompt\n if (audio && isInsidePrompt) {\n return false;\n }\n }\n }\n\n if (!session || !session.value) {\n return false;\n }\n\n const filledResponseAreas = Object.values(session.value || {}).filter((val) => !!val).length;\n\n return filledResponseAreas >= responseAreasToBeFilled;\n};\n\nexport default class DragInTheBlank extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n this._audioInitialized = false;\n this.audioComplete = false;\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(\n this.tagName.toLowerCase(),\n isComplete(this._session, this._model, this.audioComplete, this),\n !!this._model,\n ),\n );\n // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio\n this._audioInitialized = false;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n value: this._session.value,\n onChange: this.changeSession,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n setTimeout(() => renderMath(this), 0);\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n isComplete(this._session, this._model, this.audioComplete, this),\n ),\n );\n };\n\n changeSession = (value) => {\n this.session.value = value;\n this.session.selector = 'Mouse';\n\n this.dispatchChangedEvent();\n this._render();\n };\n\n _createAudioInfoToast() {\n const info = document.createElement('div');\n info.id = 'play-audio-info';\n\n Object.assign(info.style, {\n position: 'absolute',\n top: 0,\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n background: 'white',\n zIndex: '1000',\n cursor: 'pointer',\n });\n\n const img = document.createElement('img');\n img.src = EnableAudioAutoplayImage;\n img.alt = 'Click anywhere to enable audio autoplay';\n img.width = 500;\n img.height = 300;\n\n info.appendChild(img);\n return info;\n }\n\n connectedCallback() {\n this._render();\n\n // Observation: audio in Chrome will have the autoplay attribute,\n // while other browsers will not have the autoplay attribute and will need a user interaction to play the audio\n // This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox\n const observer = new MutationObserver((mutationsList, observer) => {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n if (this._audioInitialized) return;\n const audio = this.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('.preview-prompt');\n\n if (!this._model) return;\n if (!this._model.autoplayAudioEnabled) return;\n if (audio && !isInsidePrompt) return;\n if (!audio) return;\n\n const info = this._createAudioInfoToast();\n const container = this.querySelector('#main-container');\n const enableAudio = () => {\n if (this.querySelector('#play-audio-info')) {\n audio.play();\n container.removeChild(info);\n }\n\n document.removeEventListener('click', enableAudio);\n };\n\n // if the audio is paused, it means the user has not interacted with the page yet and the audio will not play\n // FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked\n setTimeout(() => {\n if (audio.paused && !this.querySelector('#play-audio-info')) {\n // add info message as a toast to enable audio playback\n container.appendChild(info);\n document.addEventListener('click', enableAudio);\n } else {\n document.removeEventListener('click', enableAudio);\n }\n }, 500);\n\n // we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering\n const handlePlaying = () => {\n //timestamp when auto-played audio started playing\n this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();\n\n const info = this.querySelector('#play-audio-info');\n if (info) {\n container.removeChild(info);\n }\n\n audio.removeEventListener('playing', handlePlaying);\n };\n\n audio.addEventListener('playing', handlePlaying);\n\n // we need to listen for the ended event to update the isComplete state\n const handleEnded = () => {\n //timestamp when auto-played audio completed playing\n this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();\n\n let { audioStartTime, audioEndTime, waitTime } = this._session;\n if (!waitTime && audioStartTime && audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n this._session.waitTime = audioEndTime - audioStartTime;\n }\n\n this.audioComplete = true;\n this.dispatchChangedEvent();\n audio.removeEventListener('ended', handleEnded);\n };\n\n audio.addEventListener('ended', handleEnded);\n\n // store references to remove later\n this._audio = audio;\n this._handlePlaying = handlePlaying;\n this._handleEnded = handleEnded;\n this._enableAudio = enableAudio;\n // set to true to prevent multiple initializations\n this._audioInitialized = true;\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe(this, { childList: true, subtree: true });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this._enableAudio);\n\n if (this._audio) {\n this._audio.removeEventListener('playing', this._handlePlaying);\n this._audio.removeEventListener('ended', this._handleEnded);\n this._audio = null;\n }\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEO,MAAMM,UAAU,GAAGA,CAACC,OAAO,EAAEC,KAAK,EAAEC,aAAa,EAAEC,cAAc,KAAK;EAC3E,MAAM;IAAEC,oBAAoB;IAAEC,oBAAoB;IAAEC;EAAwB,CAAC,GAAGL,KAAK,IAAI,CAAC,CAAC;EAE3F,IAAIG,oBAAoB,IAAIC,oBAAoB,IAAI,CAACH,aAAa,EAAE;IAClE,IAAIC,cAAc,EAAE;MAClB,MAAMI,KAAK,GAAGJ,cAAc,CAACK,aAAa,CAAC,OAAO,CAAC;MACnD,MAAMC,cAAc,GAAGF,KAAK,IAAIA,KAAK,CAACG,OAAO,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AAC;IAExD,IAAI,IAAI,CAACH,MAAM,EAAE;MACf,IAAI,CAACA,MAAM,CAACV,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAACW,cAAc,CAAC;MAC/D,IAAI,CAACD,MAAM,CAACV,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAACY,YAAY,CAAC;MAC3D,IAAI,CAACF,MAAM,GAAG,IAAI;IACpB;IAEA,IAAI,IAAI,CAAC1D,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACmE,OAAO,CAAC,CAAC;MACpB,IAAI,CAACnE,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACd,OAAA,CAAAK,OAAA,GAAAJ,cAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "10.2.2
|
|
7
|
+
"version": "10.2.2",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postpublish": "../../scripts/postpublish"
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"@mui/icons-material": "^7.3.4",
|
|
16
16
|
"@mui/material": "^7.3.4",
|
|
17
17
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
18
|
-
"@pie-lib/correct-answer-toggle": "4.0.
|
|
19
|
-
"@pie-lib/drag": "4.
|
|
20
|
-
"@pie-lib/mask-markup": "3.1.
|
|
18
|
+
"@pie-lib/correct-answer-toggle": "4.0.8",
|
|
19
|
+
"@pie-lib/drag": "4.1.3",
|
|
20
|
+
"@pie-lib/mask-markup": "3.1.2",
|
|
21
21
|
"@pie-lib/math-rendering": "5.1.0",
|
|
22
|
-
"@pie-lib/render-ui": "
|
|
22
|
+
"@pie-lib/render-ui": "7.0.2",
|
|
23
23
|
"lodash-es": "^4.17.23",
|
|
24
24
|
"prop-types": "^15.8.1",
|
|
25
25
|
"react": "18.3.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"author": "",
|
|
29
29
|
"license": "ISC",
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "2976324c2d55b1d41f54aadc9b8f493b3ae839b2",
|
|
31
31
|
"main": "lib/index.js",
|
|
32
32
|
"module": "src/index.js"
|
|
33
33
|
}
|