@pie-element/match-list 7.1.1 → 7.1.2-next.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.
- package/controller.js +1 -0
- package/dist/browser/controller/index.js +201 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +14088 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/isEmpty-Eo-n7WSl.js +387 -0
- package/dist/browser/isEmpty-Eo-n7WSl.js.map +1 -0
- package/dist/controller/defaults.d.ts +17 -0
- package/dist/controller/defaults.js +9 -0
- package/dist/controller/index.d.ts +38 -0
- package/dist/controller/index.js +105 -0
- package/dist/delivery/answer-area.d.ts +27 -0
- package/dist/delivery/answer-area.js +94 -0
- package/dist/delivery/answer.d.ts +40 -0
- package/dist/delivery/answer.js +176 -0
- package/dist/delivery/arrow.d.ts +17 -0
- package/dist/delivery/arrow.js +35 -0
- package/dist/delivery/choices-list.d.ts +21 -0
- package/dist/delivery/choices-list.js +37 -0
- package/dist/delivery/droppable-placeholder.d.ts +24 -0
- package/dist/delivery/droppable-placeholder.js +42 -0
- package/dist/delivery/index.d.ts +21 -0
- package/dist/delivery/index.js +49 -0
- package/dist/delivery/main.d.ts +26 -0
- package/dist/delivery/main.js +149 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindKey.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js +26 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js +18 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findKey.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js +9 -0
- package/package.json +62 -18
- package/CHANGELOG.json +0 -572
- package/CHANGELOG.md +0 -1489
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/controller/CHANGELOG.json +0 -242
- package/controller/CHANGELOG.md +0 -1047
- package/controller/lib/defaults.js +0 -15
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -246
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -25
- package/docs/config-schema.json +0 -70
- package/docs/config-schema.json.md +0 -55
- package/docs/demo/config.js +0 -34
- package/docs/demo/generate.js +0 -54
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -170
- package/docs/pie-schema.json.md +0 -104
- package/lib/answer-area.js +0 -168
- package/lib/answer-area.js.map +0 -1
- package/lib/answer.js +0 -267
- package/lib/answer.js.map +0 -1
- package/lib/arrow.js +0 -57
- package/lib/arrow.js.map +0 -1
- package/lib/choices-list.js +0 -60
- package/lib/choices-list.js.map +0 -1
- package/lib/droppable-placeholder.js +0 -60
- package/lib/droppable-placeholder.js.map +0 -1
- package/lib/index.js +0 -86
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -220
- package/lib/main.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import e from "./main.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { createRoot as n } from "react-dom/client";
|
|
4
|
+
import r from "debug";
|
|
5
|
+
import { SessionChangedEvent as i } from "@pie-element/shared-player-events";
|
|
6
|
+
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
7
|
+
//#region src/delivery/index.ts
|
|
8
|
+
var o = r("pie-ui:graph-lines"), s = (e, t) => {
|
|
9
|
+
if (!e) return !1;
|
|
10
|
+
let n = e.value, r = !0;
|
|
11
|
+
return n && (t.config.prompts || []).forEach((e) => {
|
|
12
|
+
Number.isFinite(n[e.id]) || (r = !1);
|
|
13
|
+
}), r;
|
|
14
|
+
}, c = class extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(), this._root = null;
|
|
17
|
+
}
|
|
18
|
+
set model(e) {
|
|
19
|
+
this._model = e, this._render();
|
|
20
|
+
}
|
|
21
|
+
set session(e) {
|
|
22
|
+
this._session = e, this._render();
|
|
23
|
+
}
|
|
24
|
+
get session() {
|
|
25
|
+
return this._session;
|
|
26
|
+
}
|
|
27
|
+
sessionChanged(e) {
|
|
28
|
+
this._session.value = e.value, this.dispatchEvent(new i(this.tagName.toLowerCase(), s(this._session, this._model))), o("session: ", this._session), this._render();
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
this._render();
|
|
32
|
+
}
|
|
33
|
+
_render() {
|
|
34
|
+
if (!this._model || !this._session) return;
|
|
35
|
+
let r = t.createElement(e, {
|
|
36
|
+
model: this._model,
|
|
37
|
+
session: this._session,
|
|
38
|
+
onSessionChange: this.sessionChanged.bind(this)
|
|
39
|
+
});
|
|
40
|
+
this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
41
|
+
a(this);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
disconnectedCallback() {
|
|
45
|
+
this._root && this._root.unmount();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { e as Component, c as default, s as isComplete };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/main.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class Main extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
session: PropTypes.Validator<object>;
|
|
14
|
+
onSessionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
model: PropTypes.Validator<object>;
|
|
16
|
+
prompt: PropTypes.Requireable<string>;
|
|
17
|
+
};
|
|
18
|
+
constructor(props: any);
|
|
19
|
+
onRemoveAnswer(id: any): void;
|
|
20
|
+
onDragStart: any;
|
|
21
|
+
onPlaceAnswer: any;
|
|
22
|
+
toggleShowCorrect: any;
|
|
23
|
+
renderDragOverlay: any;
|
|
24
|
+
render(): React.JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
export default Main;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findKey.js";
|
|
2
|
+
import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js";
|
|
3
|
+
import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js";
|
|
4
|
+
import { Answer as r } from "./answer.js";
|
|
5
|
+
import i from "./answer-area.js";
|
|
6
|
+
import a from "./choices-list.js";
|
|
7
|
+
import o from "react";
|
|
8
|
+
import s from "prop-types";
|
|
9
|
+
import { swap as c } from "@pie-lib/drag";
|
|
10
|
+
import { DndContext as l, DragOverlay as u } from "@dnd-kit/core";
|
|
11
|
+
import { restrictToFirstScrollableAncestor as d } from "@dnd-kit/modifiers";
|
|
12
|
+
import f from "@pie-lib/correct-answer-toggle";
|
|
13
|
+
import * as p from "@pie-lib/render-ui";
|
|
14
|
+
import { Feedback as m, PreviewPrompt as h, color as g } from "@pie-lib/render-ui";
|
|
15
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
16
|
+
import { styled as y } from "@mui/material/styles";
|
|
17
|
+
//#region src/delivery/main.tsx
|
|
18
|
+
function b(e) {
|
|
19
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
20
|
+
}
|
|
21
|
+
function x(e, t) {
|
|
22
|
+
return !e || b(e) ? e : b(e.default) ? e.default : t && b(e[t]) ? e[t] : t && b(e[t]?.default) ? e[t].default : e;
|
|
23
|
+
}
|
|
24
|
+
var S = x(h, "PreviewPrompt") || x(E.PreviewPrompt, "PreviewPrompt"), C = x(m, "Feedback") || x(E.Feedback, "Feedback"), w = p, T = w.default, E = T && typeof T == "object" ? T : w, D = y("div")({
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
color: g.text(),
|
|
29
|
+
backgroundColor: g.background()
|
|
30
|
+
}), O = class extends o.Component {
|
|
31
|
+
static propTypes = {
|
|
32
|
+
session: s.object.isRequired,
|
|
33
|
+
onSessionChange: s.func,
|
|
34
|
+
model: s.object.isRequired,
|
|
35
|
+
prompt: s.string
|
|
36
|
+
};
|
|
37
|
+
constructor(e) {
|
|
38
|
+
super(e), this.instanceId = n(), this.state = {
|
|
39
|
+
showCorrectAnswer: !1,
|
|
40
|
+
draggingElement: null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
onRemoveAnswer(e) {
|
|
44
|
+
let { session: t, onSessionChange: n } = this.props;
|
|
45
|
+
t.value[e] = void 0, n(t);
|
|
46
|
+
}
|
|
47
|
+
onDragStart = (e) => {
|
|
48
|
+
let { active: t } = e;
|
|
49
|
+
if (t?.data?.current) {
|
|
50
|
+
let e = null, n = t.node?.current;
|
|
51
|
+
if (n) {
|
|
52
|
+
let { width: t, height: r } = n.getBoundingClientRect();
|
|
53
|
+
e = {
|
|
54
|
+
width: t,
|
|
55
|
+
height: r
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
this.setState({ draggingElement: {
|
|
59
|
+
...t.data.current,
|
|
60
|
+
rect: e
|
|
61
|
+
} });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
onPlaceAnswer = (n) => {
|
|
65
|
+
this.setState({ draggingElement: null });
|
|
66
|
+
let { active: r, over: i } = n;
|
|
67
|
+
if (!r) return;
|
|
68
|
+
let a = r.data.current, o = i?.data.current;
|
|
69
|
+
if (!a) return;
|
|
70
|
+
let { session: s, onSessionChange: l, model: u } = this.props, { config: { duplicates: d } } = u;
|
|
71
|
+
if (t(s.value) && (s.value = {}), o.type === "choices-pool" && a.promptId !== void 0) {
|
|
72
|
+
s.value[a.promptId] = void 0, l(s);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let f = a.id, p = a.promptId;
|
|
76
|
+
if (o && o.type === "drop-zone" && o.promptId != null) {
|
|
77
|
+
let t = o.promptId;
|
|
78
|
+
if (a.type === "choice" && o.type === "drop-zone" && t !== void 0) {
|
|
79
|
+
let n = e(s.value, (e) => e === f);
|
|
80
|
+
n && !d ? s.value = c(s.value, n, t) : s.value[t] = f;
|
|
81
|
+
} else if (a.type === "target" && p != null && p !== t) {
|
|
82
|
+
let e = s.value[t] != null;
|
|
83
|
+
if (e && !d) {
|
|
84
|
+
let e = s.value[t];
|
|
85
|
+
s.value[t] = f, s.value[p] = e;
|
|
86
|
+
} else e || (s.value[t] = f, delete s.value[p]);
|
|
87
|
+
}
|
|
88
|
+
l(s);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
toggleShowCorrect = () => {
|
|
92
|
+
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
93
|
+
};
|
|
94
|
+
renderDragOverlay = () => {
|
|
95
|
+
let { draggingElement: e } = this.state;
|
|
96
|
+
return e ? /* @__PURE__ */ _(r, {
|
|
97
|
+
id: e.id,
|
|
98
|
+
title: e.value,
|
|
99
|
+
disabled: !1,
|
|
100
|
+
isDragging: !1,
|
|
101
|
+
style: e.rect ? {
|
|
102
|
+
width: e.rect.width,
|
|
103
|
+
height: e.rect.height,
|
|
104
|
+
boxSizing: "border-box"
|
|
105
|
+
} : {}
|
|
106
|
+
}) : null;
|
|
107
|
+
};
|
|
108
|
+
render() {
|
|
109
|
+
let { showCorrectAnswer: e } = this.state, { model: t, session: n } = this.props, { config: r, mode: o } = t, { prompt: s, language: c } = r;
|
|
110
|
+
return /* @__PURE__ */ v(l, {
|
|
111
|
+
onDragStart: this.onDragStart,
|
|
112
|
+
onDragEnd: this.onPlaceAnswer,
|
|
113
|
+
modifiers: [d],
|
|
114
|
+
children: [/* @__PURE__ */ v(D, { children: [
|
|
115
|
+
/* @__PURE__ */ _(S, {
|
|
116
|
+
className: "prompt",
|
|
117
|
+
prompt: s
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ _(f, {
|
|
120
|
+
show: o === "evaluate",
|
|
121
|
+
toggled: e,
|
|
122
|
+
onToggle: this.toggleShowCorrect,
|
|
123
|
+
language: c
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ _(i, {
|
|
126
|
+
instanceId: this.instanceId,
|
|
127
|
+
model: t,
|
|
128
|
+
session: n,
|
|
129
|
+
onRemoveAnswer: (e) => this.onRemoveAnswer(e),
|
|
130
|
+
disabled: o !== "gather",
|
|
131
|
+
showCorrect: e
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ _(a, {
|
|
134
|
+
instanceId: this.instanceId,
|
|
135
|
+
model: t,
|
|
136
|
+
session: n,
|
|
137
|
+
disabled: o !== "gather",
|
|
138
|
+
onRemoveAnswer: (e) => this.onRemoveAnswer(e)
|
|
139
|
+
}),
|
|
140
|
+
t.correctness && t.feedback && !e && /* @__PURE__ */ _(C, {
|
|
141
|
+
correctness: t.correctness.correctness,
|
|
142
|
+
feedback: t.feedback
|
|
143
|
+
})
|
|
144
|
+
] }), /* @__PURE__ */ _(u, { children: this.renderDragOverlay() })]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
149
|
+
export { O as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './delivery/index.js';
|