@citolab/qti-components 6.0.6 → 6.0.8

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
- import{a as w,b as h}from"./chunk-DLLHO3W2.js";import{c as o}from"./chunk-NMCIOGD2.js";import{css as x,html as y,LitElement as m}from"lit";import{property as l}from"lit/decorators.js";var p=(d,g)=>{class t extends d{constructor(){super(...arguments);this.scale=1;this.ro=new ResizeObserver(a=>{for(let e of a)this.fitToParent(e.contentRect.width)})}connectedCallback(){super.connectedCallback(),this.ro.observe(this),this.fitToParent()}set scales(a){let e=this._scales;this.requestUpdate("prop",e),this.fitToParent()}get scales(){return this._scales}fitToParent(a=this.clientWidth){let e=this.shadowRoot.querySelector(g);if(e){let c=a/e.clientWidth;this.scale=c;let v=-e.clientHeight*(1-c)+"px",b=-e.clientWidth*(1-c)+"px";requestAnimationFrame(()=>{e.style.transform=`scale(${this.scale})`,e.style.margin=`0 ${b} ${v} 0`})}}}return o([l({type:Number,reflect:!0})],t.prototype,"scale",2),o([l({type:Boolean,attribute:!1})],t.prototype,"scales",1),t};import{customElement as q,property as s}from"lit/decorators.js";import{unsafeHTML as k}from"lit/directives/unsafe-html.js";import{ContextProvider as C}from"@lit-labs/context";var f=`/* PK: Tailwind theming file for all qti-components
1
+ import{a as n,b as s}from"./chunk-DLLHO3W2.js";import{c as i}from"./chunk-NMCIOGD2.js";import{css as g,html as h,LitElement as l}from"lit";import{customElement as p,property as w}from"lit/decorators.js";import{unsafeHTML as f}from"lit/directives/unsafe-html.js";import{ContextProvider as v}from"@lit-labs/context";var c=`/* PK: Tailwind theming file for all qti-components
2
2
  Uses tailwind components and utilities from the other files
3
3
 
4
4
  https://play.tailwindcss.com/OFThGk8CbR
@@ -626,9 +626,11 @@ qti-choice-interaction:not(.qti-input-control-hidden) qti-simple-choice[role='ch
626
626
  --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
627
627
  }
628
628
 
629
- qti-choice-interaction:not(.qti-input-control-hidden) qti-simple-choice[role='checkbox'][aria-checked='true']::part(cha) {
630
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' width='100%' height='100%' viewBox='0 0 24 24'%3E%3Cpath d='M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z'/%3E%3C/svg%3E");
631
- }
629
+ qti-choice-interaction:not(.qti-input-control-hidden) qti-simple-choice[role='checkbox'][aria-checked='true']::part(cha){
630
+ --tw-bg-opacity: 1;
631
+ background-color: rgb(59 130 246 / var(--tw-bg-opacity));
632
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' width='100%' height='100%' viewBox='0 0 24 24'%3E%3Cpath d='M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z'/%3E%3C/svg%3E");
633
+ }
632
634
 
633
635
  qti-choice-interaction:not(.qti-input-control-hidden) qti-simple-choice:hover{
634
636
  --tw-bg-opacity: 1;
@@ -1252,9 +1254,11 @@ qti-hottext-interaction:not(.qti-input-control-hidden) qti-hottext[role='checkbo
1252
1254
  --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
1253
1255
  }
1254
1256
 
1255
- qti-hottext-interaction:not(.qti-input-control-hidden) qti-hottext[role='checkbox'][aria-checked='true']::part(cha) {
1256
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' width='100%' height='100%' viewBox='0 0 24 24'%3E%3Cpath d='M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z'/%3E%3C/svg%3E");
1257
- }
1257
+ qti-hottext-interaction:not(.qti-input-control-hidden) qti-hottext[role='checkbox'][aria-checked='true']::part(cha){
1258
+ --tw-bg-opacity: 1;
1259
+ background-color: rgb(59 130 246 / var(--tw-bg-opacity));
1260
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' width='100%' height='100%' viewBox='0 0 24 24'%3E%3Cpath d='M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z'/%3E%3C/svg%3E");
1261
+ }
1258
1262
 
1259
1263
  qti-hottext-interaction:not(.qti-input-control-hidden) qti-hottext{
1260
1264
  display: inline-flex;
@@ -1698,7 +1702,7 @@ qti-associate-interaction::part(associables-container){
1698
1702
  background: linear-gradient(
1699
1703
  180deg,
1700
1704
  rgb(0 0 0 / 0%) calc(50% - 1px),
1701
- #ff0000 calc(50%),
1705
+ #000000 calc(50%),
1702
1706
  rgb(0 0 0 / 0%) calc(50% + 1px)
1703
1707
  );
1704
1708
  }
@@ -2193,20 +2197,8 @@ video {
2193
2197
  max-width: 100%;
2194
2198
  height: auto;
2195
2199
  }
2196
- `;var r=class extends p(m,"qti-assessment-item"){constructor(){super(...arguments);this.disabled=!1;this.readonly=!1;this.provider=new C(this,h,{log:t=>console.log(`[my-app] ${t}`),view:"candidate"});this.processResponse=()=>{var t;return(t=this._item)==null?void 0:t.processResponse()};this.showCorrectResponse=()=>{var t;return(t=this._item)==null?void 0:t.showCorrectResponse()};this.validateResponses=()=>this._item?this._item.validateResponses():!1;this.resetInteractions=()=>{var t;return(t=this._item)==null?void 0:t.resetInteractions()};this.render=()=>y`${k(this._xml)}`}handleDisabledChange(t,i){var n,a;i&&((n=this._item)==null||n.setAttribute("disabled","")),!i&&((a=this._item)==null||a.removeAttribute("disabled"))}handleReadonlyChange(t,i){var n,a;i&&((n=this._item)==null||n.setAttribute("readonly","")),!i&&((a=this._item)==null||a.removeAttribute("readonly"))}handleResponsesChange(t,i){this._item&&(this._item.responses=i)}set qtiContext(t){this.provider.value.view=t.view,this.provider.updateObservers()}get _item(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("qti-assessment-item")}set xml(t){let i=this._xml;this._xml=t,this.requestUpdate("xml",i),requestAnimationFrame(()=>{var n;(n=this._item)==null||n.classList.add("qti-theme-raised")})}get xml(){return this._xml}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(f),this.shadowRoot.adoptedStyleSheets.push(t)}};r.styles=x`
2200
+ `;var o=class extends l{constructor(){super(...arguments);this.disabled=!1;this.readonly=!1;this.provider=new v(this,s,{log:t=>console.log(`[my-app] ${t}`),view:"candidate"});this.processResponse=()=>{var t;return(t=this._item)==null?void 0:t.processResponse()};this.showCorrectResponse=()=>{var t;return(t=this._item)==null?void 0:t.showCorrectResponse()};this.validateResponses=()=>this._item?this._item.validateResponses():!1;this.resetInteractions=()=>{var t;return(t=this._item)==null?void 0:t.resetInteractions()};this.render=()=>h`${f(this._xml)}`}handleDisabledChange(t,r){var a,e;r&&((a=this._item)==null||a.setAttribute("disabled","")),!r&&((e=this._item)==null||e.removeAttribute("disabled"))}handleReadonlyChange(t,r){var a,e;r&&((a=this._item)==null||a.setAttribute("readonly","")),!r&&((e=this._item)==null||e.removeAttribute("readonly"))}handleResponsesChange(t,r){this._item&&(this._item.responses=r)}set qtiContext(t){this.provider.value.view=t.view,this.provider.updateObservers()}get _item(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("qti-assessment-item")}set xml(t){let r=this._xml;this._xml=t,this.requestUpdate("xml",r)}get xml(){return this._xml}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(c),this.shadowRoot.adoptedStyleSheets.push(t)}};o.styles=g`
2197
2201
  :host {
2198
- display: block; /* necessary to calculate scaling position */
2199
- width: 100%;
2200
- height: 100%;
2201
- overflow: auto;
2202
- }
2203
- qti-assessment-item {
2204
- display: block; /* necessary to calculate scaling position */
2205
- width: 100%;
2206
- }
2207
- :host([scales]) qti-assessment-item {
2208
- aspect-ratio: 4 / 3;
2209
- width: 800px;
2210
- transform-origin: 0 0;
2202
+ display: block;
2211
2203
  }
2212
- `,o([s({type:Boolean})],r.prototype,"disabled",2),o([w("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),o([s({type:Boolean})],r.prototype,"readonly",2),o([w("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),o([s({type:Object,attribute:!1})],r.prototype,"responses",2),o([w("responses",{waitUntilFirstUpdate:!0})],r.prototype,"handleResponsesChange",1),o([s({type:String})],r.prototype,"xml",1),r=o([q("qti-item")],r);export{r as a};
2204
+ `,i([w({type:Boolean})],o.prototype,"disabled",2),i([n("disabled",{waitUntilFirstUpdate:!0})],o.prototype,"handleDisabledChange",1),i([w({type:Boolean})],o.prototype,"readonly",2),i([n("readonly",{waitUntilFirstUpdate:!0})],o.prototype,"handleReadonlyChange",1),i([w({type:Object,attribute:!1})],o.prototype,"responses",2),i([n("responses",{waitUntilFirstUpdate:!0})],o.prototype,"handleResponsesChange",1),i([w({type:String})],o.prototype,"xml",1),o=i([p("qti-item")],o);export{o as a};