solid-panes 4.2.6 → 4.4.0

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.
Files changed (106) hide show
  1. package/README.md +42 -0
  2. package/dist/0314353e28ce6e5539af.svg +9 -0
  3. package/dist/04567ff683933c35c465.png +0 -0
  4. package/dist/10163fd9b5a0e00d63a0.png +0 -0
  5. package/dist/1234dcb2eec2e45f252b.png +0 -0
  6. package/dist/20899934157df4db56cb.png +0 -0
  7. package/dist/33760bf79f097f449da5.png +0 -0
  8. package/dist/4cceba29ab33b1ddd9bb.svg +6 -0
  9. package/dist/578d2b6ed32e7624164e.png +0 -0
  10. package/dist/5f62a5b2b7e99b9640c7.png +0 -0
  11. package/dist/6525766ecd288ec60129.png +0 -0
  12. package/dist/7800be6f6c4b5b0f4f20.png +0 -0
  13. package/dist/7b7538c6f6b317968009.svg +9 -0
  14. package/dist/92d03142abe6efc0b42d.svg +6 -0
  15. package/dist/976473cf5fe24d657d4b.png +0 -0
  16. package/dist/RDFXMLPane.js +1 -0
  17. package/dist/bda84f59e7216675a208.png +0 -0
  18. package/dist/cd68e8f3990ba8b2139e.png +0 -0
  19. package/dist/dashboard/basicPreferences.d.ts.map +1 -1
  20. package/dist/dashboard/basicPreferences.js +1 -0
  21. package/dist/dashboard/dashboardPane.d.ts.map +1 -1
  22. package/dist/dashboard/dashboardPane.js +9 -3
  23. package/dist/dashboard/homepage.d.ts +1 -1
  24. package/dist/dashboard/homepage.d.ts.map +1 -1
  25. package/dist/dashboard/homepage.js +5 -35
  26. package/dist/e7074a7e2cb69e51cfd3.png +0 -0
  27. package/dist/f3772696fb7ee53c23d8.png +0 -0
  28. package/dist/form/pane.js +1 -1
  29. package/dist/home/homePane.d.ts.map +1 -1
  30. package/dist/home/homePane.js +2 -0
  31. package/dist/humanReadablePane.js +34 -8
  32. package/dist/icons/clock.svg +7 -0
  33. package/dist/icons/comment.svg +6 -0
  34. package/dist/icons/dashboard.svg +9 -0
  35. package/dist/icons/downArrow.svg +6 -0
  36. package/dist/icons/folder.svg +6 -0
  37. package/dist/icons/friends.svg +9 -0
  38. package/dist/icons/help.svg +8 -0
  39. package/dist/icons/iconHelper.d.ts +2 -0
  40. package/dist/icons/iconHelper.d.ts.map +1 -0
  41. package/dist/icons/iconHelper.js +23 -0
  42. package/dist/icons/menu.svg +8 -0
  43. package/dist/icons/person.svg +6 -0
  44. package/dist/icons/personInCircle.svg +8 -0
  45. package/dist/icons/sharing.svg +10 -0
  46. package/dist/icons/signOut.svg +8 -0
  47. package/dist/icons/signup.png +0 -0
  48. package/dist/icons/star.svg +3 -0
  49. package/dist/index.d.ts +5 -4
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +19 -4
  52. package/dist/internal/internalPane.d.ts.map +1 -1
  53. package/dist/internal/internalPane.js +1 -0
  54. package/dist/mainPage/footer.d.ts +14 -2
  55. package/dist/mainPage/footer.d.ts.map +1 -1
  56. package/dist/mainPage/footer.js +21 -13
  57. package/dist/mainPage/header.d.ts +16 -1
  58. package/dist/mainPage/header.d.ts.map +1 -1
  59. package/dist/mainPage/header.js +179 -61
  60. package/dist/mainPage/index.d.ts +15 -1
  61. package/dist/mainPage/index.d.ts.map +1 -1
  62. package/dist/mainPage/index.js +38 -7
  63. package/dist/mainPage/menu.css +243 -0
  64. package/dist/mainPage/menu.d.ts +7 -0
  65. package/dist/mainPage/menu.d.ts.map +1 -0
  66. package/dist/mainPage/menu.js +409 -0
  67. package/dist/n3Pane.js +1 -0
  68. package/dist/outline/context.d.ts +2 -2
  69. package/dist/outline/context.d.ts.map +1 -1
  70. package/dist/outline/context.js +5 -2
  71. package/dist/outline/manager.css +12 -14
  72. package/dist/outline/manager.js +152 -81
  73. package/dist/outline/userInput.js +6 -3
  74. package/dist/pad/padPane.css +36 -0
  75. package/dist/pad/padPane.d.ts +1 -0
  76. package/dist/pad/padPane.d.ts.map +1 -1
  77. package/dist/pad/padPane.js +32 -21
  78. package/dist/playlist/playlistPane.js +2 -6
  79. package/dist/profileUtils/ownerProfile.d.ts +5 -0
  80. package/dist/profileUtils/ownerProfile.d.ts.map +1 -0
  81. package/dist/profileUtils/ownerProfile.js +84 -0
  82. package/dist/registerPanes.js +4 -4
  83. package/dist/slideshow/slideshowPane.js +1 -1
  84. package/dist/social/editProfileDetails.d.ts +19 -0
  85. package/dist/social/editProfileDetails.d.ts.map +1 -0
  86. package/dist/social/editProfileDetails.js +267 -0
  87. package/dist/social/icons.d.ts +5 -0
  88. package/dist/social/icons.d.ts.map +1 -0
  89. package/dist/social/icons.js +60 -0
  90. package/dist/social/socialPane.css +804 -0
  91. package/dist/social/socialPane.d.ts +30 -0
  92. package/dist/social/socialPane.d.ts.map +1 -0
  93. package/dist/social/socialPane.js +558 -0
  94. package/dist/social/socialSections.d.ts +66 -0
  95. package/dist/social/socialSections.d.ts.map +1 -0
  96. package/dist/social/socialSections.js +317 -0
  97. package/dist/solid-panes.js +29050 -13866
  98. package/dist/solid-panes.js.map +1 -1
  99. package/dist/solid-panes.min.js +2235 -247
  100. package/dist/solid-panes.min.js.map +1 -1
  101. package/dist/style/tabbedtab.css +0 -124
  102. package/dist/tabbed/tabbedPane.d.ts.map +1 -1
  103. package/dist/tabbed/tabbedPane.js +2 -0
  104. package/dist/versionInfo.js +3 -3
  105. package/package.json +13 -8
  106. package/dist/socialPane.js +0 -430
