solid-ui 2.4.29 → 2.4.30

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 (259) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/dist/670.solid-ui.min.js +0 -0
  4. package/dist/805.solid-ui.min.js +1 -1
  5. package/dist/805.solid-ui.min.js.LICENSE.txt +0 -0
  6. package/dist/805.solid-ui.min.js.map +1 -1
  7. package/dist/_2b19.solid-ui.js +0 -0
  8. package/dist/_2b19.solid-ui.js.map +1 -1
  9. package/dist/index.html +0 -0
  10. package/dist/solid-ui.js +3369 -1854
  11. package/dist/solid-ui.js.map +1 -1
  12. package/dist/solid-ui.min.js +1 -1
  13. package/dist/solid-ui.min.js.LICENSE.txt +0 -0
  14. package/dist/solid-ui.min.js.map +1 -1
  15. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +191 -80
  16. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
  17. package/lib/acl/access-controller.d.ts +0 -0
  18. package/lib/acl/access-controller.d.ts.map +0 -0
  19. package/lib/acl/access-controller.js +0 -0
  20. package/lib/acl/access-controller.js.map +0 -0
  21. package/lib/acl/access-groups.d.ts +0 -0
  22. package/lib/acl/access-groups.d.ts.map +0 -0
  23. package/lib/acl/access-groups.js +0 -2
  24. package/lib/acl/access-groups.js.map +1 -1
  25. package/lib/acl/acl-control.d.ts +0 -0
  26. package/lib/acl/acl-control.d.ts.map +0 -0
  27. package/lib/acl/acl-control.js +0 -0
  28. package/lib/acl/acl-control.js.map +0 -0
  29. package/lib/acl/acl.d.ts +0 -0
  30. package/lib/acl/acl.d.ts.map +0 -0
  31. package/lib/acl/acl.js +0 -2
  32. package/lib/acl/acl.js.map +1 -1
  33. package/lib/acl/add-agent-buttons.d.ts +0 -0
  34. package/lib/acl/add-agent-buttons.d.ts.map +0 -0
  35. package/lib/acl/add-agent-buttons.js +0 -0
  36. package/lib/acl/add-agent-buttons.js.map +0 -0
  37. package/lib/acl/index.d.ts +0 -0
  38. package/lib/acl/index.d.ts.map +0 -0
  39. package/lib/acl/index.js +0 -0
  40. package/lib/acl/index.js.map +0 -0
  41. package/lib/acl/types.d.ts +0 -0
  42. package/lib/acl/types.d.ts.map +0 -0
  43. package/lib/acl/types.js +0 -0
  44. package/lib/acl/types.js.map +0 -0
  45. package/lib/chat/bookmarks.js +0 -0
  46. package/lib/chat/bookmarks.js.map +0 -0
  47. package/lib/chat/chatLogic.js +6 -4
  48. package/lib/chat/chatLogic.js.map +1 -1
  49. package/lib/chat/dateFolder.js +0 -0
  50. package/lib/chat/dateFolder.js.map +0 -0
  51. package/lib/chat/infinite.js +0 -5
  52. package/lib/chat/infinite.js.map +1 -1
  53. package/lib/chat/keys.d.ts +0 -0
  54. package/lib/chat/keys.d.ts.map +0 -0
  55. package/lib/chat/keys.js +0 -0
  56. package/lib/chat/keys.js.map +0 -0
  57. package/lib/chat/message.js +3 -7
  58. package/lib/chat/message.js.map +1 -1
  59. package/lib/chat/messageTools.js +1 -0
  60. package/lib/chat/messageTools.js.map +1 -1
  61. package/lib/chat/signature.d.ts +0 -0
  62. package/lib/chat/signature.d.ts.map +0 -0
  63. package/lib/chat/signature.js +0 -0
  64. package/lib/chat/signature.js.map +0 -0
  65. package/lib/chat/thread.js +0 -4
  66. package/lib/chat/thread.js.map +1 -1
  67. package/lib/create/create.d.ts +0 -0
  68. package/lib/create/create.d.ts.map +0 -0
  69. package/lib/create/create.js +0 -2
  70. package/lib/create/create.js.map +1 -1
  71. package/lib/create/index.d.ts +0 -0
  72. package/lib/create/index.d.ts.map +0 -0
  73. package/lib/create/index.js +0 -0
  74. package/lib/create/index.js.map +0 -0
  75. package/lib/create/types.d.ts +0 -0
  76. package/lib/create/types.d.ts.map +0 -0
  77. package/lib/create/types.js +0 -0
  78. package/lib/create/types.js.map +0 -0
  79. package/lib/debug.d.ts +0 -0
  80. package/lib/debug.d.ts.map +0 -0
  81. package/lib/debug.js +0 -0
  82. package/lib/debug.js.map +0 -0
  83. package/lib/folders.js +0 -0
  84. package/lib/folders.js.map +0 -0
  85. package/lib/footer/index.d.ts +0 -0
  86. package/lib/footer/index.d.ts.map +0 -0
  87. package/lib/footer/index.js +0 -0
  88. package/lib/footer/index.js.map +0 -0
  89. package/lib/header/empty-profile.d.ts +0 -0
  90. package/lib/header/empty-profile.d.ts.map +0 -0
  91. package/lib/header/empty-profile.js +0 -0
  92. package/lib/header/empty-profile.js.map +0 -0
  93. package/lib/header/index.d.ts +0 -0
  94. package/lib/header/index.d.ts.map +0 -0
  95. package/lib/header/index.js +0 -0
  96. package/lib/header/index.js.map +0 -0
  97. package/lib/iconBase.d.ts +0 -0
  98. package/lib/iconBase.d.ts.map +0 -0
  99. package/lib/iconBase.js +0 -0
  100. package/lib/iconBase.js.map +0 -0
  101. package/lib/icons/solid_logo.d.ts +0 -0
  102. package/lib/icons/solid_logo.d.ts.map +0 -0
  103. package/lib/icons/solid_logo.js +0 -0
  104. package/lib/icons/solid_logo.js.map +0 -0
  105. package/lib/index.d.ts +0 -0
  106. package/lib/index.d.ts.map +0 -0
  107. package/lib/index.js +0 -0
  108. package/lib/index.js.map +0 -0
  109. package/lib/log.d.ts +0 -0
  110. package/lib/log.d.ts.map +0 -0
  111. package/lib/log.js +0 -0
  112. package/lib/log.js.map +0 -0
  113. package/lib/login/login.d.ts +0 -0
  114. package/lib/login/login.d.ts.map +0 -0
  115. package/lib/login/login.js +23 -24
  116. package/lib/login/login.js.map +1 -1
  117. package/lib/matrix/index.d.ts +0 -0
  118. package/lib/matrix/index.d.ts.map +0 -0
  119. package/lib/matrix/index.js +0 -0
  120. package/lib/matrix/index.js.map +0 -0
  121. package/lib/matrix/matrix.d.ts +0 -0
  122. package/lib/matrix/matrix.d.ts.map +0 -0
  123. package/lib/matrix/matrix.js +0 -2
  124. package/lib/matrix/matrix.js.map +1 -1
  125. package/lib/matrix/types.d.ts +0 -0
  126. package/lib/matrix/types.d.ts.map +0 -0
  127. package/lib/matrix/types.js +0 -0
  128. package/lib/matrix/types.js.map +0 -0
  129. package/lib/media/index.d.ts +0 -0
  130. package/lib/media/index.d.ts.map +0 -0
  131. package/lib/media/index.js +0 -0
  132. package/lib/media/index.js.map +0 -0
  133. package/lib/media/media-capture.d.ts +0 -0
  134. package/lib/media/media-capture.d.ts.map +0 -0
  135. package/lib/media/media-capture.js +0 -3
  136. package/lib/media/media-capture.js.map +1 -1
  137. package/lib/messageArea.js +0 -4
  138. package/lib/messageArea.js.map +1 -1
  139. package/lib/noun_Camera_1618446_000000.js +0 -0
  140. package/lib/noun_Camera_1618446_000000.js.map +0 -0
  141. package/lib/ns.js +0 -0
  142. package/lib/ns.js.map +0 -0
  143. package/lib/pad.d.ts +0 -0
  144. package/lib/pad.d.ts.map +0 -0
  145. package/lib/pad.js +3 -6
  146. package/lib/pad.js.map +1 -1
  147. package/lib/participation.d.ts +0 -0
  148. package/lib/participation.d.ts.map +0 -0
  149. package/lib/participation.js +1 -4
  150. package/lib/participation.js.map +1 -1
  151. package/lib/preferences.js +0 -0
  152. package/lib/preferences.js.map +0 -0
  153. package/lib/signup/config-default.js +0 -0
  154. package/lib/signup/config-default.js.map +0 -0
  155. package/lib/signup/signup.js +0 -0
  156. package/lib/signup/signup.js.map +0 -0
  157. package/lib/stories/decorators.js +0 -0
  158. package/lib/stories/decorators.js.map +0 -0
  159. package/lib/style.js +0 -0
  160. package/lib/style.js.map +0 -0
  161. package/lib/style_multiSelect.js +0 -0
  162. package/lib/style_multiSelect.js.map +0 -0
  163. package/lib/table.js +0 -4
  164. package/lib/table.js.map +1 -1
  165. package/lib/tabs.d.ts +0 -0
  166. package/lib/tabs.d.ts.map +0 -0
  167. package/lib/tabs.js +0 -2
  168. package/lib/tabs.js.map +1 -1
  169. package/lib/typings.d.js +0 -0
  170. package/lib/typings.d.js.map +0 -0
  171. package/lib/utils/headerFooterHelpers.d.ts +0 -0
  172. package/lib/utils/headerFooterHelpers.d.ts.map +0 -0
  173. package/lib/utils/headerFooterHelpers.js +0 -0
  174. package/lib/utils/headerFooterHelpers.js.map +0 -0
  175. package/lib/utils/index.js +0 -7
  176. package/lib/utils/index.js.map +1 -1
  177. package/lib/utils/keyHelpers/accessData.d.ts +0 -0
  178. package/lib/utils/keyHelpers/accessData.d.ts.map +0 -0
  179. package/lib/utils/keyHelpers/accessData.js +0 -0
  180. package/lib/utils/keyHelpers/accessData.js.map +0 -0
  181. package/lib/utils/keyHelpers/acl.d.ts +0 -0
  182. package/lib/utils/keyHelpers/acl.d.ts.map +0 -0
  183. package/lib/utils/keyHelpers/acl.js +0 -0
  184. package/lib/utils/keyHelpers/acl.js.map +0 -0
  185. package/lib/utils/label.d.ts +0 -0
  186. package/lib/utils/label.d.ts.map +0 -0
  187. package/lib/utils/label.js +0 -0
  188. package/lib/utils/label.js.map +0 -0
  189. package/lib/versionInfo.d.ts +0 -0
  190. package/lib/versionInfo.d.ts.map +0 -0
  191. package/lib/versionInfo.js +14 -14
  192. package/lib/versionInfo.js.map +1 -1
  193. package/lib/widgets/buttons/iconLinks.d.ts +0 -0
  194. package/lib/widgets/buttons/iconLinks.d.ts.map +0 -0
  195. package/lib/widgets/buttons/iconLinks.js +0 -0
  196. package/lib/widgets/buttons/iconLinks.js.map +0 -0
  197. package/lib/widgets/buttons.d.ts +0 -0
  198. package/lib/widgets/buttons.d.ts.map +0 -0
  199. package/lib/widgets/buttons.js +2 -10
  200. package/lib/widgets/buttons.js.map +1 -1
  201. package/lib/widgets/dragAndDrop.js +0 -1
  202. package/lib/widgets/dragAndDrop.js.map +1 -1
  203. package/lib/widgets/error.d.ts +0 -0
  204. package/lib/widgets/error.d.ts.map +0 -0
  205. package/lib/widgets/error.js +0 -0
  206. package/lib/widgets/error.js.map +0 -0
  207. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts +0 -0
  208. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts.map +0 -0
  209. package/lib/widgets/forms/autocomplete/autocompleteBar.js +5 -5
  210. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +0 -0
  211. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts +0 -0
  212. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts.map +0 -0
  213. package/lib/widgets/forms/autocomplete/autocompleteField.js +0 -1
  214. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  215. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts +0 -0
  216. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +0 -0
  217. package/lib/widgets/forms/autocomplete/autocompletePicker.js +4 -7
  218. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  219. package/lib/widgets/forms/autocomplete/language.d.ts +0 -0
  220. package/lib/widgets/forms/autocomplete/language.d.ts.map +0 -0
  221. package/lib/widgets/forms/autocomplete/language.js +0 -0
  222. package/lib/widgets/forms/autocomplete/language.js.map +0 -0
  223. package/lib/widgets/forms/autocomplete/publicData.d.ts +0 -0
  224. package/lib/widgets/forms/autocomplete/publicData.d.ts.map +0 -0
  225. package/lib/widgets/forms/autocomplete/publicData.js +0 -3
  226. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  227. package/lib/widgets/forms/basic.d.ts +0 -0
  228. package/lib/widgets/forms/basic.d.ts.map +0 -0
  229. package/lib/widgets/forms/basic.js +0 -1
  230. package/lib/widgets/forms/basic.js.map +1 -1
  231. package/lib/widgets/forms/comment.d.ts +0 -0
  232. package/lib/widgets/forms/comment.d.ts.map +0 -0
  233. package/lib/widgets/forms/comment.js +0 -0
  234. package/lib/widgets/forms/comment.js.map +0 -0
  235. package/lib/widgets/forms/fieldFunction.d.ts +0 -0
  236. package/lib/widgets/forms/fieldFunction.d.ts.map +0 -0
  237. package/lib/widgets/forms/fieldFunction.js +0 -0
  238. package/lib/widgets/forms/fieldFunction.js.map +0 -0
  239. package/lib/widgets/forms/fieldParams.d.ts +0 -0
  240. package/lib/widgets/forms/fieldParams.d.ts.map +0 -0
  241. package/lib/widgets/forms/fieldParams.js +14 -14
  242. package/lib/widgets/forms/fieldParams.js.map +1 -1
  243. package/lib/widgets/forms/formStyle.d.ts +0 -0
  244. package/lib/widgets/forms/formStyle.d.ts.map +0 -0
  245. package/lib/widgets/forms/formStyle.js +0 -0
  246. package/lib/widgets/forms/formStyle.js.map +0 -0
  247. package/lib/widgets/forms.js +3 -22
  248. package/lib/widgets/forms.js.map +1 -1
  249. package/lib/widgets/index.js +0 -0
  250. package/lib/widgets/index.js.map +0 -0
  251. package/lib/widgets/multiSelect.js +0 -0
  252. package/lib/widgets/multiSelect.js.map +0 -0
  253. package/lib/widgets/peoplePicker.js +0 -1
  254. package/lib/widgets/peoplePicker.js.map +1 -1
  255. package/lib/widgets/widgetHelpers.d.ts +0 -0
  256. package/lib/widgets/widgetHelpers.d.ts.map +0 -0
  257. package/lib/widgets/widgetHelpers.js +0 -0
  258. package/lib/widgets/widgetHelpers.js.map +0 -0
  259. package/package.json +18 -18
