@pie-qti/item-player 0.1.11 → 0.1.13

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.
@@ -1,4 +1,4 @@
1
- const BLOCKED_CSS = /@import\b|url\s*\(|<\/style|expression\s*\(|javascript\s*:|vbscript\s*:|data\s*:/i;
1
+ import { isBlockedStylesheetCss } from '@pie-qti/ims-cp-core';
2
2
  export function buildScopedStylesheetCss(deliveryContext, scopeSelector = '[data-qti-item-body-scope]') {
3
3
  if (!deliveryContext)
4
4
  return '';
@@ -9,7 +9,7 @@ export function buildScopedStylesheetCss(deliveryContext, scopeSelector = '[data
9
9
  }
10
10
  function stylesheetToScopedCss(stylesheet, scopeSelector) {
11
11
  const css = stylesheet.cssText?.trim();
12
- if (!css || BLOCKED_CSS.test(css))
12
+ if (!css || isBlockedStylesheetCss(css))
13
13
  return '';
14
14
  const stylesheetScope = getStylesheetScopeSelector(stylesheet, scopeSelector);
15
15
  const scoped = scopeCssRules(css, stylesheetScope);
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheetRender.js","sourceRoot":"","sources":["../../../src/components/utils/stylesheetRender.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,mFAAmF,CAAC;AAExG,MAAM,UAAU,wBAAwB,CACvC,eAAwD,EACxD,aAAa,GAAG,4BAA4B;IAE5C,IAAI,CAAC,eAAe;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,eAAe,CAAC,WAAW;SAChC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,qBAAqB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;SACrE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAoC,EAAE,aAAqB;IACzF,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,GAAG,IAAI,WA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AqB;IAC9F,IAAI,UAAU,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,UAAU,CAAC,kBAAkB;QAAE,OAAO,aAAa,CAAC;IAC7F,OAAO,GAAG,aAAa,0BAA0B,eAAe,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACrG,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB,EAAE,aAAqB;IACjE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,IAAI,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,QAAQ,CAAC;IACxD,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,aAAa,CAAC;IAC7F,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,aAAa,GAAG,QAAQ,EAAE,CAAC;IACnE,OAAO,GAAG,aAAa,IAAI,QAAQ,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import type { ResolvedItemDeliveryContext, ResolvedQtiStylesheetRef } from '@pie-qti/ims-cp-core';\n\nconst BLOCKED_CSS = /@import\\b|url\\s*\\(|<\\/style|expression\\s*\\(|javascript\\s*:|vbscript\\s*:|data\\s*:/i;\n\nexport function buildScopedStylesheetCss(\n\tdeliveryContext: ResolvedItemDeliveryContext | undefined,\n\tscopeSelector = '[data-qti-item-body-scope]'\n): string {\n\tif (!deliveryContext) return '';\n\treturn deliveryContext.stylesheets\n\t\t.map((stylesheet) => stylesheetToScopedCss(stylesheet, scopeSelector))\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n}\n\nfunction stylesheetToScopedCss(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tconst css = stylesheet.cssText?.trim();\n\tif (!css || BLOCKED_CSS.test(css)) return '';\n\tconst stylesheetScope = getStylesheetScopeSelector(stylesheet, scopeSelector);\n\tconst scoped = scopeCssRules(css, stylesheetScope);\n\tif (!scoped) return '';\n\treturn scoped;\n}\n\nexport function scopeCssRules(css: string, scopeSelector = '[data-qti-item-body-scope]'): string {\n\tconst withoutComments = css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n\tlet scoped = '';\n\tconst rulePattern = /([^{}@]+)\\{([^{}]*)\\}/g;\n\tfor (const match of withoutComments.matchAll(rulePattern)) {\n\t\tconst selectorList = match[1]?.trim();\n\t\tconst declarations = match[2]?.trim();\n\t\tif (!selectorList || !declarations) continue;\n\t\tconst selectors = selectorList\n\t\t\t.split(',')\n\t\t\t.map((selector) => scopeSelectorText(selector.trim(), scopeSelector))\n\t\t\t.filter(Boolean);\n\t\tif (selectors.length === 0) continue;\n\t\tscoped += `${selectors.join(', ')} { ${declarations} }\\n`;\n\t}\n\treturn scoped.trim();\n}\n\nfunction getStylesheetScopeSelector(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tif (stylesheet.source !== 'stimulus' || !stylesheet.stimulusIdentifier) return scopeSelector;\n\treturn `${scopeSelector} [data-stimulus-idref=\"${escapeCssString(stylesheet.stimulusIdentifier)}\"]`;\n}\n\nfunction scopeSelectorText(selector: string, scopeSelector: string): string {\n\tif (!selector) return '';\n\tif (selector.startsWith(scopeSelector)) return selector;\n\tif (selector === ':root' || selector === 'html' || selector === 'body') return scopeSelector;\n\tif (selector.startsWith(':')) return `${scopeSelector}${selector}`;\n\treturn `${scopeSelector} ${selector}`;\n}\n\nfunction escapeCssString(value: string): string {\n\treturn value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"').replace(/\\n|\\r|\\f/g, ' ');\n}\n"]}
1
+ {"version":3,"file":"stylesheetRender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OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import type { ResolvedItemDeliveryContext, ResolvedQtiStylesheetRef } from '@pie-qti/ims-cp-core';\nimport { isBlockedStylesheetCss } from '@pie-qti/ims-cp-core';\n\nexport function buildScopedStylesheetCss(\n\tdeliveryContext: ResolvedItemDeliveryContext | undefined,\n\tscopeSelector = '[data-qti-item-body-scope]'\n): string {\n\tif (!deliveryContext) return '';\n\treturn deliveryContext.stylesheets\n\t\t.map((stylesheet) => stylesheetToScopedCss(stylesheet, scopeSelector))\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n}\n\nfunction stylesheetToScopedCss(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tconst css = stylesheet.cssText?.trim();\n\tif (!css || isBlockedStylesheetCss(css)) return '';\n\tconst stylesheetScope = getStylesheetScopeSelector(stylesheet, scopeSelector);\n\tconst scoped = scopeCssRules(css, stylesheetScope);\n\tif (!scoped) return '';\n\treturn scoped;\n}\n\nexport function scopeCssRules(css: string, scopeSelector = '[data-qti-item-body-scope]'): string {\n\tconst withoutComments = css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n\tlet scoped = '';\n\tconst rulePattern = /([^{}@]+)\\{([^{}]*)\\}/g;\n\tfor (const match of withoutComments.matchAll(rulePattern)) {\n\t\tconst selectorList = match[1]?.trim();\n\t\tconst declarations = match[2]?.trim();\n\t\tif (!selectorList || !declarations) continue;\n\t\tconst selectors = selectorList\n\t\t\t.split(',')\n\t\t\t.map((selector) => scopeSelectorText(selector.trim(), scopeSelector))\n\t\t\t.filter(Boolean);\n\t\tif (selectors.length === 0) continue;\n\t\tscoped += `${selectors.join(', ')} { ${declarations} }\\n`;\n\t}\n\treturn scoped.trim();\n}\n\nfunction getStylesheetScopeSelector(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tif (stylesheet.source !== 'stimulus' || !stylesheet.stimulusIdentifier) return scopeSelector;\n\treturn `${scopeSelector} [data-stimulus-idref=\"${escapeCssString(stylesheet.stimulusIdentifier)}\"]`;\n}\n\nfunction scopeSelectorText(selector: string, scopeSelector: string): string {\n\tif (!selector) return '';\n\tif (selector.startsWith(scopeSelector)) return selector;\n\tif (selector === ':root' || selector === 'html' || selector === 'body') return scopeSelector;\n\tif (selector.startsWith(':')) return `${scopeSelector}${selector}`;\n\treturn `${scopeSelector} ${selector}`;\n}\n\nfunction escapeCssString(value: string): string {\n\treturn value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"').replace(/\\n|\\r|\\f/g, ' ');\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { type DeclarationMap } from '@pie-qti/qti-processing';
2
2
  import type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';
3
3
  import type { ExtractionRegistry } from '../extraction/ExtractionRegistry.js';
4
- import type { AdaptiveAttemptResult, CompletionStatus, HtmlContent, ItemSessionActionCommand, ItemSessionActionResult, ItemSessionState, PlayerConfig, PlayerSecurityConfig, RubricBlock, ScoringResult, SerializedItemSessionState } from '../types/index.js';
4
+ import type { AdaptiveAttemptResult, CompletionStatus, HtmlContent, ItemSessionActionCommand, ItemSessionActionResult, ItemSessionState, PlayerConfig, PlayerSecurityConfig, RubricBlock, RubricBlockOptions, ScoringResult, SerializedItemSessionState } from '../types/index.js';
5
5
  import type { InteractionData } from '../interactions/index.js';
6
6
  import type { ResponseValidationResult } from '../types/responseValidation.js';
7
7
  import type { ComponentRegistry } from './ComponentRegistry.js';
@@ -151,9 +151,11 @@ export declare class Player {
151
151
  * Extract rubric blocks for the current role.
152
152
  *
153
153
  * QTI uses `<rubricBlock view="...">` to provide role-specific guidance.
154
- * We return sanitized HTML for direct rendering.
154
+ * We return sanitized HTML for host rendering. `scope: "direct"` rubrics
155
+ * are assessmentItem children; `scope: "itemBody"` rubrics are authored in
156
+ * the rendered item body flow.
155
157
  */
156
- getRubrics(): RubricBlock[];
158
+ getRubrics(options?: RubricBlockOptions): RubricBlock[];
157
159
  getComponentRegistry(): ComponentRegistry;
158
160
  getExtractionRegistry(): ExtractionRegistry;
159
161
  /**
@@ -233,5 +235,6 @@ export declare class Player {
233
235
  private coerceToDeclarationValue;
234
236
  private collectOutcomes;
235
237
  private renderPrintedVariables;
238
+ private renderHtmlContent;
236
239
  private getModalFeedback;
237
240
  }
@@ -136,10 +136,11 @@ export class Player {
136
136
  }
137
137
  // Store PNP profile for later use (applyPnpToRoot is called once a root element is available).
138
138
  this._pnp = config.pnp;
139
- // Build catalog index from resolved delivery context, legacy shared catalog XML, and item XML.
140
- // Item/global entries are merged first; item-level entries win on global collisions.
139
+ // Build catalog index from legacy shared catalog XML, item XML, and resolved delivery context.
140
+ // Sanitized item-level delivery context entries win over raw item XML on collisions.
141
141
  // Stimulus entries are kept separately so rendered stimulus terms can avoid ID collisions.
142
142
  let mergedCatalog = new Map();
143
+ let deliveryItemCatalog = new Map();
143
144
  for (const source of config.deliveryContext?.catalogSources ?? []) {
144
145
  const sourceCatalog = extractCatalog(source.xml);
145
146
  if (source.scope === 'stimulus' && source.stimulusIdentifier) {
@@ -147,13 +148,14 @@ export class Player {
147
148
  this._stimulusCatalogIndexes.set(source.stimulusIdentifier, mergeCatalogs(existing, sourceCatalog));
148
149
  }
149
150
  else {
150
- mergedCatalog = mergeCatalogs(mergedCatalog, sourceCatalog);
151
+ deliveryItemCatalog = mergeCatalogs(deliveryItemCatalog, sourceCatalog);
151
152
  }
152
153
  }
153
154
  if (config.catalogXml) {
154
155
  mergedCatalog = mergeCatalogs(mergedCatalog, extractCatalogFromItemXml(config.catalogXml));
155
156
  }
156
- this._catalogIndex = mergeCatalogs(mergedCatalog, extractCatalogFromItemXml(this.itemXml));
157
+ mergedCatalog = mergeCatalogs(mergedCatalog, extractCatalogFromItemXml(this.itemXml));
158
+ this._catalogIndex = mergeCatalogs(mergedCatalog, deliveryItemCatalog);
157
159
  // Check strict compliance if enabled
158
160
  if (this.config.strictQtiCompliance?.enabled) {
159
161
  this.validateStrictCompliance();
@@ -565,25 +567,29 @@ export class Player {
565
567
  const inner = this.itemDocument.serializeItemBodyChildren();
566
568
  if (!inner)
567
569
  return '';
568
- const printed = this.renderPrintedVariables(inner);
569
- const sanitized = sanitizeHtml(printed, { security: this.config.security });
570
- return toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);
570
+ return this.renderHtmlContent(inner);
571
571
  }
572
572
  /**
573
573
  * Extract rubric blocks for the current role.
574
574
  *
575
575
  * QTI uses `<rubricBlock view="...">` to provide role-specific guidance.
576
- * We return sanitized HTML for direct rendering.
576
+ * We return sanitized HTML for host rendering. `scope: "direct"` rubrics
577
+ * are assessmentItem children; `scope: "itemBody"` rubrics are authored in
578
+ * the rendered item body flow.
577
579
  */
578
- getRubrics() {
580
+ getRubrics(options = {}) {
579
581
  const role = this.role;
580
582
  const rubricEls = this.itemDocument.findRubricElements();
581
583
  if (rubricEls.length === 0)
582
584
  return [];
583
585
  const blocks = [];
584
586
  for (const el of rubricEls) {
587
+ const scope = this.itemDocument.rubricElementScope(el);
588
+ if (options.scope && options.scope !== 'all' && scope !== options.scope)
589
+ continue;
585
590
  const viewRaw = (getAttr(el, 'view') || '').trim();
586
- const view = viewRaw ? viewRaw.split(/\s+/).filter(Boolean) : [];
591
+ const view = viewRaw ? viewRaw.split(/[\s,]+/).filter(Boolean) : [];
592
+ const use = (getAttr(el, 'use') || '').trim() || undefined;
587
593
  // If view is specified, show only when it includes the current role.
588
594
  if (view.length > 0 && role && !view.includes(role))
589
595
  continue;
@@ -591,7 +597,7 @@ export class Player {
591
597
  const printed = this.renderPrintedVariables(contentRaw);
592
598
  const sanitized = sanitizeHtml(printed, { security: this.config.security });
593
599
  const html = toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);
594
- blocks.push({ view, html });
600
+ blocks.push({ view, html, scope, use });
595
601
  }
596
602
  return blocks;
597
603
  }
@@ -1371,6 +1377,11 @@ export class Player {
1371
1377
  out = out.replace(/<printedVariable\b([^>]*)\/>/gi, (_m, attrs) => renderId(readIdentifier(String(attrs))));
1372
1378
  return out;
1373
1379
  }
1380
+ renderHtmlContent(html) {
1381
+ const printed = this.renderPrintedVariables(html);
1382
+ const sanitized = sanitizeHtml(printed, { security: this.config.security });
1383
+ return toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);
1384
+ }
1374
1385
  getModalFeedback(outcomes) {
1375
1386
  const feedbackEls = this.itemDocument.findModalFeedbackElements();
1376
1387
  const active = [];