contacts-pane 2.4.8 → 2.4.12-beta4

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 (51) hide show
  1. package/.eslintrc +3 -1
  2. package/.github/workflows/ci.yml +74 -0
  3. package/.nvmrc +1 -1
  4. package/LICENSE.md +0 -0
  5. package/Makefile +0 -0
  6. package/README.md +0 -0
  7. package/__tests__/unit/data-reformat-test.js +166 -0
  8. package/__tests__/unit/data-reformat-test.ts +185 -0
  9. package/__tests__/unit/setup.js +74 -0
  10. package/__tests__/unit/setup.ts +77 -0
  11. package/babel.config.js +13 -0
  12. package/card.ai +0 -0
  13. package/card.png +0 -0
  14. package/contactLogic.js +84 -7
  15. package/contactsPane.js +64 -20
  16. package/diff.txt +0 -0
  17. package/exampleOfOpenData/mit-wikidata-details.ttl +0 -0
  18. package/exampleOfOpenData/mit-wikidata-query.sparql +0 -0
  19. package/exampleOfOpenData/wikidata-get.json +0 -0
  20. package/groupMembershipControl.js +56 -13
  21. package/individual.js +3 -2
  22. package/individualForm.js +0 -0
  23. package/jest.config.js +11 -0
  24. package/jest.setup.ts +10 -0
  25. package/lib/autocompleteBar.js +99 -0
  26. package/lib/autocompleteBar.js.map +1 -0
  27. package/lib/autocompleteField.js +157 -0
  28. package/lib/autocompleteField.js.map +1 -0
  29. package/lib/autocompletePicker.js +240 -0
  30. package/lib/autocompletePicker.js.map +1 -0
  31. package/lib/forms.js +315 -0
  32. package/lib/instituteDetailsQuery.js +38 -0
  33. package/lib/publicData.js +387 -0
  34. package/lib/publicData.js.map +1 -0
  35. package/lib/vcard.js +916 -0
  36. package/mintNewAddressBook.js +5 -4
  37. package/mugshotGallery.js +16 -4
  38. package/organizationForm.js +0 -0
  39. package/organizationForm.ttl +0 -0
  40. package/package.json +26 -13
  41. package/shapes/contacts-shapes.ttl +0 -0
  42. package/src/autocompleteBar.ts +92 -0
  43. package/src/autocompleteField.ts +180 -0
  44. package/src/autocompletePicker.ts +253 -0
  45. package/src/forms.ttl +1 -1
  46. package/src/instituteDetailsQuery.sparql +0 -0
  47. package/src/publicData.ts +385 -0
  48. package/src/vcard.ttl +0 -0
  49. package/toolsPane.js +70 -19
  50. package/tsconfig.json +16 -0
  51. package/webidControl.js +49 -4
