@pie-element/multi-trait-rubric 8.1.3 → 8.1.5

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 CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric@8.1.4...@pie-element/multi-trait-rubric@8.1.5) (2026-06-22)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
11
+ - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
12
+ - **rubric/math-observer:** implement math rendering observer for improved sync PIE-671 ([aeb4e0c](https://github.com/pie-framework/pie-elements/commit/aeb4e0c9e2c67e5915ef0c435ea4065447a7c1b1))
13
+
14
+ ## [8.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric@8.1.3...@pie-element/multi-trait-rubric@8.1.4) (2026-06-17)
15
+
16
+ ### Bug Fixes
17
+
18
+ - bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
19
+
6
20
  ## [8.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric@8.1.2...@pie-element/multi-trait-rubric@8.1.3) (2026-06-12)
7
21
 
8
22
  ### Bug Fixes
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-configure@7.1.4...@pie-element/multi-trait-rubric-configure@7.1.5) (2026-06-22)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
11
+ - handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
12
+
13
+ ## [7.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-configure@7.1.3...@pie-element/multi-trait-rubric-configure@7.1.4) (2026-06-17)
14
+
15
+ ### Bug Fixes
16
+
17
+ - bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
18
+
6
19
  ## [7.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-configure@7.1.2...@pie-element/multi-trait-rubric-configure@7.1.3) (2026-06-12)
7
20
 
8
21
  ### Bug Fixes
@@ -147,9 +147,13 @@ class MultiTraitRubricElement extends HTMLElement {
147
147
  this._root.render(element);
148
148
  }
149
149
  }
150
+ connectedCallback() {
151
+ this._render();
152
+ }
150
153
  disconnectedCallback() {
151
154
  if (this._root) {
152
155
  this._root.unmount();
156
+ this._root = null;
153
157
  }
154
158
  }