@@ -1070,8 +1070,8 @@ api.compact = async ({
1070
1070
 
1071
1071
  let key;
1072
1072
  if(container.includes('@language')) {
1073
- // if container is a language map, simplify compacted value to
1074
- // a simple string
1073
+ // if container is a language map, simplify compacted value to
1074
+ // a simple string
1075
1075
  if(_isValue(compactedItem)) {
1076
1076
  compactedItem = compactedItem['@value'];
1077
1077
  }
@@ -2447,7 +2447,7 @@ api.createTermDefinition = ({
2447
2447
  // indicate if this term may be used as a compact IRI prefix
2448
2448
  mapping._prefix = (simpleTerm &&
2449
2449
  !mapping._termHasColon &&
2450
- id.match(/[:\/\?#\[\]@]$/));
2450
+ id.match(/[:\/\?#\[\]@]$/) !== null);
2451
2451
  }
2452
2452
  }
2453
2453
 
@@ -3608,7 +3608,9 @@ const _notSafeEventCodes = new Set([
3608
3608
  'relative graph reference',
3609
3609
  'relative object reference',
3610
3610
  'relative predicate reference',
3611
- 'relative subject reference'
3611
+ 'relative subject reference',
3612
+ // toRDF / fromRDF
3613
+ 'rdfDirection not set'
3612
3614
  ]);
3613
3615
 
3614
3616
  // safe handler that rejects unsafe warning conditions
@@ -4046,48 +4048,70 @@ api.expand = async ({
4046
4048
  // drop certain top-level objects that do not occur in lists
4047
4049
  if(_isObject(rval) &&
4048
4050
  !options.keepFreeFloatingNodes && !insideList &&
4049
- (activeProperty === null || expandedActiveProperty === '@graph')) {
4051
+ (activeProperty === null ||
4052
+ expandedActiveProperty === '@graph' ||
4053
+ (_getContextValue(activeCtx, activeProperty, '@container') || [])
4054
+ .includes('@graph')
4055
+ )) {
4050
4056
  // drop empty object, top-level @value/@list, or object with only @id
4051
- if(count === 0 || '@value' in rval || '@list' in rval ||
4052
- (count === 1 && '@id' in rval)) {
4053
- // FIXME
4054
- if(options.eventHandler) {
4055
- // FIXME: one event or diff event for empty, @v/@l, {@id}?
4056
- let code;
4057
- let message;
4058
- if(count === 0) {
4059
- code = 'empty object';
4060
- message = 'Dropping empty object.';
4061
- } else if('@value' in rval) {
4062
- code = 'object with only @value';
4063
- message = 'Dropping object with only @value.';
4064
- } else if('@list' in rval) {
4065
- code = 'object with only @list';
4066
- message = 'Dropping object with only @list.';
4067
- } else if(count === 1 && '@id' in rval) {
4068
- code = 'object with only @id';
4069
- message = 'Dropping object with only @id.';
4070
- }
4071
- _handleEvent({
4072
- event: {
4073
- type: ['JsonLdEvent'],
4074
- code,
4075
- level: 'warning',
4076
- message,
4077
- details: {
4078
- value: rval
4079
- }
4080
- },
4081
- options
4082
- });
4083
- }
4084
- rval = null;
4085
- }
4057
+ rval = _dropUnsafeObject({value: rval, count, options});
4086
4058
  }
4087
4059
 
4088
4060
  return rval;
4089
4061
  };
4090
4062
 
4063
+ /**
4064
+ * Drop empty object, top-level @value/@list, or object with only @id
4065
+ *
4066
+ * @param value Value to check.
4067
+ * @param count Number of properties in object.
4068
+ * @param options The expansion options.
4069
+ *
4070
+ * @return null if dropped, value otherwise.
4071
+ */
4072
+ function _dropUnsafeObject({
4073
+ value,
4074
+ count,
4075
+ options
4076
+ }) {
4077
+ if(count === 0 || '@value' in value || '@list' in value ||
4078
+ (count === 1 && '@id' in value)) {
4079
+ // FIXME
4080
+ if(options.eventHandler) {
4081
+ // FIXME: one event or diff event for empty, @v/@l, {@id}?
4082
+ let code;
4083
+ let message;
4084
+ if(count === 0) {
4085
+ code = 'empty object';
4086
+ message = 'Dropping empty object.';
4087
+ } else if('@value' in value) {
4088
+ code = 'object with only @value';
4089
+ message = 'Dropping object with only @value.';
4090
+ } else if('@list' in value) {
4091
+ code = 'object with only @list';
4092
+ message = 'Dropping object with only @list.';
4093
+ } else if(count === 1 && '@id' in value) {
4094
+ code = 'object with only @id';
4095
+ message = 'Dropping object with only @id.';
4096
+ }
4097
+ _handleEvent({
4098
+ event: {
4099
+ type: ['JsonLdEvent'],
4100
+ code,
4101
+ level: 'warning',
4102
+ message,
4103
+ details: {
4104
+ value
4105
+ }
4106
+ },
4107
+ options
4108
+ });
4109
+ }
4110
+ return null;
4111
+ }
4112
+ return value;
4113
+ }
4114
+
4091
4115
  /**
4092
4116
  * Expand each key and value of element adding to result
4093
4117
  *
@@ -4308,7 +4332,7 @@ async function _expandObject({
4308
4332
  }
4309
4333
  return v;
4310
4334
  }),
4311
- {propertyIsArray: options.isFrame});
4335
+ {propertyIsArray: !!options.isFrame});
4312
4336
  continue;
4313
4337
  }
4314
4338
 
@@ -4449,8 +4473,7 @@ async function _expandObject({
4449
4473
 
4450
4474
  expandedValue = await api.expand({
4451
4475
  activeCtx,
4452
- activeProperty:
4453
- '@reverse',
4476
+ activeProperty: '@reverse',
4454
4477
  element: value,
4455
4478
  options
4456
4479
  });
@@ -4555,7 +4578,7 @@ async function _expandObject({
4555
4578
  });
4556
4579
  } else {
4557
4580
  // recurse into @list or @set
4558
- const isList = (expandedProperty === '@list');
4581
+ const isList = expandedProperty === '@list';
4559
4582
  if(isList || expandedProperty === '@set') {
4560
4583
  let nextActiveProperty = activeProperty;
4561
4584
  if(isList && expandedActiveProperty === '@graph') {
@@ -4607,9 +4630,21 @@ async function _expandObject({
4607
4630
  // index cases handled above
4608
4631
  if(container.includes('@graph') &&
4609
4632
  !container.some(key => key === '@id' || key === '@index')) {
4610
- // ensure expanded values are arrays
4611
- expandedValue = _asArray(expandedValue)
4612
- .map(v => ({'@graph': _asArray(v)}));
4633
+ // ensure expanded values are in an array
4634
+ expandedValue = _asArray(expandedValue);
4635
+ if(!options.isFrame) {
4636
+ // drop items if needed
4637
+ expandedValue = expandedValue.filter(v => {
4638
+ const count = Object.keys(v).length;
4639
+ return _dropUnsafeObject({value: v, count, options}) !== null;
4640
+ });
4641
+ }
4642
+ if(expandedValue.length === 0) {
4643
+ // all items dropped, skip adding and continue
4644
+ continue;
4645
+ }
4646
+ // convert to graph
4647
+ expandedValue = expandedValue.map(v => ({'@graph': _asArray(v)}));
4613
4648
  }
4614
4649
 
4615
4650
  // FIXME: can this be merged with code above to simplify?
@@ -5446,8 +5481,9 @@ function _validateFrame(frame) {
5446
5481
 
5447
5482
  if('@type' in frame[0]) {
5448
5483
  for(const type of util.asArray(frame[0]['@type'])) {
5449
- // @id must be wildcard or an IRI
5450
- if(!(types.isObject(type) || url.isAbsolute(type)) ||
5484
+ // @type must be wildcard, IRI, or @json
5485
+ if(!(types.isObject(type) || url.isAbsolute(type) ||
5486
+ (type === '@json')) ||
5451
5487
  (types.isString(type) && type.indexOf('_:') === 0)) {
5452
5488
  throw new JsonLdError(
5453
5489
  'Invalid JSON-LD syntax; invalid @type in frame.',
@@ -5817,7 +5853,7 @@ function _valueMatch(pattern, value) {
5817
5853
 
5818
5854
  "use strict";
5819
5855
  /*
5820
- * Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
5856
+ * Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
5821
5857
  */
5822
5858
 
5823
5859
 
@@ -5870,14 +5906,28 @@ api.fromRDF = async (
5870
5906
  dataset,
5871
5907
  options
5872
5908
  ) => {
5873
- const defaultGraph = {};
5874
- const graphMap = {'@default': defaultGraph};
5875
- const referencedOnce = {};
5876
5909
  const {
5877
5910
  useRdfType = false,
5878
5911
  useNativeTypes = false,
5879
5912
  rdfDirection = null
5880
5913
  } = options;
5914
+ // FIXME: use Maps?
5915
+ const defaultGraph = {};
5916
+ const graphMap = {'@default': defaultGraph};
5917
+ const referencedOnce = {};
5918
+ if(rdfDirection) {
5919
+ if(rdfDirection === 'compound-literal') {
5920
+ throw new JsonLdError(
5921
+ 'Unsupported rdfDirection value.',
5922
+ 'jsonld.InvalidRdfDirection',
5923
+ {value: rdfDirection});
5924
+ } else if(rdfDirection !== 'i18n-datatype') {
5925
+ throw new JsonLdError(
5926
+ 'Unknown rdfDirection value.',
5927
+ 'jsonld.InvalidRdfDirection',
5928
+ {value: rdfDirection});
5929
+ }
5930
+ }
5881
5931
 
5882
5932
  for(const quad of dataset) {
5883
5933
  // TODO: change 'name' to 'graph'
@@ -6462,7 +6512,8 @@ const _resolvedContextCache = new LRU({max: RESOLVED_CONTEXT_CACHE_MAX_SIZE});
6462
6512
  * [graph] true to always output a top-level graph (default: false).
6463
6513
  * [expandContext] a context to expand with.
6464
6514
  * [skipExpansion] true to assume the input is expanded and skip
6465
- * expansion, false not to, defaults to false.
6515
+ * expansion, false not to, defaults to false. Some well-formed
6516
+ * and safe-mode checks may be omitted.
6466
6517
  * [documentLoader(url, options)] the document loader.
6467
6518
  * [framing] true if compaction is occuring during a framing operation.
6468
6519
  * [safe] true to use safe mode. (default: false)
@@ -6882,13 +6933,16 @@ jsonld.link = async function(input, ctx, options) {
6882
6933
  * [base] the base IRI to use (default: `null`).
6883
6934
  * [expandContext] a context to expand with.
6884
6935
  * [skipExpansion] true to assume the input is expanded and skip
6885
- * expansion, false not to, defaults to false.
6936
+ * expansion, false not to, defaults to false. Some well-formed
6937
+ * and safe-mode checks may be omitted.
6886
6938
  * [inputFormat] the format if input is not JSON-LD:
6887
6939
  * 'application/n-quads' for N-Quads.
6888
6940
  * [format] the format if output is a string:
6889
6941
  * 'application/n-quads' for N-Quads.
6890
6942
  * [documentLoader(url, options)] the document loader.
6891
6943
  * [useNative] true to use a native canonize algorithm
6944
+ * [rdfDirection] null or 'i18n-datatype' to support RDF
6945
+ * transformation of @direction (default: null).
6892
6946
  * [safe] true to use safe mode. (default: true).
6893
6947
  * [contextResolver] internal use only.
6894
6948
  *
@@ -6945,8 +6999,8 @@ jsonld.normalize = jsonld.canonize = async function(input, options) {
6945
6999
  * (default: false).
6946
7000
  * [useNativeTypes] true to convert XSD types into native types
6947
7001
  * (boolean, integer, double), false not to (default: false).
6948
- * [rdfDirection] 'i18n-datatype' to support RDF transformation of
6949
- * @direction (default: null).
7002
+ * [rdfDirection] null or 'i18n-datatype' to support RDF
7003
+ * transformation of @direction (default: null).
6950
7004
  * [safe] true to use safe mode. (default: false)
6951
7005
  *
6952
7006
  * @return a Promise that resolves to the JSON-LD document.
@@ -6991,13 +7045,16 @@ jsonld.fromRDF = async function(dataset, options) {
6991
7045
  * [base] the base IRI to use.
6992
7046
  * [expandContext] a context to expand with.
6993
7047
  * [skipExpansion] true to assume the input is expanded and skip
6994
- * expansion, false not to, defaults to false.
7048
+ * expansion, false not to, defaults to false. Some well-formed
7049
+ * and safe-mode checks may be omitted.
6995
7050
  * [format] the format to use to output a string:
6996
7051
  * 'application/n-quads' for N-Quads.
6997
7052
  * [produceGeneralizedRdf] true to output generalized RDF, false
6998
7053
  * to produce only standard RDF (default: false).
6999
7054
  * [documentLoader(url, options)] the document loader.
7000
7055
  * [safe] true to use safe mode. (default: false)
7056
+ * [rdfDirection] null or 'i18n-datatype' to support RDF
7057
+ * transformation of @direction (default: null).
7001
7058
  * [contextResolver] internal use only.
7002
7059
  *
7003
7060
  * @return a Promise that resolves to the RDF dataset.
@@ -7768,7 +7825,7 @@ api.setupGlobals = function(jsonld) {
7768
7825
 
7769
7826
  "use strict";
7770
7827
  /*
7771
- * Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
7828
+ * Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
7772
7829
  */
7773
7830
 
7774
7831
 
@@ -7776,6 +7833,7 @@ const {createNodeMap} = __webpack_require__(/*! ./nodeMap */ "./node_modules/jso
7776
7833
  const {isKeyword} = __webpack_require__(/*! ./context */ "./node_modules/jsonld/lib/context.js");
7777
7834
  const graphTypes = __webpack_require__(/*! ./graphTypes */ "./node_modules/jsonld/lib/graphTypes.js");
7778
7835
  const jsonCanonicalize = __webpack_require__(/*! canonicalize */ "./node_modules/canonicalize/lib/canonicalize.js");
7836
+ const JsonLdError = __webpack_require__(/*! ./JsonLdError */ "./node_modules/jsonld/lib/JsonLdError.js");
7779
7837
  const types = __webpack_require__(/*! ./types */ "./node_modules/jsonld/lib/types.js");
7780
7838
  const util = __webpack_require__(/*! ./util */ "./node_modules/jsonld/lib/util.js");
7781
7839
 
@@ -8081,18 +8139,61 @@ function _objectToRDF(
8081
8139
  } else if(types.isNumber(value)) {
8082
8140
  object.value = value.toFixed(0);
8083
8141
  object.datatype.value = datatype || XSD_INTEGER;
8084
- } else if(rdfDirection === 'i18n-datatype' &&
8085
- '@direction' in item) {
8086
- const datatype = 'https://www.w3.org/ns/i18n#' +
8087
- (item['@language'] || '') +
8088
- `_${item['@direction']}`;
8142
+ } else if('@direction' in item && rdfDirection === 'i18n-datatype') {
8143
+ const language = (item['@language'] || '').toLowerCase();
8144
+ const direction = item['@direction'];
8145
+ const datatype = `https://www.w3.org/ns/i18n#${language}_${direction}`;
8089
8146
  object.datatype.value = datatype;
8090
8147
  object.value = value;
8148
+ } else if('@direction' in item && rdfDirection === 'compound-literal') {
8149
+ throw new JsonLdError(
8150
+ 'Unsupported rdfDirection value.',
8151
+ 'jsonld.InvalidRdfDirection',
8152
+ {value: rdfDirection});
8153
+ } else if('@direction' in item && rdfDirection) {
8154
+ throw new JsonLdError(
8155
+ 'Unknown rdfDirection value.',
8156
+ 'jsonld.InvalidRdfDirection',
8157
+ {value: rdfDirection});
8091
8158
  } else if('@language' in item) {
8159
+ if('@direction' in item && !rdfDirection) {
8160
+ if(options.eventHandler) {
8161
+ // FIXME: only emit once?
8162
+ _handleEvent({
8163
+ event: {
8164
+ type: ['JsonLdEvent'],
8165
+ code: 'rdfDirection not set',
8166
+ level: 'warning',
8167
+ message: 'rdfDirection not set for @direction.',
8168
+ details: {
8169
+ object: object.value
8170
+ }
8171
+ },
8172
+ options
8173
+ });
8174
+ }
8175
+ }
8092
8176
  object.value = value;
8093
8177
  object.datatype.value = datatype || RDF_LANGSTRING;
8094
8178
  object.language = item['@language'];
8095
8179
  } else {
8180
+ if('@direction' in item && !rdfDirection) {
8181
+ if(options.eventHandler) {
8182
+ // FIXME: only emit once?
8183
+ _handleEvent({
8184
+ event: {
8185
+ type: ['JsonLdEvent'],
8186
+ code: 'rdfDirection not set',
8187
+ level: 'warning',
8188
+ message: 'rdfDirection not set for @direction.',
8189
+ details: {
8190
+ object: object.value
8191
+ }
8192
+ },
8193
+ options
8194
+ });
8195
+ }
8196
+ }
8096
8197
  object.value = value;
8097
8198
  object.datatype.value = datatype || XSD_STRING;
8098
8199
  }
@@ -8273,7 +8374,7 @@ api.parsers = {
8273
8374
  'hostname', 'port', 'path', 'directory', 'file', 'query', 'fragment'
8274
8375
  ],
8275
8376
  /* eslint-disable-next-line max-len */
8276
- regex: /^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
8377
+ regex: /^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
8277
8378
  }
8278
8379
  };
8279
8380
  api.parse = (str, parser) => {
@@ -10054,11 +10155,12 @@ const NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/
10054
10155
  module.exports = class URDNA2015 {
10055
10156
  constructor({
10056
10157
  createMessageDigest = () => new MessageDigest('sha256'),
10158
+ canonicalIdMap = new Map(),
10057
10159
  maxDeepIterations = Infinity
10058
10160
  } = {}) {
10059
10161
  this.name = 'URDNA2015';
10060
10162
  this.blankNodeInfo = new Map();
10061
- this.canonicalIssuer = new IdentifierIssuer('_:c14n');
10163
+ this.canonicalIssuer = new IdentifierIssuer('_:c14n', canonicalIdMap);
10062
10164
  this.createMessageDigest = createMessageDigest;
10063
10165
  this.maxDeepIterations = maxDeepIterations;
10064
10166
  this.quads = null;
@@ -10594,11 +10696,12 @@ const NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/
10594
10696
  module.exports = class URDNA2015Sync {
10595
10697
  constructor({
10596
10698
  createMessageDigest = () => new MessageDigest('sha256'),
10699
+ canonicalIdMap = new Map(),
10597
10700
  maxDeepIterations = Infinity
10598
10701
  } = {}) {
10599
10702
  this.name = 'URDNA2015';
10600
10703
  this.blankNodeInfo = new Map();
10601
- this.canonicalIssuer = new IdentifierIssuer('_:c14n');
10704
+ this.canonicalIssuer = new IdentifierIssuer('_:c14n', canonicalIdMap);
10602
10705
  this.createMessageDigest = createMessageDigest;
10603
10706
  this.maxDeepIterations = maxDeepIterations;
10604
10707
  this.quads = null;
@@ -11300,7 +11403,7 @@ module.exports = class URDNA2012Sync extends URDNA2015Sync {
11300
11403
  * This library works in the browser and node.js.
11301
11404
  *
11302
11405
  * BSD 3-Clause License
11303
- * Copyright (c) 2016-2022 Digital Bazaar, Inc.
11406
+ * Copyright (c) 2016-2023 Digital Bazaar, Inc.
11304
11407
  * All rights reserved.
11305
11408
  *
11306
11409
  * Redistribution and use in source and binary forms, with or without
@@ -11342,6 +11445,15 @@ try {
11342
11445
  rdfCanonizeNative = __webpack_require__(/*! rdf-canonize-native */ "?2b19");
11343
11446
  } catch(e) {}
11344
11447
 
11448
+ // return a dataset from input dataset or legacy dataset
11449
+ function _inputToDataset(input/*, options*/) {
11450
+ // back-compat with legacy dataset
11451
+ if(!Array.isArray(input)) {
11452
+ return exports.NQuads.legacyDatasetToQuads(input);
11453
+ }
11454
+ return input;
11455
+ }
11456
+
11345
11457
  // expose helpers
11346
11458
  exports.NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/lib/NQuads.js");
11347
11459
  exports.IdentifierIssuer = __webpack_require__(/*! ./IdentifierIssuer */ "./node_modules/rdf-canonize/lib/IdentifierIssuer.js");
@@ -11363,7 +11475,8 @@ exports._rdfCanonizeNative = function(api) {
11363
11475
  /**
11364
11476
  * Asynchronously canonizes an RDF dataset.
11365
11477
  *
11366
- * @param {Array} dataset - The dataset to canonize.
11478
+ * @param {Array|object|string} input - The input to canonize given as a
11479
+ * dataset or legacy dataset.
11367
11480
  * @param {object} options - The options to use:
11368
11481
  * {string} algorithm - The canonicalization algorithm to use, `URDNA2015` or
11369
11482
  * `URGNA2012`.
@@ -11372,6 +11485,9 @@ exports._rdfCanonizeNative = function(api) {
11372
11485
  * implementation used by the canonize algorithm; note that using a hash
11373
11486
  * algorithm (or HMAC algorithm) that differs from the one specified by
11374
11487
  * the canonize algorithm will result in different output.
11488
+ * {Map} [canonicalIdMap] - An optional Map to be populated by the canonical
11489
+ * identifier issuer with the bnode identifier mapping generated by the
11490
+ * canonicalization algorithm.
11375
11491
  * {boolean} [useNative=false] - Use native implementation.
11376
11492
  * {number} [maxDeepIterations=Infinity] - The maximum number of times to run
11377
11493
  * deep comparison algorithms (such as the N-Degree Hash Quads algorithm
@@ -11382,11 +11498,8 @@ exports._rdfCanonizeNative = function(api) {
11382
11498
  *
11383
11499
  * @return a Promise that resolves to the canonicalized RDF Dataset.
11384
11500
  */
11385
- exports.canonize = async function(dataset, options) {
11386
- // back-compat with legacy dataset
11387
- if(!Array.isArray(dataset)) {
11388
- dataset = exports.NQuads.legacyDatasetToQuads(dataset);
11389
- }
11501
+ exports.canonize = async function(input, options) {
11502
+ const dataset = _inputToDataset(input, options);
11390
11503
 
11391
11504
  if(options.useNative) {
11392
11505
  if(!rdfCanonizeNative) {
@@ -11423,7 +11536,8 @@ exports.canonize = async function(dataset, options) {
11423
11536
  * only. It synchronously canonizes an RDF dataset and does not work in the
11424
11537
  * browser.
11425
11538
  *
11426
- * @param {Array} dataset - The dataset to canonize.
11539
+ * @param {Array|object|string} input - The input to canonize given as a
11540
+ * dataset or legacy dataset.
11427
11541
  * @param {object} options - The options to use:
11428
11542
  * {string} algorithm - The canonicalization algorithm to use, `URDNA2015` or
11429
11543
  * `URGNA2012`.
@@ -11442,11 +11556,8 @@ exports.canonize = async function(dataset, options) {
11442
11556
  *
11443
11557
  * @return the RDF dataset in canonical form.
11444
11558
  */
11445
- exports._canonizeSync = function(dataset, options) {
11446
- // back-compat with legacy dataset
11447
- if(!Array.isArray(dataset)) {
11448
- dataset = exports.NQuads.legacyDatasetToQuads(dataset);
11449
- }
11559
+ exports._canonizeSync = function(input, options) {
11560
+ const dataset = _inputToDataset(input, options);
11450
11561
 
11451
11562
  if(options.useNative) {
11452
11563
  if(!rdfCanonizeNative) {