@pie-element/select-text 13.1.1-next.11 → 13.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/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaultConfiguration.d.ts +179 -0
- package/dist/author/defaultConfiguration.js +141 -0
- package/dist/author/design.d.ts +38 -0
- package/dist/author/design.js +264 -0
- package/dist/author/index.d.ts +27 -0
- package/dist/author/index.js +74 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.js +50 -0
- package/dist/browser/Check-CXevxzJJ.js +9941 -0
- package/dist/browser/Check-CXevxzJJ.js.map +1 -0
- package/dist/browser/_getTag-x1UozeM0.js +381 -0
- package/dist/browser/_getTag-x1UozeM0.js.map +1 -0
- package/dist/browser/author/index.js +41566 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +195 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/debounce-CUpLfqAu.js +86 -0
- package/dist/browser/debounce-CUpLfqAu.js.map +1 -0
- package/dist/browser/delivery/index.js +89 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/isEmpty-Bsms1e2W.js +16 -0
- package/dist/browser/isEmpty-Bsms1e2W.js.map +1 -0
- package/dist/browser/main-4aycOoI5.js +4804 -0
- package/dist/browser/main-4aycOoI5.js.map +1 -0
- package/dist/browser/print/index.js +42 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/browser/select-text.css +2 -0
- package/dist/controller/defaults.d.ts +27 -0
- package/dist/controller/defaults.js +21 -0
- package/dist/controller/index.d.ts +25 -0
- package/dist/controller/index.js +121 -0
- package/dist/delivery/index.d.ts +19 -0
- package/dist/delivery/index.js +60 -0
- package/dist/delivery/main.d.ts +34 -0
- package/dist/delivery/main.js +136 -0
- package/dist/delivery/utils.d.ts +10 -0
- package/dist/delivery/utils.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +167 -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/_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/_arrayEach.js +7 -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/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -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/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -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/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -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/_baseIsSet.js +9 -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/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -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/_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/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -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/_defineProperty.js +10 -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/_getAllKeysIn.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/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -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/_getSymbolsIn.js +11 -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/_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/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.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/_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/_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/_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/_nativeKeysIn.js +8 -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/_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/_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/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -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/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/isMap.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/isSet.js +7 -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/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -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/toNumber.js +19 -0
- package/dist/print/index.d.ts +15 -0
- package/dist/print/index.js +41 -0
- package/package.json +87 -21
- package/CHANGELOG.json +0 -1422
- package/CHANGELOG.md +0 -2278
- package/LICENSE.md +0 -5
- package/README.md +0 -5
- package/configure/CHANGELOG.json +0 -1032
- package/configure/CHANGELOG.md +0 -2013
- package/configure/lib/defaultConfiguration.js +0 -177
- package/configure/lib/defaultConfiguration.js.map +0 -1
- package/configure/lib/design.js +0 -406
- package/configure/lib/design.js.map +0 -1
- package/configure/lib/index.js +0 -128
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/utils.js +0 -92
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -25
- package/controller/CHANGELOG.json +0 -442
- package/controller/CHANGELOG.md +0 -1464
- package/controller/lib/defaults.js +0 -25
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -258
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -16
- package/docs/config-schema.json +0 -2135
- package/docs/config-schema.json.md +0 -1579
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -823
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -24
- package/docs/pie-schema.json +0 -1248
- package/docs/pie-schema.json.md +0 -711
- package/lib/index.js +0 -103
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -191
- package/lib/main.js.map +0 -1
- package/lib/print.js +0 -87
- package/lib/print.js.map +0 -1
- package/lib/utils.js +0 -80
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/select-text/controller/src/defaults.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
|
+
declare const _default: {
|
|
10
|
+
feedbackEnabled: boolean;
|
|
11
|
+
highlightChoices: boolean;
|
|
12
|
+
maxSelections: number;
|
|
13
|
+
mode: string;
|
|
14
|
+
partialScoring: boolean;
|
|
15
|
+
prompt: string;
|
|
16
|
+
promptEnabled: boolean;
|
|
17
|
+
rationale: string;
|
|
18
|
+
rationaleEnabled: boolean;
|
|
19
|
+
scoringType: string;
|
|
20
|
+
studentInstructionsEnabled: boolean;
|
|
21
|
+
teacherInstructions: string;
|
|
22
|
+
teacherInstructionsEnabled: boolean;
|
|
23
|
+
text: string;
|
|
24
|
+
tokens: never[];
|
|
25
|
+
toolbarEditorPosition: string;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/controller/defaults.ts
|
|
2
|
+
var e = {
|
|
3
|
+
feedbackEnabled: !1,
|
|
4
|
+
highlightChoices: !1,
|
|
5
|
+
maxSelections: 0,
|
|
6
|
+
mode: "sentence",
|
|
7
|
+
partialScoring: !1,
|
|
8
|
+
prompt: "",
|
|
9
|
+
promptEnabled: !0,
|
|
10
|
+
rationale: "",
|
|
11
|
+
rationaleEnabled: !0,
|
|
12
|
+
scoringType: "auto",
|
|
13
|
+
studentInstructionsEnabled: !0,
|
|
14
|
+
teacherInstructions: "",
|
|
15
|
+
teacherInstructionsEnabled: !0,
|
|
16
|
+
text: "",
|
|
17
|
+
tokens: [],
|
|
18
|
+
toolbarEditorPosition: "bottom"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/select-text/controller/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 getCorrectness: (tokens: any, selected: any) => "unknown" | "correct" | "partially-correct" | "incorrect";
|
|
10
|
+
export declare const getPartialScore: (question: any, session: any, totalCorrect: any) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Generates detailed trace log for select-text scoring evaluation
|
|
13
|
+
* @param {Object} question - the question model
|
|
14
|
+
* @param {Object} session - the student session
|
|
15
|
+
* @param {Object} env - the environment
|
|
16
|
+
* @returns {Array<string>} traceLog
|
|
17
|
+
*/
|
|
18
|
+
export declare const getLogTrace: (question: any, session: any, env: any) => string[];
|
|
19
|
+
export declare const outcome: (question: any, session: any, env: any) => Promise<unknown>;
|
|
20
|
+
export declare function createDefaultModel(model?: {}): Promise<unknown>;
|
|
21
|
+
export declare const normalizeSession: (session: any) => any;
|
|
22
|
+
export declare const normalize: (question: any) => any;
|
|
23
|
+
export declare const model: (question: any, session: any, env: any) => Promise<unknown>;
|
|
24
|
+
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
25
|
+
export declare const validate: (model?: {}, config?: {}) => {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
2
|
+
import t from "./defaults.js";
|
|
3
|
+
import n from "debug";
|
|
4
|
+
import { getFeedbackForCorrectness as r } from "@pie-element/shared-feedback";
|
|
5
|
+
import { partialScoring as i } from "@pie-element/shared-controller-utils";
|
|
6
|
+
//#region src/controller/index.ts
|
|
7
|
+
var a = n("@pie-element:select-text:controller"), o = (e = {}, t = {}) => e?.start === t?.start && e?.end === t?.end || e?.start === t?.oldStart && e?.end === t?.oldEnd, s = (e = [], t = [], n = !1) => (e || []).map((e) => {
|
|
8
|
+
let r = !!e.correct, i = r && !(t || []).find((t) => o(e, t));
|
|
9
|
+
return {
|
|
10
|
+
...e,
|
|
11
|
+
correct: n ? r : void 0,
|
|
12
|
+
isMissing: n ? i : void 0
|
|
13
|
+
};
|
|
14
|
+
}), c = (e, t) => {
|
|
15
|
+
let n = e.filter((e) => e.correct === !0);
|
|
16
|
+
if (n.length === 0) return "unknown";
|
|
17
|
+
let r = l(e, t);
|
|
18
|
+
if (r.length === t.length) {
|
|
19
|
+
if (r.length === n.length) return "correct";
|
|
20
|
+
if (r.length > 0) return "partially-correct";
|
|
21
|
+
}
|
|
22
|
+
return r.length > 0 ? "partially-correct" : "incorrect";
|
|
23
|
+
}, l = (e, t) => (t || []).filter((t) => e.findIndex((e) => e.correct && o(e, t)) !== -1), u = (t, n, r) => {
|
|
24
|
+
if (!n || e(n)) return 0;
|
|
25
|
+
let i = l(t.tokens, n.selectedTokens).length, a = (t.tokens || []).filter((e) => e.correct === !0), o = i - (n.selectedTokens && n.selectedTokens.length > a.length ? n.selectedTokens && n.selectedTokens.length - i : 0), s = o < 0 ? 0 : o;
|
|
26
|
+
return r.length ? parseFloat((s / r.length).toFixed(2)) : 0;
|
|
27
|
+
}, d = (e, t, n) => {
|
|
28
|
+
let r = [], a = t?.selectedTokens || [], s = e?.tokens || [];
|
|
29
|
+
if (a.length === 0) return r.push("Student did not select any token."), r;
|
|
30
|
+
r.push(`Student selected ${a.length} token(s).`);
|
|
31
|
+
let c = 0, l = 0, d = 0;
|
|
32
|
+
for (let e = 0; e < s.length; e++) {
|
|
33
|
+
let t = s[e];
|
|
34
|
+
t.correct && (c++, a.some((e) => o(t, e)) ? l++ : d++);
|
|
35
|
+
}
|
|
36
|
+
let f = a.length - l;
|
|
37
|
+
l > 0 && r.push(`${l} correct token(s) selected.`), f > 0 && r.push(`${f} incorrect token(s) selected.`), d > 0 && r.push(`${d} required correct token(s) were not selected.`);
|
|
38
|
+
let p = i.enabled(e, n, !0);
|
|
39
|
+
p ? (r.push("Score calculated using partial scoring."), r.push("Score is based on the number of correct minus incorrect selections, divided by the total number of correct tokens."), f > 0 && a.length > c && r.push("Extra selected tokens beyond the correct set reduce the score.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must select all correct tokens and no incorrect tokens to receive full credit."));
|
|
40
|
+
let m = u(e, t, s.filter((e) => e.correct)), h = p ? m : +(m === 1);
|
|
41
|
+
return r.push(`Final score: ${h}.`), r;
|
|
42
|
+
}, f = (t, n, r) => new Promise((a) => {
|
|
43
|
+
if ((!n || e(n)) && a({
|
|
44
|
+
score: 0,
|
|
45
|
+
empty: !0,
|
|
46
|
+
logTrace: ["Student did not select any token."]
|
|
47
|
+
}), n = m(n), r.mode !== "evaluate") a({
|
|
48
|
+
score: void 0,
|
|
49
|
+
completed: void 0,
|
|
50
|
+
logTrace: []
|
|
51
|
+
});
|
|
52
|
+
else {
|
|
53
|
+
let e = i.enabled(t, r, !0), o = t.tokens.filter((e) => e.correct), s = u(t, n, o);
|
|
54
|
+
a({
|
|
55
|
+
score: e ? s : +(s === 1),
|
|
56
|
+
logTrace: d(t, n, r)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function p(e = {}) {
|
|
61
|
+
return new Promise((n) => {
|
|
62
|
+
n({
|
|
63
|
+
...t,
|
|
64
|
+
...e
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var m = (e) => ({
|
|
69
|
+
selectedTokens: [],
|
|
70
|
+
...e
|
|
71
|
+
}), h = (e) => ({
|
|
72
|
+
...t,
|
|
73
|
+
...e
|
|
74
|
+
}), g = (e, t, n) => {
|
|
75
|
+
t ||= { selectedToken: [] }, t.selectedTokens = t.selectedTokens || [];
|
|
76
|
+
let i = h(e);
|
|
77
|
+
return new Promise((e) => {
|
|
78
|
+
a("[model]", "normalizedQuestion: ", i), a("[model]", "session: ", t);
|
|
79
|
+
let o = s(i.tokens, t.selectedTokens, n.mode === "evaluate");
|
|
80
|
+
a("[model] tokens:", o);
|
|
81
|
+
let l = n.mode === "evaluate" ? c(i.tokens, t.selectedTokens) : void 0;
|
|
82
|
+
(n.mode === "evaluate" && i.feedbackEnabled ? r(l, i.feedback) : Promise.resolve(void 0)).then((t) => {
|
|
83
|
+
let r = {
|
|
84
|
+
tokens: o,
|
|
85
|
+
highlightChoices: i.highlightChoices,
|
|
86
|
+
prompt: i.promptEnabled ? i.prompt : null,
|
|
87
|
+
text: i.text,
|
|
88
|
+
disabled: n.mode !== "gather",
|
|
89
|
+
maxSelections: i.maxSelections,
|
|
90
|
+
correctness: l,
|
|
91
|
+
env: n,
|
|
92
|
+
feedback: t,
|
|
93
|
+
incorrect: n.mode === "evaluate" ? l !== "correct" : void 0,
|
|
94
|
+
language: i.language,
|
|
95
|
+
extraCSSRules: i.extraCSSRules
|
|
96
|
+
};
|
|
97
|
+
n.role === "instructor" && (n.mode === "view" || n.mode === "evaluate") ? (r.rationale = i.rationaleEnabled ? i.rationale : null, r.teacherInstructions = i.teacherInstructionsEnabled ? i.teacherInstructions : null) : (r.rationale = null, r.teacherInstructions = null), e(r);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}, _ = (e, t) => new Promise((n) => {
|
|
101
|
+
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
102
|
+
let { tokens: t } = e;
|
|
103
|
+
n({
|
|
104
|
+
id: "1",
|
|
105
|
+
selectedTokens: t.filter((e) => e.correct)
|
|
106
|
+
});
|
|
107
|
+
} else n(null);
|
|
108
|
+
}), v = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), y = (e = {}, t = {}) => {
|
|
109
|
+
let { tokens: n } = e, { minTokens: r = 2, maxTokens: i, maxSelections: a } = t, o = {}, s = (n || []).length;
|
|
110
|
+
[
|
|
111
|
+
"teacherInstructions",
|
|
112
|
+
"prompt",
|
|
113
|
+
"rationale"
|
|
114
|
+
].forEach((n) => {
|
|
115
|
+
t[n]?.required && !v(e[n]) && (o[n] = "This field is required.");
|
|
116
|
+
});
|
|
117
|
+
let c = (n || []).reduce((e, t) => t.correct ? e + 1 : e, 0);
|
|
118
|
+
return s < r ? o.tokensError = `There should be at least ${r} tokens defined.` : s > i && (o.tokensError = `No more than ${i} tokens should be defined.`), c < 1 ? o.selectionsError = "There should be at least 1 token selected." : c > a && (o.selectionsError = `No more than ${a} tokens should be selected.`), o;
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
export { _ as createCorrectResponseSession, p as createDefaultModel, c as getCorrectness, d as getLogTrace, u as getPartialScore, g as model, h as normalize, m as normalizeSession, f as outcome, y as validate };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/select-text/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 default class SelectText extends HTMLElement {
|
|
10
|
+
constructor();
|
|
11
|
+
set model(m: any);
|
|
12
|
+
set session(s: any);
|
|
13
|
+
get session(): any;
|
|
14
|
+
isSessionComplete(): boolean;
|
|
15
|
+
selectionChanged(selection: any): void;
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
render(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import e from "./utils.js";
|
|
2
|
+
import t from "./main.js";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import { createRoot as r } from "react-dom/client";
|
|
5
|
+
import { ModelSetEvent as i, SessionChangedEvent as a } from "@pie-element/shared-player-events";
|
|
6
|
+
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
7
|
+
//#region src/delivery/index.ts
|
|
8
|
+
var s = class extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(), this._root = null;
|
|
11
|
+
}
|
|
12
|
+
set model(e) {
|
|
13
|
+
this._model = e, this.render(), this.dispatchEvent(new i(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== void 0));
|
|
14
|
+
}
|
|
15
|
+
set session(t) {
|
|
16
|
+
if (this._session = t, this._model) {
|
|
17
|
+
let { tokens: n } = e(this._model) || {}, { selectedTokens: r } = t || {};
|
|
18
|
+
r ||= [];
|
|
19
|
+
let i = (e) => n.find(({ start: t, end: n }) => e.start === t && e.end === n);
|
|
20
|
+
if (!r.reduce((e, t) => e && i(t), !0)) {
|
|
21
|
+
let { tokens: t } = e({
|
|
22
|
+
...this._model,
|
|
23
|
+
tokens: r
|
|
24
|
+
}) || {};
|
|
25
|
+
t && (this._session.selectedTokens = t);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
Array.isArray(this._session.selectedTokens) || (this._session.selectedTokens = []), this.render();
|
|
29
|
+
}
|
|
30
|
+
get session() {
|
|
31
|
+
return this._session;
|
|
32
|
+
}
|
|
33
|
+
isSessionComplete() {
|
|
34
|
+
let { selectedTokens: e } = this._session || {};
|
|
35
|
+
return Array.isArray(e) && e.length > 0;
|
|
36
|
+
}
|
|
37
|
+
selectionChanged(e) {
|
|
38
|
+
this._session.selectedTokens = e, this.dispatchEvent(new a(this.tagName.toLowerCase(), this.isSessionComplete()));
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
this.render();
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
if (this._model && this._session) {
|
|
45
|
+
let e = n.createElement(t, {
|
|
46
|
+
model: this._model,
|
|
47
|
+
session: this._session,
|
|
48
|
+
onSelectionChange: this.selectionChanged.bind(this)
|
|
49
|
+
});
|
|
50
|
+
this._root ||= r(this), this._root.render(e), queueMicrotask(() => {
|
|
51
|
+
o(this);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
this._root && this._root.unmount();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { s as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/select-text/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
|
+
model: PropTypes.Requireable<object>;
|
|
14
|
+
session: PropTypes.Requireable<object>;
|
|
15
|
+
onSelectionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
static defaultProps: {};
|
|
18
|
+
constructor(props: any);
|
|
19
|
+
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
20
|
+
toggleShowCorrect: any;
|
|
21
|
+
correctAnswer: any;
|
|
22
|
+
render(): React.JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
export default class Stateful extends React.Component {
|
|
25
|
+
static propTypes: {
|
|
26
|
+
model: PropTypes.Requireable<object>;
|
|
27
|
+
session: PropTypes.Requireable<object>;
|
|
28
|
+
onSelectionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
29
|
+
};
|
|
30
|
+
constructor(props: any);
|
|
31
|
+
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
32
|
+
change: any;
|
|
33
|
+
render(): React.JSX.Element;
|
|
34
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import e from "./utils.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { Legend as r, TextSelect as i } from "@pie-lib/text-select";
|
|
5
|
+
import a from "@pie-lib/correct-answer-toggle";
|
|
6
|
+
import * as o from "@pie-lib/render-ui";
|
|
7
|
+
import { Collapsible as s, Feedback as c, PreviewPrompt as l, UiLayout as u, color as d, hasMedia as f, hasText as p } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
|
+
import { styled as g } from "@mui/material/styles";
|
|
10
|
+
import _ from "debug";
|
|
11
|
+
//#region src/delivery/main.tsx
|
|
12
|
+
function v(e) {
|
|
13
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
14
|
+
}
|
|
15
|
+
function y(e, t) {
|
|
16
|
+
return !e || v(e) ? e : v(e.default) ? e.default : t && v(e[t]) ? e[t] : t && v(e[t]?.default) ? e[t].default : e;
|
|
17
|
+
}
|
|
18
|
+
var b = y(u, "UiLayout") || y(E.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt") || y(E.PreviewPrompt, "PreviewPrompt"), S = y(s, "Collapsible") || y(E.Collapsible, "Collapsible"), C = y(c, "Feedback") || y(E.Feedback, "Feedback"), w = o, T = w.default, E = T && typeof T == "object" ? T : w, D = _("@pie-ui:select-text"), O = g(b)({
|
|
19
|
+
color: d.text(),
|
|
20
|
+
backgroundColor: d.background()
|
|
21
|
+
}), k = g(i)(({ theme: e }) => ({
|
|
22
|
+
marginBottom: e.spacing(1),
|
|
23
|
+
marginTop: e.spacing(2),
|
|
24
|
+
whiteSpace: "normal"
|
|
25
|
+
})), A = g("div")(({ theme: e }) => ({
|
|
26
|
+
verticalAlign: "middle",
|
|
27
|
+
marginBottom: e.spacing(1)
|
|
28
|
+
})), j = g(S)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), M = {
|
|
29
|
+
model: n.object,
|
|
30
|
+
session: n.object,
|
|
31
|
+
onSelectionChange: n.func.isRequired
|
|
32
|
+
}, N = class extends t.Component {
|
|
33
|
+
static propTypes = M;
|
|
34
|
+
static defaultProps = {};
|
|
35
|
+
constructor(t) {
|
|
36
|
+
super(t), this.state = {
|
|
37
|
+
showCorrectAnswer: this.props.model.alwaysShowCorrect || !1,
|
|
38
|
+
model: e(t.model)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
UNSAFE_componentWillReceiveProps(t) {
|
|
42
|
+
this.setState({
|
|
43
|
+
showCorrectAnswer: !!t.model.alwaysShowCorrect,
|
|
44
|
+
model: e(t.model)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
toggleShowCorrect = () => {
|
|
48
|
+
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
49
|
+
};
|
|
50
|
+
correctAnswer = () => {
|
|
51
|
+
let { model: e } = this.state;
|
|
52
|
+
return e.tokens.filter((e) => e.correct);
|
|
53
|
+
};
|
|
54
|
+
render() {
|
|
55
|
+
let { session: e, onSelectionChange: t } = this.props, { showCorrectAnswer: n, model: i } = this.state, { env: o, extraCSSRules: s } = i, { mode: c } = o || {}, l = n ? this.correctAnswer() : e.selectedTokens, u = i.rationale && (p(i.rationale) || f(i.rationale)), d = i.teacherInstructions && (p(i.teacherInstructions) || f(i.teacherInstructions));
|
|
56
|
+
return D("[render] selectedTokens:", l), /* @__PURE__ */ h(O, {
|
|
57
|
+
extraCSSRules: s,
|
|
58
|
+
children: [
|
|
59
|
+
d && (i.animationsDisabled ? /* @__PURE__ */ m(A, { children: /* @__PURE__ */ m(x, { prompt: i.teacherInstructions }) }) : /* @__PURE__ */ m(j, {
|
|
60
|
+
labels: {
|
|
61
|
+
hidden: "Show Teacher Instructions",
|
|
62
|
+
visible: "Hide Teacher Instructions"
|
|
63
|
+
},
|
|
64
|
+
children: /* @__PURE__ */ m(x, { prompt: i.teacherInstructions })
|
|
65
|
+
})),
|
|
66
|
+
/* @__PURE__ */ m(A, { children: /* @__PURE__ */ m(x, { prompt: i.prompt }) }),
|
|
67
|
+
!i.alwaysShowCorrect && /* @__PURE__ */ m(a, {
|
|
68
|
+
show: i.disabled && i.incorrect,
|
|
69
|
+
toggled: n,
|
|
70
|
+
onToggle: this.toggleShowCorrect,
|
|
71
|
+
language: i.language
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ m(k, {
|
|
74
|
+
disabled: i.disabled,
|
|
75
|
+
text: i.text,
|
|
76
|
+
tokens: i.tokens,
|
|
77
|
+
selectedTokens: l,
|
|
78
|
+
onChange: (e) => {
|
|
79
|
+
t(e.map((e) => i.tokens.find(({ start: t, end: n }) => e.start === t && e.end === n) || e));
|
|
80
|
+
},
|
|
81
|
+
highlightChoices: i.highlightChoices,
|
|
82
|
+
maxNoOfSelections: i.maxSelections,
|
|
83
|
+
animationsDisabled: i.animationsDisabled
|
|
84
|
+
}),
|
|
85
|
+
c === "evaluate" && /* @__PURE__ */ m(r, {
|
|
86
|
+
language: i.language,
|
|
87
|
+
showOnlyCorrect: n
|
|
88
|
+
}),
|
|
89
|
+
u && (i.animationsDisabled ? /* @__PURE__ */ m(A, { children: /* @__PURE__ */ m(x, { prompt: i.rationale }) }) : /* @__PURE__ */ m(j, {
|
|
90
|
+
labels: {
|
|
91
|
+
hidden: "Show Rationale",
|
|
92
|
+
visible: "Hide Rationale"
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ m(x, { prompt: i.rationale })
|
|
95
|
+
})),
|
|
96
|
+
i.correctness && i.feedback && !n && /* @__PURE__ */ m(C, {
|
|
97
|
+
correctness: i.correctness,
|
|
98
|
+
feedback: i.feedback
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, P = class extends t.Component {
|
|
104
|
+
static propTypes = M;
|
|
105
|
+
constructor(e) {
|
|
106
|
+
super(e), this.state = {
|
|
107
|
+
model: e.model,
|
|
108
|
+
session: e.session
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
UNSAFE_componentWillReceiveProps(e) {
|
|
112
|
+
this.setState({
|
|
113
|
+
model: e.model,
|
|
114
|
+
session: e.session
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
change = (e) => {
|
|
118
|
+
let t = {
|
|
119
|
+
...this.state.session,
|
|
120
|
+
selectedTokens: e
|
|
121
|
+
};
|
|
122
|
+
this.setState({ session: t }, () => {
|
|
123
|
+
this.props.onSelectionChange(this.state.session.selectedTokens);
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
render() {
|
|
127
|
+
let { model: e, session: t } = this.state;
|
|
128
|
+
return /* @__PURE__ */ m(N, {
|
|
129
|
+
model: e,
|
|
130
|
+
session: t,
|
|
131
|
+
onSelectionChange: this.change
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
//#endregion
|
|
136
|
+
export { P as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/select-text/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
|
+
declare const _default: (model: any) => any;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/delivery/utils.tsx
|
|
2
|
+
var e = function() {
|
|
3
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", t = document.createElement("div");
|
|
4
|
+
return t.innerHTML = e.trim(), t;
|
|
5
|
+
}, t = function(e, t) {
|
|
6
|
+
return t ? e.innerHTML : `${e.innerHTML}
|
|
7
|
+
|
|
8
|
+
`;
|
|
9
|
+
}, n = function(e) {
|
|
10
|
+
var n = e.querySelectorAll("div[separator=true]"), r = "";
|
|
11
|
+
return n.forEach(function(e, i) {
|
|
12
|
+
r += t(e, i === n.length - 1);
|
|
13
|
+
}), r || null;
|
|
14
|
+
}, r = function(t) {
|
|
15
|
+
var r = e(t), i = document.createElement("div");
|
|
16
|
+
return i.innerHTML = `<div separator='true'>${r.innerHTML}</div>`, r = i, Array.from(r.querySelectorAll("*")).length === 0 ? t : n(r);
|
|
17
|
+
}, i = (e) => {
|
|
18
|
+
if (!e) return e;
|
|
19
|
+
let t = r(e.text || ""), n = (e.tokens || []).reduce((n, i = {}) => {
|
|
20
|
+
let a = r((e.text || "").slice(i.start, i.end));
|
|
21
|
+
if (!a) return [...n, i];
|
|
22
|
+
let o = (e) => {
|
|
23
|
+
let n = e;
|
|
24
|
+
for (; n >= 0;) {
|
|
25
|
+
let e = t.slice(n).indexOf(a);
|
|
26
|
+
if (e >= 0) return e + n;
|
|
27
|
+
n--;
|
|
28
|
+
}
|
|
29
|
+
return 0;
|
|
30
|
+
}, s = n[n.length - 1], c = o(s ? s.end : i.start), l = c + a.length;
|
|
31
|
+
return [...n, {
|
|
32
|
+
...i,
|
|
33
|
+
text: a,
|
|
34
|
+
start: c,
|
|
35
|
+
end: l,
|
|
36
|
+
oldStart: i.start,
|
|
37
|
+
oldEnd: i.end
|
|
38
|
+
}];
|
|
39
|
+
}, []);
|
|
40
|
+
return {
|
|
41
|
+
...e,
|
|
42
|
+
tokens: n,
|
|
43
|
+
text: t
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { i as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './delivery/index.js';
|