@@ -9,9 +9,7 @@
9
9
  /* If you need style in a pane, insert it in the dom (2016)*/
10
10
 
11
11
  /* @import url("js/panes/microblogPane/mbStyle.css"); /*microblog pane */
12
- /* @import url("js/panes/social/style.css"); /*social pane*/
13
12
  /* @import url("chrome://tabulator/content/js/panes/microblogPane/mbStyle.css"); /*microblog pane*/
14
- /* @import url("chrome://tabulator/content/js/panes/social/style.css"); /*social pane*/
15
13
 
16
14
  /* I couldn't find the code for the collapse image. this is a quick work around
17
15
  to make the collapsing easier to use ( the triangles dont jump 20 pixels). ~cm2
@@ -177,128 +175,6 @@ div.premises {
177
175
  left: 0%; /*May be we could shift the left margin a bit?*/
178
176
  }
179
177
 
180
- /* ***************** Social Pane **********/
181
-
182
- div.socialPane {
183
- border-top: solid 1px #777;
184
- border-bottom: solid 1px #777;
185
- padding-top: 0.5em;
186
- padding-bottom: 0.5em;
187
- margin: 0;
188
- }
189
-
190
- img.foafPic {
191
- width: 100%;
192
- border: none;
193
- margin: 0;
194
- padding: 0;
195
- /*float:right; */
196
- }
197
-
198
- div.mildNotice {
199
- border: dashed 0.1em #777;
200
- margin: 1em;
201
- padding: 1em;
202
- width: 80%; /* float: right; */
203
- background-color: #ffe;
204
- }
205
-
206
- .friendBox {
207
- /* height: 4em; */
208
- border-top: solid 0.01em #ccc;
209
- margin: 0;
210
- padding: 0.3em;
211
- /* float: left; */
212
- }
213
- .friendBoxBig {
214
- height: 20em;
215
- border-top: solid 0.01em #202; /* float: left; */
216
- }
217
-
218
- .socialPane a {
219
- color: #3b5998;
220
- text-decoration: none;
221
- font-weight: bold;
222
- }
223
- .socialPane a:link {
224
- color: #3b5998;
225
- text-decoration: none;
226
- font-weight: bold;
227
- }
228
- .socialPane a:visited {
229
- color: #3b5998;
230
- text-decoration: none;
231
- font-weight: bold;
232
- }
233
- .socialPane a:hover {
234
- color: #3b5998;
235
- text-decoration: underline;
236
- font-weight: bold;
237
- }
238
- .socialPane a:active {
239
- color: #888;
240
- text-decoration: none;
241
- }
242
-
243
- img.foafThumb {
244
- height: 3em;
245
- border: 0px;
246
- margin: 0.1em;
247
- padding: 0.1em;
248
- vertical-align: middle;
249
- } /* Thumbnail of a fiend etc */
250
-
251
- .friendBox .confirmed {
252
- font-weight: bold;
253
- }
254
-
255
- table.inputForm {
256
- font-size: 100%;
257
- }
258
-
259
- .mainBlock {
260
- background: #fff;
261
- color: #000;
262
- float: left;
263
- width: 46%;
264
- margin: 0;
265
- border-left: 1px solid #ccc;
266
- border-right: 1px solid #ccc;
267
- border-bottom: 1px solid #ccc;
268
- padding: 0;
269
- }
270
-
271
- .navBlock {
272
- background-color: #eee;
273
- float: left;
274
- width: 25%;
275
- border: 0;
276
- padding: 0.5em;
277
- margin: 0;
278
- }
279
-
280
- .navBlock .navSection {
281
- border: solid 0.05em gray;
282
- padding: 0.5em;
283
- border-radius: 0.5em; /* CSS3: border-radius: .4em; */
284
- }
285
-
286
- div.socialPane h2 {
287
- color: #202;
288
- }
289
- div.socialPane h3 {
290
- color: #202;
291
- }
292
-
293
- div.social_linkButton {
294
- width: 80%;
295
- background-color: #fff;
296
- border: solid 0.05em #ccc;
297
- margin-top: 0.1em;
298
- margin-bottom: 0.1em;
299
- padding: 0.1em;
300
- text-align: center;
301
- }
302
178
 