package/lib/forms.js ADDED
@@ -0,0 +1,315 @@
1
+ module.exports = `
2
+ # This turtle file defined the forms usied in the contacts management
3
+ #
4
+ # Indivduals and orgs are in one file as they both
5
+ # share some forms (address etc) and also interact (roles)
6
+
7
+ # Now hand-edited, was originally made using form editor.
8
+ # Forms documentaion: https://solid.github.io/solid-ui/Documentation/forms-intro.html
9
+
10
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
11
+ @prefix dct: <http://purl.org/dc/terms/>.
12
+ @prefix foaf: <http://xmlns.com/foaf/0.1/>.
13
+ @prefix owl: <http://www.w3.org/2002/07/owl#>.
14
+ @prefix prov: <http://www.w3.org/ns/prov#>.
15
+ @prefix ui: <http://www.w3.org/ns/ui#>.
16
+ @prefix schema: <http://schema.org/>.
17
+ @prefix solid: <http://www.w3.org/ns/solid/terms#>.
18
+ @prefix vcard: <http://www.w3.org/2006/vcard/ns#>.
19
+ @prefix : <#>.
20
+
21
+ # Ontology additions or interpretations needed for the form to work well
22
+
23
+ # The ontology file doesn't make them disjoint. This makes the selector be a choice.
24
+ vcard:TelephoneType owl:disjointUnionOf ( vcard:Cell vcard:Home vcard:Work) .
25
+ vcard:Type owl:disjointUnionOf (vcard:Home vcard:Work) . # for email
26
+
27
+ # Better field labels
28
+ vcard:Cell ui:label "mobile"@en . # app will imake nitial caps if nec
29
+ vcard:hasAddress ui:label "address"@en .
30
+ vcard:bday ui:label "born"@en.
31
+ vcard:hasEmail ui:label "email"@en .
32
+ vcard:hasTelephone ui:label "phone"@en .
33
+ vcard:note ui:label "notes"@en .
34
+
35
+
36
+
37
+ # Ontology data to drive a top classifier
38
+
39
+ foaf:Agent owl:disjointUnionOf (
40
+ vcard:Individual
41
+ # @@ schema:robot @@ schem:SoftwareApplication, n0:Agent, n0:Person,
42
+ prov:SoftwareAgent
43
+ # vcard:Group a group of agents is not (currently) an agent itself.
44
+ # You can't get a decision out of it so it can't own a bank account
45
+ vcard:Organization
46
+ ).
47
+
48
+
49
+ # Ontology data to drive the classifier
50
+
51
+ solid:InterestingOrganization owl:disjointUnionOf (
52
+ # Airline - a Corpration
53
+ # Consortium - a Corporation or a NGO
54
+ schema:Corporation
55
+ schema:EducationalOrganization
56
+ schema:ResearchOrganization
57
+ # FundingScheme - eh?
58
+ schema:GovernmentOrganization
59
+ # LibrarySystem
60
+ # LocalBusiness - Corporation
61
+ schema:MedicalOrganization
62
+ schema:NGO
63
+ # NewsMediaOrganization - a Corporation or a NGO
64
+ schema:MusicGroup # e.g. a band
65
+ schema:Project # like Solid
66
+ schema:SportsOrganization # a Team
67
+ ) .
68
+
69
+ #########################################################
70
+ # The forms themselves
71
+
72
+ foaf:Agent ui:creationForm :AgentForm .
73
+
74
+ :AgentForm a ui:Form; schema:name "Form for editing a agent" ;
75
+ ui:parts ( :AgentClassifier :AgentOptions ) .
76
+
77
+ :AgentClassifier a ui:Classifier; ui:label "What sort of agent?"@en;
78
+ ui:category foaf:Agent .
79
+
80
+ :AgentOptions a ui:Options; ui:dependingon rdf:type;
81
+ ui:case [ ui:for vcard:Individual; ui:use :form1 ],
82
+ [ ui:for vcard:Organization; ui:use :orgDetailsForm ],
83
+ [ ui:for prov:SoftwareAgent; ui:use :robotDetailsForm ] .
84
+
85
+ # Robots
86
+
87
+ :robotDetailsForm a ui:Form; ui:parts ( ) . # @@@@
88
+
89
+ # Individual-specific form
90
+
91
+ vcard:Individual
92
+ ui:creationForm :form1 .
93
+
94
+ # The addressComment, etc., fields with a comment before each type of field
95
+ # were originally partly because the labels on the fields were clumsy like "hasAddress".
96
+ # This is fixed by adding the ui:label to the properties above, so let's try
97
+ # removing the little micro-headings
98
+
99
+ # For org:
100
+ :orgDetailsForm a ui:Form ; dct:title "Contact details for an organozation";
101
+ ui:parts (
102
+ :OrgClassifier
103
+
104
+ :fullNameField
105
+ :addresses
106
+ :eMails
107
+ :telephones
108
+ :noteField ) .
109
+ # For individual:
110
+ :form1
111
+ dct:title "Contact Details for a person" ;
112
+ a ui:Form ;
113
+ ui:part
114
+ :fullNameField, :roleField, :orgNameField,
115
+ # :addressesComment,
116
+ :addresses,
117
+ # :emailComment,
118
+ :eMails,
119
+ # :telephoneComment,
120
+ :telephones,
121
+ # :noteComment,
122
+ :noteField ;
123
+ ui:parts (
124
+ :fullNameField :roleField :orgNameField
125
+ # :addressesComment
126
+ :addresses
127
+ # :emailComment
128
+ :eMails
129
+ # :telephoneComment
130
+ :telephones :birthdayField
131
+ # :noteComment
132
+ :noteField ) .
133
+
134
+ :fullNameField
135
+ a ui:SingleLineTextField ;
136
+ ui:label "Name";
137
+ ui:maxLength "128" ;
138
+ ui:property vcard:fn ;
139
+ ui:size "40" .
140
+
141
+ :roleField
142
+ a ui:SingleLineTextField ;
143
+ ui:suppressEmptyUneditable true;
144
+ ui:maxLength "128" ;
145
+ ui:property vcard:role ;
146
+ ui:size "40" .
147
+
148
+ :orgNameField
149
+ a ui:SingleLineTextField ;
150
+ ui:suppressEmptyUneditable true;
151
+ ui:maxLength "128" ;
152
+ ui:property vcard:organization-name ;
153
+ ui:size "40" .
154
+
155
+
156
+ :addressesComment
157
+ a ui:Comment ;
158
+ ui:suppressIfUneditable true;
159
+ ui:contents "Address" .
160
+
161
+
162
+ :addresses
163
+ dct:title "Address details" ;
164
+ a ui:Multiple ;
165
+ ui:part :oneAddress ;
166
+ ui:property vcard:hasAddress .
167
+
168
+ :oneAddress
169
+ a ui:Group ;
170
+ ui:parts ( :id1409437207443 :id1409437292400 :id1409437421996 :id1409437467649 :id1409437569420 ). # :id1409437646712
171
+
172
+ :id1409437207443
173
+ a ui:SingleLineTextField ;
174
+ ui:maxLength "128" ;
175
+ ui:property vcard:street-address ;
176
+ ui:size "40" .
177
+
178
+ :id1409437292400
179
+ a ui:SingleLineTextField ;
180
+ ui:maxLength "128" ;
181
+ ui:property vcard:locality ;
182
+ ui:size "40" .
183
+
184
+ :id1409437421996
185
+ a ui:SingleLineTextField ;
186
+ ui:maxLength "25" ;
187
+ ui:property vcard:postal-code ;
188
+ ui:size "25" .
189
+
190
+ :id1409437467649
191
+ a ui:SingleLineTextField ;
192
+ ui:maxLength "128" ;
193
+ ui:property vcard:region ;
194
+ ui:size "40" .
195
+
196
+ :id1409437569420
197
+ a ui:SingleLineTextField ;
198
+ ui:maxLength "128" ;
199
+ ui:property vcard:country-name ;
200
+ ui:size "40" .
201
+
202
+ :id1409437646712
203
+ a ui:Classifier ;
204
+ ui:from rdf:Class ;
205
+ ui:property rdf:type .
206
+
207
+
208
+ ##############################
209
+
210
+ :emailComment
211
+ a ui:Comment ;
212
+ ui:suppressIfUneditable true;
213
+
214
+ ui:contents "Email" .
215
+
216
+
217
+ :eMails
218
+ a ui:Multiple ;
219
+ ui:part :oneEMail ;
220
+ ui:property vcard:hasEmail .
221
+
222
+ :oneEMail
223
+ a ui:Group ; # hint: side by side is good
224
+ ui:part :emailValue, :emailType ;
225
+ ui:parts ( :emailType :emailValue ).
226
+
227
+ :emailValue
228
+ a ui:EmailField ; ui:label "email";
229
+ ui:property vcard:value ;
230
+ ui:size "50" .
231
+
232
+ :emailType
233
+ a ui:Classifier ;
234
+ ui:canMintNew "0" ;
235
+ ui:category vcard:Type ;
236
+ ui:from vcard:Type ;
237
+ ui:property rdf:type .
238
+
239
+
240
+ ##############################
241
+
242
+ :telephoneComment
243
+ a ui:Comment ;
244
+ ui:suppressIfUneditable true;
245
+ ui:contents "Phones" .
246
+
247
+
248
+ :telephones
249
+ a ui:Multiple ;
250
+ ui:part :onetelephone ;
251
+ ui:property vcard:hasTelephone .
252
+
253
+ :onetelephone
254
+ a ui:Group ;
255
+ ui:part :telephoneValue, :telephoneType ;
256
+ ui:parts ( :telephoneType :telephoneValue ).
257
+
258
+ :telephoneValue
259
+ a ui:PhoneField ;
260
+ ui:property vcard:value ;
261
+ ui:size "50" .
262
+
263
+ :telephoneType
264
+ a ui:Classifier ;
265
+ ui:canMintNew "0" ;
266
+ ui:category vcard:TelephoneType ;
267
+ ui:from vcard:Type ;
268
+ ui:property rdf:type .
269
+
270
+ ##############################
271
+
272
+ :birthdayField
273
+ a ui:DateField;
274
+ ui:label "Born";
275
+ ui:suppressEmptyUneditable true;
276
+ ui:property vcard:bday .
277
+
278
+ ##############################
279
+
280
+ :noteComment
281
+ a ui:Comment ;
282
+ ui:suppressIfUneditable true;
283
+ ui:contents "General Notes" .
284
+
285
+ :noteField
286
+ a ui:MultiLineTextField ;
287
+ ui:suppressEmptyUneditable true;
288
+
289
+ ui:property vcard:note .
290
+
291
+
292
+ ############ organization forms
293
+
294
+ :OrganinizatioCreationForm a ui:Form; schema:name "Form for editing contact details of an organization" ;
295
+ ui:parts ( :OrgClassifier :homePageURIField ) .
296
+
297
+
298
+ :OrgClassifier a ui:Classifier; ui:label "What sort of organization?"@en;
299
+ ui:category solid:InterestingOrganization .
300
+
301
+
302
+ :instituteNameField
303
+ a ui:SingleLineTextField ;
304
+ ui:label "Intitute Name";
305
+ ui:maxLength "200" ;
306
+ ui:property schema:name ;
307
+ ui:size "80" .
308
+
309
+ :homePageURIField a ui:NamedNodeURIField;
310
+ ui:property schema:url . # @@ ??
311
+
312
+ :initituteTypeField a ui:Classifier;
313
+ ui:label "What sort of organization";
314
+ ui:category solid:InterestingOrganization .
315
+ `
@@ -0,0 +1,38 @@
1
+ module.exports = `
2
+ prefix vcard: <http://www.w3.org/2006/vcard/ns#>
3
+ CONSTRUCT
4
+ { wd:Q49108 vcard:fn ?itemLabel.
5
+ wd:Q49108 rdf:type ?klass. ?klass rdfs:label ?klassLabel; rdfs:comment ?klassDescription .
6
+ wd:Q49108 schema:logo ?logo;
7
+ schema:image ?image;
8
+ schema:logo ?sealImage;
9
+ schema:subOrganization ?subsidiary .
10
+ ?subsidiary rdfs:label ?subsidiaryLabel .
11
+ ?supersidiary schema:subOrganization wd:Q49108 .
12
+ ?supersidiary rdfs:label ?supersidiaryLabel .
13
+ wd:Q49108 schema:location ?location .
14
+ ?location schema:elevation ?elevation .
15
+ ?location wdt:P131 ?region . ?region rdfs:label ?regionLabel .
16
+ ?location wdt:P625 ?coordinates .
17
+ ?location schema:country ?country . ?country rdfs:label ?countryLabel .
18
+ }
19
+ WHERE
20
+ { optional {wd:Q49108 rdfs:label ?itemLabel} .
21
+ optional {wd:Q49108 wdt:P154 ?logo .}
22
+ optional {wd:Q49108 wdt:P31 ?klass .}
23
+ optional {wd:Q49108 wdt:P158 ?sealImage .}
24
+ optional {wd:Q49108 wdt:P18 ?image .}
25
+
26
+ optional { wd:Q49108 wdt:P355 ?subsidiary . }
27
+ optional { ?supersidiary wdt:P355 wd:Q49108. }
28
+
29
+ optional { wd:Q49108 wdt:P276 ?location .
30
+
31
+ optional { ?location schema:eleveation ?elevation }
32
+ optional { ?location wdt:P131 ?region }
33
+ optional { ?location wdt:P625 ?coordinates }
34
+ optional { ?location wdt:P17 ?country }
35
+ }
36
+ SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,de,it". }
37
+ }
38
+ `