@qti-components/base 2.4.1 → 2.5.0-next.1

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.
@@ -8,6 +8,12 @@ export interface SessionContext {
8
8
  /** @deprecated Never set by the library. Removed in the next major. */
9
9
  navTestLoading?: boolean;
10
10
  view?: View;
11
+ /**
12
+ * What test plugins keep, by plugin name: JSON the test stores and restores without reading it.
13
+ * Part of the persisted state (`QtiTestState.session.plugins`); written through the
14
+ * `cito-test-update-plugin-state` request.
15
+ */
16
+ plugins?: Readonly<Record<string, unknown>>;
11
17
  }
12
18
  export declare const INITIAL_SESSION_CONTEXT: Readonly<SessionContext>;
13
19
  export declare const sessionContext: {
@@ -1 +1 @@
1
- {"version":3,"file":"session.context.js","sourceRoot":"","sources":["../../src/context/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAe7C,MAAM,CAAC,MAAM,uBAAuB,GAA6B,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAEvF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAA2B,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nexport type View = 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor' | '';\n\nexport interface SessionContext {\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemRefId?: string | null;\n /** @deprecated Never set by the library. Removed in the next major. */\n navItemLoading?: boolean;\n /** @deprecated Never set by the library. Removed in the next major. */\n navTestLoading?: boolean;\n view?: View;\n}\n\nexport const INITIAL_SESSION_CONTEXT: Readonly<SessionContext> = { view: 'candidate' };\n\nexport const sessionContext = createContext<Readonly<SessionContext>>(Symbol('sessionContext'));\n"]}
1
+ {"version":3,"file":"session.context.js","sourceRoot":"","sources":["../../src/context/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB7C,MAAM,CAAC,MAAM,uBAAuB,GAA6B,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAEvF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAA2B,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nexport type View = 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor' | '';\n\nexport interface SessionContext {\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemRefId?: string | null;\n /** @deprecated Never set by the library. Removed in the next major. */\n navItemLoading?: boolean;\n /** @deprecated Never set by the library. Removed in the next major. */\n navTestLoading?: boolean;\n view?: View;\n /**\n * What test plugins keep, by plugin name: JSON the test stores and restores without reading it.\n * Part of the persisted state (`QtiTestState.session.plugins`); written through the\n * `cito-test-update-plugin-state` request.\n */\n plugins?: Readonly<Record<string, unknown>>;\n}\n\nexport const INITIAL_SESSION_CONTEXT: Readonly<SessionContext> = { view: 'candidate' };\n\nexport const sessionContext = createContext<Readonly<SessionContext>>(Symbol('sessionContext'));\n"]}
@@ -18,6 +18,8 @@ export type ComputedItem = ComputedItemContext & {
18
18
  };
19
19
  export type ComputedContext = {
20
20
  view: View;
21
+ /** What test plugins keep, by plugin name (`QtiTestState.session.plugins`). Read-only; write with `cito-test-update-plugin-state`. */
22
+ plugins?: Readonly<Record<string, unknown>>;
21
23
  identifier: string;
22
24
  title: string;
23
25
  testParts: {
@@ -37,4 +39,11 @@ export type ComputedContext = {
37
39
  allowSkipping?: boolean;
38
40
  }[];
39
41
  }[];
42
+ /**
43
+ * The rendered `qti-assessment-item` for an item-ref identifier, or null when it is not on the
44
+ * page. Looked up when called, so it is never a stale element; ask again after the context
45
+ * updates (it does when an item is rendered). A function, so `JSON.stringify` leaves it out.
46
+ * Set by `test-navigation`; for plugins that read an item's content (e.g. text-to-speech).
47
+ */
48
+ itemElement?: (identifier: string) => HTMLElement | null;
40
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"computed.types.js","sourceRoot":"","sources":["../../../src/context/types/computed.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { View } from '../session.context';\nimport type { ComputedItemContext } from './computed-item.types';\n\nexport type ComputedItem = ComputedItemContext & {\n categories?: string[]; // not necessary for outside world\n type?: 'info' | 'regular';\n index?: number;\n active?: boolean;\n allowSkipping?: boolean;\n maxAttempts?: number;\n showFeedback?: boolean;\n showSolution?: boolean;\n numAttempts?: number;\n valid?: boolean;\n isDefaultResponse?: boolean;\n done?: boolean;\n /** Last *ended attempt* reached the optimal outcome (best achievable score / correct response). */\n optimal?: boolean;\n};\n\nexport type ComputedContext = {\n view: View;\n identifier: string;\n title: string;\n testParts: {\n active?: boolean;\n identifier: string;\n navigationMode: 'linear' | 'nonlinear';\n submissionMode: 'individual' | 'simultaneous';\n allowSkipping?: boolean;\n sections: {\n active?: boolean;\n identifier: string;\n title: string;\n completed?: boolean;\n items: ComputedItem[];\n navigationMode: 'linear' | 'nonlinear';\n submissionMode: 'individual' | 'simultaneous';\n allowSkipping?: boolean;\n }[];\n }[];\n};\n"]}
1
+ {"version":3,"file":"computed.types.js","sourceRoot":"","sources":["../../../src/context/types/computed.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { View } from '../session.context';\nimport type { ComputedItemContext } from './computed-item.types';\n\nexport type ComputedItem = ComputedItemContext & {\n categories?: string[]; // not necessary for outside world\n type?: 'info' | 'regular';\n index?: number;\n active?: boolean;\n allowSkipping?: boolean;\n maxAttempts?: number;\n showFeedback?: boolean;\n showSolution?: boolean;\n numAttempts?: number;\n valid?: boolean;\n isDefaultResponse?: boolean;\n done?: boolean;\n /** Last *ended attempt* reached the optimal outcome (best achievable score / correct response). */\n optimal?: boolean;\n};\n\nexport type ComputedContext = {\n view: View;\n /** What test plugins keep, by plugin name (`QtiTestState.session.plugins`). Read-only; write with `cito-test-update-plugin-state`. */\n plugins?: Readonly<Record<string, unknown>>;\n identifier: string;\n title: string;\n testParts: {\n active?: boolean;\n identifier: string;\n navigationMode: 'linear' | 'nonlinear';\n submissionMode: 'individual' | 'simultaneous';\n allowSkipping?: boolean;\n sections: {\n active?: boolean;\n identifier: string;\n title: string;\n completed?: boolean;\n items: ComputedItem[];\n navigationMode: 'linear' | 'nonlinear';\n submissionMode: 'individual' | 'simultaneous';\n allowSkipping?: boolean;\n }[];\n }[];\n /**\n * The rendered `qti-assessment-item` for an item-ref identifier, or null when it is not on the\n * page. Looked up when called, so it is never a stale element; ask again after the context\n * updates (it does when an item is rendered). A function, so `JSON.stringify` leaves it out.\n * Set by `test-navigation`; for plugins that read an item's content (e.g. text-to-speech).\n */\n itemElement?: (identifier: string) => HTMLElement | null;\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qti-components/base",
3
3
  "description": "QTI shared utilities",
4
- "version": "2.4.1",
4
+ "version": "2.5.0-next.1",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@qti-components/utilities": "^1.3.3"