303
179
  /* For question-and-answer stuff for new web id but quite reusable.
304
180
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tabbedPane.d.ts","sourceRoot":"","sources":["../../src/tabbed/tabbedPane.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,QAAA,MAAM,UAAU,EAAE,cAgDjB,CAAA;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"tabbedPane.d.ts","sourceRoot":"","sources":["../../src/tabbed/tabbedPane.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,QAAA,MAAM,UAAU,EAAE,cAkDjB,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -17,6 +17,7 @@ const TabbedPane = {
17
17
  audience: [_solidUi.ns.solid('PowerUser')],
18
18
  // Does the subject deserve this pane?
19
19
  label: (subject, context) => {
20
+ // @ts-ignore
20
21
  const kb = context.session.store;
21
22
  const typeURIs = kb.findTypeURIs(subject);
22
23
  if (_solidUi.ns.meeting('Cluster').uri in typeURIs) {
@@ -26,6 +27,7 @@ const TabbedPane = {
26
27
  },
27
28
  render: (subject, context) => {
28
29
  const dom = context.dom;
30
+ // @ts-ignore
29
31
  const store = context.session.store;
30
32
  const div = dom.createElement('div');
31
33
  (async () => {
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _default = exports.default = {
8
- buildTime: '2026-04-07T22:58:23Z',
9
- commit: 'd79a48bec1a4409f7579518fb4a51e26198e7652',
8
+ buildTime: '2026-04-24T13:13:17Z',
9
+ commit: '462cb784e8920dea6ca5d7abfbba0e478338a13d',
10
10
  npmInfo: {
11
- 'solid-panes': '4.2.6',
11
+ 'solid-panes': '4.4.0',
12
12
  npm: '10.9.7',
13
13
  node: '22.22.2',
14
14
  acorn: '8.15.0',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-panes",
3
- "version": "4.2.6",
3
+ "version": "4.4.0",
4
4
  "description": "Solid-compatible Panes: applets and views for the mashlib and databrowser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,6 +22,9 @@
22
22
  "lint": "eslint",
23
23
  "lint-fix": "eslint --fix",
24
24
  "typecheck": "tsc --noEmit",
25
+ "watch-js": "babel src --out-dir dist --source-maps --extensions '.ts,.js' --watch",
26
+ "watch-dist": "webpack --watch",
27
+ "watch-types": "tsc --emitDeclarationOnly --watch --preserveWatchOutput",
25
28
  "typecheck-test": "tsc --noEmit -p tsconfig.test.json",
26
29
  "test": "jest --no-coverage",
27
30
  "test-watch": "npm run lint && jest --onlyChanged --watch",
@@ -30,7 +33,7 @@
30
33
  "ignore:prepublishOnly": "npm run build && npm run lint && npm test",
31
34
  "preversion": "npm run lint && npm run typecheck && npm test",
32
35
  "postversion": "git push origin main --follow-tags",
33
- "watch": "npm run build-version && babel src -d dist --source-maps --extensions '.ts,.js' --watch",
36
+ "watch": "npm run build-version && concurrently -k -n babel,types,webpack \"npm:watch-js\" \"npm:watch-types\" \"npm:watch-dist\"",
34
37
  "start": "webpack serve --config webpack.dev.config.mjs --open"
35
38
  },
36
39
  "repository": {
@@ -60,23 +63,24 @@
60
63
  "@solid/better-simple-slideshow": "^0.1.0",
61
64
  "activitystreams-pane": "^1.0.2",
62
65
  "chat-pane": "^3.0.3",
63
- "contacts-pane": "^3.1.0",
66
+ "contacts-pane": "^3.2.0",
64
67
  "dompurify": "^3.3.1",
65
- "folder-pane": "^3.0.2",
68
+ "folder-pane": "^3.1.0",
66
69
  "issue-pane": "^3.0.2",
67
70
  "marked": "^17.0.3",
68
71
  "meeting-pane": "^3.0.2",
69
72
  "mime-types": "^3.0.2",
70
73
  "pane-registry": "^3.1.0",
71
- "profile-pane": "^3.1.5",
74
+ "profile-pane": "^3.2.1",
72
75
  "solid-namespace": "^0.5.4",
73
- "solid-ui": "^3.0.6",
74
- "source-pane": "^3.0.2"
76
+ "solid-ui": "^3.1.0",
77
+ "source-pane": "^3.1.0"
75
78
  },
76
79
  "overrides": {
77
80
  "rdflib": "$rdflib",
78
81
  "solid-logic": "$solid-logic",
79
- "solid-ui": "$solid-ui"
82
+ "solid-ui": "$solid-ui",
83
+ "pane-registry": "$pane-registry"
80
84
  },
81
85
  "devDependencies": {
82
86
  "@babel/cli": "^7.28.6",
@@ -93,6 +97,7 @@
93
97
  "babel-loader": "^10.0.0",
94
98
  "babel-plugin-inline-import": "^3.0.0",
95
99
  "buffer": "^6.0.3",
100
+ "concurrently": "^9.2.1",
96
101
  "copy-webpack-plugin": "^14.0.0",
97
102
  "css-loader": "^7.1.4",
98
103
  "eslint": "^9.39.3",
@@ -1,430 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.socialPane = void 0;
7
- var UI = _interopRequireWildcard(require("solid-ui"));
8
- var _solidLogic = require("solid-logic");
9
- var $rdf = _interopRequireWildcard(require("rdflib"));
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
- /* Social Pane
12
- **
13
- ** This outline pane provides social network functions
14
- ** Using for example the FOAF ontology.
15
- ** Goal: A *distributed* version of facebook, advogato, etc etc
16
- ** - Similarly easy user interface, but data storage distributed
17
- ** - Read and write both user-private (address book) and public data clearly
18
- ** -- todo: use common code to get username and load profile and set 'me'
19
- */
20
-
21
- const socialPane = exports.socialPane = {
22
- icon: UI.icons.originalIconBase + 'foaf/foafTiny.gif',
23
- name: 'social',
24
- label: function (subject, context) {
25
- const kb = context.session.store;
26
- const types = kb.findTypeURIs(subject);
27
- if (types[UI.ns.foaf('Person').uri] || types[UI.ns.vcard('Individual').uri]) {
28
- return 'Friends';
29
- }
30
- return null;
31
- },
32
- render: function (s, context) {
33
- const dom = context.dom;
34
- const common = function (x, y) {
35
- // Find common members of two lists
36
- const both = [];
37
- for (let i = 0; i < x.length; i++) {
38
- for (let j = 0; j < y.length; j++) {
39
- if (y[j].sameTerm(x[i])) {
40
- both.push(y[j]);
41
- break;
42
- }
43
- }
44
- }
45
- return both;
46
- };
47
- const people = function (n) {
48
- let res = ' ';
49
- res += n || 'no';
50
- if (n === 1) return res + ' person';
51
- return res + ' people';
52
- };
53
- const say = function (str) {
54
- console.log(str);
55
- const p = dom.createElement('p');
56
- p.textContent = str;
57
- tips.appendChild(p);
58
- };
59
- const link = function (contents, uri) {
60
- if (!uri) return contents;
61
- const a = dom.createElement('a');
62
- a.setAttribute('href', uri);
63
- a.appendChild(contents);
64
- return a;
65
- };
66
- const text = function (str) {
67
- return dom.createTextNode(str);
68
- };
69
- const buildCheckboxForm = function (lab, statement, state) {
70
- const f = dom.createElement('form');
71
- const input = dom.createElement('input');
72
- f.appendChild(input);
73
- const tx = dom.createTextNode(lab);
74
- tx.className = 'question';
75
- f.appendChild(tx);
76
- input.setAttribute('type', 'checkbox');
77
- const boxHandler = function (_e) {
78
- tx.className = 'pendingedit';
79
- // alert('Should be greyed out')
80
- if (this.checked) {
81
- // Add link
82
- try {
83
- outliner.UserInput.sparqler.insert_statement(statement, function (uri, success, errorBody) {
84
- tx.className = 'question';
85
- if (!success) {
86
- UI.log.alert(null, 'Message', 'Error occurs while inserting ' + statement + '\n\n' + errorBody);
87
- input.checked = false; // rollback UI
88
- return;
89
- }
90
- kb.add(statement.subject, statement.predicate, statement.object, statement.why);
91
- });
92
- } catch (e) {
93
- UI.log.error('Data write fails:' + e);
94
- UI.log.alert('Data write fails:' + e);
95
- input.checked = false; // rollback UI
96
- tx.className = 'question';
97
- }
98
- } else {
99
- // Remove link
100
- try {
101
- outliner.UserInput.sparqler.delete_statement(statement, function (uri, success, errorBody) {
102
- tx.className = 'question';
103
- if (!success) {
104
- UI.log.alert('Error occurs while deleting ' + statement + '\n\n' + errorBody);
105
- this.checked = true; // Rollback UI
106
- } else {
107
- kb.removeMany(statement.subject, statement.predicate, statement.object, statement.why);
108
- }
109
- });
110
- } catch (e) {
111
- UI.log.alert('Delete fails:' + e);
112
- this.checked = true; // Rollback UI
113
- // return
114
- }
115
- }
116
- };
117
- input.checked = state;
118
- input.addEventListener('click', boxHandler, false);
119
- return f;
120
- };
121
- const oneFriend = function (friend, _confirmed) {
122
- return UI.widgets.personTR(dom, UI.ns.foaf('knows'), friend, {});
123
- };
124
-
125
- // ////////// Body of render():
126
-
127
- const outliner = context.getOutliner(dom);
128
- const kb = context.session.store;
129
- const div = dom.createElement('div');
130
- div.setAttribute('class', 'socialPane');
131
- const foaf = UI.ns.foaf;
132
- const vcard = UI.ns.vcard;
133
-
134
- // extracted from tabbedtab.css 2017-03-21
135
- const navBlockStyle = 'background-color: #eee; width: 25%; border: 0; padding: 0.5em; margin: 0;';
136
- const mainBlockStyle = 'background-color: #fff; color: #000; width: 46%; margin: 0; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 0;';
137
- const foafPicStyle = ' width: 100% ; border: none; margin: 0; padding: 0;';
138
- const structure = div.appendChild(dom.createElement('table'));
139
- const tr = structure.appendChild(dom.createElement('tr'));
140
- const left = tr.appendChild(dom.createElement('td'));
141
- const middle = tr.appendChild(dom.createElement('td'));
142
- const right = tr.appendChild(dom.createElement('td'));
143
- const tools = left;
144
- tools.style.cssText = navBlockStyle;
145
- const mainTable = middle.appendChild(dom.createElement('table'));
146
- mainTable.style.cssText = mainBlockStyle;
147
- const tips = right;
148
- tips.style.cssText = navBlockStyle;
149
-
150
- // Image top left
151
- const src = kb.any(s, foaf('img')) || kb.any(s, foaf('depiction'));
152
- if (src) {
153
- const img = dom.createElement('IMG');
154
- img.setAttribute('src', src.uri); // w640 h480
155
- // img.className = 'foafPic'
156
- img.style.cssText = foafPicStyle;
157
- tools.appendChild(img);
158
- }
159
- const name = kb.anyValue(s, foaf('name')) || '???';
160
- let h3 = dom.createElement('H3');
161
- h3.appendChild(dom.createTextNode(name));
162
- let me = _solidLogic.authn.currentUser();
163
- const meUri = me ? me.uri : null;
164
-
165
- // @@ Add: event handler to redraw the stuff below when me changes.
166
- const loginOutButton = UI.login.loginStatusBox(dom, webIdUri => {
167
- me = kb.sym(webIdUri);
168
- // @@ To be written: redraw as a function the new me
169
- // @@ refresh the sidebars
170
- UI.widgets.refreshTree(div); // this refreshes the middle at least
171
- });
172
- tips.appendChild(loginOutButton);
173
- const thisIsYou = me && kb.sameThings(me, s);
174
- const knows = foaf('knows');
175
- // var givenName = kb.sym('http://www.w3.org/2000/10/swap/pim/contact#givenName')
176
- const familiar = kb.anyValue(s, foaf('givenname')) || kb.anyValue(s, foaf('firstName')) || kb.anyValue(s, foaf('nick')) || kb.anyValue(s, foaf('name')) || kb.anyValue(s, vcard('fn'));
177
- const friends = kb.each(s, knows);
178
-
179
- // Do I have a public profile document?
180
- let profile = null; // This could be SPARQL { ?me foaf:primaryTopic [ a foaf:PersonalProfileDocument ] }
181
- let editable = false;
182
- let incoming;
183
- let outgoing;
184
- if (me) {
185
- // The definition of FAF personal profile document is ..
186
- const works = kb.each(undefined, foaf('primaryTopic'), me); // having me as primary topic
187
- let message = '';
188
- for (let i = 0; i < works.length; i++) {
189
- if (kb.whether(works[i], UI.ns.rdf('type'), foaf('PersonalProfileDocument'))) {
190
- editable = outliner.UserInput.sparqler.editable(works[i].uri, kb);
191
- if (!editable) {
192
- message += 'Your profile <' + UI.utils.escapeForXML(works[i].uri) + '> is not remotely editable.';
193
- } else {
194
- profile = works[i];
195
- break;
196
- }
197
- }
198
- }
199
- if (!profile) {
200
- say(message + '\nI couldn\'t find your editable personal profile document.');
201
- } else {
202
- say('Editing your profile ' + profile + '.');
203
- // Do I have an EDITABLE profile?
204
- editable = outliner.UserInput.sparqler.editable(profile.uri, kb);
205
- }
206
- if (thisIsYou) {
207
- // This is about me
208
- // pass... @@
209
- } else {
210
- // This is about someone else
211
- // My relationship with this person
212
-
213
- h3 = dom.createElement('h3');
214
- h3.appendChild(dom.createTextNode('You and ' + familiar));
215
- tools.appendChild(h3);
216
- const cme = kb.canon(me);
217
- incoming = kb.whether(s, knows, cme);
218
- outgoing = false;
219
- const outgoingSt = kb.statementsMatching(cme, knows, s);
220
- if (outgoingSt.length) {
221
- outgoing = true;
222
- if (!profile) profile = outgoingSt[0].why;
223
- }
224
- const tr = dom.createElement('tr');
225
- tools.appendChild(tr);
226
- const youAndThem = function () {
227
- tr.appendChild(link(text('You'), meUri));
228
- tr.appendChild(text(' and '));
229
- tr.appendChild(link(text(familiar), s.uri));
230
- };
231
- if (!incoming) {
232
- if (!outgoing) {
233
- youAndThem();
234
- tr.appendChild(text(' have not said you know each other.'));
235
- } else {
236
- tr.appendChild(link(text('You'), meUri));
237
- tr.appendChild(text(' know '));
238
- tr.appendChild(link(text(familiar), s.uri));
239
- tr.appendChild(text(' (unconfirmed)'));
240
- }
241
- } else {
242
- if (!outgoing) {
243
- tr.appendChild(link(text(familiar), s.uri));
244
- tr.appendChild(text(' knows '));
245
- tr.appendChild(link(text('you'), meUri));
246
- tr.appendChild(text(' (unconfirmed).')); // @@
247
- tr.appendChild(text(' confirm you know '));
248
- tr.appendChild(link(text(familiar), s.uri));
249
- tr.appendChild(text('.'));
250
- } else {
251
- youAndThem();
252
- tr.appendChild(text(' say you know each other.'));
253
- }
254
- }
255
- if (editable) {
256
- const f = buildCheckboxForm('You know ' + familiar, new $rdf.Statement(me, knows, s, profile), outgoing);
257
- tools.appendChild(f);
258
- } // editable
259
-
260
- // //////////////// Mutual friends
261
- if (friends) {
262
- const myFriends = kb.each(me, foaf('knows'));
263
- if (myFriends.length) {
264
- const mutualFriends = common(friends, myFriends);
265
- const tr = dom.createElement('tr');
266
- tools.appendChild(tr);
267
- tr.appendChild(dom.createTextNode('You' + (familiar ? ' and ' + familiar : '') + ' know' + people(mutualFriends.length) + ' found in common'));
268
- if (mutualFriends) {
269
- for (let i = 0; i < mutualFriends.length; i++) {
270
- tr.appendChild(dom.createTextNode(', ' + UI.utils.label(mutualFriends[i])));
271
- }
272
- }
273
- }
274
- const tr = dom.createElement('tr');
275
- tools.appendChild(tr);
276
- } // friends
277
- } // About someone else
278
- } // me is defined
279
- // End of you and s
280
-
281
- // div.appendChild(dom.createTextNode(plural(friends.length, 'acquaintance') +'. '))
282
-
283
- // ///////////////////////////////////////////// Main block
284
- //
285
- // Should: Find the intersection and difference sets
286
-
287
- // List all x such that s knows x.
288
- UI.widgets.attachmentList(dom, s, mainTable, {
289
- doc: profile,
290
- modify: !!editable,
291
- predicate: foaf('knows'),
292
- noun: 'friend'
293
- });
294
-
295
- // Figure out which are reciprocated:
296
- // @@ Does not look up profiles
297
- // Does distinguish reciprocated from unreciprocated friendships
298
- //
299
- function _triageFriends(s) {
300
- outgoing = kb.each(s, foaf('knows'));
301
- incoming = kb.each(undefined, foaf('knows'), s); // @@ have to load the friends
302
- const confirmed = [];
303
- const unconfirmed = [];
304
- const requests = [];
305
- for (let i = 0; i < outgoing.length; i++) {
306
- const friend = outgoing[i];
307
- let found = false;
308
- for (let j = 0; j < incoming.length; j++) {
309
- if (incoming[j].sameTerm(friend)) {
310
- found = true;
311
- break;
312
- }
313
- }
314
- if (found) confirmed.push(friend);else unconfirmed.push(friend);
315
- } // outgoing
316
-
317
- for (let i = 0; i < incoming.length; i++) {
318
- const friend = incoming[i];
319
- // var lab = UI.utils.label(friend)
320
- let found = false;
321
- for (let j = 0; j < outgoing.length; j++) {
322
- if (outgoing[j].sameTerm(friend)) {
323
- found = true;
324
- break;
325
- }
326
- }
327
- if (!found) requests.push(friend);
328
- } // incoming
329
-
330
- const cases = [['Acquaintances', outgoing], ['Mentioned as acquaintances by: ', requests]];
331
- for (let i = 0; i < cases.length; i++) {
332
- const thisCase = cases[i];
333
- const friends = thisCase[1];
334
- if (friends.length === 0) continue; // Skip empty sections (sure?)
335
-
336
- const h3 = dom.createElement('h3');
337
- h3.textContent = thisCase[0];
338
- const htr = dom.createElement('tr');
339
- htr.appendChild(h3);
340
- mainTable.appendChild(htr);
341
- const items = [];
342
- for (let j9 = 0; j9 < friends.length; j9++) {
343
- items.push([UI.utils.label(friends[j9]), friends[j9]]);
344
- }
345
- items.sort();
346
- let last = null;
347
- let fr;
348
- for (let j7 = 0; j7 < items.length; j7++) {
349
- fr = items[j7][1];
350
- if (fr.sameTerm(last)) continue; // unique
351
- last = fr;
352
- if (UI.utils.label(fr) !== '...') {
353
- // This check is to avoid bnodes with no labels attached
354
- // appearing in the friends list with "..." - Oshani
355
- mainTable.appendChild(oneFriend(fr));
356
- }
357
- }
358
- }
359
- }
360
- /* if ($rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice) {
361
- triageFriends(s)
362
- } */
363
- // //////////////////////////////////// Basic info on left
364
-
365
- h3 = dom.createElement('h3');
366
- h3.appendChild(dom.createTextNode('Basic Information'));
367
- tools.appendChild(h3);
368
-
369
- // For each home page like thing make a label which will
370
- // make sense and add the domain (like "w3.org blog") if there are more than one of the same type
371
- //
372
- const preds = [UI.ns.foaf('homepage'), UI.ns.foaf('weblog'), UI.ns.foaf('workplaceHomepage'), UI.ns.foaf('schoolHomepage')];
373
- for (let i6 = 0; i6 < preds.length; i6++) {
374
- const pred = preds[i6];
375
- const sts = kb.statementsMatching(s, pred);
376
- if (sts.length === 0) {
377
- // if (editable) say("No home page set. Use the blue + icon at the bottom of the main view to add information.")
378
- } else {
379
- const uris = [];
380
- for (let j5 = 0; j5 < sts.length; j5++) {
381
- const st = sts[j5];
382
- if (st.object.uri) uris.push(st.object.uri); // Ignore if not symbol
383
- }
384
- uris.sort();
385
- let last2 = '';
386
- let lab2;
387
- for (let k = 0; k < uris.length; k++) {
388
- const uri = uris[k];
389
- if (uri === last2) continue; // uniques only
390
- last2 = uri;
391
- let hostlabel = '';
392
- lab2 = UI.utils.label(pred);
393
- if (uris.length > 1) {
394
- const l = uri.indexOf('//');
395
- if (l > 0) {
396
- let r = uri.indexOf('/', l + 2);
397
- const r2 = uri.lastIndexOf('.', r);
398
- if (r2 > 0) r = r2;
399
- hostlabel = uri.slice(l + 2, r);
400
- }
401
- }
402
- if (hostlabel) lab2 = hostlabel + ' ' + lab2; // disambiguate
403
- const t = dom.createTextNode(lab2);
404
- const a = dom.createElement('a');
405
- a.appendChild(t);
406
- a.setAttribute('href', uri);
407
- const d = dom.createElement('div');
408
- // d.className = 'social_linkButton'
409
- d.style.cssText = 'width: 80%; background-color: #fff; border: solid 0.05em #ccc; margin-top: 0.1em; margin-bottom: 0.1em; padding: 0.1em; text-align: center;';
410
- d.appendChild(a);
411
- tools.appendChild(d);
412
- }
413
- }
414
- }
415
- const preds2 = [UI.ns.foaf('openid'), UI.ns.foaf('nick')];
416
- for (let i2 = 0; i2 < preds2.length; i2++) {
417
- const pred = preds2[i2];
418
- const sts2 = kb.statementsMatching(s, pred);
419
- if (sts2.length === 0) {
420
- // if (editable) say("No home page set. Use the blue + icon at the bottom of the main view to add information.")
421
- } else {
422
- outliner.appendPropertyTRs(tools, sts2, false, function (_pred) {
423
- return true;
424
- });
425
- }
426
- }
427
- return div;
428
- } // render()
429
- }; //
430
- // ends