qti3-item-player-vue3 0.2.5 → 0.2.7
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/assets/pci/pci.html +39 -16
 - package/dist/qti3-item-player-vue3.js +4203 -3673
 - package/dist/qti3-item-player-vue3.umd.cjs +54 -54
 - package/dist/qti3Player.css +1 -1
 - package/package.json +1 -1
 
    
        package/dist/assets/pci/pci.html
    CHANGED
    
    | 
         @@ -289,7 +289,7 @@ const QTI_PCI_API = { 
     | 
|
| 
       289 
289 
     | 
    
         
             
                this.setDom(document.getElementById('qti3-player-pci-element'));
         
     | 
| 
       290 
290 
     | 
    
         
             
                this.setPci(pci);
         
     | 
| 
       291 
291 
     | 
    
         
             
                this.setTypeIdentifier(pci.typeIdentifier);
         
     | 
| 
       292 
     | 
    
         
            -
                this.setProperties(pci.properties);
         
     | 
| 
      
 292 
     | 
    
         
            +
                this.setProperties(this.transformProperties(pci.properties));
         
     | 
| 
       293 
293 
     | 
    
         
             
                this.setModuleResolution(pci.moduleResolution);
         
     | 
| 
       294 
294 
     | 
    
         
             
                this.setContextVariables(pci.contextVariables);
         
     | 
| 
       295 
295 
     | 
    
         
             
                this.setTemplateVariables(pci.templateVariables);
         
     | 
| 
         @@ -331,29 +331,52 @@ const QTI_PCI_API = { 
     | 
|
| 
       331 
331 
     | 
    
         
             
              },
         
     | 
| 
       332 
332 
     | 
    
         | 
| 
       333 
333 
     | 
    
         
             
              injectStylesheets () {
         
     | 
| 
       334 
     | 
    
         
            -
                const stylesheets = this.getStylesheets() 
     | 
| 
       335 
     | 
    
         
            -
                if (stylesheets === null) return 
     | 
| 
      
 334 
     | 
    
         
            +
                const stylesheets = this.getStylesheets()
         
     | 
| 
      
 335 
     | 
    
         
            +
                if (stylesheets === null) return
         
     | 
| 
       336 
336 
     | 
    
         
             
                stylesheets.forEach((stylesheet) => {
         
     | 
| 
       337 
     | 
    
         
            -
                   
     | 
| 
       338 
     | 
    
         
            -
                   
     | 
| 
       339 
     | 
    
         
            -
                  const  
     | 
| 
       340 
     | 
    
         
            -
                   
     | 
| 
       341 
     | 
    
         
            -
                   
     | 
| 
       342 
     | 
    
         
            -
                   
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
      
 337 
     | 
    
         
            +
                  if (!stylesheet.hasOwnProperty('css')) return
         
     | 
| 
      
 338 
     | 
    
         
            +
                  // Stylesheet css property is base64.  Decode it.
         
     | 
| 
      
 339 
     | 
    
         
            +
                  const cssText = this.decodeBase64ToBytes(stylesheet.css)
         
     | 
| 
      
 340 
     | 
    
         
            +
                  const style = document.createElement('style')
         
     | 
| 
      
 341 
     | 
    
         
            +
                  style.innerHTML = `${cssText}`
         
     | 
| 
      
 342 
     | 
    
         
            +
                  document.head.appendChild(style)
         
     | 
| 
      
 343 
     | 
    
         
            +
                })
         
     | 
| 
      
 344 
     | 
    
         
            +
              },
         
     | 
| 
      
 345 
     | 
    
         
            +
             
     | 
| 
      
 346 
     | 
    
         
            +
              /**
         
     | 
| 
      
 347 
     | 
    
         
            +
               * @description Transform the given properties object into a new object
         
     | 
| 
      
 348 
     | 
    
         
            +
               * containing the same keys, but with base64-decoded values.
         
     | 
| 
      
 349 
     | 
    
         
            +
               * @param {Object} properties
         
     | 
| 
      
 350 
     | 
    
         
            +
               * @return {Object} transformed properties object with decoded values
         
     | 
| 
      
 351 
     | 
    
         
            +
               */
         
     | 
| 
      
 352 
     | 
    
         
            +
              transformProperties (properties) {
         
     | 
| 
      
 353 
     | 
    
         
            +
                const props = {}
         
     | 
| 
      
 354 
     | 
    
         
            +
                for (const [key, value] of Object.entries(properties)) {
         
     | 
| 
      
 355 
     | 
    
         
            +
                  props[`${key}`] = `${this.decodeBase64ToBytes(value)}`
         
     | 
| 
      
 356 
     | 
    
         
            +
                }
         
     | 
| 
      
 357 
     | 
    
         
            +
            	  return props
         
     | 
| 
      
 358 
     | 
    
         
            +
              },
         
     | 
| 
      
 359 
     | 
    
         
            +
             
     | 
| 
      
 360 
     | 
    
         
            +
              decodeBase64ToBytes (base64) {
         
     | 
| 
      
 361 
     | 
    
         
            +
                const textDecoder = new TextDecoder()
         
     | 
| 
      
 362 
     | 
    
         
            +
                return textDecoder.decode(this.base64ToBytes(base64))
         
     | 
| 
      
 363 
     | 
    
         
            +
              },
         
     | 
| 
      
 364 
     | 
    
         
            +
             
     | 
| 
      
 365 
     | 
    
         
            +
              base64ToBytes (base64) {
         
     | 
| 
      
 366 
     | 
    
         
            +
                const binString = atob(base64)
         
     | 
| 
      
 367 
     | 
    
         
            +
                return Uint8Array.from(binString, (m) => m.codePointAt(0))
         
     | 
| 
       345 
368 
     | 
    
         
             
              },
         
     | 
| 
       346 
369 
     | 
    
         | 
| 
       347 
370 
     | 
    
         
             
              getModuleDependencies () {
         
     | 
| 
       348 
371 
     | 
    
         
             
                // Init qtiCustomInteractionContext as the first dependency
         
     | 
| 
       349 
     | 
    
         
            -
                let dependencies = ['qtiCustomInteractionContext'] 
     | 
| 
      
 372 
     | 
    
         
            +
                let dependencies = ['qtiCustomInteractionContext']
         
     | 
| 
       350 
373 
     | 
    
         | 
| 
       351 
     | 
    
         
            -
                const paths = this.getModuleResolution().paths 
     | 
| 
      
 374 
     | 
    
         
            +
                const paths = this.getModuleResolution().paths
         
     | 
| 
       352 
375 
     | 
    
         
             
                for (let property in paths) {
         
     | 
| 
       353 
     | 
    
         
            -
                  dependencies.push(property) 
     | 
| 
       354 
     | 
    
         
            -
                } 
     | 
| 
      
 376 
     | 
    
         
            +
                  dependencies.push(property)
         
     | 
| 
      
 377 
     | 
    
         
            +
                }
         
     | 
| 
       355 
378 
     | 
    
         | 
| 
       356 
     | 
    
         
            -
                return dependencies 
     | 
| 
      
 379 
     | 
    
         
            +
                return dependencies
         
     | 
| 
       357 
380 
     | 
    
         
             
              },
         
     | 
| 
       358 
381 
     | 
    
         | 
| 
       359 
382 
     | 
    
         
             
              /**
         
     |