155
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_pieConfigureEvents","require","_react","_interopRequireDefault","_client","_main","_defaults","_utils","_modals","modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","MultiTraitRubricElement","HTMLElement","constructor","_defineProperty2","default","currentModel","_model","validatedModel","scales","excludeZero","forEach","scale","scorePointsLabels","traits","maxPoints","howManyScorePointLabelsShouldHave","howManyScorePointLabelsItHas","length","i","push","slice","trait","scorePointsDescriptors","howManyScorePointDescriptorsItHas","shouldAddColumn0","some","addOrRemoveScaleColumn","excludeZeroTypes","add0","updateModelAccordingToReceivedProps","_render","dispatchEvent","ModelUpdatedEvent","_configuration","_root","insertSound","handler","InsertSoundEvent","onDeleteSound","src","done","DeleteSoundEvent","insertImage","InsertImageEvent","onDeleteImage","DeleteImageEvent","element","React","createElement","Main","onModelChanged","onConfigurationChanged","uploadSoundSupport","add","bind","delete","imageSupport","createRoot","render","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import {\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n InsertImageEvent,\n DeleteImageEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport Main from './main';\nimport defaults from './defaults';\nimport { addOrRemoveScaleColumn } from './utils';\nimport { excludeZeroTypes } from './modals';\n\nconst modelWithDefaults = (m) => ({ ...defaults.model, ...m });\nconst configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });\n\nexport default class MultiTraitRubricElement extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n }\n\n updateModelAccordingToReceivedProps = (m) => {\n const currentModel = { ...this._model };\n\n if (!m) {\n return currentModel;\n }\n\n const validatedModel = { ...m };\n const { scales, excludeZero } = validatedModel || {};\n\n (scales || []).forEach((scale) => {\n if (!scale) {\n scale = { scorePointsLabels: [], traits: [] };\n }\n\n const { maxPoints } = scale || {};\n\n scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];\n scale.traits = [...(scale.traits || [])];\n\n const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;\n const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;\n\n if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {\n scale.scorePointsLabels.push('');\n }\n } else {\n scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n\n (scale.traits || []).forEach((trait) => {\n if (!trait) {\n trait = { scorePointsDescriptors: [] };\n }\n\n trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];\n\n const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;\n\n if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {\n trait.scorePointsDescriptors.push('');\n }\n } else {\n trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n });\n });\n\n if (validatedModel.excludeZero) {\n // check if any scale has maxPoints set to 1\n const shouldAddColumn0 = validatedModel.scales.some((scale) => scale.maxPoints === 1);\n\n if (shouldAddColumn0) {\n // excludeZero should be false and disabled when maxPoints is 1\n validatedModel.excludeZero = false;\n // add column 0 for all scales\n validatedModel.scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);\n }\n }\n\n return validatedModel;\n };\n\n set model(m) {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged = (m) => {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n this._render();\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,SAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,MAAMQ,iBAAiB,GAAIC,CAAC,KAAM;EAAE,GAAGC,iBAAQ,CAACC,KAAK;EAAE,GAAGF;AAAE,CAAC,CAAC;AAC9D,MAAMG,yBAAyB,GAAIC,CAAC,KAAM;EAAE,GAAGH,iBAAQ,CAACI,aAAa;EAAE,GAAGD;AAAE,CAAC,CAAC;AAE/D,MAAME,uBAAuB,SAASC,WAAW,CAAC;EAC/DC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+CAM6BV,CAAC,IAAK;MAC3C,MAAMW,YAAY,GAAG;QAAE,GAAG,IAAI,CAACC;MAAO,CAAC;MAEvC,IAAI,CAACZ,CAAC,EAAE;QACN,OAAOW,YAAY;MAC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cAAK,CAACC,aAAa,CAACC,aAAI,EAAE;QACtCrD,KAAK,EAAE,IAAI,CAACU,MAAM;QAClBP,aAAa,EAAE,IAAI,CAACkC,cAAc;QAClCiB,cAAc,EAAE,IAAI,CAACA,cAAc;QACnCC,sBAAsB,EAAE,IAAI,CAACA,sBAAsB;QACnDC,kBAAkB,EAAE;UAClBC,GAAG,EAAE,IAAI,CAAClB,WAAW,CAACmB,IAAI,CAAC,IAAI,CAAC;UAChCC,MAAM,EAAE,IAAI,CAACjB,aAAa,CAACgB,IAAI,CAAC,IAAI;QACtC,CAAC;QACDE,YAAY,EAAE;UACZH,GAAG,EAAE,IAAI,CAACX,WAAW,CAACY,IAAI,CAAC,IAAI,CAAC;UAChCC,MAAM,EAAE,IAAI,CAACX,aAAa,CAACU,IAAI,CAAC,IAAI;QACtC;MACF,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAACpB,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAAuB,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAACvB,KAAK,CAACwB,MAAM,CAACZ,OAAO,CAAC;IAC5B;EACF;EAEAa,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACzB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAAC0B,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAzD,OAAA,GAAAJ,uBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_pieConfigureEvents","require","_react","_interopRequireDefault","_client","_main","_defaults","_utils","_modals","modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","MultiTraitRubricElement","HTMLElement","constructor","_defineProperty2","default","currentModel","_model","validatedModel","scales","excludeZero","forEach","scale","scorePointsLabels","traits","maxPoints","howManyScorePointLabelsShouldHave","howManyScorePointLabelsItHas","length","i","push","slice","trait","scorePointsDescriptors","howManyScorePointDescriptorsItHas","shouldAddColumn0","some","addOrRemoveScaleColumn","excludeZeroTypes","add0","updateModelAccordingToReceivedProps","_render","dispatchEvent","ModelUpdatedEvent","_configuration","_root","insertSound","handler","InsertSoundEvent","onDeleteSound","src","done","DeleteSoundEvent","insertImage","InsertImageEvent","onDeleteImage","DeleteImageEvent","element","React","createElement","Main","onModelChanged","onConfigurationChanged","uploadSoundSupport","add","bind","delete","imageSupport","createRoot","render","connectedCallback","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import {\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n InsertImageEvent,\n DeleteImageEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport Main from './main';\nimport defaults from './defaults';\nimport { addOrRemoveScaleColumn } from './utils';\nimport { excludeZeroTypes } from './modals';\n\nconst modelWithDefaults = (m) => ({ ...defaults.model, ...m });\nconst configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });\n\nexport default class MultiTraitRubricElement extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n }\n\n updateModelAccordingToReceivedProps = (m) => {\n const currentModel = { ...this._model };\n\n if (!m) {\n return currentModel;\n }\n\n const validatedModel = { ...m };\n const { scales, excludeZero } = validatedModel || {};\n\n (scales || []).forEach((scale) => {\n if (!scale) {\n scale = { scorePointsLabels: [], traits: [] };\n }\n\n const { maxPoints } = scale || {};\n\n scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];\n scale.traits = [...(scale.traits || [])];\n\n const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;\n const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;\n\n if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {\n scale.scorePointsLabels.push('');\n }\n } else {\n scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n\n (scale.traits || []).forEach((trait) => {\n if (!trait) {\n trait = { scorePointsDescriptors: [] };\n }\n\n trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];\n\n const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;\n\n if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {\n trait.scorePointsDescriptors.push('');\n }\n } else {\n trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n });\n });\n\n if (validatedModel.excludeZero) {\n // check if any scale has maxPoints set to 1\n const shouldAddColumn0 = validatedModel.scales.some((scale) => scale.maxPoints === 1);\n\n if (shouldAddColumn0) {\n // excludeZero should be false and disabled when maxPoints is 1\n validatedModel.excludeZero = false;\n // add column 0 for all scales\n validatedModel.scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);\n }\n }\n\n return validatedModel;\n };\n\n set model(m) {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged = (m) => {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n this._render();\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n }\n\n connectedCallback() {\n this._render();\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,SAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,MAAMQ,iBAAiB,GAAIC,CAAC,KAAM;EAAE,GAAGC,iBAAQ,CAACC,KAAK;EAAE,GAAGF;AAAE,CAAC,CAAC;AAC9D,MAAMG,yBAAyB,GAAIC,CAAC,KAAM;EAAE,GAAGH,iBAAQ,CAACI,aAAa;EAAE,GAAGD;AAAE,CAAC,CAAC;AAE/D,MAAME,uBAAuB,SAASC,WAAW,CAAC;EAC/DC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+CAM6BV,CAAC,IAAK;MAC3C,MAAMW,YAAY,GAAG;QAAE,GAAG,IAAI,CAACC;MAAO,CAAC;MAEvC,IAAI,CAACZ,CAAC,EAAE;QACN,OAAOW,YAAY;MACrB;MAEA,MAAME,cAAc,GAAG;QAAE,GAAGb;MAAE,CAAC;MAC/B,MAAM;QAAEc,MAAM;QAAEC;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,EAAE,IAAI,CAACkC,cAAc;QAClCiB,cAAc,EAAE,IAAI,CAACA,cAAc;QACnCC,sBAAsB,EAAE,IAAI,CAACA,sBAAsB;QACnDC,kBAAkB,EAAE;UAClBC,GAAG,EAAE,IAAI,CAAClB,WAAW,CAACmB,IAAI,CAAC,IAAI,CAAC;UAChCC,MAAM,EAAE,IAAI,CAACjB,aAAa,CAACgB,IAAI,CAAC,IAAI;QACtC,CAAC;QACDE,YAAY,EAAE;UACZH,GAAG,EAAE,IAAI,CAACX,WAAW,CAACY,IAAI,CAAC,IAAI,CAAC;UAChCC,MAAM,EAAE,IAAI,CAACX,aAAa,CAACU,IAAI,CAAC,IAAI;QACtC;MACF,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAACpB,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAAuB,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAACvB,KAAK,CAACwB,MAAM,CAACZ,OAAO,CAAC;IAC5B;EACF;EAEAa,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAAC7B,OAAO,CAAC,CAAC;EAChB;EAEA8B,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAAC1B,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAAC2B,OAAO,CAAC,CAAC;MACpB,IAAI,CAAC3B,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAAC4B,OAAA,CAAA1D,OAAA,GAAAJ,uBAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/multi-trait-rubric-configure",
3
- "version": "7.1.3",
3
+ "version": "7.1.5",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -11,9 +11,9 @@
11
11
  "@mui/icons-material": "^7.3.4",
12
12
  "@mui/material": "^7.3.4",
13
13
  "@pie-framework/pie-configure-events": "^1.3.0",
14
- "@pie-lib/config-ui": "13.0.7",
15
- "@pie-lib/drag": "4.0.4",
16
- "@pie-lib/editable-html-tip-tap": "2.1.5",
14
+ "@pie-lib/config-ui": "13.0.9",
15
+ "@pie-lib/drag": "4.0.5",
16
+ "@pie-lib/editable-html-tip-tap": "2.1.7",
17
17
  "@pie-lib/render-ui": "6.1.2",
18
18
  "debug": "^4.1.1",
19
19
  "lodash-es": "^4.17.23",
package/lib/index.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _client = require("react-dom/client");
10
11
  var _piePlayerEvents = require("@pie-framework/pie-player-events");
@@ -13,9 +14,49 @@ var _mathRendering = require("@pie-lib/math-rendering");
13
14
  class MultiTraitRubric extends HTMLElement {
14
15
  constructor() {
15
16
  super();
17
+ // React commits asynchronously, so a queueMicrotask(renderMath) can run before
18
+ // the LaTeX spans are in the DOM and leave raw LaTeX on first render — this is
19
+ // especially visible when this element is mounted inside complex-rubric, which
20
+ // swaps its innerHTML and re-defines the inner element. Observing the DOM and
21
+ // typesetting after each commit keeps math in sync regardless of timing.
22
+ (0, _defineProperty2.default)(this, "_scheduleMathRender", () => {
23
+ if (this._mathRenderPending) return;
24
+ this._mathRenderPending = true;
25
+ requestAnimationFrame(() => {
26
+ if (this._mathObserver) {
27
+ this._mathObserver.disconnect();
28
+ }
29
+ (0, _mathRendering.renderMath)(this);
30
+ this._mathRenderPending = false;
31
+ setTimeout(() => {
32
+ if (this._mathObserver) {
33
+ this._mathObserver.observe(this, {
34
+ childList: true,
35
+ subtree: true
36
+ });
37
+ }
38
+ }, 50);
39
+ });
40
+ });
16
41
  this._model = {};
17
42
  this._session = null;
18
43
  this._root = null;
44
+ this._mathObserver = null;
45
+ this._mathRenderPending = false;
46
+ }
47
+ _initMathObserver() {
48
+ if (this._mathObserver) return;
49
+ this._mathObserver = new MutationObserver(this._scheduleMathRender);
50
+ this._mathObserver.observe(this, {
51
+ childList: true,
52
+ subtree: true
53
+ });
54
+ }
55
+ _disconnectMathObserver() {
56
+ if (this._mathObserver) {
57
+ this._mathObserver.disconnect();
58
+ this._mathObserver = null;
59
+ }
19
60
  }
20
61
  set model(s) {
21
62
  this._model = s;
@@ -29,9 +70,11 @@ class MultiTraitRubric extends HTMLElement {
29
70
  return this._session;
30
71
  }
31
72
  connectedCallback() {
73
+ this._initMathObserver();
32
74
  this._render();
33
75
  }
34
76
  _render() {
77
+ this._initMathObserver();
35
78
  const el = /*#__PURE__*/_react.default.createElement(_main.default, {
36
79
  model: this._model,
37
80
  session: this._session
@@ -40,13 +83,12 @@ class MultiTraitRubric extends HTMLElement {
40
83
  this._root = (0, _client.createRoot)(this);
41
84
  }
42
85
  this._root.render(el);
43
- queueMicrotask(() => {
44
- (0, _mathRendering.renderMath)(this);
45
- });
46
86
  }
47
87
  disconnectedCallback() {
88
+ this._disconnectMathObserver();
48
89
  if (this._root) {
49
90
  this._root.unmount();
91
+ this._root = null;
50
92
  }
51
93
  }
52
94
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_piePlayerEvents","_main","_mathRendering","MultiTraitRubric","HTMLElement","constructor","_model","_session","_root","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","el","React","createElement","Main","createRoot","render","queueMicrotask","renderMath","disconnectedCallback","unmount","exports","default"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nexport default class MultiTraitRubric extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = null;\n this._root = null;\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n const el = React.createElement(Main, { model: this._model, session: this._session });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEe,MAAMK,gBAAgB,SAASC,WAAW,CAAC;EACxDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAACC,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACC,KAAK,GAAG,IAAI;EACnB;EAEA,IAAIC,KAAKA,CAACC,CAAC,EAAE;IACX,IAAI,CAACJ,MAAM,GAAGI,CAAC;IACf,IAAI,CAACC,aAAa,CAAC,IAAIC,8BAAa,CAAC,IAAI,CAACC,OAAO,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACP,QAAQ,EAAE,CAAC,CAAC,IAAI,CAACD,MAAM,CAAC,CAAC;IAE/F,IAAI,CAACS,OAAO,CAAC,CAAC;EAChB;EAEA,IAAIC,OAAOA,CAACN,CAAC,EAAE;IACb,IAAI,CAACH,QAAQ,GAAGG,CAAC;EACnB;EAEA,IAAIM,OAAOA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACT,QAAQ;EACtB;EAEAU,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACF,OAAO,CAAC,CAAC;EAChB;EAEAA,OAAOA,CAAA,EAAG;IACR,MAAMG,EAAE,gBAAGC,cAAK,CAACC,aAAa,CAACC,aAAI,EAAE;MAAEZ,KAAK,EAAE,IAAI,CAACH,MAAM;MAAEU,OAAO,EAAE,IAAI,CAACT;IAAS,CAAC,CAAC;IAEpF,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;MACf,IAAI,CAACA,KAAK,GAAG,IAAAc,kBAAU,EAAC,IAAI,CAAC;IAC/B;IACA,IAAI,CAACd,KAAK,CAACe,MAAM,CAACL,EAAE,CAAC;IACrBM,cAAc,CAAC,MAAM;MACnB,IAAAC,yBAAU,EAAC,IAAI,CAAC;IAClB,CAAC,CAAC;EACJ;EAEAC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAAClB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACmB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAA1B,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_piePlayerEvents","_main","_mathRendering","MultiTraitRubric","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","_session","_root","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","el","React","createElement","Main","createRoot","render","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nexport default class MultiTraitRubric extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n // React commits asynchronously, so a queueMicrotask(renderMath) can run before\n // the LaTeX spans are in the DOM and leave raw LaTeX on first render — this is\n // especially visible when this element is mounted inside complex-rubric, which\n // swaps its innerHTML and re-defines the inner element. Observing the DOM and\n // typesetting after each commit keeps math in sync regardless of timing.\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._initMathObserver();\n this._render();\n }\n\n _render() {\n this._initMathObserver();\n\n const el = React.createElement(Main, { model: this._model, session: this._session });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEe,MAAMK,gBAAgB,SAASC,WAAW,CAAC;EACxDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAQT;IACA;IACA;IACA;IACA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,+BACsB,MAAM;MAC1B,IAAI,IAAI,CAACC,kBAAkB,E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AAC,IAAI,CAACC,OAAO,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACX,QAAQ,EAAE,CAAC,CAAC,IAAI,CAACD,MAAM,CAAC,CAAC;IAE/F,IAAI,CAACa,OAAO,CAAC,CAAC;EAChB;EAEA,IAAIC,OAAOA,CAACN,CAAC,EAAE;IACb,IAAI,CAACP,QAAQ,GAAGO,CAAC;EACnB;EAEA,IAAIM,OAAOA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACb,QAAQ;EACtB;EAEAc,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACZ,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACU,OAAO,CAAC,CAAC;EAChB;EAEAA,OAAOA,CAAA,EAAG;IACR,IAAI,CAACV,iBAAiB,CAAC,CAAC;IAExB,MAAMa,EAAE,gBAAGC,cAAK,CAACC,aAAa,CAACC,aAAI,EAAE;MAAEZ,KAAK,EAAE,IAAI,CAACP,MAAM;MAAEc,OAAO,EAAE,IAAI,CAACb;IAAS,CAAC,CAAC;IAEpF,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;MACf,IAAI,CAACA,KAAK,GAAG,IAAAkB,kBAAU,EAAC,IAAI,CAAC;IAC/B;IACA,IAAI,CAAClB,KAAK,CAACmB,MAAM,CAACL,EAAE,CAAC;EACvB;EAEAM,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAAChB,uBAAuB,CAAC,CAAC;IAC9B,IAAI,IAAI,CAACJ,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACqB,OAAO,CAAC,CAAC;MACpB,IAAI,CAACrB,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACsB,OAAA,CAAAlC,OAAA,GAAAJ,gBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/multi-trait-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "8.1.3",
4
+ "version": "8.1.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -18,7 +18,7 @@
18
18
  "react": "18.3.1",
19
19
  "react-dom": "18.3.1"
20
20
  },
21
- "gitHead": "213c3a293da2591ffaf2ba5c5fb50f0fe7577cfa",
21
+ "gitHead": "f898c2bf045f66d34e66e8bb201950bfd00b2f0f",
22
22
  "scripts": {
23
23
  "postpublish": "../../scripts/postpublish"
24
24
  },