diff --git a/VERSION.txt b/VERSION.txt index 985701e95dc..d37adef09a7 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -7.0.15 \ No newline at end of file +7.0.16 \ No newline at end of file diff --git a/build/es6/node_modules/@lrnwebcomponents/app-hax/app-hax.js b/build/es6/node_modules/@lrnwebcomponents/app-hax/app-hax.js index 4395d02e153..4bc48e1514a 100644 --- a/build/es6/node_modules/@lrnwebcomponents/app-hax/app-hax.js +++ b/build/es6/node_modules/@lrnwebcomponents/app-hax/app-hax.js @@ -1,4 +1,4 @@ -import{css as e,html as t,unsafeCSS as o}from"../../lit/index.js";import{toJS as a,autorun as i}from"../../mobx/dist/mobx.esm.js";import{localStorageSet as n,localStorageGet as s}from"../utils/utils.js";import"../simple-tooltip/simple-tooltip.js";import{SimpleColors as r}from"../simple-colors/simple-colors.js";import{store as l}from"./lib/v1/AppHaxStore.js";import{I18NMixin as p}from"../i18n-manager/lib/I18NMixin.js";import{AppHaxAPI as d}from"./lib/v1/AppHaxBackendAPI.js";import{SimpleTourManager as c}from"../simple-popover/lib/simple-tour.js";import{SuperDaemonInstance as m}from"../super-daemon/super-daemon.js";import"../simple-toolbar/lib/simple-toolbar-button.js";import"../simple-colors-shared-styles/simple-colors-shared-styles.js";import"./lib/v1/AppHaxRouter.js";import"./lib/v1/app-hax-label.js";import"./lib/v1/app-hax-top-bar.js";import{SimpleTourFinder as h}from"../simple-popover/lib/SimpleTourFinder.js";const u=new URL("./lib/assets/images/Logout.svg",import.meta.url).href;function darkToggle(e){e.matches?l.darkMode=!0:l.darkMode=!1}function soundToggle(){l.soundStatus=!a(l.soundStatus),n("app-hax-soundStatus",a(l.soundStatus)),l.appEl.playSound("click")}export class AppHax extends(p(h(r))){static get tag(){return"app-hax"}_openExternalLink(e){window.open(e,"_blank")}async _haxStoreContribute(e,t,o=null){let a="";if("merlin"==e){var i=`[${e}] New command request from HAX daemon`;a=`Location: ${window.location.href}\nMerlin command: ${o}\nWhat did you want merlin to do?\n`}else{i=`[${e}] User report from HAX daemon`;if(a=`Location: ${window.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${window.screen.width}x${window.screen.height}\nWindow size: ${window.innerWidth}x${window.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}window.open(`https://github.com/elmsln/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${i}&body=${encodeURIComponent(a)}`,"_blank")}playSound(e="coin2"){return new Promise((t=>{if(l.soundStatus&&l.appReady){let o=["click","click2","coin","coin2","hit","success"].includes(e)?e:"hit";this.audio=new Audio(new URL(`./lib/assets/sounds/${o}.mp3`,import.meta.url).href),this.audio.volume=.5,this.audio.onended=e=>{t()},this.audio.play(),setTimeout((()=>{t()}),1e3)}else t()}))}_tokenRefreshFailed(e){window.dispatchEvent(new CustomEvent("jwt-login-logout",{composed:!0,bubbles:!0,cancelable:!1,detail:!0})),setTimeout((()=>{this.reset(!0)}),100)}connectedCallback(){super.connectedCallback(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",darkToggle,{signal:this.windowControllers.signal}),window.addEventListener("jwt-logged-in",this._jwtLoggedIn.bind(this),{signal:this.windowControllers.signal}),window.addEventListener("jwt-login-refresh-error",this._tokenRefreshFailed.bind(this),{signal:this.windowControllers.signal})}goToLocation(e){window.location=e}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}constructor(){super(),this.unlockComingSoon=!1,this.unlockTerrible=!1,this.t=this.t||{},this.t={...this.t,selectPage:"Select page",backToSiteList:"Back to site list",listMySites:"List my sites",cancel:"Cancel",editDetails:"Page details",add:"Add",editSettings:"Edit settings",source:"Source",viewSource:"View source",findMedia:"Find media",undo:"Undo",redo:"Redo",media:"Media",outline:"Outline",blocks:"Blocks",addBlock:"Add block",addPage:"Add page",addChildPage:"Add child page",clonePage:"Clone page",importDocxFile:"Import docx file",delete:"Delete page",siteSettings:"Site settings",close:"Close",settings:"Settings",editPage:"Edit page",edit:"Edit",configureBlock:"Configure block",configure:"Configure",save:"Save",home:"Home",saveChanges:"Save changes",startNewJourney:"Start new journey",newJourney:"New Journey",accountInfo:"Account Info",outlineDesigner:"Outline designer",pageOutline:"Page outline",more:"More",siteActions:"Site actions",insights:"Insights dashboard",merlin:"Merlin",summonMerlin:"Summon Merlin",logOut:"Log out",menu:"Menu",showMore:"More"},void 0!==window.speechSynthesis&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition||window.oSpeechRecognition)&&(m.voiceSearch=!0),m.icon="hax:wizard-hat",m.appendContext("*"),m.allowedCallback=()=>!(!a(l.appReady)||!a(l.isLoggedIn)),m.questionTags=[{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}],m.defineOption({title:"Tour of top menu buttons",icon:"help",tags:["Help","ui","tour"],priority:-1e3,value:{target:this,method:"helpClick",args:[]},eventName:"super-daemon-element-method",path:"HAX/app/tour",context:["*","?"]}),m.defineOption({title:"Unlock hidden features",icon:"hax:hax2022",tags:["Developer","features","hidden"],value:{target:this,method:"fireUnlocked",args:[]},eventName:"super-daemon-element-method",path:">developer/hax/unlockAll",context:[">"]}),m.defineOption({title:"Unlock terrible 2000s themes",icon:"hax:table-multiple",tags:["Developer","terrible","2000","tables"],value:{target:this,method:"fireTerrible",args:[]},eventName:"super-daemon-element-method",path:">developer/hax/terrible2000s",context:[">"]}),m.defineOption({title:"Go to site",icon:"hax:hax2022",tags:["Sites","Administration","change"],eventName:"super-daemon-run-program",path:"hax/action/goToSite",value:{name:"Go to site",program:async(e,t)=>{let o=[];return a(l.manifest.items).forEach((async t=>{(""==e||t.metadata.site&&t.metadata.site.name&&t.metadata.site.name.includes(e))&&o.push({title:t.title,icon:t.metadata.theme&&t.metadata.theme.variables&&t.metadata.theme.variables.icon?t.metadata.theme.variables.icon:"hax:hax2022",tags:["site",t.description],value:{target:this,method:"goToLocation",args:[t.slug]},eventName:"super-daemon-element-method",context:["*","hax/action/goToSite/"+t.metadata.site.name],path:"hax/action/goToSite/"+t.metadata.site.name})})),o}},context:["*"]}),m.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX","?","*"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.windowControllers=new AbortController,this.__tour=c,this.__tour.registerNewTour({key:"hax",name:"HAX top menu",style:"\n simple-popover-manager::part(simple-popover) {\n max-width: 250px;\n font-family: sans-serif;\n }\n simple-popover-manager button {\n font-family: sans-serif;\n font-size: 12px;\n margin: 0px 2px;\n color: var(--simple-colors-default-theme-grey-12);\n }\n simple-popover-manager p {\n font-family: sans-serif;\n padding: 0;\n margin: 0;\n width: 250px;\n font-size: 10px;\n line-height: 20px;\n }\n simple-popover-manager h1 {\n font-family: sans-serif;\n margin: 0;\n font-size: 12px;\n width: 250px;\n padding: 0;\n }\n simple-popover-manager::part(simple-popover-body),\n simple-popover-manager::part(simple-popover-heading) {\n color: black;\n background-color: white;\n font-family: sans-serif;\n }\n body.dark-mode simple-popover-manager::part(simple-popover-body),\n body.dark-mode simple-popover-manager::part(simple-popover-heading) {\n color: white;\n background-color: black;\n font-family: sans-serif;\n }\n body.dark-mode simple-popover-manager simple-icon-button-lite {\n color: white;\n background-color: black;\n font-family: sans-serif;\n }\n "}),this.tourName="hax",i((()=>{const e=a(l.activeItem);e&&e.title&&l.setPageTitle(e.title)})),i((()=>{this.siteReady=a(l.siteReady)})),i((()=>{const e=a(l.badDevice);!1===e?(import("../rpg-character/rpg-character.js"),import("./lib/random-word/random-word.js")):!0===e&&document.body.classList.add("bad-device")})),this.userMenuOpen=!1,this.courses=[],this.activeItem={},this.phrases={new:["What's ya name?","HAX to the moon","Welcome to the Jungle","We like to party","Build something awesome","Everything is awesome!","Everything is cool","When you're part of the team","When you're living our dream","Welcome to the up-side-down"],return:["Welcome back, take 2?","That wasn't very long","Stranger thiings have happened","Student driven platform","Faculty centered platform","Instructional designer influenced platform","Free, Open, Community driven","One brick at a time..","Sup?","You again? Awesome!","Let's do this","There can only be one ring...","There is another","Fancy that, I love HAX and you show up"]},this.isNewUser=null,this.basePath="/",this.searchTerm="",this.appMode="",this.soundIcon="",this.store=l,this.sound=new Audio,i((()=>{this.isNewUser=a(l.isNewUser),this.isNewUser&&"create"!==a(l.appMode)&&"404"!==a(l.appMode)&&(l.appMode="create",setTimeout((()=>{l.createSiteSteps=!0}),0))})),i((()=>{this.userName=a(l.user.name)})),i((()=>{this.appMode=a(l.appMode)})),i((()=>{this.searchTerm=a(l.searchTerm)})),i((async()=>{const e=a(l.location);e&&e.route&&(e.route.step?(l.appMode="create",l.createSiteSteps=!0):e.route.slug?(this.reset(),setTimeout((()=>{window.location=e.route.slug}),0)):"404"===e.route.name?(l.createSiteSteps=!1,l.appMode="404",setTimeout((()=>{l.toast("the page miss.. it burns!!!",3e3,{fire:!0,walking:!0})}),500)):"home"!==e.route.name&&"search"!==e.route.name||(l.appMode="home",l.createSiteSteps=!1))})),i((()=>{l.routes.length>0&&null===l.location&&(l.location=a(l.routes[0]))})),null===s("app-hax-darkMode",null)&&(l.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches),i((()=>{n("app-hax-darkMode",a(l.darkMode)),requestAnimationFrame((()=>{a(l.darkMode)?(document.body.classList.add("dark-mode"),l.toast("I'm ascared of the dark",2e3,{fire:!0}),this.dark=!0,m.dark=!0,m.toastInstance.darkMode=!0):(document.body.classList.remove("dark-mode"),l.toast("Sunny day it is",2e3,{hat:"random"}),this.dark=!1,m.dark=!1,m.toastInstance.darkMode=!1)}))})),i((()=>{const e=a(l.appMode);e&&(document.body.classList.remove("app-hax-search"),document.body.classList.remove("app-hax-create"),document.body.classList.remove("app-hax-404"),document.body.classList.remove("app-hax-home"),document.body.classList.add(`app-hax-${e}`))}))}static get properties(){return{...super.properties,unlockComingSoon:{type:Boolean},unlockTerrible:{type:Boolean},courses:{type:Array},userName:{type:String},activeItem:{type:Object},soundIcon:{type:String},searchTerm:{type:String},appMode:{type:String},isNewUser:{type:Boolean},phrases:{type:Object},userMenuOpen:{type:Boolean},siteReady:{type:Boolean},basePath:{type:String,attribute:"base-path"},token:{type:String}}}reset(e=!1){try{window.localStorage.removeItem("app-hax-step"),window.localStorage.removeItem("app-hax-site"),e&&(document.querySelector("base")?window.location=document.querySelector("base").href:window.location.reload())}catch(e){}}fireTerrible(){this.unlockTerrible=!0,l.appEl.playSound("coin").then((()=>{l.appEl.playSound("coin2").then((()=>{l.appEl.playSound("success").then((()=>{m.merlinSpeak("Enjoy these early 2000s table based layouts. May they remind you how never to web, again.")}))}))}))}fireUnlocked(){this.unlockComingSoon=!0,l.appEl.playSound("coin").then((()=>{l.appEl.playSound("coin2").then((()=>{l.appEl.playSound("success").then((()=>{m.merlinSpeak("Unbelievable! You, (Subject Name), must be the pride of (Subject Hometown). Enjoy all locked features as a boon!")}))}))}))}logout(){window.dispatchEvent(new CustomEvent("jwt-login-logout",{composed:!0,bubbles:!0,cancelable:!1,detail:!0})),this.closeMenu(),this.__logoutUserAction=!0}_jwtLoggedIn(e){!1===e.detail&&this.__logoutUserAction&&(this.__logoutUserAction=!1,setTimeout((()=>{this.reset(!0)}),100))}login(){import("./lib/v1/app-hax-site-login.js").then((()=>{const e=document.createElement("app-hax-site-login");if(this.querySelector('[slot="externalproviders"]')){const t=this.querySelector('[slot="externalproviders"]').cloneNode(!0);e.appendChild(t)}import("../simple-modal/simple-modal.js").then((()=>{setTimeout((()=>{this.dispatchEvent(new CustomEvent("simple-modal-show",{bubbles:!0,cancelable:!0,composed:!0,detail:{title:"< login >",elements:{content:e},modal:!0,styles:{"--simple-modal-titlebar-background":"transparent","--simple-modal-titlebar-color":"black","--simple-modal-width":"40vw","--simple-modal-min-width":"300px","--simple-modal-z-index":"100000000","--simple-modal-height":"62vh","--simple-modal-min-height":"400px","--simple-modal-titlebar-height":"64px"}}}))}),0)}))}))}static get styles(){return[...super.styles,e` +import{css as e,html as t,unsafeCSS as o}from"../../lit/index.js";import{toJS as a,autorun as i}from"../../mobx/dist/mobx.esm.js";import{localStorageSet as n,localStorageGet as s}from"../utils/utils.js";import"../simple-tooltip/simple-tooltip.js";import{SimpleColors as r}from"../simple-colors/simple-colors.js";import{store as l}from"./lib/v1/AppHaxStore.js";import{I18NMixin as p}from"../i18n-manager/lib/I18NMixin.js";import{AppHaxAPI as d}from"./lib/v1/AppHaxBackendAPI.js";import{SimpleTourManager as c}from"../simple-popover/lib/simple-tour.js";import{SuperDaemonInstance as m}from"../super-daemon/super-daemon.js";import"../simple-toolbar/lib/simple-toolbar-button.js";import"../simple-colors-shared-styles/simple-colors-shared-styles.js";import"./lib/v1/AppHaxRouter.js";import"./lib/v1/app-hax-label.js";import"./lib/v1/app-hax-top-bar.js";import{SimpleTourFinder as h}from"../simple-popover/lib/SimpleTourFinder.js";const u=new URL("./lib/assets/images/Logout.svg",import.meta.url).href;function darkToggle(e){e.matches?l.darkMode=!0:l.darkMode=!1}function soundToggle(){l.soundStatus=!a(l.soundStatus),n("app-hax-soundStatus",a(l.soundStatus)),l.appEl.playSound("click")}export class AppHax extends(p(h(r))){static get tag(){return"app-hax"}_openExternalLink(e){window.open(e,"_blank")}async _haxStoreContribute(e,t,o=null){let a="";if("merlin"==e){var i=`[${e}] New command request from HAX daemon`;a=`Location: ${window.location.href}\nMerlin command: ${o}\nWhat did you want merlin to do?\n`}else{i=`[${e}] User report from HAX daemon`;if(a=`Location: ${window.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${window.screen.width}x${window.screen.height}\nWindow size: ${window.innerWidth}x${window.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}window.open(`https://github.com/elmsln/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${i}&body=${encodeURIComponent(a)}`,"_blank")}playSound(e="coin2"){return new Promise((t=>{if(l.soundStatus&&l.appReady){let o=["click","click2","coin","coin2","hit","success"].includes(e)?e:"hit";this.audio=new Audio(new URL(`./lib/assets/sounds/${o}.mp3`,import.meta.url).href),this.audio.volume=.5,this.audio.onended=e=>{t()},this.audio.play(),setTimeout((()=>{t()}),1e3)}else t()}))}_tokenRefreshFailed(e){window.dispatchEvent(new CustomEvent("jwt-login-logout",{composed:!0,bubbles:!0,cancelable:!1,detail:!0})),setTimeout((()=>{this.reset(!0)}),100)}connectedCallback(){super.connectedCallback(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",darkToggle,{signal:this.windowControllers.signal}),window.addEventListener("jwt-logged-in",this._jwtLoggedIn.bind(this),{signal:this.windowControllers.signal}),window.addEventListener("jwt-login-refresh-error",this._tokenRefreshFailed.bind(this),{signal:this.windowControllers.signal})}goToLocation(e){window.location=e}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}constructor(){super(),this.unlockComingSoon=!1,this.unlockTerrible=!1,this.t=this.t||{},this.t={...this.t,selectPage:"Select page",backToSiteList:"Back to site list",listMySites:"List my sites",cancel:"Cancel",editDetails:"Page details",add:"Add",editSettings:"Edit settings",source:"Source",viewSource:"View source",findMedia:"Find media",undo:"Undo",redo:"Redo",media:"Media",outline:"Outline",blocks:"Blocks",addBlock:"Add block",addPage:"Add page",addChildPage:"Add child page",clonePage:"Clone page",importDocxFile:"Import docx file",delete:"Delete page",siteSettings:"Site settings",close:"Close",settings:"Settings",editPage:"Edit page",edit:"Edit",configureBlock:"Configure block",configure:"Configure",save:"Save",home:"Home",saveChanges:"Save changes",startNewJourney:"Start new journey",newJourney:"New Journey",accountInfo:"Account Info",outlineDesigner:"Outline designer",pageOutline:"Page outline",more:"More",siteActions:"Site actions",insights:"Insights dashboard",merlin:"Merlin",summonMerlin:"Summon Merlin",logOut:"Log out",menu:"Menu",showMore:"More"},void 0!==window.speechSynthesis&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition||window.oSpeechRecognition)&&(m.voiceSearch=!0),m.icon="hax:wizard-hat",m.appendContext("*"),m.allowedCallback=()=>!(!a(l.appReady)||!a(l.isLoggedIn)),m.questionTags=[{value:"*",label:"List everything I can do"},{value:"?",label:"HELP!"}],m.defineOption({title:"Tour of top menu buttons",icon:"help",tags:["Help","ui","tour"],priority:-1e3,value:{target:this,method:"helpClick",args:[]},eventName:"super-daemon-element-method",path:"HAX/app/tour",context:["*","?"]}),m.defineOption({title:"Unlock hidden features",icon:"hax:hax2022",tags:["Developer","features","hidden"],value:{target:this,method:"fireUnlocked",args:[]},eventName:"super-daemon-element-method",path:">developer/hax/unlockAll",context:[">"]}),m.defineOption({title:"Unlock terrible 2000s themes",icon:"hax:table-multiple",tags:["Developer","terrible","2000","tables"],value:{target:this,method:"fireTerrible",args:[]},eventName:"super-daemon-element-method",path:">developer/hax/terrible2000s",context:[">"]}),m.defineOption({title:"Go to site",icon:"hax:hax2022",tags:["Sites","Administration","change"],eventName:"super-daemon-run-program",path:"HAX/action/goToSite",value:{name:"Go to site",program:async(e,t)=>{let o=[];return a(l.manifest.items).forEach((async t=>{(""==e||t.metadata.site&&t.metadata.site.name&&t.metadata.site.name.includes(e))&&o.push({title:t.title,icon:t.metadata.theme&&t.metadata.theme.variables&&t.metadata.theme.variables.icon?t.metadata.theme.variables.icon:"hax:hax2022",tags:["site",t.description],value:{target:this,method:"goToLocation",args:[t.slug]},eventName:"super-daemon-element-method",context:["*","HAX/action/goToSite/"+t.metadata.site.name],path:"HAX/action/goToSite/"+t.metadata.site.name})})),o}},context:["*"]}),m.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX","?","*"]}),m.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX","?","*"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.windowControllers=new AbortController,this.__tour=c,this.__tour.registerNewTour({key:"hax",name:"HAX top menu",style:"\n simple-popover-manager::part(simple-popover) {\n max-width: 250px;\n font-family: sans-serif;\n }\n simple-popover-manager button {\n font-family: sans-serif;\n font-size: 12px;\n margin: 0px 2px;\n color: var(--simple-colors-default-theme-grey-12);\n }\n simple-popover-manager p {\n font-family: sans-serif;\n padding: 0;\n margin: 0;\n width: 250px;\n font-size: 10px;\n line-height: 20px;\n }\n simple-popover-manager h1 {\n font-family: sans-serif;\n margin: 0;\n font-size: 12px;\n width: 250px;\n padding: 0;\n }\n simple-popover-manager::part(simple-popover-body),\n simple-popover-manager::part(simple-popover-heading) {\n color: black;\n background-color: white;\n font-family: sans-serif;\n }\n body.dark-mode simple-popover-manager::part(simple-popover-body),\n body.dark-mode simple-popover-manager::part(simple-popover-heading) {\n color: white;\n background-color: black;\n font-family: sans-serif;\n }\n body.dark-mode simple-popover-manager simple-icon-button-lite {\n color: white;\n background-color: black;\n font-family: sans-serif;\n }\n "}),this.tourName="hax",i((()=>{const e=a(l.activeItem);e&&e.title&&l.setPageTitle(e.title)})),i((()=>{this.siteReady=a(l.siteReady)})),i((()=>{const e=a(l.badDevice);!1===e?(import("../rpg-character/rpg-character.js"),import("./lib/random-word/random-word.js")):!0===e&&document.body.classList.add("bad-device")})),this.userMenuOpen=!1,this.courses=[],this.activeItem={},this.phrases={new:["What's ya name?","HAX to the moon","Welcome to the Jungle","We like to party","Build something awesome","Everything is awesome!","Everything is cool","When you're part of the team","When you're living our dream","Welcome to the up-side-down"],return:["Welcome back, take 2?","That wasn't very long","Stranger thiings have happened","Student driven platform","Faculty centered platform","Instructional designer influenced platform","Free, Open, Community driven","One brick at a time..","Sup?","You again? Awesome!","Let's do this","There can only be one ring...","There is another","Fancy that, I love HAX and you show up"]},this.isNewUser=null,this.basePath="/",this.searchTerm="",this.appMode="",this.soundIcon="",this.store=l,this.sound=new Audio,i((()=>{this.isNewUser=a(l.isNewUser),this.isNewUser&&"create"!==a(l.appMode)&&"404"!==a(l.appMode)&&(l.appMode="create",setTimeout((()=>{l.createSiteSteps=!0}),0))})),i((()=>{this.userName=a(l.user.name)})),i((()=>{this.appMode=a(l.appMode)})),i((()=>{this.searchTerm=a(l.searchTerm)})),i((async()=>{const e=a(l.location);e&&e.route&&(e.route.step?(l.appMode="create",l.createSiteSteps=!0):e.route.slug?(this.reset(),setTimeout((()=>{window.location=e.route.slug}),0)):"404"===e.route.name?(l.createSiteSteps=!1,l.appMode="404",setTimeout((()=>{l.toast("the page miss.. it burns!!!",3e3,{fire:!0,walking:!0})}),500)):"home"!==e.route.name&&"search"!==e.route.name||(l.appMode="home",l.createSiteSteps=!1))})),i((()=>{l.routes.length>0&&null===l.location&&(l.location=a(l.routes[0]))})),null===s("app-hax-darkMode",null)&&(l.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches),i((()=>{n("app-hax-darkMode",a(l.darkMode)),requestAnimationFrame((()=>{a(l.darkMode)?(document.body.classList.add("dark-mode"),l.toast("I'm ascared of the dark",2e3,{fire:!0}),this.dark=!0,m.dark=!0,m.toastInstance.darkMode=!0):(document.body.classList.remove("dark-mode"),l.toast("Sunny day it is",2e3,{hat:"random"}),this.dark=!1,m.dark=!1,m.toastInstance.darkMode=!1)}))})),i((()=>{const e=a(l.appMode);e&&(document.body.classList.remove("app-hax-search"),document.body.classList.remove("app-hax-create"),document.body.classList.remove("app-hax-404"),document.body.classList.remove("app-hax-home"),document.body.classList.add(`app-hax-${e}`))}))}static get properties(){return{...super.properties,unlockComingSoon:{type:Boolean},unlockTerrible:{type:Boolean},courses:{type:Array},userName:{type:String},activeItem:{type:Object},soundIcon:{type:String},searchTerm:{type:String},appMode:{type:String},isNewUser:{type:Boolean},phrases:{type:Object},userMenuOpen:{type:Boolean},siteReady:{type:Boolean},basePath:{type:String,attribute:"base-path"},token:{type:String}}}reset(e=!1){try{window.localStorage.removeItem("app-hax-step"),window.localStorage.removeItem("app-hax-site"),e&&(document.querySelector("base")?window.location=document.querySelector("base").href:window.location.reload())}catch(e){}}fireTerrible(){this.unlockTerrible=!0,l.appEl.playSound("coin").then((()=>{l.appEl.playSound("coin2").then((()=>{l.appEl.playSound("success").then((()=>{m.merlinSpeak("Enjoy these early 2000s table based layouts. May they remind you how never to web, again.")}))}))}))}fireUnlocked(){this.unlockComingSoon=!0,l.appEl.playSound("coin").then((()=>{l.appEl.playSound("coin2").then((()=>{l.appEl.playSound("success").then((()=>{m.merlinSpeak("Unbelievable! You, (Subject Name), must be the pride of (Subject Hometown). Enjoy all locked features as a boon!")}))}))}))}logout(){window.dispatchEvent(new CustomEvent("jwt-login-logout",{composed:!0,bubbles:!0,cancelable:!1,detail:!0})),this.closeMenu(),this.__logoutUserAction=!0}_jwtLoggedIn(e){!1===e.detail&&this.__logoutUserAction&&(this.__logoutUserAction=!1,setTimeout((()=>{this.reset(!0)}),100))}login(){import("./lib/v1/app-hax-site-login.js").then((()=>{const e=document.createElement("app-hax-site-login");if(this.querySelector('[slot="externalproviders"]')){const t=this.querySelector('[slot="externalproviders"]').cloneNode(!0);e.appendChild(t)}import("../simple-modal/simple-modal.js").then((()=>{setTimeout((()=>{this.dispatchEvent(new CustomEvent("simple-modal-show",{bubbles:!0,cancelable:!0,composed:!0,detail:{title:"< login >",elements:{content:e},modal:!0,styles:{"--simple-modal-titlebar-background":"transparent","--simple-modal-titlebar-color":"black","--simple-modal-width":"40vw","--simple-modal-min-width":"300px","--simple-modal-z-index":"100000000","--simple-modal-height":"62vh","--simple-modal-min-height":"400px","--simple-modal-titlebar-height":"64px"}}}))}),0)}))}))}static get styles(){return[...super.styles,e` :host { display: block; --app-hax-background-color-active: var(--app-hax-accent-color); diff --git a/build/es6/node_modules/@lrnwebcomponents/drag-n-drop/drag-n-drop.js b/build/es6/node_modules/@lrnwebcomponents/drag-n-drop/drag-n-drop.js deleted file mode 100644 index a38af8d39aa..00000000000 --- a/build/es6/node_modules/@lrnwebcomponents/drag-n-drop/drag-n-drop.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright 2019 The Pennsylvania State University - * @license Apache-2.0, see License.md for full text. - * - * Inspiration from: https://codepen.io/bradtraversy/pen/odmVgN - */ -class DragNDrop extends HTMLElement{get html(){return'\n\n
\n \n
'}static get properties(){return{...super.properties,editing:{name:"editing",type:Boolean}}}static get tag(){return"drag-n-drop"}constructor(t=!1){super(),this.__dragging={},this.tag=DragNDrop.tag;let e=DragNDrop.properties;for(let t in e)e.hasOwnProperty(t)&&(this.hasAttribute(t)?this[t]=this.getAttribute(t):(this.setAttribute(t,e[t].value),this[t]=e[t].value));this.template=document.createElement("template"),this.attachShadow({mode:"open"}),t||this.render()}connectedCallback(){window.ShadyCSS&&window.ShadyCSS.styleElement(this)}_copyAttribute(t,e){const r=this.shadowRoot.querySelectorAll(e),i=this.getAttribute(t),n=null==i?"removeAttribute":"setAttribute";for(const e of r)e[n](t,i)}_setProperty({name:t,value:e}){this[t]=e}render(){this.shadowRoot.innerHTML=null,this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0))}static get observedAttributes(){return["editing"]}get editing(){return this.getAttribute("editing")}set editing(t){t?this.setAttribute("editing",t):this.removeAttribute("editing")}attributeChangedCallback(t,e,r){if("editing"===t){const t=this.querySelectorAll("[data-draggable]"),e=this.querySelectorAll("[data-droppable]");if(r){for(const t of e)t.setAttribute("droppable","true"),t.addEventListener("dragover",this.dragOver.bind(this)),t.addEventListener("dragenter",this.dragEnter.bind(this)),t.addEventListener("dragleave",this.dragLeave.bind(this)),t.addEventListener("drop",this.dragDrop.bind(this));for(const e of t)e.setAttribute("draggable","true"),e.addEventListener("dragstart",this.dragStart.bind(this)),e.addEventListener("dragend",this.dragEnd.bind(this))}else{for(const t of e)t.removeAttribute("droppable"),t.removeEventListener("dragover",this.dragOver.bind(this)),t.removeEventListener("dragenter",this.dragEnter.bind(this)),t.removeEventListener("dragleave",this.dragLeave.bind(this)),t.removeEventListener("drop",this.dragDrop.bind(this));for(const e of t)e.removeAttribute("draggable"),e.removeEventListener("dragstart",this.dragStart.bind(this)),e.removeEventListener("dragend",this.dragEnd.bind(this))}}}dragStart(t){this.__dragging=t.target,this.__dragging.className+=" hold",setTimeout((()=>this.__dragging.className="invisible"),0),t.stopPropagation(),t.stopImmediatePropagation()}dragEnd(t){this.__dragging.className="fill"}dragOver(t){t.preventDefault()}dragEnter(t){t.preventDefault(),t.target.className+=" hovered"}dragLeave(t){t.target.className="empty"}dragDrop(t){t.target.className="empty",t.target.appendChild(this.__dragging)}}window.customElements.define(DragNDrop.tag,DragNDrop);export{DragNDrop}; \ No newline at end of file diff --git a/build/es6/node_modules/@lrnwebcomponents/hax-body/hax-body.js b/build/es6/node_modules/@lrnwebcomponents/hax-body/hax-body.js index 53c3ad66402..86c1843a3cc 100755 --- a/build/es6/node_modules/@lrnwebcomponents/hax-body/hax-body.js +++ b/build/es6/node_modules/@lrnwebcomponents/hax-body/hax-body.js @@ -128,15 +128,13 @@ import{html as e,css as t,render as i,unsafeCSS as o}from"../../lit/index.js";im -webkit-user-select: text; -o-user-select: text; } - :host([edit-mode]) - #bodycontainer - ::slotted(*[data-hax-ray]:hover) { + :host([edit-mode]) #bodycontainer ::slotted(*[data-hax-ray]:hover) { cursor: pointer; outline: 2px solid var(--hax-ui-color-hover, #0001); transition: 0.2s outline-width ease-in-out; outline-offset: 8px; } - + :host([edit-mode]) #bodycontainer ::slotted([contenteditable][data-hax-ray]:empty:not([data-instructional-action]))::before { diff --git a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-gizmo-browser.js b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-gizmo-browser.js index db49cfd9d83..7934e010cbe 100644 --- a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-gizmo-browser.js +++ b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-gizmo-browser.js @@ -52,82 +52,81 @@ import{LitElement as e,html as t,css as i}from"../../../lit/index.js";import{Sim margin: 8px 0px; } `]}constructor(){super(),this.activePreview=null,this.daemonKeyCombo=null,r((()=>{this.daemonKeyCombo=n(s.daemonKeyCombo)})),this.items=[],this.categories=[],this.like="",this.value="",this.where="index",this.recentGizmoList=[],this.t={filterContentTypes:"Filter Content Types"},this.registerLocalization({context:this,namespace:"hax"}),this.addEventListener("mouseleave",this.closePopover.bind(this)),this.addEventListener("mouseout",this.closePopover.bind(this)),r((()=>{if(s.editMode){const e=n(s.recentGizmoList);let t=[],i=[];e.forEach((e=>{e&&e.tag&&(i.includes(e.tag)||(i.push(e.tag),t.push(e),t.length>5&&(i.shift(),t.shift())))})),this.recentGizmoList=t}}))}static get properties(){return{...super.properties,categories:{type:Array},hidden:{type:Boolean,reflect:!0},recentGizmoList:{type:Array},activePreview:{type:Number}}}closePopover(){this.activePreview=null,window.SimplePopoverManager.requestAvailability().opened=!1}render(){return t`${this.hidden?"":t`
- -
- - - ${this.recentGizmoList.map(((e,i)=>t` + + + + ${this.recentGizmoList.map(((e,i)=>t` + + ${this.activePreview===parseInt(i)?t` + + `:""} + `))} + + + ${this.categories.map((e=>t` - - ${this.activePreview===parseInt(i)?t` - - `:""} - `))} - - - ${this.categories.map((e=>t` - - ${this.filtered.map(((i,a)=>t`${i&&i.tags&&i.tags.includes(e)?t` - - ${this.activePreview===parseInt(a)?t` - - `:""} - `:""}`))} - - `))} - `}`}static get tag(){return"hax-gizmo-browser"}_hoverForPreviewChange(e){const t=e.detail;t.opened&&(this.activePreview=parseInt(t.dataset.index),setTimeout((()=>{e.detail.openedChanged(!0)}),10))}_dragStart(e){let t=s.haxSchemaFromTag(e.target.eventData);var i;i=t.gizmo.tag&&t.demoSchema&&t.demoSchema[0]?o(t.demoSchema[0]):document.createElement(e.target.eventData),s.recentGizmoList.push(t.gizmo),s.__dragTarget=i,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move"),e.stopPropagation(),e.stopImmediatePropagation()}inputfilterChanged(e){this.like=e.target.value,""==this.like?this.collapseAll():this.expandAll()}expandAll(){this.shadowRoot.querySelectorAll("a11y-collapse").forEach((e=>{e.expanded=!0}))}collapseAll(){this.shadowRoot.querySelectorAll("a11y-collapse:not(#recent)").forEach((e=>{e.expanded=!1}))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"filtered"==t&&this.requestUpdate(),"items"==t&&this[t]&&this[t].length>0&&(this.categories=[...this.updateCategories(this.items)])}))}ucfirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}updateCategories(e){let t=[];return e.forEach((e=>{e.tags&&e.tags[0]&&(t.includes(e.tags[0])||t.push(e.tags[0]))})),t.sort(),t}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),r((()=>{s.editMode&&this.resetList(n(s.gizmoList))}))}resetList(e){if(e){this.like="",this.value="";const t=e.filter(((e,t)=>!(e&&e.meta&&(e.meta.inlineOnly||e.meta.hidden||e.requiresParent))));t.map(((e,i)=>{t[i].index=e.title+" "+e.tag,e.tags&&(t[i].index+=" "+e.tags.join(" ")),e.meta&&e.meta.author&&(t[i].index+=" "+e.meta.author)})),this.items=[...t]}}}customElements.define(HaxGizmoBrowser.tag,HaxGizmoBrowser);export{HaxGizmoBrowser}; \ No newline at end of file + + ${this.filtered.map(((i,a)=>t`${i&&i.tags&&i.tags.includes(e)?t` + + ${this.activePreview===parseInt(a)?t` + + `:""} + `:""}`))} + + `))} `}`}static get tag(){return"hax-gizmo-browser"}_hoverForPreviewChange(e){const t=e.detail;t.opened&&(this.activePreview=parseInt(t.dataset.index),setTimeout((()=>{e.detail.openedChanged(!0)}),10))}_dragStart(e){let t=s.haxSchemaFromTag(e.target.eventData);var i;i=t.gizmo.tag&&t.demoSchema&&t.demoSchema[0]?o(t.demoSchema[0]):document.createElement(e.target.eventData),s.recentGizmoList.push(t.gizmo),s.__dragTarget=i,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move"),e.stopPropagation(),e.stopImmediatePropagation()}inputfilterChanged(e){this.like=e.target.value,""==this.like?this.collapseAll():this.expandAll()}expandAll(){this.shadowRoot.querySelectorAll("a11y-collapse").forEach((e=>{e.expanded=!0}))}collapseAll(){this.shadowRoot.querySelectorAll("a11y-collapse:not(#recent)").forEach((e=>{e.expanded=!1}))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"filtered"==t&&this.requestUpdate(),"items"==t&&this[t]&&this[t].length>0&&(this.categories=[...this.updateCategories(this.items)])}))}ucfirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}updateCategories(e){let t=[];return e.forEach((e=>{e.tags&&e.tags[0]&&(t.includes(e.tags[0])||t.push(e.tags[0]))})),t.sort(),t}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),r((()=>{s.editMode&&this.resetList(n(s.gizmoList))}))}resetList(e){if(e){this.like="",this.value="";const t=e.filter(((e,t)=>!(e&&e.meta&&(e.meta.inlineOnly||e.meta.hidden||e.requiresParent))));t.map(((e,i)=>{t[i].index=e.title+" "+e.tag,e.tags&&(t[i].index+=" "+e.tags.join(" ")),e.meta&&e.meta.author&&(t[i].index+=" "+e.meta.author)})),this.items=[...t]}}}customElements.define(HaxGizmoBrowser.tag,HaxGizmoBrowser);export{HaxGizmoBrowser}; \ No newline at end of file diff --git a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-map.js b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-map.js index 4da9820d369..d106f9ba216 100644 --- a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-map.js +++ b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-map.js @@ -106,81 +106,79 @@ import{html as t,css as i}from"../../../lit/index.js";import"../../simple-icon/l li.parent-h6 + li.is-child ~ li.is-child hax-toolbar-item { margin-left: 12px; } - `]}constructor(){super(),this.elementList=[],this.t={contentStatistics:"Content Statistics",words:"Words",headings:"Headings",paragraphs:"Paragraphs",widgets:"Widgets",characters:"Characters",listView:"List view"},this.registerLocalization({context:this,namespace:"hax"}),r((()=>{a.editMode&&(this.activeNode=h(a.activeNode),setTimeout((()=>{this.requestUpdate()}),0))}))}async updateHAXMap(t){let e=[];for(var i=0;i0)for(var l=0;l{switch(t.tag){case"blockquote":case"div":case"span":case"p":case"ul":case"ol":case"strong":case"em":i.p++;break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":i.h++;break;default:i.e++}})),i)this[`${e}Count`]=i[e]}}render(){return t`${this.hidden?"":t` -
${this.t.contentStatistics}
-
-
- ${this.wCount} - ${this.t.words} -
-
- ${this.pCount} - ${this.t.paragraphs} -
-
- ${this.cCount} - ${this.t.characters} -
-
- ${this.hCount} - ${this.t.headings} -
-
- ${this.eCount} - ${this.t.widgets} -
-
-
${this.t.listView}
- `} - `}editItem(t){!1!==t&&this.elementList[t].node&&this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:this.elementList[t].node,eventName:"content-edit",value:!0}}))}isLocked(t){if(!1!==t&&this.elementList[t].node){let e=this.elementList[t].node;return!!(null!=e.getAttribute("data-hax-lock")||e.parentNode&&null!=e.parentNode.getAttribute("data-hax-lock"))}}itemOp(t,e){if(!1!==t&&this.elementList[t].node&&e){let i=this.elementList[t].node;if(null==i.getAttribute("data-hax-lock")&&i.parentNode&&null==i.parentNode.getAttribute("data-hax-lock"))switch(e){case"transform":this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:i,eventName:"hax-transform-node",value:!0}}));break;case"lock":i.setAttribute("data-hax-lock","data-hax-lock");break;case"delete":a.activeHaxBody.haxDeleteNode(i);break;case"down":i.nextElementSibling&&a.activeHaxBody.haxMoveGridPlate(i);break;case"up":i.previousElementSibling&&"PAGE-BREAK"!==i.previousElementSibling.tagName&&a.activeHaxBody.haxMoveGridPlate(i,-1)}else"lock"===e&&i.removeAttribute("data-hax-lock");setTimeout((()=>{this.requestUpdate()}),0)}}indentedElements(t){let e="h1";return t.map((t=>{let i=t;return null===i.parent&&(i.parent=e),["h1","h2","h3","h4","h5","h6"].includes(i.tag)&&(i.parent=i.tag,e=i.tag),i}))}goToItem(t){if(!1!==t&&this.elementList[t].node){let e=this.elementList[t].node;a.activeNode=e,e.classList.add("blinkfocus"),"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView({behavior:"smooth",inline:"center"}),setTimeout((()=>{e.classList.remove("blinkfocus")}),500)}}scrollInMap(){var t=l(e)[0];this.goToItem(t.getAttribute("data-index"))}static get tag(){return"hax-map"}static get properties(){return{...super.properties,opened:{type:Boolean},hidden:{type:Boolean,reflect:!0},elementList:{type:Array},cCount:{type:String},wCount:{type:String},bCount:{type:String},hCount:{type:String},pCount:{type:String},eCount:{type:String},activeNode:{type:Object}}}}customElements.define(HaxMap.tag,HaxMap);export{HaxMap}; \ No newline at end of file + `]}constructor(){super(),this.elementList=[],this.t={contentStatistics:"Content Statistics",words:"Words",headings:"Headings",paragraphs:"Paragraphs",widgets:"Widgets",characters:"Characters",listView:"List view"},this.registerLocalization({context:this,namespace:"hax"}),r((()=>{a.editMode&&(this.activeNode=h(a.activeNode),setTimeout((()=>{this.requestUpdate()}),0))}))}async updateHAXMap(t){let e=[];for(var i=0;i0)for(var l=0;l{switch(t.tag){case"blockquote":case"div":case"span":case"p":case"ul":case"ol":case"strong":case"em":i.p++;break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":i.h++;break;default:i.e++}})),i)this[`${e}Count`]=i[e]}}render(){return t`${this.hidden?"":t`
${this.t.contentStatistics}
+
+
+ ${this.wCount} + ${this.t.words} +
+
+ ${this.pCount} + ${this.t.paragraphs} +
+
+ ${this.cCount} + ${this.t.characters} +
+
+ ${this.hCount} + ${this.t.headings} +
+
+ ${this.eCount} + ${this.t.widgets} +
+
+
${this.t.listView}
+
    + ${this.indentedElements(this.elementList).map(((e,i)=>t` +
  • + + + ${"page-break"!=e.tag?t` + + ${a.isTextElement(e.node)||"grid-plate"==e.tag?t``:t` + + `} + + + + `:""} +
  • + `))} +
`} `}editItem(t){!1!==t&&this.elementList[t].node&&this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:this.elementList[t].node,eventName:"content-edit",value:!0}}))}isLocked(t){if(!1!==t&&this.elementList[t].node){let e=this.elementList[t].node;return!!(null!=e.getAttribute("data-hax-lock")||e.parentNode&&null!=e.parentNode.getAttribute("data-hax-lock"))}}itemOp(t,e){if(!1!==t&&this.elementList[t].node&&e){let i=this.elementList[t].node;if(null==i.getAttribute("data-hax-lock")&&i.parentNode&&null==i.parentNode.getAttribute("data-hax-lock"))switch(e){case"transform":this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:i,eventName:"hax-transform-node",value:!0}}));break;case"lock":i.setAttribute("data-hax-lock","data-hax-lock");break;case"delete":a.activeHaxBody.haxDeleteNode(i);break;case"down":i.nextElementSibling&&a.activeHaxBody.haxMoveGridPlate(i);break;case"up":i.previousElementSibling&&"PAGE-BREAK"!==i.previousElementSibling.tagName&&a.activeHaxBody.haxMoveGridPlate(i,-1)}else"lock"===e&&i.removeAttribute("data-hax-lock");setTimeout((()=>{this.requestUpdate()}),0)}}indentedElements(t){let e="h1";return t.map((t=>{let i=t;return null===i.parent&&(i.parent=e),["h1","h2","h3","h4","h5","h6"].includes(i.tag)&&(i.parent=i.tag,e=i.tag),i}))}goToItem(t){if(!1!==t&&this.elementList[t].node){let e=this.elementList[t].node;a.activeNode=e,e.classList.add("blinkfocus"),"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView({behavior:"smooth",inline:"center"}),setTimeout((()=>{e.classList.remove("blinkfocus")}),500)}}scrollInMap(){var t=l(e)[0];this.goToItem(t.getAttribute("data-index"))}static get tag(){return"hax-map"}static get properties(){return{...super.properties,opened:{type:Boolean},hidden:{type:Boolean,reflect:!0},elementList:{type:Array},cCount:{type:String},wCount:{type:String},bCount:{type:String},hCount:{type:String},pCount:{type:String},eCount:{type:String},activeNode:{type:Object}}}}customElements.define(HaxMap.tag,HaxMap);export{HaxMap}; \ No newline at end of file diff --git a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-view-source.js b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-view-source.js index f87b9cf7889..bd9693cd30b 100644 --- a/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-view-source.js +++ b/build/es6/node_modules/@lrnwebcomponents/hax-body/lib/hax-view-source.js @@ -46,163 +46,161 @@ import{LitElement as t,html as e,css as o}from"../../../lit/index.js";import{Mtz flex: 0 1 auto; } } - `]}render(){return e`${this.hidden?"":e` - - - - - - ${m.has("@core/docxToHtml")?e` - `:e` - - - `} - - ${m.has("@core/mdToHtml")?e` - - - - - `:e``} - - - - ${m.has("@core/prettyHtml")?e` + `]}render(){return e`${this.hidden?"":e` - `:e``} - - - - - + + ${m.has("@core/docxToHtml")?e` + `:e` + + + `} + + ${m.has("@core/mdToHtml")?e` + + + + + `:e``} + + - - - ${m.has("@core/htmlToDocx")?e` - - - `:e` + ${m.has("@core/prettyHtml")?e` - - `} - - ${m.has("@core/htmlToMd")?e` - - - - - `:e``} - ${m.has("@core/htmlToPdf")?e` - - - - `:e``} - + `:e``} - - - -
-
- - -
`} - `}static get tag(){return"hax-view-source"}refreshHTMLEditor(t){this.updateEditor()}importDOCX(t){import("../../file-system-broker/lib/docx-file-system-broker.js").then((async t=>{const e=window.FileSystemBroker.requestAvailability(),o=await e.loadFile("docx");window.DOCXFileSystemBroker.requestAvailability().fileToHTML(o,"hax-view-source")}))}importMDviaMicro(t){import("../../file-system-broker/file-system-broker.js").then((async t=>{const e=window.FileSystemBroker.requestAvailability(),o=await e.getFileContents("markdown"),a=await m.call("@core/mdToHtml",{md:o});200==a.status&&this.insertContentsFromFile({detail:{name:"hax-view-source",value:a.data}})}))}importDOCXviaMicro(t){import("../../file-system-broker/file-system-broker.js").then((async t=>{const e=window.FileSystemBroker.requestAvailability(),o=await e.loadFile("docx"),a=new FormData;a.append("upload",o);const i=await m.call("@core/docxToHtml",a);200==i.status&&this.insertContentsFromFile({detail:{name:"hax-view-source",value:i.data.contents}})}))}insertContentsFromFile(t){if("hax-view-source"===t.detail.name){let o=document.createElement("div");o.innerHTML=t.detail.value;let a=!1;r.activeNode.hasAttribute("slot")&&(a=r.activeNode.getAttribute("slot"));for(var e=o.children.length-1;e>0;e--)a&&o.children[e].setAttribute("slot",a),r.activeNode.parentNode.insertBefore(o.children[e],r.activeNode.nextSibling);r.toast(this.t.fileImported),this.close()}}connectedCallback(){super.connectedCallback(),window.addEventListener("docx-file-system-data",this.insertContentsFromFile,{signal:this.windowControllers.signal})}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}async download(t){const e=await this.contentToFile(!1);this.downloadFromData(e,"html","my-new-code"),r.toast(this.t.fileDownloaded),this.close()}async downloadDOCX(t){import("../../file-system-broker/lib/docx-file-system-broker.js").then((async t=>{let e=await r.activeHaxBody.haxToContent();window.DOCXFileSystemBroker.requestAvailability().HTMLToDOCX(e,document.title),r.toast(this.t.fileDownloaded),this.close()}))}async downloadDOCXviaMicro(t){let e=await r.activeHaxBody.haxToContent();const o=await m.call("@core/htmlToDocx",{html:e});if(200==o.status){const t=document.createElement("a");t.href=window.URL.createObjectURL(n(`${o.data}`,"application/vnd.openxmlformats-officedocument.wordprocessingml.document")),t.download="PageContents.docx",t.target="_blank",this.appendChild(t),t.click(),this.removeChild(t),r.toast(this.t.fileDownloaded),this.close()}}async downloadMDviaMicro(t){let e=await r.activeHaxBody.haxToContent();const o=await m.call("@core/htmlToMd",{html:e});if(200==o.status&&o.data){const t=document.createElement("a");t.href=window.URL.createObjectURL(n(btoa(o.data),"text/markdown")),t.download="PageContents.md",t.target="_blank",this.appendChild(t),t.click(),this.removeChild(t),r.toast(this.t.fileDownloaded),this.close()}}async downloadPDFviaMicro(t){let e=await r.activeHaxBody.haxToContent();var o="";document.querySelector("base")&&(o=document.querySelector("base").href);const a=await m.call("@core/htmlToPdf",{base:o,html:e});if(200==a.status&&a.data){const t=document.createElement("a");t.href=window.URL.createObjectURL(n(a.data,"application/pdf")),t.download="PageContents.pdf",t.target="_blank",this.appendChild(t),t.click(),this.removeChild(t),r.toast(this.t.fileDownloaded),this.close()}}async downloadfull(t){const e=await this.contentToFile(!0);this.downloadFromData(e,"html","my-new-webpage"),r.toast(this.t.fileDownloaded),this.close()}async importContent(t){let e=this.shadowRoot.querySelector("#textarea").value,o="slot"===r.activeHaxBody.shadowRoot.querySelector("#body").localName?r.activeHaxBody.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[];if(o.length>0&&"PAGE-BREAK"===o[0].tagName&&!e.includes("{const t=o.data.replace(/^\s+|\s+$/gm,"");this.shadowRoot.querySelector("#textarea").editorValue=t}),0));const a=this.shadowRoot.querySelector("#textarea").value;r.toast("Formatting updated, Content updated"),r.activeHaxBody.importContent(a)}openSource(){window.customElements.get("code-editor")?setTimeout((()=>{this.updateEditor()}),1e3):import("../../code-editor/code-editor.js").then((()=>{this.updateEditor(),setTimeout((()=>{this.updateEditor()}),1e3)}))}selectBody(t){let e=this.shadowRoot.querySelector("#hiddentextarea");e.value=this.shadowRoot.querySelector("#textarea").value,e.removeAttribute("hidden"),e.focus(),e.select(),document.execCommand("copy"),e.setAttribute("hidden","hidden"),r.toast(this.t.copiedToClipboard)}async htmlToHaxElements(t){let e=await r.htmlToHaxElements(this.shadowRoot.querySelector("#textarea").value);var o=JSON.stringify(e,null,2);let a=this.shadowRoot.querySelector("#textarea").value,i=this.shadowRoot.querySelector("#hiddentextarea");i.removeAttribute("hidden"),i.value=o,i.focus(),i.select(),document.execCommand("copy"),i.value=a,i.setAttribute("hidden","hidden"),r.toast(this.t.copiedToClipboard),this.close()}close(){r.haxTray.trayDetail=""}updateEditor(){r.activeHaxBody&&this.shadowRoot&&this.shadowRoot.querySelector("#textarea")&&(this.shadowRoot.querySelector("#textarea").editorValue="",setTimeout((async()=>{const t=l(await r.activeHaxBody.haxToContent()).replace(/^\s+|\s+$/gm,"");this.shadowRoot.querySelector("#textarea").editorValue=t}),0))}async contentToFile(t){let e=await r.activeHaxBody.haxToContent();var o=e;return t&&(o=`\n \n \n \n \n \n hax-body demo\n