Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/20260501125058-pie-element-multiple-choice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pie-element/multiple-choice": patch
---

multiple-choice release flow test
5 changes: 5 additions & 0 deletions .changeset/common-cougars-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pie-element/multiple-choice": patch
---

test multiple-choice release flow
5 changes: 5 additions & 0 deletions .changeset/floppy-sites-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pie-element/multiple-choice": patch
---

test release flow
5 changes: 5 additions & 0 deletions .changeset/orange-toes-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pie-element/multiple-choice": patch
---

test multiple-choice release flow
88 changes: 88 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"@pie-element/element-demo": "0.1.1",
"esm-player-test": "1.0.0",
"@pie-element/core": "0.1.0",
"@pie-element/element-player": "0.1.1",
"@pie-element/element-theme": "0.1.0",
"@pie-element/element-theme-daisyui": "0.1.0",
"@pie-element/categorize": "13.0.1",
"@pie-element/charting": "12.0.1",
"@pie-element/complex-rubric": "7.0.1",
"@pie-element/drag-in-the-blank": "10.0.1",
"@pie-element/drawing-response": "12.0.1",
"@pie-element/ebsr": "14.1.0",
"@pie-element/explicit-constructed-response": "11.0.1",
"@pie-element/extended-text-entry": "15.0.1",
"@pie-element/fraction-model": "6.0.1",
"@pie-element/graphing": "10.0.1",
"@pie-element/graphing-solution-set": "6.0.1",
"@pie-element/hotspot": "11.0.1",
"@pie-element/image-cloze-association": "10.0.1",
"@pie-element/inline-dropdown": "10.0.1",
"@pie-element/likert": "4.0.1",
"@pie-element/match": "12.0.1",
"@pie-element/match-list": "7.0.1",
"@pie-element/math-inline": "0.1.0",
"@pie-element/math-templated": "0.1.0",
"@pie-element/matrix": "4.0.1",
"@pie-element/multi-trait-rubric": "8.0.1",
"@pie-element/multiple-choice": "13.1.0",
"@pie-element/number-line": "13.0.1",
"@pie-element/passage": "7.0.1",
"@pie-element/placement-ordering": "14.0.1",
"@pie-element/rubric": "8.0.1",
"@pie-element/select-text": "13.0.1",
"@pie-element/mc-populated-blank": "0.2.10",
"@pie-element/simple-cloze": "0.1.3",
"@pie-element/venn-classification": "0.1.0",
"@pie-lib/categorize": "2.0.1",
"@pie-lib/charting": "7.0.1",
"@pie-lib/config-ui": "13.0.1",
"@pie-lib/controller-utils": "2.0.1",
"@pie-lib/correct-answer-toggle": "4.0.1",
"@pie-lib/drag": "4.0.1",
"@pie-lib/editable-html-tip-tap": "2.0.1",
"@pie-lib/graphing": "4.0.2",
"@pie-lib/graphing-solution-set": "4.0.1",
"@pie-lib/graphing-utils": "3.0.1",
"@pie-lib/icons": "4.0.1",
"@pie-lib/mask-markup": "3.0.1",
"@pie-lib/math-input": "0.1.0",
"@pie-lib/math-rendering": "0.1.0",
"@pie-lib/math-toolbar": "3.0.1",
"@pie-lib/plot": "4.0.1",
"@pie-lib/render-ui": "6.0.1",
"@pie-lib/rubric": "2.0.1",
"@pie-lib/style-utils": "2.0.1",
"@pie-lib/test-utils": "2.0.1",
"@pie-lib/text-select": "3.0.1",
"@pie-lib/tools": "2.0.1",
"@pie-lib/translator": "4.0.1",
"@pie-lib/delivery-events-svelte": "0.1.0",
"@pie-lib/editable-html-tiptap-svelte": "0.1.2",
"@pie-lib/math-input-svelte": "0.1.0",
"@pie-lib/styling-svelte": "0.1.2",
"@pie-element/print-player": "1.0.1",
"@pie-element/element-bundler": "0.1.1",
"@pie-element/bundler-shared": "0.1.1",
"@pie-element/shared-configure-events": "0.1.0",
"@pie-element/shared-controller-utils": "0.1.0",
"@pie-element/shared-feedback": "0.1.0",
"@pie-element/shared-math-rendering-mathjax": "0.1.0",
"@pie-element/shared-player-events": "0.1.0",
"@pie-element/shared-test-utils": "0.1.0",
"@pie-element/shared-theming": "0.1.0",
"@pie-element/shared-theming-mui": "0.1.0",
"@pie-element/shared-types": "0.1.0",
"@pie-element/shared-utils": "0.1.0",
"@pie-element/cli": "0.1.1"
},
"changesets": [
"20260501125058-pie-element-multiple-choice",
"common-cougars-hang",
"floppy-sites-watch"
]
}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
PUBLISH_NPM_TOKEN: ""
PUBLISH_NODE_AUTH_TOKEN: ""
# Flip to 'true' and restore `publish: bun run release:publish` on changesets/action to re-enable CI publish.
ENABLE_CICD_NPM_PUBLISH: "false"
ENABLE_CICD_NPM_PUBLISH: "true"
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
with:
# Omit `publish` so the action never runs `bun run release:publish` from CI.
# Re-enable publishing by setting ENABLE_CICD_NPM_PUBLISH=true and adding:
# publish: bun run release:publish
publish: bun run release:publish
createGithubReleases: false
version: bun run version
title: 'chore(release): version packages [skip-heavy-ci]'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ If you're a maintainer and need to sync changes from the upstream `pie-elements`
```bash
# 1. Clone upstream repositories as siblings (one-time setup)
cd ..
git clone https://github.com/PieLabs/pie-elements.git
git clone https://github.com/PieLabs/pie-lib.git
git clone https://github.com/pie-framework/pie-elements.git
git clone https://github.com/pie-framework/pie-lib.git
cd pie-elements-ng

# 2. Pull latest upstream changes
Expand Down
22 changes: 11 additions & 11 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"svelte": "^5.54.0",
"turbo": "^2.9.6",
"turbo": "^2.9.9",
"typescript": "^5.9.3",
"vite": "^8.0.1",
"vitest": "^4.1.0"
Expand Down
16 changes: 16 additions & 0 deletions packages/elements-react/ebsr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @pie-element/ebsr

## 14.1.1-next.1

### Patch Changes

- Updated dependencies [e32415a]
- @pie-element/multiple-choice@13.1.1-next.1

## 14.1.1-next.0

### Patch Changes

- Updated dependencies [259eb4d]
- Updated dependencies [7bd4a51]
- @pie-element/multiple-choice@13.1.1-next.0
2 changes: 1 addition & 1 deletion packages/elements-react/ebsr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pie-element/ebsr",
"version": "14.0.1",
"version": "14.1.1-next.1",
"description": "",
"dependencies": {
"@pie-element/multiple-choice": "workspace:*",
Expand Down
67 changes: 66 additions & 1 deletion packages/elements-react/ebsr/src/delivery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ export const isSessionComplete = (session) => {
return isNonEmptyArray(a) && isNonEmptyArray(b);
};

function getPlayerAttributes(element) {
const player =
element.closest('pie-player') ||
element.closest('pie-item-player');

if (!player) {
return { baseHeadingLevel: undefined, includeSrHeading: true };
}

const getRaw = (camelCaseName, hyphenatedName, allLowerName) => {
let raw = player[camelCaseName];

// fallback in case someone sets via HTML attribute manually
if (raw == null) {
raw =
player.getAttribute(hyphenatedName) ??
player.getAttribute(allLowerName);
}

return raw;
};

const levelRaw = getRaw('baseHeadingLevel', 'base-heading-level', 'baseheadinglevel');
const level = parseInt(levelRaw, 10);
const baseHeadingLevel = Number.isFinite(level) && level >= 1 && level <= 6 ? level : undefined;

const srRaw = getRaw('includeSrHeading', 'include-sr-heading', 'includesrheading');
const includeSrHeading = srRaw == null ? true : srRaw !== false && srRaw !== 'false';

return { baseHeadingLevel, includeSrHeading };
}

export default class Ebsr extends HTMLElement {
constructor() {
super();
Expand Down Expand Up @@ -95,6 +127,12 @@ export default class Ebsr extends HTMLElement {
mode,
keyMode: this._model[key].choicePrefix,
};

// Parts of an EBSR item should not render their own SR headings —
// the EBSR element itself provides the item-level heading.
const { includeSrHeading, baseHeadingLevel } = getPlayerAttributes(this);
part.includeSrHeading = includeSrHeading;
part.baseHeadingLevel = baseHeadingLevel !== undefined ? Math.min(6, baseHeadingLevel + (includeSrHeading ? 1 : 0)) : undefined;
}
}

Expand Down Expand Up @@ -126,16 +164,43 @@ export default class Ebsr extends HTMLElement {

connectedCallback() {
this._render();
this._initPlayerObserver();
this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);
}

disconnectedCallback() {
this._disconnectPlayerObserver();
this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);
}

_initPlayerObserver() {
const player = this.closest('pie-player') || this.closest('pie-item-player');
if (!player) return;

this._playerObserver = new MutationObserver(() => {
this._render();
});
this._playerObserver.observe(player, {
attributes: true,
attributeFilter: ['base-heading-level', 'baseheadinglevel', 'include-sr-heading', 'includesrheading'],
});
}

_disconnectPlayerObserver() {
if (this._playerObserver) {
this._playerObserver.disconnect();
this._playerObserver = null;
}
}

_render() {
this.ariaLabel = 'Two-Part Question';
this.role = 'region';

const { baseHeadingLevel: ebsrLevel, includeSrHeading } = getPlayerAttributes(this);
const headingTag = ebsrLevel ? `h${Math.min(6, ebsrLevel)}` : 'h2';
const srHeading = includeSrHeading ? `<${headingTag} class="srOnly">Two-Part Question</${headingTag}>` : '';

this.innerHTML = `
<style>
.srOnly {
Expand All @@ -150,7 +215,7 @@ export default class Ebsr extends HTMLElement {
}
${this._model?.extraCSSRules?.rules}
</style>
<h2 class="srOnly">Two-Part Question</h2>
${srHeading}
<${MC_TAG_NAME} id="a"></${MC_TAG_NAME}>
<${MC_TAG_NAME} id="b"></${MC_TAG_NAME}>
`;
Expand Down
14 changes: 14 additions & 0 deletions packages/elements-react/multiple-choice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @pie-element/multiple-choice

## 13.1.1-next.1

### Patch Changes

- e32415a: test release flow

## 13.1.1-next.0

### Patch Changes

- 259eb4d: multiple-choice release flow test
- 7bd4a51: test multiple-choice release flow
2 changes: 1 addition & 1 deletion packages/elements-react/multiple-choice/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pie-element/multiple-choice",
"version": "13.0.1",
"version": "13.1.0",
"description": "React implementation of multiple-choice element synced from pie-elements",
"dependencies": {
"@emotion/react": "^11.14.0",
Expand Down
Loading
Loading