solid-ui 2.4.27-5b3471ff → 2.4.27-6168d169
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/670.solid-ui.min.js +1 -0
- package/dist/805.solid-ui.min.js +3 -0
- package/dist/805.solid-ui.min.js.LICENSE.txt +58 -0
- package/dist/805.solid-ui.min.js.map +1 -0
- package/dist/_2b19.solid-ui.js +14 -0
- package/dist/_2b19.solid-ui.js.map +1 -0
- package/dist/index.html +1 -9
- package/dist/{main.js → solid-ui.js} +3206 -19489
- package/dist/solid-ui.js.map +1 -0
- package/dist/solid-ui.min.js +3 -0
- package/dist/solid-ui.min.js.LICENSE.txt +50 -0
- package/dist/solid-ui.min.js.map +1 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +12134 -0
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -0
- package/lib/acl/access-controller.d.ts +2 -3
- package/lib/acl/access-controller.d.ts.map +1 -1
- package/lib/acl/access-controller.js +17 -15
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.d.ts.map +1 -1
- package/lib/acl/access-groups.js +78 -8
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.d.ts.map +1 -1
- package/lib/acl/acl-control.js +10 -11
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -1
- package/lib/acl/acl.js +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.d.ts.map +1 -1
- package/lib/acl/add-agent-buttons.js +4 -3
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/footer/index.d.ts.map +1 -1
- package/lib/footer/index.js +5 -1
- package/lib/footer/index.js.map +1 -1
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +41 -20
- package/lib/header/index.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +39 -37
- package/lib/login/login.js.map +1 -1
- package/lib/media/media-capture.d.ts +2 -2
- package/lib/media/media-capture.d.ts.map +1 -1
- package/lib/media/media-capture.js +11 -15
- package/lib/media/media-capture.js.map +1 -1
- package/lib/pad.d.ts +2 -2
- package/lib/pad.d.ts.map +1 -1
- package/lib/pad.js +14 -37
- package/lib/pad.js.map +1 -1
- package/lib/participation.d.ts +5 -5
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +21 -21
- package/lib/participation.js.map +1 -1
- package/lib/style.js +91 -2
- package/lib/style.js.map +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +14 -8
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.d.ts +0 -4
- package/lib/utils/headerFooterHelpers.d.ts.map +1 -1
- package/lib/utils/headerFooterHelpers.js +0 -27
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/versionInfo.js +7 -7
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +43 -49
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.js +10 -18
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +7 -2
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms.js +8 -4
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +10 -10
- package/dist/main.js.map +0 -1
- package/lib/acl/styles.d.ts +0 -90
- package/lib/acl/styles.d.ts.map +0 -1
- package/lib/acl/styles.js +0 -98
- package/lib/acl/styles.js.map +0 -1
- package/lib/footer/styleMap.d.ts +0 -8
- package/lib/footer/styleMap.d.ts.map +0 -1
- package/lib/footer/styleMap.js +0 -15
- package/lib/footer/styleMap.js.map +0 -1
- package/lib/header/styleMap.d.ts +0 -117
- package/lib/header/styleMap.d.ts.map +0 -1
- package/lib/header/styleMap.js +0 -139
- package/lib/header/styleMap.js.map +0 -1
- package/lib/jss/index.d.ts +0 -20
- package/lib/jss/index.d.ts.map +0 -1
- package/lib/jss/index.js +0 -47
- package/lib/jss/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dragAndDrop.js","names":["debug","_interopRequireWildcard","require","mime","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","makeDropTarget","ele","droppedURIHandler","droppedFileHandler","dragoverListener","e","preventDefault","dataTransfer","dropEffect","dragenterListener","log","style","savedStyle","border","backgroundColor","borderRadius","dragleaveListener","dropListener","types","join","uris","text","t","length","type","getData","split","files","i","f","name","size","lastModifiedDate","toLocaleDateString","slice","addTargetListeners","addEventListener","makeDraggable","tr","setAttribute","fontWeight","setData","uri","outerHTML","stopPropagation","uploadFiles","fetcher","fileBase","imageBase","successHandler","reader","FileReader","onload","theFile","data","target","result","suffix","byteLength","contentType","lookup","msg","alert","Error","extension","endsWith","folderName","startsWith","destURI","encodeURIComponent","webOperation","then","_response","error","readAsArrayBuffer"],"sources":["../../src/widgets/dragAndDrop.js"],"sourcesContent":["/* Drag and drop common functionality\n *\n * It is easy to make something draggable, or to make it a drag target!\n * Just call the functions below. In a solid world, any part of the UI which\n * represent one thing which has a UR, should be made draggable using makeDraggable\n * Any list of things should typically allow you to drag new members of the list\n * onto it.\n * The file upload function uploadFiles is provided as often of someone drags a file from the computer\n * desktop, you may want to upload it into the pod.\n */\nimport * as debug from '../debug'\nimport * as mime from 'mime-types'\n\n/* global FileReader alert */\n\nexport function makeDropTarget (ele, droppedURIHandler, droppedFileHandler) {\n const dragoverListener = function (e) {\n e.preventDefault() // Neeed else drop does not work [sic]\n e.dataTransfer.dropEffect = 'copy'\n }\n\n const dragenterListener = function (e) {\n debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.style) {\n // necessary not sure when\n if (!this.savedStyle) {\n this.savedStyle = {}\n this.savedStyle.border = this.style.border\n this.savedStyle.backgroundColor = this.style.backgroundColor\n this.savedStyle.borderRadius = this.style.borderRadius\n }\n this.style.backgroundColor = '#ccc'\n this.style.border = '0.25em dashed black'\n this.style.borderRadius = '0.3em'\n }\n\n e.dataTransfer.dropEffect = 'link'\n debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect)\n }\n const dragleaveListener = function (e) {\n debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.savedStyle) {\n this.style.border = this.savedStyle.border\n this.style.backgroundColor = this.savedStyle.backgroundColor\n this.style.borderRadius = this.savedStyle.borderRadius\n } else {\n this.style.backgroundColor = 'white'\n this.style.border = '0em solid black'\n }\n }\n\n const dropListener = function (e) {\n if (e.preventDefault) e.preventDefault() // stops the browser from redirecting off to the text.\n debug.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)\n debug.log(\n 'Drop event. types: ' +\n (e.dataTransfer.types ? e.dataTransfer.types.join(', ') : 'NOPE')\n )\n\n let uris = null\n let text\n if (e.dataTransfer.types) {\n for (let t = 0; t < e.dataTransfer.types.length; t++) {\n const type = e.dataTransfer.types[t]\n if (type === 'text/uri-list') {\n uris = e.dataTransfer.getData(type).split('\\n') // @ ignore those starting with #\n debug.log('Dropped text/uri-list: ' + uris)\n } else if (type === 'text/plain') {\n text = e.dataTransfer.getData(type)\n } else if (type === 'Files' && droppedFileHandler) {\n const files = e.dataTransfer.files // FileList object.\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n 'Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate\n ? f.lastModifiedDate.toLocaleDateString()\n : 'n/a')\n )\n }\n droppedFileHandler(files)\n }\n }\n if (uris === null && text && text.slice(0, 4) === 'http') {\n uris = text\n debug.log(\"Waring: Poor man's drop: using text for URI\") // chrome disables text/uri-list??\n }\n } else {\n // ... however, if we're IE, we don't have the .types property, so we'll just get the Text value\n uris = [e.dataTransfer.getData('Text')]\n debug.log('WARNING non-standard drop event: ' + uris[0])\n }\n debug.log('Dropped URI list (2): ' + uris)\n if (uris) {\n droppedURIHandler(uris)\n }\n this.style.backgroundColor = 'white' // restore style\n return false\n } // dropListener\n\n const addTargetListeners = function (ele) {\n if (!ele) {\n debug.log('@@@ addTargetListeners: ele ' + ele)\n }\n ele.addEventListener('dragover', dragoverListener)\n ele.addEventListener('dragenter', dragenterListener)\n ele.addEventListener('dragleave', dragleaveListener)\n ele.addEventListener('drop', dropListener)\n }\n addTargetListeners(ele, droppedURIHandler)\n} // listen for dropped URIs\n\n// Make an HTML element draggable as a URI-identified thing\n//\n// Possibly later set the drag image too?\n//\nexport function makeDraggable (tr, obj) {\n tr.setAttribute('draggable', 'true') // Stop the image being dragged instead - just the TR\n\n tr.addEventListener(\n 'dragstart',\n function (e) {\n tr.style.fontWeight = 'bold'\n e.dataTransfer.setData('text/uri-list', obj.uri)\n e.dataTransfer.setData('text/plain', obj.uri)\n e.dataTransfer.setData('text/html', tr.outerHTML)\n debug.log(\n 'Dragstart: ' + tr + ' -> ' + obj + 'de: ' + e.dataTransfer.dropEffect\n )\n },\n false\n )\n\n tr.addEventListener(\n 'drag',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // debug.log('Drag: dropEffect: ' + e.dataTransfer.dropEffect)\n },\n false\n )\n\n tr.addEventListener(\n 'dragend',\n function (e) {\n tr.style.fontWeight = 'normal'\n debug.log('Dragend dropeffect: ' + e.dataTransfer.dropEffect)\n debug.log('Dragend: ' + tr + ' -> ' + obj)\n },\n false\n )\n}\n\n/** uploadFiles\n**\n** Generic uploader of local files to the web\n** typically called from dropped file handler\n**\n** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher\n** @param {Array<File>} files Array of file objects\n** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)\n** @param {String } imageBase URI of folder in which to put images\n** @param successHandler function(file, uploadedURI) Called after EACH success upload\n** With file object an final URI as params\n*/\n\nexport function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n ' dropped: Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a')\n ) // See e.g. https://www.html5rocks.com/en/tutorials/file/dndfiles/\n\n // @@ Add: progress bar(s)\n const reader = new FileReader()\n reader.onload = (function (theFile) {\n return function (e) {\n const data = e.target.result\n let suffix = ''\n debug.log(' File read byteLength : ' + data.byteLength)\n let contentType = theFile.type\n if (!theFile.type || theFile.type === '') {\n // Not known by browser\n contentType = mime.lookup(theFile.name)\n if (!contentType) {\n const msg =\n 'Filename needs to have an extension which gives a type we know: ' +\n theFile.name\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n } else {\n const extension = mime.extension(theFile.type)\n // Note not simple: eg .mp3 => audio/mpeg; .mpga => audio/mpeg; audio/mp3 => .mp3\n if (extension && extension !== 'false' && !theFile.name.endsWith('.' + extension) && // Not already has preferred extension? and ...\n theFile.type !== mime.lookup(theFile.name)) { // the mime type of this ext is not the right one?\n suffix = '_.' + extension\n // console.log('MIME TYPE MISMATCH: ' + mime.lookup(theFile.name) + ': adding extension: ' + suffix)\n }\n }\n const folderName = theFile.type.startsWith('image/')\n ? imageBase || fileBase\n : fileBase\n const destURI =\n folderName +\n (folderName.endsWith('/') ? '' : '/') +\n encodeURIComponent(theFile.name) +\n suffix\n\n fetcher\n .webOperation('PUT', destURI, {\n data,\n contentType\n })\n .then(\n _response => {\n debug.log(' Upload: put OK: ' + destURI)\n successHandler(theFile, destURI)\n },\n error => {\n const msg = ' Upload: FAIL ' + destURI + ', Error: ' + error\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n )\n }\n })(f)\n reader.readAsArrayB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GACrCI,kBAAkB,CAAChB,OAAO,CAACvB,IAAI,CAAC,GAChC2B,MAAM;QAERX,OAAO,CACJwB,YAAY,CAAC,KAAK,EAAEF,OAAO,EAAE;UAC5Bd,IAAI,EAAJA,IAAI;UACJK,WAAW,EAAXA;QACF,CAAC,CAAC,CACDY,IAAI,CACH,UAAAC,SAAS,EAAI;UACXlG,KAAK,CAACoC,GAAG,CAAC,mBAAmB,GAAG0D,OAAO,CAAC;UACxCnB,cAAc,CAACI,OAAO,EAAEe,OAAO,CAAC;QAClC,CAAC,EACD,UAAAK,KAAK,EAAI;UACP,IAAMZ,GAAG,GAAG,gBAAgB,GAAGO,OAAO,GAAG,WAAW,GAAGK,KAAK;UAC5DnG,KAAK,CAACoC,GAAG,CAACmD,GAAG,CAAC;UACdC,KAAK,CAACD,GAAG,CAAC;UACV,MAAM,IAAIE,KAAK,CAACF,GAAG,CAAC;QACtB,CAAC,CACF;MACL,CAAC;IACH,CAAC,CAAEhC,CAAC,CAAC;IACLqB,MAAM,CAACwB,iBAAiB,CAAC7C,CAAC,CAAC;EAC7B;AACF"}
|
|
1
|
+
{"version":3,"file":"dragAndDrop.js","names":["debug","_interopRequireWildcard","require","mime","style","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","makeDropTarget","ele","droppedURIHandler","droppedFileHandler","dragoverListener","e","preventDefault","dataTransfer","dropEffect","dragenterListener","log","localStyle","savedStyle","dragEvent","dragleaveListener","dropEvent","dropListener","types","join","uris","text","t","length","type","getData","split","files","i","f","name","size","lastModifiedDate","toLocaleDateString","slice","restoreStyle","addTargetListeners","addEventListener","makeDraggable","tr","setAttribute","fontWeight","setData","uri","outerHTML","stopPropagation","uploadFiles","fetcher","fileBase","imageBase","successHandler","reader","FileReader","onload","theFile","data","target","result","suffix","byteLength","contentType","lookup","msg","alert","Error","extension","endsWith","folderName","startsWith","destURI","encodeURIComponent","webOperation","then","_response","error","readAsArrayBuffer"],"sources":["../../src/widgets/dragAndDrop.js"],"sourcesContent":["/* Drag and drop common functionality\n *\n * It is easy to make something draggable, or to make it a drag target!\n * Just call the functions below. In a solid world, any part of the UI which\n * represent one thing which has a URI, should be made draggable using makeDraggable\n * Any list of things should typically allow you to drag new members of the list\n * onto it.\n * The file upload function uploadFiles is provided as often as someone drags a file from the computer\n * desktop, you may want to upload it into the pod.\n */\nimport * as debug from '../debug'\nimport * as mime from 'mime-types'\nimport * as style from '../style'\n\n/* global FileReader alert */\n\nexport function makeDropTarget (ele, droppedURIHandler, droppedFileHandler) {\n const dragoverListener = function (e) {\n e.preventDefault() // Need else drop does not work [sic]\n e.dataTransfer.dropEffect = 'copy'\n }\n\n const dragenterListener = function (e) {\n debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.localStyle) {\n // necessary not sure when\n if (!this.savedStyle) {\n this.savedStyle = style.dragEvent\n }\n }\n\n e.dataTransfer.dropEffect = 'link'\n debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect)\n }\n const dragleaveListener = function (e) {\n debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.savedStyle) {\n this.localStyle = this.savedStyle\n } else {\n this.localStyle = style.dropEvent\n }\n }\n\n const dropListener = function (e) {\n if (e.preventDefault) e.preventDefault() // stops the browser from redirecting off to the text.\n debug.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)\n debug.log(\n 'Drop event. types: ' +\n (e.dataTransfer.types ? e.dataTransfer.types.join(', ') : 'NOPE')\n )\n\n let uris = null\n let text\n if (e.dataTransfer.types) {\n for (let t = 0; t < e.dataTransfer.types.length; t++) {\n const type = e.dataTransfer.types[t]\n if (type === 'text/uri-list') {\n uris = e.dataTransfer.getData(type).split('\\n') // @ ignore those starting with #\n debug.log('Dropped text/uri-list: ' + uris)\n } else if (type === 'text/plain') {\n text = e.dataTransfer.getData(type)\n } else if (type === 'Files' && droppedFileHandler) {\n const files = e.dataTransfer.files // FileList object.\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n 'Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate\n ? f.lastModifiedDate.toLocaleDateString()\n : 'n/a')\n )\n }\n droppedFileHandler(files)\n }\n }\n if (uris === null && text && text.slice(0, 4) === 'http') {\n uris = text\n debug.log(\"Waring: Poor man's drop: using text for URI\") // chrome disables text/uri-list??\n }\n } else {\n // ... however, if we're IE, we don't have the .types property, so we'll just get the Text value\n uris = [e.dataTransfer.getData('Text')]\n debug.log('WARNING non-standard drop event: ' + uris[0])\n }\n debug.log('Dropped URI list (2): ' + uris)\n if (uris) {\n droppedURIHandler(uris)\n }\n this.localStyle = style.restoreStyle // restore style\n return false\n } // dropListener\n\n const addTargetListeners = function (ele) {\n if (!ele) {\n debug.log('@@@ addTargetListeners: ele ' + ele)\n }\n ele.addEventListener('dragover', dragoverListener)\n ele.addEventListener('dragenter', dragenterListener)\n ele.addEventListener('dragleave', dragleaveListener)\n ele.addEventListener('drop', dropListener)\n }\n addTargetListeners(ele, droppedURIHandler)\n} // listen for dropped URIs\n\n// Make an HTML element draggable as a URI-identified thing\n//\n// Possibly later set the drag image too?\n//\nexport function makeDraggable (tr, obj) {\n tr.setAttribute('draggable', 'true') // Stop the image being dragged instead - just the TR\n\n tr.addEventListener(\n 'dragstart',\n function (e) {\n tr.style.fontWeight = 'bold'\n e.dataTransfer.setData('text/uri-list', obj.uri)\n e.dataTransfer.setData('text/plain', obj.uri)\n e.dataTransfer.setData('text/html', tr.outerHTML)\n debug.log(\n 'Dragstart: ' + tr + ' -> ' + obj + 'de: ' + e.dataTransfer.dropEffect\n )\n },\n false\n )\n\n tr.addEventListener(\n 'drag',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // debug.log('Drag: dropEffect: ' + e.dataTransfer.dropEffect)\n },\n false\n )\n\n tr.addEventListener(\n 'dragend',\n function (e) {\n tr.style.fontWeight = 'normal'\n debug.log('Dragend dropeffect: ' + e.dataTransfer.dropEffect)\n debug.log('Dragend: ' + tr + ' -> ' + obj)\n },\n false\n )\n}\n\n/** uploadFiles\n**\n** Generic uploader of local files to the web\n** typically called from dropped file handler\n**\n** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher\n** @param {Array<File>} files Array of file objects\n** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)\n** @param {String } imageBase URI of folder in which to put images\n** @param successHandler function(file, uploadedURI) Called after EACH success upload\n** With file object an final URI as params\n*/\n\nexport function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n ' dropped: Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a')\n ) // See e.g. https://www.html5rocks.com/en/tutorials/file/dndfiles/\n\n // @@ Add: progress bar(s)\n const reader = new FileReader()\n reader.onload = (function (theFile) {\n return function (e) {\n const data = e.target.result\n let suffix = ''\n debug.log(' File read byteLength : ' + data.byteLength)\n let contentType = theFile.type\n if (!theFile.type || theFile.type === '') {\n // Not known by browser\n contentType = mime.lookup(theFile.name)\n if (!contentType) {\n const msg =\n 'Filename needs to have an extension which gives a type we know: ' +\n theFile.name\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n } else {\n const extension = mime.extension(theFile.type)\n // Note not simple: eg .mp3 => audio/mpeg; .mpga => audio/mpeg; audio/mp3 => .mp3\n if (extension && extension !== 'false' && !theFile.name.endsWith('.' + extension) && // Not already has preferred extension? and ...\n theFile.type !== mime.lookup(theFile.name)) { // the mime type of this ext is not the right one?\n suffix = '_.' + extension\n // console.log('MIME TYPE MISMATCH: ' + mime.lookup(theFile.name) + ': adding extension: ' + suffix)\n }\n }\n const folderName = theFile.type.startsWith('image/')\n ? imageBase || fileBase\n : fileBase\n const destURI =\n folderName +\n (folderName.endsWith('/') ? '' : '/') +\n encodeURIComponent(theFile.name) +\n suffix\n\n fetcher\n .webOperation('PUT', destURI, {\n data,\n contentType\n })\n .then(\n _response => {\n debug.log(' Upload: put OK: ' + destURI)\n successHandler(theFile, destURI)\n },\n error => {\n const msg = ' Upload: FAIL ' + destURI + ', Error: ' + error\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n )\n }\n })(f)\n reader.readAsArrayBuffer(f)\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAiC,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,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QACF,CAAC,CAAC,CACDY,IAAI,CACH,UAAAC,SAAS,EAAI;UACXnG,KAAK,CAACqC,GAAG,CAAC,mBAAmB,GAAG0D,OAAO,CAAC;UACxCnB,cAAc,CAACI,OAAO,EAAEe,OAAO,CAAC;QAClC,CAAC,EACD,UAAAK,KAAK,EAAI;UACP,IAAMZ,GAAG,GAAG,gBAAgB,GAAGO,OAAO,GAAG,WAAW,GAAGK,KAAK;UAC5DpG,KAAK,CAACqC,GAAG,CAACmD,GAAG,CAAC;UACdC,KAAK,CAACD,GAAG,CAAC;UACV,MAAM,IAAIE,KAAK,CAACF,GAAG,CAAC;QACtB,CAAC,CACF;MACL,CAAC;IACH,CAAC,CAAEjC,CAAC,CAAC;IACLsB,MAAM,CAACwB,iBAAiB,CAAC9C,CAAC,CAAC;EAC7B;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/widgets/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/widgets/error.ts"],"names":[],"mappings":"AAgBA,wBAAgB,iBAAiB,CAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,cAAc,CAoBjI"}
|
package/lib/widgets/error.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.errorMessageBlock = errorMessageBlock;
|
|
7
8
|
var _widgets = require("../widgets");
|
|
9
|
+
var style = _interopRequireWildcard(require("../style"));
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
12
|
/**
|
|
9
13
|
* Create an error message block
|
|
10
14
|
* @param dom The DOM on which dom.createElement will be called
|
|
@@ -33,8 +37,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
|
|
|
33
37
|
}
|
|
34
38
|
div.appendChild((0, _widgets.cancelButton)(dom, function () {
|
|
35
39
|
if (div.parentNode) div.parentNode.removeChild(div);
|
|
36
|
-
})).style =
|
|
37
|
-
div.setAttribute('style',
|
|
40
|
+
})).style = style.errorCancelButton;
|
|
41
|
+
div.setAttribute('style', style.errorMessageBlock);
|
|
42
|
+
div.style.backgroundColor = backgroundColor || style.defaultErrorBackgroundColor;
|
|
38
43
|
return div;
|
|
39
44
|
}
|
|
40
45
|
//# sourceMappingURL=error.js.map
|
package/lib/widgets/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":["_widgets","require","errorMessageBlock","dom","err","backgroundColor","err2","div","createElement","errorObject","Error","console","error","concat","stack","textContent","message","appendChild","cancelButton","parentNode","removeChild","
|
|
1
|
+
{"version":3,"file":"error.js","names":["_widgets","require","style","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","errorMessageBlock","dom","err","backgroundColor","err2","div","createElement","errorObject","Error","console","error","concat","stack","textContent","message","appendChild","cancelButton","parentNode","removeChild","errorCancelButton","setAttribute","defaultErrorBackgroundColor"],"sources":["../../src/widgets/error.ts"],"sourcesContent":["/**\n * Create an error message block\n * @param dom The DOM on which dom.createElement will be called\n * @param err The error message string to display (or an error object)\n * @param backgroundColor Background color. Default: '#fee'\n * @param err2 Is the second param is a string, you can put the original Error in here\n * @returns A div element with the err string\n *\n * This will return a DOM element you can put in the UI as a notice for the user\n * Meanwhile the stack is dumped to the console for the developer, so you actually know\n * where it happened!\n */\n/* eslint-disable no-console */\nimport { cancelButton } from '../widgets'\nimport * as style from '../style'\n\nexport function errorMessageBlock (dom: HTMLDocument, err: string | Error, backgroundColor?: string, err2?: Error): HTMLDivElement {\n const div = dom.createElement('div')\n\n /* tslint:disable-next-line */ // Too complex for TS?\n // @ts-ignore\n const errorObject:Error = err2 || err instanceof Error ? err : null\n\n if (errorObject) {\n console.error(`errorMessageBlock: ${errorObject} at: ${errorObject.stack || '??'}`, errorObject) // @@ pick one\n div.textContent = errorObject.message\n } else {\n div.textContent = err as string\n }\n\n div.appendChild(cancelButton(dom, () => { if (div.parentNode) div.parentNode.removeChild(div) }))\n .style = style.errorCancelButton\n\n div.setAttribute('style', style.errorMessageBlock)\n div.style.backgroundColor = (backgroundColor || style.defaultErrorBackgroundColor)\n return div\n}\n"],"mappings":";;;;;;;AAaA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAiC,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,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EAC/B;EACA,IAAMC,WAAiB,GAAGH,IAAI,IAAIF,GAAG,YAAYM,KAAK,GAAGN,GAAG,GAAG,IAAI;EAEnE,IAAIK,WAAW,EAAE;IACfE,OAAO,CAACC,KAAK,uBAAAC,MAAA,CAAuBJ,WAAW,WAAAI,MAAA,CAAQJ,WAAW,CAACK,KAAK,IAAI,IAAI,GAAIL,WAAW,CAAC,EAAC;IACjGF,GAAG,CAACQ,WAAW,GAAGN,WAAW,CAACO,OAAO;EACvC,CAAC,MAAM;IACLT,GAAG,CAACQ,WAAW,GAAGX,GAAa;EACjC;EAEAG,GAAG,CAACU,WAAW,CAAC,IAAAC,qBAAY,EAACf,GAAG,EAAE,YAAM;IAAE,IAAII,GAAG,CAACY,UAAU,EAAEZ,GAAG,CAACY,UAAU,CAACC,WAAW,CAACb,GAAG,CAAC;EAAC,CAAC,CAAC,CAAC,CAC9F7B,KAAK,GAAGA,KAAK,CAAC2C,iBAAiB;EAElCd,GAAG,CAACe,YAAY,CAAC,OAAO,EAAE5C,KAAK,CAACwB,iBAAiB,CAAC;EAClDK,GAAG,CAAC7B,KAAK,CAAC2B,eAAe,GAAIA,eAAe,IAAI3B,KAAK,CAAC6C,2BAA4B;EAClF,OAAOhB,GAAG;AACZ"}
|
package/lib/widgets/forms.js
CHANGED
|
@@ -851,7 +851,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
851
851
|
** <select id=dropDownSelect>
|
|
852
852
|
** <option> ....
|
|
853
853
|
** <subForm>
|
|
854
|
-
** Alternative implementatons
|
|
854
|
+
** Alternative implementatons could be:
|
|
855
855
|
** -- pop-up menu (as here)
|
|
856
856
|
** -- radio buttons
|
|
857
857
|
** -- auto-complete typing
|
|
@@ -892,11 +892,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
892
892
|
subForm: subForm,
|
|
893
893
|
disambiguate: false
|
|
894
894
|
};
|
|
895
|
-
function getSelectorOptions() {
|
|
895
|
+
function getSelectorOptions(dataSource) {
|
|
896
896
|
var possible = [];
|
|
897
897
|
var possibleProperties;
|
|
898
898
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
899
|
-
for (var x in findMembersNT(kb, uiFrom,
|
|
899
|
+
for (var x in findMembersNT(kb, uiFrom, dataSource)) {
|
|
900
900
|
possible.push(kb.fromNT(x));
|
|
901
901
|
} // Use rdfs
|
|
902
902
|
|
|
@@ -928,6 +928,10 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
928
928
|
|
|
929
929
|
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
930
930
|
if (multiSelect) opts.multiSelect = true;
|
|
931
|
+
|
|
932
|
+
// by default searches the dataDoc graph or optionally the full store
|
|
933
|
+
var dataSource = kb.any(form, ui('search-full-store')).length ? null : dataDoc; // optional
|
|
934
|
+
|
|
931
935
|
var selector;
|
|
932
936
|
rhs.refresh = function () {
|
|
933
937
|
// from ui:property
|
|
@@ -935,7 +939,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
935
939
|
return object.value;
|
|
936
940
|
});
|
|
937
941
|
// from ui:from + ui:property
|
|
938
|
-
var possibleOptions = getSelectorOptions();
|
|
942
|
+
var possibleOptions = getSelectorOptions(dataSource);
|
|
939
943
|
possibleOptions.push(selectedOptions);
|
|
940
944
|
possibleOptions = sortByLabel(possibleOptions);
|
|
941
945
|
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|