@pie-element/ebsr 14.2.1-next.2 → 14.2.1-next.29
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.json +1547 -0
- package/CHANGELOG.md +2281 -0
- package/LICENSE.md +5 -0
- package/README.md +62 -0
- package/configure/CHANGELOG.json +992 -0
- package/configure/CHANGELOG.md +2144 -0
- package/configure/lib/defaults.js +229 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +154 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +222 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.js +492 -0
- package/configure/src/defaults.js +173 -0
- package/configure/src/index.js +174 -0
- package/configure/src/main.jsx +235 -0
- package/controller/CHANGELOG.json +552 -0
- package/controller/CHANGELOG.md +1282 -0
- package/controller/lib/defaults.js +31 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +448 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +18 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/controller/src/__tests__/index.test.js +591 -0
- package/controller/src/__tests__/utils.test.js +48 -0
- package/controller/src/defaults.js +25 -0
- package/controller/src/index.js +442 -0
- package/controller/src/utils.js +18 -0
- package/docs/config-schema.json +5787 -0
- package/docs/config-schema.json.md +4278 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +52 -0
- package/docs/demo/index.html +2 -0
- package/docs/demo/session.js +14 -0
- package/docs/pie-schema.json +2911 -0
- package/docs/pie-schema.json.md +2142 -0
- package/ebsr.png +0 -0
- package/lib/index.js +207 -0
- package/lib/index.js.map +1 -0
- package/lib/print.js +186 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +5664 -0
- package/module/demo.js +77 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +115 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +17 -56
- package/src/__tests__/index.test.js +129 -0
- package/src/index.js +222 -0
- package/src/print.js +207 -0
- package/dist/author/defaults.d.ts +0 -66
- package/dist/author/defaults.js +0 -161
- package/dist/author/index.d.ts +0 -34
- package/dist/author/index.js +0 -78
- package/dist/author/main.d.ts +0 -22
- package/dist/author/main.js +0 -121
- package/dist/controller/defaults.d.ts +0 -15
- package/dist/controller/defaults.js +0 -26
- package/dist/controller/index.d.ts +0 -42
- package/dist/controller/index.js +0 -186
- package/dist/controller/utils.d.ts +0 -10
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/index.d.ts +0 -26
- package/dist/delivery/index.js +0 -132
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -165
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
- package/dist/print/index.d.ts +0 -25
- package/dist/print/index.js +0 -107
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/controller/src/utils.js
|
|
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
|
-
export declare const getCorrectResponse: (choices: any) => any;
|
|
10
|
-
export declare const isResponseCorrect: (question: any, key: any, session: any) => any;
|
package/dist/controller/utils.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js";
|
|
2
|
-
//#region src/controller/utils.ts
|
|
3
|
-
var t = (e) => e && e.filter((e) => e.correct).map((e) => e.value).sort(), n = (n, r, i) => {
|
|
4
|
-
let a = t(n.choices);
|
|
5
|
-
return i && i.value ? e((i.value[r].value || []).sort(), a) : !1;
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|
|
8
|
-
export { n as isResponseCorrect };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/src/index.js
|
|
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
|
-
export declare const isSessionComplete: (session: any) => boolean;
|
|
10
|
-
export default class Ebsr extends HTMLElement {
|
|
11
|
-
constructor();
|
|
12
|
-
onSessionUpdated: any;
|
|
13
|
-
set model(m: any);
|
|
14
|
-
set session(s: any);
|
|
15
|
-
get session(): any;
|
|
16
|
-
setPartModel(part: any, key: any): void;
|
|
17
|
-
setPartSession(part: any, key: any): void;
|
|
18
|
-
dispatchSessionChanged(partSession: any, key: any): void;
|
|
19
|
-
get partA(): Element | null;
|
|
20
|
-
get partB(): Element | null;
|
|
21
|
-
connectedCallback(): void;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
|
-
_initPlayerObserver(): void;
|
|
24
|
-
_disconnectPlayerObserver(): void;
|
|
25
|
-
_render(): void;
|
|
26
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js";
|
|
2
|
-
import { SessionChangedEvent as t } from "@pie-element/shared-player-events";
|
|
3
|
-
import n from "@pie-element/multiple-choice";
|
|
4
|
-
import r from "debug";
|
|
5
|
-
//#region src/delivery/index.tsx
|
|
6
|
-
var i = t.TYPE, a = "ebsr-multiple-choice", o = r("pie-elements:ebsr"), s = class extends n {};
|
|
7
|
-
customElements.get(a) || customElements.define(a, s);
|
|
8
|
-
var c = (e) => Array.isArray(e) && e.length > 0, l = (t) => {
|
|
9
|
-
let n = e(t, "value.partA.value"), r = e(t, "value.partB.value");
|
|
10
|
-
return c(n) && c(r);
|
|
11
|
-
};
|
|
12
|
-
function u(e) {
|
|
13
|
-
let t = e.closest("pie-player") || e.closest("pie-item-player");
|
|
14
|
-
if (!t) return {
|
|
15
|
-
baseHeadingLevel: void 0,
|
|
16
|
-
includeSrHeading: !0
|
|
17
|
-
};
|
|
18
|
-
let n = (e, n, r) => {
|
|
19
|
-
let i = t[e];
|
|
20
|
-
return i ??= t.getAttribute(n) ?? t.getAttribute(r), i;
|
|
21
|
-
}, r = n("baseHeadingLevel", "base-heading-level", "baseheadinglevel"), i = parseInt(r, 10), a = Number.isFinite(i) && i >= 1 && i <= 6 ? i : void 0, o = n("includeSrHeading", "include-sr-heading", "includesrheading");
|
|
22
|
-
return {
|
|
23
|
-
baseHeadingLevel: a,
|
|
24
|
-
includeSrHeading: o == null ? !0 : o !== !1 && o !== "false"
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var d = class extends HTMLElement {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(), this._model = {}, this._session = {};
|
|
30
|
-
}
|
|
31
|
-
onSessionUpdated = (e) => {
|
|
32
|
-
if (e.target === this) return;
|
|
33
|
-
e.preventDefault(), e.stopImmediatePropagation();
|
|
34
|
-
let t = e.target.getAttribute("id");
|
|
35
|
-
if (t) {
|
|
36
|
-
let n = `part${t.toUpperCase()}`;
|
|
37
|
-
e.update && (this._model[n] = e.update), this.dispatchSessionChanged(e.srcElement._session, n);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
set model(e) {
|
|
41
|
-
this._model = e, customElements.whenDefined(a).then(() => {
|
|
42
|
-
this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB");
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
set session(e) {
|
|
46
|
-
this._session = e, customElements.whenDefined(a).then(() => {
|
|
47
|
-
this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB");
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
get session() {
|
|
51
|
-
return this._session;
|
|
52
|
-
}
|
|
53
|
-
setPartModel(e, t) {
|
|
54
|
-
if (this._model && this._model[t] && e) {
|
|
55
|
-
let { mode: n } = this._model;
|
|
56
|
-
e.model = {
|
|
57
|
-
...this._model[t],
|
|
58
|
-
mode: n,
|
|
59
|
-
keyMode: this._model[t].choicePrefix
|
|
60
|
-
};
|
|
61
|
-
let { includeSrHeading: r, baseHeadingLevel: i } = u(this);
|
|
62
|
-
e.includeSrHeading = r, e.baseHeadingLevel = i;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
setPartSession(e, t) {
|
|
66
|
-
if (this._session && this._model && e) {
|
|
67
|
-
let { value: n } = this._session;
|
|
68
|
-
e.session = n && n[t] ? n[t] : { id: t };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
dispatchSessionChanged(e, n) {
|
|
72
|
-
this._session.value = {
|
|
73
|
-
...this._session.value,
|
|
74
|
-
[n]: e
|
|
75
|
-
}, o("[onSessionChanged] session: ", this._session);
|
|
76
|
-
let r = l(this._session);
|
|
77
|
-
this.dispatchEvent(new t(this.tagName.toLowerCase(), r));
|
|
78
|
-
}
|
|
79
|
-
get partA() {
|
|
80
|
-
return this.querySelector(`${a}#a`);
|
|
81
|
-
}
|
|
82
|
-
get partB() {
|
|
83
|
-
return this.querySelector(`${a}#b`);
|
|
84
|
-
}
|
|
85
|
-
connectedCallback() {
|
|
86
|
-
this._render(), this._initPlayerObserver(), this.addEventListener(i, this.onSessionUpdated);
|
|
87
|
-
}
|
|
88
|
-
disconnectedCallback() {
|
|
89
|
-
this._disconnectPlayerObserver(), this.removeEventListener(i, this.onSessionUpdated);
|
|
90
|
-
}
|
|
91
|
-
_initPlayerObserver() {
|
|
92
|
-
let e = this.closest("pie-player") || this.closest("pie-item-player");
|
|
93
|
-
e && (this._playerObserver = new MutationObserver(() => {
|
|
94
|
-
this._render();
|
|
95
|
-
}), this._playerObserver.observe(e, {
|
|
96
|
-
attributes: !0,
|
|
97
|
-
attributeFilter: [
|
|
98
|
-
"base-heading-level",
|
|
99
|
-
"baseheadinglevel",
|
|
100
|
-
"include-sr-heading",
|
|
101
|
-
"includesrheading"
|
|
102
|
-
]
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
_disconnectPlayerObserver() {
|
|
106
|
-
this._playerObserver &&= (this._playerObserver.disconnect(), null);
|
|
107
|
-
}
|
|
108
|
-
_render() {
|
|
109
|
-
this.ariaLabel = "Two-Part Question", this.role = "region";
|
|
110
|
-
let { baseHeadingLevel: e, includeSrHeading: t } = u(this), n = e ? `h${Math.min(6, e)}` : "h2", r = t ? `<${n} class="srOnly">Two-Part Question</${n}>` : "";
|
|
111
|
-
this.innerHTML = `
|
|
112
|
-
<style>
|
|
113
|
-
.srOnly {
|
|
114
|
-
position: absolute;
|
|
115
|
-
width: 1px;
|
|
116
|
-
height: 1px;
|
|
117
|
-
padding: 0;
|
|
118
|
-
margin: -1px;
|
|
119
|
-
overflow: hidden;
|
|
120
|
-
left: -10000px;
|
|
121
|
-
top: auto;
|
|
122
|
-
}
|
|
123
|
-
${this._model?.extraCSSRules?.rules}
|
|
124
|
-
</style>
|
|
125
|
-
${r}
|
|
126
|
-
<${a} id="a"></${a}>
|
|
127
|
-
<${a} id="b"></${a}>
|
|
128
|
-
`, customElements.get(a) && (this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB"), this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB"));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
//#endregion
|
|
132
|
-
export { d as default, l as isSessionComplete };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED