lucos_search_component 3.0.5 → 4.0.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.
package/dist/index.js CHANGED
@@ -5704,9 +5704,9 @@ var categoryColoursCSS = "/* Generated by scripts/generate-colours.js — do not
5704
5704
  function buildFilterBy(types, excludeTypes, isContact) {
5705
5705
  const parts = [];
5706
5706
  if (types) {
5707
- parts.push(`type:=[${types}]`);
5707
+ parts.push(`types:=[${types}]`);
5708
5708
  } else if (excludeTypes) {
5709
- parts.push(`type:!=[${excludeTypes}]`);
5709
+ parts.push(`types:!=[${excludeTypes}]`);
5710
5710
  }
5711
5711
  if (isContact === 'true') {
5712
5712
  parts.push('is_contact:=true');
@@ -6129,7 +6129,7 @@ class LucosSearchComponent extends HTMLSpanElement {
6129
6129
  if (!key) { this._langFamilies = []; return []; }
6130
6130
  const searchParams = new URLSearchParams({
6131
6131
  q: '*',
6132
- filter_by: 'type:=Language Family',
6132
+ filter_by: 'types:=Language Family',
6133
6133
  query_by: 'pref_label',
6134
6134
  include_fields: 'id,pref_label',
6135
6135
  sort_by: 'pref_label:asc',
@@ -8,7 +8,7 @@
8
8
  <label for="search2">No Tracks:</label><span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-exclude_types="Track"><select id="search2"></select></span>
9
9
  <label for="search3">Only Cites and Rivers:</label><span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-types="City,River"><select id="search3"></select></span>
10
10
  <label for="search4">Load with existing items:</label><span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}"><select id="search4" multiple>
11
- <option selected>https://contacts.l42.eu/people/2</option>
11
+ <option selected>https://eolas.l42.eu/metadata/person/2/</option>
12
12
  <option selected>https://eolas.l42.eu/metadata/place/2/</option>
13
13
  <option selected>https://media-metadata.l42.eu/tracks/13713</option>
14
14
  <option selected>https://eolas.l42.eu/metadata/language/ain/</option>
@@ -40,11 +40,11 @@
40
40
  <div style="column-count: 2; column-gap: 2em; border: 1px solid #ccc; padding: 1em;">
41
41
  <div style="break-inside: avoid;">
42
42
  <label for="col-search1">Theme tune:</label>
43
- <span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-types="CreativeWork"><select id="col-search1"></select></span>
43
+ <span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-types="Creative Work"><select id="col-search1"></select></span>
44
44
  </div>
45
45
  <div style="break-inside: avoid;">
46
46
  <label for="col-search2">Soundtrack:</label>
47
- <span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-types="CreativeWork"><select id="col-search2"></select></span>
47
+ <span is="lucos-search" data-api-key="${KEY_LUCOS_ARACHNE}" data-types="Creative Work"><select id="col-search2"></select></span>
48
48
  </div>
49
49
  <div style="break-inside: avoid;">
50
50
  <label for="col-search3">Language:</label>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucos_search_component",
3
- "version": "3.0.5",
3
+ "version": "4.0.0",
4
4
  "description": "Web Components for searching lucOS data",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,5 +19,15 @@ test('omitting data-is-contact produces no is_contact filter', () => {
19
19
 
20
20
  test('data-is-contact combines correctly with data-types', () => {
21
21
  const result = buildFilterBy('Person', null, 'true');
22
- assert.equal(result, 'type:=[Person] && is_contact:=true');
22
+ assert.equal(result, 'types:=[Person] && is_contact:=true');
23
+ });
24
+
25
+ test('data-types produces types:= filter', () => {
26
+ const result = buildFilterBy('City,River', null, null);
27
+ assert.equal(result, 'types:=[City,River]');
28
+ });
29
+
30
+ test('data-exclude-types produces types:!= filter', () => {
31
+ const result = buildFilterBy(null, 'Track', null);
32
+ assert.equal(result, 'types:!=[Track]');
23
33
  });
@@ -9,9 +9,9 @@
9
9
  export function buildFilterBy(types, excludeTypes, isContact) {
10
10
  const parts = [];
11
11
  if (types) {
12
- parts.push(`type:=[${types}]`);
12
+ parts.push(`types:=[${types}]`);
13
13
  } else if (excludeTypes) {
14
- parts.push(`type:!=[${excludeTypes}]`);
14
+ parts.push(`types:!=[${excludeTypes}]`);
15
15
  }
16
16
  if (isContact === 'true') {
17
17
  parts.push('is_contact:=true');
@@ -416,7 +416,7 @@ class LucosSearchComponent extends HTMLSpanElement {
416
416
  if (!key) { this._langFamilies = []; return []; }
417
417
  const searchParams = new URLSearchParams({
418
418
  q: '*',
419
- filter_by: 'type:=Language Family',
419
+ filter_by: 'types:=Language Family',
420
420
  query_by: 'pref_label',
421
421
  include_fields: 'id,pref_label',
422
422
  sort_by: 'pref_label:asc',