solid-ui 2.4.28-58251370 → 2.4.28-5e5291ce
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 +111 -104
- 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 +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 +31 -1
- package/lib/style.js.map +1 -1
- package/lib/tabs.d.ts +0 -125
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +15 -8
- 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 +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/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 button in it
|
|
15
15
|
*
|
|
16
|
-
* This
|
|
16
|
+
* This expects the button 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;AAOlD;;;;;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"));
|
|
14
15
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
15
16
|
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); }
|
|
16
17
|
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
|
|
23
|
+
// The HTML5 functionality (on mobile) is to prompt for either
|
|
24
|
+
// a realtime camera capture, OR a selection from images already not 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 photo
|
|
28
|
+
// or access camera roll (etc) OR to access solid cloud storage of favorite photo albums.
|
|
29
29
|
// (Especially latest taken ones)
|
|
30
30
|
//
|
|
31
31
|
|
|
@@ -34,10 +34,6 @@ 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;'
|
|
41
37
|
var contentType = 'image/png';
|
|
42
38
|
|
|
43
39
|
/** A control to capture a picture using camera
|
|
@@ -82,7 +78,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
82
78
|
player = main.appendChild(dom.createElement('video'));
|
|
83
79
|
player.setAttribute('controls', '1');
|
|
84
80
|
player.setAttribute('autoplay', '1');
|
|
85
|
-
player.setAttribute('style', controlStyle);
|
|
81
|
+
player.setAttribute('style', style.controlStyle);
|
|
86
82
|
if (!navigator.mediaDevices) {
|
|
87
83
|
throw new Error('navigator.mediaDevices not available');
|
|
88
84
|
}
|
|
@@ -104,9 +100,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
104
100
|
function grabCanvas() {
|
|
105
101
|
// Draw the video frame to the canvas.
|
|
106
102
|
canvas = dom.createElement('canvas');
|
|
107
|
-
canvas.setAttribute('width', canvasWidth);
|
|
108
|
-
canvas.setAttribute('height', canvasHeight);
|
|
109
|
-
canvas.setAttribute('style', controlStyle);
|
|
103
|
+
canvas.setAttribute('width', style.canvasWidth);
|
|
104
|
+
canvas.setAttribute('height', style.canvasHeight);
|
|
105
|
+
canvas.setAttribute('style', style.controlStyle);
|
|
110
106
|
main.appendChild(canvas);
|
|
111
107
|
var context = canvas.getContext('2d');
|
|
112
108
|
context.drawImage(player, 0, 0, canvas.width, canvas.height);
|
|
@@ -163,9 +159,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
163
159
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
164
160
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
165
161
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
166
|
-
* @returns {DomElement} - A div element with the
|
|
162
|
+
* @returns {DomElement} - A div element with the button in it
|
|
167
163
|
*
|
|
168
|
-
* This
|
|
164
|
+
* This expects the button to a large control when it is pressed
|
|
169
165
|
*/
|
|
170
166
|
|
|
171
167
|
function cameraButton(dom, store, getImageDoc, doneCallback) {
|
|
@@ -1 +1 @@
|
|
|
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;AACA,IAAAE,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAqC,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,CA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AAG,EAAEV,UAAU,EAAE,cAAc,CAAC;EAC3D,IAAI6E,OAAO;EAAA,SACIC,aAAaA,CAAAC,EAAA;IAAA,OAAAC,cAAA,CAAAC,KAAA,OAAAC,SAAA;EAAA;EAAA,SAAAF,eAAA;IAAAA,cAAA,OAAAG,kBAAA,2BAAAC,YAAA,YAAAC,IAAA,CAA5B,SAAAC,QAA8BC,QAAQ;MAAA,OAAAH,YAAA,YAAAI,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YACpC9E,GAAG,CAACoC,WAAW,CAAC2B,OAAO,CAAC;YACxB/D,GAAG,CAACO,WAAW,CAACuD,GAAG,CAAC;YACpB/D,YAAY,CAAC0E,QAAQ,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAvB,IAAA;QAAA;MAAA,GAAAmB,OAAA;IAAA,CACvB;IAAA,OAAAN,cAAA,CAAAC,KAAA,OAAAC,SAAA;EAAA;EACDpE,GAAG,CAACO,WAAW,CAACuD,GAAG,CAAC;EACpBA,GAAG,CAACjD,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"}
|
|
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":";;;;;;;;;;;A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AC0D,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"}
|
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 { renderParticipants, 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 participation 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;AAMjE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAMnH,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,OAusBzH;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, "renderParticipants", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return _participation.
|
|
33
|
+
return _participation.renderParticipants;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
exports.xmlEncode = xmlEncode;
|
|
@@ -48,6 +48,7 @@ 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"));
|
|
51
52
|
var _participation = require("./participation");
|
|
52
53
|
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); }
|
|
53
54
|
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; }
|
|
@@ -112,7 +113,7 @@ function lightColorHash(author) {
|
|
|
112
113
|
/** notepad
|
|
113
114
|
*
|
|
114
115
|
* @param {HTMLDocument} dom - the web page of the browser
|
|
115
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
116
|
+
* @param {NamedNode} padDoc - the document into which the participation should be shown
|
|
116
117
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
117
118
|
* @param {NamedNode} me - person who is logged into the pod
|
|
118
119
|
* @param {notepadOptions} options - the options that can be passed in consist of statusArea, exists
|
|
@@ -125,7 +126,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
125
126
|
if (me && !me.uri) throw new Error('UI.pad.notepad: Invalid userid');
|
|
126
127
|
var updater = store.updater;
|
|
127
128
|
var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
|
|
128
|
-
table.setAttribute('style',
|
|
129
|
+
table.setAttribute('style', style.notepadStyle);
|
|
129
130
|
var upstreamStatus = null;
|
|
130
131
|
var downstreamStatus = null;
|
|
131
132
|
if (options.statusArea) {
|
|
@@ -134,10 +135,10 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
134
135
|
upstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
135
136
|
downstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
136
137
|
if (upstreamStatus) {
|
|
137
|
-
upstreamStatus.setAttribute('style',
|
|
138
|
+
upstreamStatus.setAttribute('style', style.upstreamStatus);
|
|
138
139
|
}
|
|
139
140
|
if (downstreamStatus) {
|
|
140
|
-
downstreamStatus.setAttribute('style',
|
|
141
|
+
downstreamStatus.setAttribute('style', style.downstreamStatus);
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
/* @@ TODO want to look into this, it seems upstream should be a boolean and default to false ?
|
|
@@ -160,9 +161,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
160
161
|
var setPartStyle = function setPartStyle(part, colors, pending) {
|
|
161
162
|
var chunk = part.subject;
|
|
162
163
|
colors = colors || '';
|
|
163
|
-
var baseStyle =
|
|
164
|
-
var headingCore =
|
|
165
|
-
var headingStyle =
|
|
164
|
+
var baseStyle = style.baseStyle;
|
|
165
|
+
var headingCore = style.headingCore;
|
|
166
|
+
var headingStyle = style.headingStyle;
|
|
166
167
|
var author = kb.any(chunk, ns.dc('author'));
|
|
167
168
|
if (!colors && author) {
|
|
168
169
|
// Hash the user webid for now -- later allow user selection!
|
|
@@ -174,9 +175,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
174
175
|
// and when the indent is stored as a Number itself, not in an object.
|
|
175
176
|
var indent = kb.any(chunk, PAD('indent'));
|
|
176
177
|
indent = indent ? indent.value : 0;
|
|
177
|
-
var
|
|
178
|
+
var localStyle = indent >= 0 ? baseStyle + 'text-indent: ' + indent * 3 + 'em;' : headingCore + headingStyle[-1 - indent];
|
|
178
179
|
// ? baseStyle + 'padding-left: ' + (indent * 3) + 'em;'
|
|
179
|
-
part.setAttribute('style',
|
|
180
|
+
part.setAttribute('style', localStyle + colors);
|
|
180
181
|
};
|
|
181
182
|
var removePart = function removePart(part) {
|
|
182
183
|
var chunk = part.subject;
|
|
@@ -256,28 +257,6 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
256
257
|
});
|
|
257
258
|
};
|
|
258
259
|
|
|
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
|
-
*/
|
|
281
260
|
var addListeners = function addListeners(part, chunk) {
|
|
282
261
|
part.addEventListener('keydown', function (event) {
|
|
283
262
|
if (!updater) {
|
|
@@ -320,7 +299,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
320
299
|
return;
|
|
321
300
|
case 3: // being deleted already
|
|
322
301
|
case 4:
|
|
323
|
-
// already
|
|
302
|
+
// already deleted state
|
|
324
303
|
return;
|
|
325
304
|
case undefined:
|
|
326
305
|
case 0:
|
|
@@ -621,8 +600,6 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
621
600
|
}
|
|
622
601
|
return;
|
|
623
602
|
}
|
|
624
|
-
// var last = kb.the(undefined, PAD('previous'), subject)
|
|
625
|
-
// var chunk = first // = kb.the(subject, PAD('next'));
|
|
626
603
|
var row;
|
|
627
604
|
|
|
628
605
|
// First see which of the logical chunks have existing physical manifestations
|
|
@@ -684,7 +661,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
684
661
|
(0, _debug.log)(' reloaded OK');
|
|
685
662
|
clearStatus();
|
|
686
663
|
if (!consistencyCheck()) {
|
|
687
|
-
complain('
|
|
664
|
+
complain('CONSISTENCY CHECK FAILED');
|
|
688
665
|
} else {
|
|
689
666
|
refreshTree(table);
|
|
690
667
|
}
|