uni-answer-sheet 2.0.0 → 2.2.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/CHANGELOG.md +19 -0
- package/README.md +92 -9
- package/REFERENCE_ASSETS.md +7 -0
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/browser.js +57 -55
- package/dist/chunks/index-ChLOq9ID.js +2260 -0
- package/dist/chunks/runtime-QFMZtUfH.js +24479 -0
- package/dist/index.d.ts +79 -4
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -2
- package/dist/chunks/index-D612hHe6.js +0 -1081
- package/dist/chunks/runtime-DFHaUhsH.js +0 -24041
package/dist/index.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ interface ReferenceGroup {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
type CardPreset = 'a4' | 'a3-two' | 'a3-three';
|
|
298
|
-
type BlockKind = 'choice' | ExerciseKind;
|
|
298
|
+
type BlockKind = 'choice' | 'area' | ExerciseKind;
|
|
299
299
|
type ChoiceScoreType = 'LESS_SCORE' | 'ITEM_SCORE';
|
|
300
300
|
interface CardChoiceQuestion {
|
|
301
301
|
id: string;
|
|
@@ -336,9 +336,12 @@ interface CardBlock {
|
|
|
336
336
|
choices?: CardChoiceSettings;
|
|
337
337
|
exercise?: ExerciseSettings;
|
|
338
338
|
reference?: ReferenceGroup;
|
|
339
|
+
/** Reference card-only sections, excluded from the question structure. */
|
|
340
|
+
areaType?: 'forbiden' | 'editArea';
|
|
339
341
|
}
|
|
340
342
|
interface CardDocument {
|
|
341
343
|
version: 1;
|
|
344
|
+
usage?: 'exam' | 'homework';
|
|
342
345
|
questionCard?: boolean;
|
|
343
346
|
title: string;
|
|
344
347
|
preset: CardPreset;
|
|
@@ -352,6 +355,12 @@ interface CardDocument {
|
|
|
352
355
|
halfPoint?: boolean;
|
|
353
356
|
choiceDirection?: 'row' | 'column';
|
|
354
357
|
mergeObjective?: boolean;
|
|
358
|
+
recognition?: CardRecognitionSettings;
|
|
359
|
+
}
|
|
360
|
+
interface CardRecognitionSettings {
|
|
361
|
+
examQrCode?: boolean;
|
|
362
|
+
subjectMarkers?: boolean;
|
|
363
|
+
pointBlack?: boolean;
|
|
355
364
|
}
|
|
356
365
|
interface CardPaperTitle {
|
|
357
366
|
id: string;
|
|
@@ -380,6 +389,9 @@ interface CardHeaderSettings {
|
|
|
380
389
|
mifeng: boolean;
|
|
381
390
|
kaohao: 'school' | 'code';
|
|
382
391
|
weishu: number;
|
|
392
|
+
/** Reference homework header settings. */
|
|
393
|
+
tiaomaStyle?: 1 | 2;
|
|
394
|
+
classText?: boolean;
|
|
383
395
|
}
|
|
384
396
|
|
|
385
397
|
interface ReferenceOptionData {
|
|
@@ -458,8 +470,68 @@ interface AnswerSheetDictionaries {
|
|
|
458
470
|
defaultCourseCode?: string;
|
|
459
471
|
}
|
|
460
472
|
|
|
473
|
+
interface Rect {
|
|
474
|
+
x: number;
|
|
475
|
+
y: number;
|
|
476
|
+
width: number;
|
|
477
|
+
height: number;
|
|
478
|
+
}
|
|
479
|
+
type RegionType = 'ClassId' | 'StudentId' | 'IgnoreFlag' | 'MultiChoice' | 'Checkbox' | 'FrameOnly' | 'ScoreBox' | 'QuestionChoice' | 'Blank' | 'PageCode' | 'SubjectCode' | 'ExamQrCode' | 'ReferencePoint';
|
|
480
|
+
interface RecognitionRegion {
|
|
481
|
+
id: string;
|
|
482
|
+
sectionType: RegionType;
|
|
483
|
+
/** Absolute position on the containing physical paper, in unscaled 96 dpi pixels. */
|
|
484
|
+
rect: Rect;
|
|
485
|
+
role: 'region' | 'cell' | 'line';
|
|
486
|
+
scope?: 'section';
|
|
487
|
+
blockId?: string;
|
|
488
|
+
questionId?: string;
|
|
489
|
+
partId?: string;
|
|
490
|
+
questionIds?: string[];
|
|
491
|
+
answerId?: string;
|
|
492
|
+
optionId?: string;
|
|
493
|
+
/** Ownership only. A child's rect uses the same paper origin as its parent. */
|
|
494
|
+
parentId?: string;
|
|
495
|
+
value?: string;
|
|
496
|
+
columnNumber?: number;
|
|
497
|
+
}
|
|
498
|
+
interface RecognitionPage {
|
|
499
|
+
pageNumber: number;
|
|
500
|
+
pageSize: {
|
|
501
|
+
width: number;
|
|
502
|
+
height: number;
|
|
503
|
+
};
|
|
504
|
+
/** Position of the top-left registration mark; not the coordinate-system origin. */
|
|
505
|
+
anchorOrigin: {
|
|
506
|
+
x: number;
|
|
507
|
+
y: number;
|
|
508
|
+
};
|
|
509
|
+
anchorSize: {
|
|
510
|
+
width: number;
|
|
511
|
+
height: number;
|
|
512
|
+
};
|
|
513
|
+
panelSize: {
|
|
514
|
+
width: number;
|
|
515
|
+
height: number;
|
|
516
|
+
};
|
|
517
|
+
/** All four marks use the physical paper's top-left corner as (0, 0). */
|
|
518
|
+
anchors: Record<'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight', Rect>;
|
|
519
|
+
regions: RecognitionRegion[];
|
|
520
|
+
}
|
|
521
|
+
interface RecognitionData {
|
|
522
|
+
version: 2;
|
|
523
|
+
unit: 'px';
|
|
524
|
+
dpi: 96;
|
|
525
|
+
/** X grows rightward and Y downward; every physical page starts at (0, 0). */
|
|
526
|
+
origin: 'topLeftPaper';
|
|
527
|
+
singlePagePartition: number;
|
|
528
|
+
pages: RecognitionPage[];
|
|
529
|
+
}
|
|
530
|
+
|
|
461
531
|
/** Round-trippable source plus the reference project's sectionInfoList/quesTextMap. */
|
|
462
|
-
type AnswerSheetData = CardDocument & ReferencePaperData
|
|
532
|
+
type AnswerSheetData = CardDocument & ReferencePaperData & {
|
|
533
|
+
recognitionData: RecognitionData;
|
|
534
|
+
};
|
|
463
535
|
type SaveResult = {
|
|
464
536
|
ok: true;
|
|
465
537
|
data: AnswerSheetData;
|
|
@@ -467,7 +539,7 @@ type SaveResult = {
|
|
|
467
539
|
ok: false;
|
|
468
540
|
issues: ValidationIssue[];
|
|
469
541
|
};
|
|
470
|
-
type AnswerSheetLayout = Partial<Pick<CardDocument, 'preset' | 'margin' | 'gap' | 'questionCard' | 'scanMarking' | 'halfPoint' | 'choiceDirection' | 'mergeObjective'>> & {
|
|
542
|
+
type AnswerSheetLayout = Partial<Pick<CardDocument, 'usage' | 'preset' | 'margin' | 'gap' | 'questionCard' | 'scanMarking' | 'halfPoint' | 'choiceDirection' | 'mergeObjective'>> & {
|
|
471
543
|
/** Reference field aliases; conflicting aliases are rejected. */
|
|
472
544
|
pageNum?: 1 | 2 | 3;
|
|
473
545
|
quesCard?: boolean;
|
|
@@ -481,6 +553,7 @@ type AnswerSheetInitialization = Pick<CardCreation, 'name' | 'id' | 'exampaperId
|
|
|
481
553
|
/** Paper preset, margins/gap in mm, and the existing page-layout switches. */
|
|
482
554
|
layout?: AnswerSheetLayout;
|
|
483
555
|
header?: Partial<CardHeaderSettings>;
|
|
556
|
+
recognition?: CardDocument['recognition'];
|
|
484
557
|
} & ({
|
|
485
558
|
gradeCode: string;
|
|
486
559
|
courseCode: string;
|
|
@@ -522,6 +595,8 @@ interface AnswerSheetInstance {
|
|
|
522
595
|
validate(): Promise<ValidationResult>;
|
|
523
596
|
/** Waits for input and pagination; failure never contains savable data. */
|
|
524
597
|
save(): Promise<SaveResult>;
|
|
598
|
+
/** Measures the printed layout in 96 dpi pixels from each physical paper's top-left corner. */
|
|
599
|
+
getRecognitionData(): Promise<RecognitionData>;
|
|
525
600
|
setOptions(options: Partial<Omit<AnswerSheetOptions, 'plugins' | 'initialValue'>>): void;
|
|
526
601
|
focusIssue(issue: ValidationIssue): void;
|
|
527
602
|
destroy(): void;
|
|
@@ -531,4 +606,4 @@ interface AnswerSheetInstance {
|
|
|
531
606
|
declare function createAnswerSheet(target: string | HTMLElement, options: AnswerSheetOptions): AnswerSheetInstance;
|
|
532
607
|
|
|
533
608
|
export { AnswerSheetDataError, createAnswerSheet };
|
|
534
|
-
export type { AnswerSheetData, AnswerSheetDictionaries, AnswerSheetEditorPlugin, AnswerSheetInitialization, AnswerSheetInstance, AnswerSheetLayout, AnswerSheetOptions, CardBlock, CardChoiceQuestion, CardChoiceSettings, CardCreation, CardDocument, CardHeaderSettings, CardPaperTitle, CardPreset, CourseOption, GradeOption, ImageUploadHandler, PhaseCode, QuestionType, ReferenceGroup, ReferencePaperData, ReferencePart, ReferenceQuestion, ReferenceSectionData, ReferenceText, RichTextDocument, SaveResult, ValidationIssue, ValidationResult };
|
|
609
|
+
export type { AnswerSheetData, AnswerSheetDictionaries, AnswerSheetEditorPlugin, AnswerSheetInitialization, AnswerSheetInstance, AnswerSheetLayout, AnswerSheetOptions, CardBlock, CardChoiceQuestion, CardChoiceSettings, CardCreation, CardDocument, CardHeaderSettings, CardPaperTitle, CardPreset, CardRecognitionSettings, CourseOption, GradeOption, ImageUploadHandler, PhaseCode, QuestionType, RecognitionData, RecognitionPage, RecognitionRegion, Rect, ReferenceGroup, ReferencePaperData, ReferencePart, ReferenceQuestion, ReferenceSectionData, ReferenceText, RegionType, RichTextDocument, SaveResult, ValidationIssue, ValidationResult };
|
package/dist/index.js
CHANGED