solid-ui 2.4.28-46a60cc6 → 2.4.28-58251370
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/solid-ui.js +104 -111
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.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 +15 -11
- 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 +37 -14
- 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 +1 -32
- package/lib/style.js.map +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +8 -14
- package/lib/tabs.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/dragAndDrop.js +18 -10
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +2 -7
- package/lib/widgets/error.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,9 +11,9 @@ export declare function cameraCaptureControl(dom: HTMLDocument, store: IndexedFo
|
|
|
11
11
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
12
12
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
13
13
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
14
|
-
* @returns {DomElement} - A div element with the
|
|
14
|
+
* @returns {DomElement} - A div element with the buton in it
|
|
15
15
|
*
|
|
16
|
-
* This
|
|
16
|
+
* This expacts the buttton to a large control when it is pressed
|
|
17
17
|
*/
|
|
18
18
|
export declare function cameraButton(dom: HTMLDocument, store: IndexedFormula, getImageDoc: () => NamedNode, doneCallback: (imageDoc: any) => Promise<void>): HTMLElement;
|
|
19
19
|
//# sourceMappingURL=media-capture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-capture.d.ts","sourceRoot":"","sources":["../../src/media/media-capture.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"media-capture.d.ts","sourceRoot":"","sources":["../../src/media/media-capture.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAYlD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,KAAA,KAAK,OAAO,CAAC,IAAI,CAAC,kBAmI1C;AAED;;;;;;;;GAQG;AAEH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,KAAA,KAAK,OAAO,CAAC,IAAI,CAAC,GACxC,WAAW,CAqBb"}
|
|
@@ -11,21 +11,21 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
12
|
var debug = _interopRequireWildcard(require("../debug"));
|
|
13
13
|
var _iconBase = require("../iconBase");
|
|
14
|
-
var style = _interopRequireWildcard(require("../style"));
|
|
15
14
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
16
15
|
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); }
|
|
17
16
|
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; }
|
|
17
|
+
/// /////////////////////////////////////////////
|
|
18
18
|
//
|
|
19
19
|
// Media input widget
|
|
20
20
|
//
|
|
21
21
|
//
|
|
22
22
|
// Workflow:
|
|
23
|
-
// The HTML5 functionality (on
|
|
24
|
-
// a realtime camera capture, OR a selection from images already
|
|
23
|
+
// The HTML5 functionality (on mobille) is to prompt for either
|
|
24
|
+
// a realtime camera capture , OR a selection from images already ont the device
|
|
25
25
|
// (eg camera roll).
|
|
26
26
|
//
|
|
27
|
-
// The solid alternative is to either take a
|
|
28
|
-
// or access
|
|
27
|
+
// The solid alternative is to either take a phtoto
|
|
28
|
+
// or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.
|
|
29
29
|
// (Especially latest taken ones)
|
|
30
30
|
//
|
|
31
31
|
|
|
@@ -34,6 +34,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
34
|
var cameraIcon = _iconBase.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
|
|
35
35
|
var retakeIcon = _iconBase.icons.iconBase + 'noun_479395.svg'; // Get it from github
|
|
36
36
|
|
|
37
|
+
var canvasWidth = '640';
|
|
38
|
+
var canvasHeight = '480';
|
|
39
|
+
var controlStyle = "border-radius: 0.5em; margin: 0.8em; width: ".concat(canvasWidth, "; height:").concat(canvasHeight, ";");
|
|
40
|
+
// const controlStyle = 'border-radius: 0.5em; margin: 0.8em; width: 320; height:240;'
|
|
37
41
|
var contentType = 'image/png';
|
|
38
42
|
|
|
39
43
|
/** A control to capture a picture using camera
|
|
@@ -78,7 +82,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
78
82
|
player = main.appendChild(dom.createElement('video'));
|
|
79
83
|
player.setAttribute('controls', '1');
|
|
80
84
|
player.setAttribute('autoplay', '1');
|
|
81
|
-
player.setAttribute('style',
|
|
85
|
+
player.setAttribute('style', controlStyle);
|
|
82
86
|
if (!navigator.mediaDevices) {
|
|
83
87
|
throw new Error('navigator.mediaDevices not available');
|
|
84
88
|
}
|
|
@@ -100,9 +104,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
100
104
|
function grabCanvas() {
|
|
101
105
|
// Draw the video frame to the canvas.
|
|
102
106
|
canvas = dom.createElement('canvas');
|
|
103
|
-
canvas.setAttribute('width',
|
|
104
|
-
canvas.setAttribute('height',
|
|
105
|
-
canvas.setAttribute('style',
|
|
107
|
+
canvas.setAttribute('width', canvasWidth);
|
|
108
|
+
canvas.setAttribute('height', canvasHeight);
|
|
109
|
+
canvas.setAttribute('style', controlStyle);
|
|
106
110
|
main.appendChild(canvas);
|
|
107
111
|
var context = canvas.getContext('2d');
|
|
108
112
|
context.drawImage(player, 0, 0, canvas.width, canvas.height);
|
|
@@ -159,9 +163,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
159
163
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
160
164
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
161
165
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
162
|
-
* @returns {DomElement} - A div element with the
|
|
166
|
+
* @returns {DomElement} - A div element with the buton in it
|
|
163
167
|
*
|
|
164
|
-
* This
|
|
168
|
+
* This expacts the buttton to a large control when it is pressed
|
|
165
169
|
*/
|
|
166
170
|
|
|
167
171
|
function cameraButton(dom, store, getImageDoc, doneCallback) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-capture.js","names":["debug","_interopRequireWildcard","require","_iconBase","style","widgets","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","cameraIcon","icons","iconBase","retakeIcon","contentType","cameraCaptureControl","dom","store","getImageDoc","doneCallback","div","createElement","destination","imageBlob","player","canvas","table","appendChild","mainTR","main","setAttribute","buttons","cancelButton","addEventListener","_event","stopVideo","retakeButton","button","retake","visibility","shutterButton","grabCanvas","sendButton","continueButton","saveBlob","displayPlayer","controlStyle","navigator","mediaDevices","Error","getUserMedia","constraints","then","stream","srcObject","video","removeChild","canvasWidth","canvasHeight","context","getContext","drawImage","width","height","parentNode","toBlob","blob","msg","concat","type","size","log","reviewImage","getVideoTracks","forEach","track","stop","fetcher","webOperation","uri","data","_resp","err","alert","cameraButton","but","control","restoreButton","_x","_restoreButton","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","imageDoc","wrap","_callee$","_context","prev","next"],"sources":["../../src/media/media-capture.ts"],"sourcesContent":["//\n// Media input widget\n//\n//\n// Workflow:\n// The HTML5 functionality (on mobile) is to prompt for either\n// a realtime camera capture, OR a selection from images already not the device\n// (eg camera roll).\n//\n// The solid alternative is to either take a photo\n// or access camera roll (etc) OR to access solid cloud storage of favorite photo albums.\n// (Especially latest taken ones)\n//\nimport * as debug from '../debug'\n\n/** @module mediaCapture */\n\nimport { icons } from '../iconBase'\nimport * as style from '../style'\nimport * as widgets from '../widgets'\nimport { IndexedFormula, NamedNode } from 'rdflib'\n\nconst cameraIcon = icons.iconBase + 'noun_Camera_1618446_000000.svg' // Get it from github\nconst retakeIcon = icons.iconBase + 'noun_479395.svg' // Get it from github\n\nconst contentType = 'image/png'\n\n/** A control to capture a picture using camera\n * @param {Docuemnt} dom - The Document object\n * @param {IndexedForumla} store - The quadstore to store data in\n * @param {NamedNode} getImageDoc() - NN of the image file to be created\n * @param {function} doneCallback - Called when a picture has been taken\n */\nexport function cameraCaptureControl (\n dom: HTMLDocument,\n store: IndexedFormula,\n getImageDoc: () => NamedNode,\n doneCallback: (imageDoc) => Promise<void>\n) {\n const div = dom.createElement('div')\n let destination, imageBlob, player, canvas\n\n const table = div.appendChild(dom.createElement('table'))\n const mainTR = table.appendChild(dom.createElement('tr'))\n const main = mainTR.appendChild(dom.createElement('td'))\n main.setAttribute('colspan', '4')\n\n const buttons = table.appendChild(dom.createElement('tr'))\n\n buttons\n .appendChild(dom.createElement('td')) // Cancel button\n .appendChild(widgets.cancelButton(dom))\n .addEventListener('click', _event => {\n stopVideo()\n doneCallback(null)\n })\n\n const retakeButton = buttons\n .appendChild(dom.createElement('td')) // Retake button\n .appendChild(widgets.button(dom, retakeIcon, 'Retake'))\n retakeButton.addEventListener('click', _event => {\n retake()\n })\n retakeButton.style.visibility = 'collapse' // Hide for now\n\n const shutterButton = buttons\n .appendChild(dom.createElement('td')) // Trigger capture button\n .appendChild(\n widgets.button(dom, icons.iconBase + 'noun_10636.svg', 'Snap')\n )\n shutterButton.addEventListener('click', grabCanvas)\n shutterButton.style.visibility = 'collapse' // Hide for now\n\n const sendButton = buttons\n .appendChild(dom.createElement('td')) // Confirm and save button\n .appendChild(widgets.continueButton(dom)) // @@ or send icon??\n sendButton.addEventListener('click', _event => {\n saveBlob(imageBlob, destination)\n })\n sendButton.style.visibility = 'collapse' // Hide for now\n\n function displayPlayer () {\n player = main.appendChild(dom.createElement('video'))\n player.setAttribute('controls', '1')\n player.setAttribute('autoplay', '1')\n player.setAttribute('style', style.controlStyle)\n if (!navigator.mediaDevices) {\n throw new Error('navigator.mediaDevices not available')\n }\n navigator.mediaDevices.getUserMedia(constraints).then(stream => {\n player.srcObject = stream\n shutterButton.style.visibility = 'visible' // Enable\n sendButton.style.visibility = 'collapse'\n retakeButton.style.visibility = 'collapse'\n })\n }\n\n const constraints = {\n video: true\n }\n\n function retake () {\n main.removeChild(canvas)\n displayPlayer() // Make new one as old one is stuck black\n }\n\n function grabCanvas () {\n // Draw the video frame to the canvas.\n canvas = dom.createElement('canvas')\n canvas.setAttribute('width', style.canvasWidth)\n canvas.setAttribute('height', style.canvasHeight)\n canvas.setAttribute('style', style.controlStyle)\n main.appendChild(canvas)\n\n const context = canvas.getContext('2d')\n context.drawImage(player, 0, 0, canvas.width, canvas.height)\n\n player.parentNode.removeChild(player)\n\n canvas.toBlob(blob => {\n const msg = `got blob type ${blob.type} size ${blob.size}`\n debug.log(msg)\n destination = getImageDoc()\n imageBlob = blob // save for review\n reviewImage()\n // alert(msg)\n }, contentType) // toBlob\n }\n\n function reviewImage () {\n sendButton.style.visibility = 'visible'\n retakeButton.style.visibility = 'visible'\n shutterButton.style.visibility = 'collapse' // Hide for now\n }\n\n function stopVideo () {\n if (player && player.srcObject) {\n player.srcObject.getVideoTracks().forEach(track => track.stop())\n }\n }\n function saveBlob (blob, destination) {\n const contentType = blob.type\n // if (!confirm('Save picture to ' + destination + ' ?')) return\n debug.log(\n 'Putting ' + blob.size + ' bytes of ' + contentType + ' to ' + destination\n )\n // @@ TODO Remove casting\n ;(store as any).fetcher\n .webOperation('PUT', destination.uri, {\n data: blob,\n contentType\n })\n .then(\n _resp => {\n debug.log('ok saved ' + destination)\n stopVideo()\n doneCallback(destination)\n },\n err => {\n stopVideo()\n alert(err)\n }\n )\n }\n\n // Attach the video stream to the video element and autoplay.\n displayPlayer()\n return div\n}\n\n/** A button to capture a picture using camera\n * @param {Docuemnt} dom - The Document object\n * @param {IndexedForumla} store - The quadstore to store data in\n * @param {fuunction} getImageDoc - returns NN of the image file to be created\n * @param {function<Node>} doneCallback - called with the image taken\n * @returns {DomElement} - A div element with the button in it\n *\n * This expects the button to a large control when it is pressed\n */\n\nexport function cameraButton (\n dom: HTMLDocument,\n store: IndexedFormula,\n getImageDoc: () => NamedNode,\n doneCallback: (imageDoc) => Promise<void>\n): HTMLElement {\n const div = dom.createElement('div')\n const but = widgets.button(dom, cameraIcon, 'Take picture')\n let control\n async function restoreButton (imageDoc) {\n div.removeChild(control)\n div.appendChild(but)\n doneCallback(imageDoc)\n }\n div.appendChild(but)\n but.addEventListener('click', _event => {\n div.removeChild(but)\n control = cameraCaptureControl(\n dom,\n store,\n getImageDoc,\n restoreButton\n )\n div.appendChild(control)\n })\n return div\n}\n"],"mappings":";;;;;;;;;;;AAaA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAAqC,SAAAI,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,SAAAN,wBAAAU,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,CA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QAAQ;MAAA,OAAAH,YAAA,YAAAI,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YACpCjF,GAAG,CAACoC,WAAW,CAAC8B,OAAO,CAAC;YACxBlE,GAAG,CAACO,WAAW,CAAC0D,GAAG,CAAC;YACpBlE,YAAY,CAAC6E,QAAQ,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAvB,IAAA;QAAA;MAAA,GAAAmB,OAAA;IAAA,CACvB;IAAA,OAAAN,cAAA,CAAAC,KAAA,OAAAC,SAAA;EAAA;EACDvE,GAAG,CAACO,WAAW,CAAC0D,GAAG,CAAC;EACpBA,GAAG,CAACpD,gBAAgB,CAAC,OAAO,EAAE,UAAAC,MAAM,EAAI;IACtCd,GAAG,CAACoC,WAAW,CAAC6B,GAAG,CAAC;IACpBC,OAAO,GAAGvE,oBAAoB,CAC5BC,GAAG,EACHC,KAAK,EACLC,WAAW,EACXqE,aAAa,CACd;IACDnE,GAAG,CAACO,WAAW,CAAC2D,OAAO,CAAC;EAC1B,CAAC,CAAC;EACF,OAAOlE,GAAG;AACZ"}
|
|
1
|
+
{"version":3,"file":"media-capture.js","names":["debug","_interopRequireWildcard","require","_iconBase","widgets","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","cameraIcon","icons","iconBase","retakeIcon","canvasWidth","canvasHeight","controlStyle","concat","contentType","cameraCaptureControl","dom","store","getImageDoc","doneCallback","div","createElement","destination","imageBlob","player","canvas","table","appendChild","mainTR","main","setAttribute","buttons","cancelButton","addEventListener","_event","stopVideo","retakeButton","button","retake","style","visibility","shutterButton","grabCanvas","sendButton","continueButton","saveBlob","displayPlayer","navigator","mediaDevices","Error","getUserMedia","constraints","then","stream","srcObject","video","removeChild","context","getContext","drawImage","width","height","parentNode","toBlob","blob","msg","type","size","log","reviewImage","getVideoTracks","forEach","track","stop","fetcher","webOperation","uri","data","_resp","err","alert","cameraButton","but","control","restoreButton","_x","_restoreButton","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","imageDoc","wrap","_callee$","_context","prev","next"],"sources":["../../src/media/media-capture.ts"],"sourcesContent":["/// /////////////////////////////////////////////\n//\n// Media input widget\n//\n//\n// Workflow:\n// The HTML5 functionality (on mobille) is to prompt for either\n// a realtime camera capture , OR a selection from images already ont the device\n// (eg camera roll).\n//\n// The solid alternative is to either take a phtoto\n// or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.\n// (Especially latest taken ones)\n//\nimport * as debug from '../debug'\n\n/** @module mediaCapture */\n\nimport { icons } from '../iconBase'\nimport * as widgets from '../widgets'\nimport { IndexedFormula, NamedNode } from 'rdflib'\n\nconst cameraIcon = icons.iconBase + 'noun_Camera_1618446_000000.svg' // Get it from github\nconst retakeIcon = icons.iconBase + 'noun_479395.svg' // Get it from github\n\nconst canvasWidth = '640'\nconst canvasHeight = '480'\n\nconst controlStyle = `border-radius: 0.5em; margin: 0.8em; width: ${canvasWidth}; height:${canvasHeight};`\n// const controlStyle = 'border-radius: 0.5em; margin: 0.8em; width: 320; height:240;'\nconst contentType = 'image/png'\n\n/** A control to capture a picture using camera\n * @param {Docuemnt} dom - The Document object\n * @param {IndexedForumla} store - The quadstore to store data in\n * @param {NamedNode} getImageDoc() - NN of the image file to be created\n * @param {function} doneCallback - Called when a picture has been taken\n */\nexport function cameraCaptureControl (\n dom: HTMLDocument,\n store: IndexedFormula,\n getImageDoc: () => NamedNode,\n doneCallback: (imageDoc) => Promise<void>\n) {\n const div = dom.createElement('div')\n let destination, imageBlob, player, canvas\n\n const table = div.appendChild(dom.createElement('table'))\n const mainTR = table.appendChild(dom.createElement('tr'))\n const main = mainTR.appendChild(dom.createElement('td'))\n main.setAttribute('colspan', '4')\n\n const buttons = table.appendChild(dom.createElement('tr'))\n\n buttons\n .appendChild(dom.createElement('td')) // Cancel button\n .appendChild(widgets.cancelButton(dom))\n .addEventListener('click', _event => {\n stopVideo()\n doneCallback(null)\n })\n\n const retakeButton = buttons\n .appendChild(dom.createElement('td')) // Retake button\n .appendChild(widgets.button(dom, retakeIcon, 'Retake'))\n retakeButton.addEventListener('click', _event => {\n retake()\n })\n retakeButton.style.visibility = 'collapse' // Hide for now\n\n const shutterButton = buttons\n .appendChild(dom.createElement('td')) // Trigger capture button\n .appendChild(\n widgets.button(dom, icons.iconBase + 'noun_10636.svg', 'Snap')\n )\n shutterButton.addEventListener('click', grabCanvas)\n shutterButton.style.visibility = 'collapse' // Hide for now\n\n const sendButton = buttons\n .appendChild(dom.createElement('td')) // Confirm and save button\n .appendChild(widgets.continueButton(dom)) // @@ or send icon??\n sendButton.addEventListener('click', _event => {\n saveBlob(imageBlob, destination)\n })\n sendButton.style.visibility = 'collapse' // Hide for now\n\n function displayPlayer () {\n player = main.appendChild(dom.createElement('video'))\n player.setAttribute('controls', '1')\n player.setAttribute('autoplay', '1')\n player.setAttribute('style', controlStyle)\n if (!navigator.mediaDevices) {\n throw new Error('navigator.mediaDevices not available')\n }\n navigator.mediaDevices.getUserMedia(constraints).then(stream => {\n player.srcObject = stream\n shutterButton.style.visibility = 'visible' // Enable\n sendButton.style.visibility = 'collapse'\n retakeButton.style.visibility = 'collapse'\n })\n }\n\n const constraints = {\n video: true\n }\n\n function retake () {\n main.removeChild(canvas)\n displayPlayer() // Make new one as old one is stuck black\n }\n\n function grabCanvas () {\n // Draw the video frame to the canvas.\n canvas = dom.createElement('canvas')\n canvas.setAttribute('width', canvasWidth)\n canvas.setAttribute('height', canvasHeight)\n canvas.setAttribute('style', controlStyle)\n main.appendChild(canvas)\n\n const context = canvas.getContext('2d')\n context.drawImage(player, 0, 0, canvas.width, canvas.height)\n\n player.parentNode.removeChild(player)\n\n canvas.toBlob(blob => {\n const msg = `got blob type ${blob.type} size ${blob.size}`\n debug.log(msg)\n destination = getImageDoc()\n imageBlob = blob // save for review\n reviewImage()\n // alert(msg)\n }, contentType) // toBlob\n }\n\n function reviewImage () {\n sendButton.style.visibility = 'visible'\n retakeButton.style.visibility = 'visible'\n shutterButton.style.visibility = 'collapse' // Hide for now\n }\n\n function stopVideo () {\n if (player && player.srcObject) {\n player.srcObject.getVideoTracks().forEach(track => track.stop())\n }\n }\n function saveBlob (blob, destination) {\n const contentType = blob.type\n // if (!confirm('Save picture to ' + destination + ' ?')) return\n debug.log(\n 'Putting ' + blob.size + ' bytes of ' + contentType + ' to ' + destination\n )\n // @@ TODO Remove casting\n ;(store as any).fetcher\n .webOperation('PUT', destination.uri, {\n data: blob,\n contentType\n })\n .then(\n _resp => {\n debug.log('ok saved ' + destination)\n stopVideo()\n doneCallback(destination)\n },\n err => {\n stopVideo()\n alert(err)\n }\n )\n }\n\n // Attach the video stream to the video element and autoplay.\n displayPlayer()\n return div\n}\n\n/** A button to capture a picture using camera\n * @param {Docuemnt} dom - The Document object\n * @param {IndexedForumla} store - The quadstore to store data in\n * @param {fuunction} getImageDoc - returns NN of the image file to be created\n * @param {function<Node>} doneCallback - called with the image taken\n * @returns {DomElement} - A div element with the buton in it\n *\n * This expacts the buttton to a large control when it is pressed\n */\n\nexport function cameraButton (\n dom: HTMLDocument,\n store: IndexedFormula,\n getImageDoc: () => NamedNode,\n doneCallback: (imageDoc) => Promise<void>\n): HTMLElement {\n const div = dom.createElement('div')\n const but = widgets.button(dom, cameraIcon, 'Take picture')\n let control\n async function restoreButton (imageDoc) {\n div.removeChild(control)\n div.appendChild(but)\n doneCallback(imageDoc)\n }\n div.appendChild(but)\n but.addEventListener('click', _event => {\n div.removeChild(but)\n control = cameraCaptureControl(\n dom,\n store,\n getImageDoc,\n restoreButton\n )\n div.appendChild(control)\n })\n return div\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;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,gBAAgB,CAAC,OAAO,EAAE,UAAAC,MAAM,EAAI;IACtCd,GAAG,CAACoC,WAAW,CAAC0B,GAAG,CAAC;IACpBC,OAAO,GAAGpE,oBAAoB,CAC5BC,GAAG,EACHC,KAAK,EACLC,WAAW,EACXkE,aAAa,CACd;IACDhE,GAAG,CAACO,WAAW,CAACwD,OAAO,CAAC;EAC1B,CAAC,CAAC;EACF,OAAO/D,GAAG;AACZ"}
|
package/lib/pad.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Notepad Widget
|
|
3
3
|
*/
|
|
4
4
|
import { NamedNode, IndexedFormula } from 'rdflib';
|
|
5
|
-
export {
|
|
5
|
+
export { renderPartipants, participationObject, manageParticipation, recordParticipation } from './participation';
|
|
6
6
|
type notepadOptions = {
|
|
7
7
|
statusArea?: HTMLDivElement;
|
|
8
8
|
exists?: boolean;
|
|
@@ -16,7 +16,7 @@ export declare function lightColorHash(author?: NamedNode): string;
|
|
|
16
16
|
/** notepad
|
|
17
17
|
*
|
|
18
18
|
* @param {HTMLDocument} dom - the web page of the browser
|
|
19
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
19
|
+
* @param {NamedNode} padDoc - the document into which the particpation should be shown
|
|
20
20
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
21
21
|
* @param {NamedNode} me - person who is logged into the pod
|
|
22
22
|
* @param {notepadOptions} options - the options that can be passed in consist of statusArea, exists
|
package/lib/pad.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pad.d.ts","sourceRoot":"","sources":["../src/pad.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAa,SAAS,EAAM,cAAc,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"pad.d.ts","sourceRoot":"","sources":["../src/pad.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAa,SAAS,EAAM,cAAc,EAAE,MAAM,QAAQ,CAAA;AAKjE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAMjH,KAAK,cAAc,GAAG;IACpB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAgBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAU1D;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,OAwuBzH;AAED;;;GAGG;AAGH,wBAAgB,SAAS,CAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,SAUhE;AAED;;GAEG;AAEH,wBAAgB,SAAS,CAAE,GAAG,KAAA,OAE7B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,cAAc,UA6C1D"}
|
package/lib/pad.js
CHANGED
|
@@ -27,10 +27,10 @@ Object.defineProperty(exports, "recordParticipation", {
|
|
|
27
27
|
return _participation.recordParticipation;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "renderPartipants", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return _participation.
|
|
33
|
+
return _participation.renderPartipants;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
exports.xmlEncode = xmlEncode;
|
|
@@ -48,7 +48,6 @@ var _widgets = require("./widgets");
|
|
|
48
48
|
var _utils = require("./utils");
|
|
49
49
|
var _debug = require("./debug");
|
|
50
50
|
var _solidLogic = require("solid-logic");
|
|
51
|
-
var style = _interopRequireWildcard(require("./style"));
|
|
52
51
|
var _participation = require("./participation");
|
|
53
52
|
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); }
|
|
54
53
|
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; }
|
|
@@ -113,7 +112,7 @@ function lightColorHash(author) {
|
|
|
113
112
|
/** notepad
|
|
114
113
|
*
|
|
115
114
|
* @param {HTMLDocument} dom - the web page of the browser
|
|
116
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
115
|
+
* @param {NamedNode} padDoc - the document into which the particpation should be shown
|
|
117
116
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
118
117
|
* @param {NamedNode} me - person who is logged into the pod
|
|
119
118
|
* @param {notepadOptions} options - the options that can be passed in consist of statusArea, exists
|
|
@@ -126,7 +125,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
126
125
|
if (me && !me.uri) throw new Error('UI.pad.notepad: Invalid userid');
|
|
127
126
|
var updater = store.updater;
|
|
128
127
|
var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
|
|
129
|
-
table.setAttribute('style',
|
|
128
|
+
table.setAttribute('style', 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;');
|
|
130
129
|
var upstreamStatus = null;
|
|
131
130
|
var downstreamStatus = null;
|
|
132
131
|
if (options.statusArea) {
|
|
@@ -135,10 +134,10 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
135
134
|
upstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
136
135
|
downstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
137
136
|
if (upstreamStatus) {
|
|
138
|
-
upstreamStatus.setAttribute('style',
|
|
137
|
+
upstreamStatus.setAttribute('style', 'width:50%');
|
|
139
138
|
}
|
|
140
139
|
if (downstreamStatus) {
|
|
141
|
-
downstreamStatus.setAttribute('style',
|
|
140
|
+
downstreamStatus.setAttribute('style', 'width:50%');
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
/* @@ TODO want to look into this, it seems upstream should be a boolean and default to false ?
|
|
@@ -161,9 +160,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
161
160
|
var setPartStyle = function setPartStyle(part, colors, pending) {
|
|
162
161
|
var chunk = part.subject;
|
|
163
162
|
colors = colors || '';
|
|
164
|
-
var baseStyle =
|
|
165
|
-
var headingCore =
|
|
166
|
-
var headingStyle =
|
|
163
|
+
var baseStyle = 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;';
|
|
164
|
+
var headingCore = 'font-family: sans-serif; font-weight: bold; border: none;';
|
|
165
|
+
var headingStyle = ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'];
|
|
167
166
|
var author = kb.any(chunk, ns.dc('author'));
|
|
168
167
|
if (!colors && author) {
|
|
169
168
|
// Hash the user webid for now -- later allow user selection!
|
|
@@ -175,9 +174,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
175
174
|
// and when the indent is stored as a Number itself, not in an object.
|
|
176
175
|
var indent = kb.any(chunk, PAD('indent'));
|
|
177
176
|
indent = indent ? indent.value : 0;
|
|
178
|
-
var
|
|
177
|
+
var style = indent >= 0 ? baseStyle + 'text-indent: ' + indent * 3 + 'em;' : headingCore + headingStyle[-1 - indent];
|
|
179
178
|
// ? baseStyle + 'padding-left: ' + (indent * 3) + 'em;'
|
|
180
|
-
part.setAttribute('style',
|
|
179
|
+
part.setAttribute('style', style + colors);
|
|
181
180
|
};
|
|
182
181
|
var removePart = function removePart(part) {
|
|
183
182
|
var chunk = part.subject;
|
|
@@ -257,6 +256,28 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
257
256
|
});
|
|
258
257
|
};
|
|
259
258
|
|
|
259
|
+
// Use this sort of code to split the line when return pressed in the middle @@
|
|
260
|
+
/*
|
|
261
|
+
function doGetCaretPosition doGetCaretPosition (oField) {
|
|
262
|
+
var iCaretPos = 0
|
|
263
|
+
// IE Support
|
|
264
|
+
if (document.selection) {
|
|
265
|
+
// Set focus on the element to avoid IE bug
|
|
266
|
+
oField.focus()
|
|
267
|
+
// To get cursor position, get empty selection range
|
|
268
|
+
var oSel = document.selection.createRange()
|
|
269
|
+
// Move selection start to 0 position
|
|
270
|
+
oSel.moveStart('character', -oField.value.length)
|
|
271
|
+
// The caret position is selection length
|
|
272
|
+
iCaretPos = oSel.text.length
|
|
273
|
+
// Firefox suppor
|
|
274
|
+
} else if (oField.selectionStart || oField.selectionStart === '0') {
|
|
275
|
+
iCaretPos = oField.selectionStart
|
|
276
|
+
}
|
|
277
|
+
// Return results
|
|
278
|
+
return (iCaretPos)
|
|
279
|
+
}
|
|
280
|
+
*/
|
|
260
281
|
var addListeners = function addListeners(part, chunk) {
|
|
261
282
|
part.addEventListener('keydown', function (event) {
|
|
262
283
|
if (!updater) {
|
|
@@ -299,7 +320,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
299
320
|
return;
|
|
300
321
|
case 3: // being deleted already
|
|
301
322
|
case 4:
|
|
302
|
-
// already
|
|
323
|
+
// already deleme state
|
|
303
324
|
return;
|
|
304
325
|
case undefined:
|
|
305
326
|
case 0:
|
|
@@ -600,6 +621,8 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
600
621
|
}
|
|
601
622
|
return;
|
|
602
623
|
}
|
|
624
|
+
// var last = kb.the(undefined, PAD('previous'), subject)
|
|
625
|
+
// var chunk = first // = kb.the(subject, PAD('next'));
|
|
603
626
|
var row;
|
|
604
627
|
|
|
605
628
|
// First see which of the logical chunks have existing physical manifestations
|
|
@@ -661,7 +684,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
661
684
|
(0, _debug.log)(' reloaded OK');
|
|
662
685
|
clearStatus();
|
|
663
686
|
if (!consistencyCheck()) {
|
|
664
|
-
complain('
|
|
687
|
+
complain('CONSITENCY CHECK FAILED');
|
|
665
688
|
} else {
|
|
666
689
|
refreshTree(table);
|
|
667
690
|
}
|