@pie-players/pie-players-shared 1.0.0-beta.0 → 1.0.0-beta.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.
- package/dist/pie/index.d.ts +1 -0
- package/dist/pie/index.js +1 -0
- package/dist/pie/versioned-tag.d.ts +10 -0
- package/dist/pie/versioned-tag.js +27 -0
- package/dist/types/index.d.ts +29 -3
- package/package.json +1 -1
package/dist/pie/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { BundleType, defaultPieElementOptions, isCustomElementConstructor, isPie
|
|
|
41
41
|
export { attemptCustomElementDefine, defineCustomElementSafely, type AttemptCustomElementDefineOptions, type SafeDefineAttempt, type SafeDefineOutcome, type SafeDefineResult, type SafeDefineStatus, } from "./custom-element-define.js";
|
|
42
42
|
export { toPrintHashedTag, toViewTag, validateCustomElementTag, VIEW_TAG_SUFFIX, } from "./tag-names.js";
|
|
43
43
|
export type { PieViewMode } from "./tag-names.js";
|
|
44
|
+
export { runtimeElementTags } from "./versioned-tag.js";
|
|
44
45
|
export { updatePieElement, updatePieElements, updatePieElementWithRef, } from "./updates.js";
|
|
45
46
|
export type { ElementOverrides } from "./overrides.js";
|
|
46
47
|
export { addOrUpdateOverrideInUrl, applyElementOverrides, applyElementVersionOverridesPreserveTags, extractPackageInfo, formatElementOverrideParam, parseElementOverridesFromCurrentUrl, parseElementOverridesFromUrl, } from "./overrides.js";
|
package/dist/pie/index.js
CHANGED
|
@@ -44,6 +44,7 @@ isPieAvailable, isPieRegistryAvailable, Status, } from "./types.js";
|
|
|
44
44
|
// Tag naming helpers
|
|
45
45
|
export { attemptCustomElementDefine, defineCustomElementSafely, } from "./custom-element-define.js";
|
|
46
46
|
export { toPrintHashedTag, toViewTag, validateCustomElementTag, VIEW_TAG_SUFFIX, } from "./tag-names.js";
|
|
47
|
+
export { runtimeElementTags } from "./versioned-tag.js";
|
|
47
48
|
// Updates
|
|
48
49
|
export { updatePieElement, updatePieElements, updatePieElementWithRef, } from "./updates.js";
|
|
49
50
|
export { addOrUpdateOverrideInUrl, applyElementOverrides, applyElementVersionOverridesPreserveTags, extractPackageInfo, formatElementOverrideParam, parseElementOverridesFromCurrentUrl, parseElementOverridesFromUrl, } from "./overrides.js";
|
|
@@ -17,3 +17,13 @@ export declare function parseVersionedTagName(tagName: string): {
|
|
|
17
17
|
export declare function toPackageVersionedTag(tagName: string, packageSpec: string, options?: {
|
|
18
18
|
preserveUnversionedTag?: boolean;
|
|
19
19
|
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* The tags a player can define an authored element under, most specific first:
|
|
22
|
+
* the versioned tag for its package spec, aligned to the page's preloaded
|
|
23
|
+
* registration, then the authored tag, which an unversioned spec keeps. With no
|
|
24
|
+
* spec the authored tag is the only candidate.
|
|
25
|
+
*
|
|
26
|
+
* For code that looks an element's class up by tag without rendering it, such as
|
|
27
|
+
* reading what the class declares before the element is in the DOM.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runtimeElementTags(tagName: string, packageSpec?: string): string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { alignPreloadedElementVersions } from "../loaders/preloaded-alignment.js";
|
|
1
2
|
import { parsePackageName } from "./utils.js";
|
|
2
3
|
const VERSION_DELIMITER = "--version-";
|
|
3
4
|
const TAG_VERSION_PATTERN = "[0-9A-Za-z-]+";
|
|
@@ -45,3 +46,29 @@ export function toPackageVersionedTag(tagName, packageSpec, options = {}) {
|
|
|
45
46
|
// package versions at runtime, which requires updating the cloned runtime tag.
|
|
46
47
|
return `${baseName}${VERSION_DELIMITER}${targetEncodedVersion}`;
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The tags a player can define an authored element under, most specific first:
|
|
51
|
+
* the versioned tag for its package spec, aligned to the page's preloaded
|
|
52
|
+
* registration, then the authored tag, which an unversioned spec keeps. With no
|
|
53
|
+
* spec the authored tag is the only candidate.
|
|
54
|
+
*
|
|
55
|
+
* For code that looks an element's class up by tag without rendering it, such as
|
|
56
|
+
* reading what the class declares before the element is in the DOM.
|
|
57
|
+
*/
|
|
58
|
+
export function runtimeElementTags(tagName, packageSpec) {
|
|
59
|
+
if (!packageSpec)
|
|
60
|
+
return [tagName];
|
|
61
|
+
let versioned;
|
|
62
|
+
try {
|
|
63
|
+
const { elements } = alignPreloadedElementVersions({
|
|
64
|
+
elements: { [tagName]: packageSpec },
|
|
65
|
+
});
|
|
66
|
+
versioned = toPackageVersionedTag(tagName, elements[tagName], {
|
|
67
|
+
preserveUnversionedTag: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return [tagName];
|
|
72
|
+
}
|
|
73
|
+
return versioned === tagName ? [tagName] : [versioned, tagName];
|
|
74
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -464,9 +464,25 @@ export interface AccessibilityCatalog {
|
|
|
464
464
|
identifier: string;
|
|
465
465
|
cards: CatalogCard[];
|
|
466
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* A learner's personal needs profile, in tool ids. An AfA PNP 3.0 record maps to
|
|
469
|
+
* it through the AfA adapter the packaged tool set exports.
|
|
470
|
+
*/
|
|
467
471
|
export interface PersonalNeedsProfile {
|
|
472
|
+
/** Tools the learner may turn on. */
|
|
468
473
|
supports: string[];
|
|
474
|
+
/** Tools withheld from the learner; a prohibition outranks a support. */
|
|
469
475
|
prohibitedSupports?: string[];
|
|
476
|
+
/**
|
|
477
|
+
* Tools granted as `supports` grants them and turned on when the learner's
|
|
478
|
+
* toolbar first shows them. A block withdraws them as it withdraws a support.
|
|
479
|
+
*/
|
|
480
|
+
activateAtInit?: string[];
|
|
481
|
+
/**
|
|
482
|
+
* Parameters by tool id, the lowest layer: the assessment's and an item's
|
|
483
|
+
* `toolParameters` override them key by key.
|
|
484
|
+
*/
|
|
485
|
+
toolParameters?: ToolParameters;
|
|
470
486
|
}
|
|
471
487
|
export interface AssessmentEntity extends BaseEntity, SearchMetaDataEntity {
|
|
472
488
|
name?: string;
|
|
@@ -509,8 +525,9 @@ export interface AssessmentSettings {
|
|
|
509
525
|
toolOverrides?: Record<string, boolean>;
|
|
510
526
|
};
|
|
511
527
|
/**
|
|
512
|
-
* Parameters by tool id, handed to the tool wherever policy shows it
|
|
513
|
-
*
|
|
528
|
+
* Parameters by tool id, handed to the tool wherever policy shows it. They
|
|
529
|
+
* override the profile's `toolParameters` key by key, and an item's
|
|
530
|
+
* `toolParameters` override them on that item's own toolbar. Provider
|
|
514
531
|
* configuration belongs in the toolkit's `tools.providers`.
|
|
515
532
|
*/
|
|
516
533
|
toolParameters?: ToolParameters;
|
|
@@ -531,6 +548,15 @@ export interface ToolParameterMap {
|
|
|
531
548
|
signLanguage: {
|
|
532
549
|
signLang?: string;
|
|
533
550
|
};
|
|
551
|
+
/**
|
|
552
|
+
* `rate` multiplies every playback speed, 1 being the provider's normal
|
|
553
|
+
* speed; `pitch` runs 0–2 with 1 normal; `volume` runs 0–1.
|
|
554
|
+
*/
|
|
555
|
+
textToSpeech: {
|
|
556
|
+
rate?: number;
|
|
557
|
+
pitch?: number;
|
|
558
|
+
volume?: number;
|
|
559
|
+
};
|
|
534
560
|
}
|
|
535
561
|
/** The parameter shape of tool `K`: its {@link ToolParameterMap} entry, else open. */
|
|
536
562
|
export type ToolParametersFor<K extends string> = K extends keyof ToolParameterMap ? ToolParameterMap[K] : Record<string, unknown>;
|
|
@@ -547,7 +573,7 @@ export type ToolParameters = {
|
|
|
547
573
|
export interface ItemSettings {
|
|
548
574
|
requiredTools?: string[];
|
|
549
575
|
restrictedTools?: string[];
|
|
550
|
-
/** Parameters by tool id;
|
|
576
|
+
/** Parameters by tool id; override the assessment's key by key. */
|
|
551
577
|
toolParameters?: ToolParameters;
|
|
552
578
|
}
|
|
553
579
|
export type PlayerMode = "gather" | "view" | "evaluate" | "author";
|