@rr0/cms 0.2.3 → 0.2.5

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.
@@ -3,11 +3,11 @@ import { RR0EventFactory, TypedDataFactory } from "@rr0/data";
3
3
  import { PeopleJson } from "./PeopleJson";
4
4
  export declare class PeopleFactory extends TypedDataFactory<People, PeopleJson> {
5
5
  constructor(eventFactory: RR0EventFactory);
6
+ parse(peopleJson: PeopleJson): People;
6
7
  /**
7
8
  * Determine people name from directory name.
8
9
  *
9
10
  * @param peopleJson
10
11
  */
11
12
  protected completeFromDirName(peopleJson: PeopleJson): PeopleJson;
12
- parse(peopleJson: PeopleJson): People;
13
13
  }
@@ -6,33 +6,6 @@ export class PeopleFactory extends TypedDataFactory {
6
6
  constructor(eventFactory) {
7
7
  super(eventFactory, "people");
8
8
  }
9
- /**
10
- * Determine people name from directory name.
11
- *
12
- * @param peopleJson
13
- */
14
- completeFromDirName(peopleJson) {
15
- const result = { ...peopleJson };
16
- const dirName = peopleJson.dirName;
17
- if (dirName) {
18
- const lastSlash = dirName.lastIndexOf("/");
19
- const lastDir = dirName.substring(lastSlash + 1);
20
- const title = StringUtil.camelToText(lastDir);
21
- const firstSpace = title.indexOf(" ");
22
- const lastName = title.substring(0, firstSpace);
23
- result.lastName = peopleJson.lastName || lastName;
24
- const firstNameStr = title.substring(firstSpace + 1);
25
- const firstNames = firstNameStr.split(" ");
26
- result.firstNames = peopleJson.firstNames || firstNames;
27
- const id = path.basename(dirName);
28
- result.id = peopleJson.id || id;
29
- result.title = `${firstNames.join(" ")} ${lastName}`;
30
- }
31
- else {
32
- result.dirName = "";
33
- }
34
- return result;
35
- }
36
9
  parse(peopleJson) {
37
10
  peopleJson = this.completeFromDirName(peopleJson);
38
11
  const peopleData = super.parse(peopleJson);
@@ -63,4 +36,31 @@ export class PeopleFactory extends TypedDataFactory {
63
36
  people.title = people.firstAndLastName + (qualifier ? ` (${qualifier})` : "");
64
37
  return people;
65
38
  }
39
+ /**
40
+ * Determine people name from directory name.
41
+ *
42
+ * @param peopleJson
43
+ */
44
+ completeFromDirName(peopleJson) {
45
+ const result = { ...peopleJson };
46
+ const dirName = peopleJson.dirName;
47
+ if (dirName) {
48
+ const lastSlash = dirName.lastIndexOf("/");
49
+ const lastDir = dirName.substring(lastSlash + 1);
50
+ const title = StringUtil.camelToText(lastDir);
51
+ const firstSpace = title.indexOf(" ");
52
+ const lastName = title.substring(0, firstSpace);
53
+ result.lastName = peopleJson.lastName || lastName;
54
+ const firstNameStr = title.substring(firstSpace + 1);
55
+ const firstNames = firstNameStr.split(" ");
56
+ result.firstNames = peopleJson.firstNames || firstNames;
57
+ const id = path.basename(dirName);
58
+ result.id = peopleJson.id || id;
59
+ result.title = `${firstNames.join(" ")} ${lastName}`;
60
+ }
61
+ else {
62
+ result.dirName = "";
63
+ }
64
+ return result;
65
+ }
66
66
  }
@@ -6,11 +6,11 @@ export class SearchComponent extends HTMLElement {
6
6
  static readonly NAME: string;
7
7
  static get observedAttributes(): string[];
8
8
  shadow: ShadowRoot;
9
- attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
10
9
  /**
11
10
  * @param {string} value
12
11
  */
13
12
  set placeholder(value: string);
13
+ attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
14
14
  connectedCallback(): void;
15
15
  #private;
16
16
  }
@@ -49,12 +49,6 @@ export class SearchComponent extends HTMLElement {
49
49
  static get observedAttributes() {
50
50
  return ["placeholder"];
51
51
  }
52
- attributeChangedCallback(name, oldValue, newValue) {
53
- switch (name) {
54
- case "placeholder":
55
- this.placeholder = newValue;
56
- }
57
- }
58
52
  /**
59
53
  * @param {string} value
60
54
  */
@@ -62,6 +56,12 @@ export class SearchComponent extends HTMLElement {
62
56
  const input = this.shadow.getElementById("search-input");
63
57
  input.placeholder = value;
64
58
  }
59
+ attributeChangedCallback(name, oldValue, newValue) {
60
+ switch (name) {
61
+ case "placeholder":
62
+ this.placeholder = newValue;
63
+ }
64
+ }
65
65
  connectedCallback() {
66
66
  this.onmouseover = __classPrivateFieldGet(this, _SearchComponent_instances, "m", _SearchComponent_siteSearchLoad).bind(this);
67
67
  const input = this.shadow.getElementById("search-input");
@@ -29,6 +29,7 @@ export class SourceFactory {
29
29
  * @param href
30
30
  */
31
31
  async createInternal(context, href) {
32
+ var _a;
32
33
  if (path.dirname(href).startsWith("/")) {
33
34
  href = href.substring(1);
34
35
  }
@@ -65,7 +66,7 @@ export class SourceFactory {
65
66
  }
66
67
  const publication = source.publication;
67
68
  if (publication && !publication.time) {
68
- publication.time = this.time.contextFromFileName(context, href).date;
69
+ publication.time = (_a = this.time.contextFromFileName(context, href)) === null || _a === void 0 ? void 0 : _a.date;
69
70
  }
70
71
  if (hash) {
71
72
  source.index = hash;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@rr0/cms",
3
3
  "type": "module",
4
4
  "author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
5
- "version": "0.2.3",
5
+ "version": "0.2.5",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@rr0/common": "^1.1.3",
32
32
  "@rr0/lang": "^0.1.12",
33
- "@rr0/time": "^0.9.1",
33
+ "@rr0/time": "^0.9.2",
34
34
  "@rr0/place": "^0.5.1",
35
35
  "@rr0/data": "^0.2.3",
36
36
  "@javarome/fileutil": "^0.3.6",