@rr0/cms 0.1.14 → 0.1.16
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/BaseReplaceCommand.d.ts +2 -2
- package/dist/DefaultContentVisitor.d.ts +11 -11
- package/dist/DescriptionReplaceCommand.d.ts +3 -3
- package/dist/ImageCommand.d.ts +3 -3
- package/dist/MetaLinkReplaceCommand.d.ts +3 -3
- package/dist/OpenGraphCommand.d.ts +6 -6
- package/dist/OpenGraphCommand.js +1 -1
- package/dist/RR0ContentStep.d.ts +11 -11
- package/dist/RR0ContentStep.js +2 -2
- package/dist/{RR0SsgContext.d.ts → RR0Context.d.ts} +8 -8
- package/dist/{RR0SsgContext.js → RR0Context.js} +4 -4
- package/dist/anchor/AnchorHandler.d.ts +2 -2
- package/dist/anchor/AnchorReplaceCommand.d.ts +2 -2
- package/dist/anchor/AnchorReplacer.d.ts +3 -3
- package/dist/anchor/CaseAnchorHandler.d.ts +2 -2
- package/dist/anchor/CaseAnchorHandler.js +2 -2
- package/dist/anchor/DataAnchorHandler.d.ts +6 -6
- package/dist/book/BookContentVisitor.d.ts +2 -2
- package/dist/book/BookDirectoryStep.d.ts +5 -5
- package/dist/book/BookService.d.ts +3 -1
- package/dist/book/BookService.js +4 -4
- package/dist/book/Chapters.d.ts +3 -3
- package/dist/book/Chapters.js +2 -2
- package/dist/build.js +27 -8
- package/dist/data/AbstractDataFactory.d.ts +3 -2
- package/dist/data/AbstractDataFactory.js +1 -1
- package/dist/data/AbstractDataService.d.ts +2 -3
- package/dist/data/AbstractDataService.js +2 -8
- package/dist/data/RR0Data.d.ts +4 -3
- package/dist/data/TypedDataFactory.d.ts +3 -2
- package/dist/data/TypedDataFactory.js +4 -0
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +1 -1
- package/dist/index/IndexedReplacer.d.ts +4 -4
- package/dist/index/IndexedReplacerFactory.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lang/LanguageReplaceCommand.d.ts +3 -3
- package/dist/lang/RR0Messages.d.ts +1 -1
- package/dist/lang/RR0Messages_en.d.ts +1 -1
- package/dist/lang/RR0Messages_en.js +1 -1
- package/dist/lang/RR0Messages_fr.d.ts +1 -1
- package/dist/lang/RR0Messages_fr.js +1 -1
- package/dist/note/NoteFileCounter.d.ts +2 -2
- package/dist/note/NoteRenderer.d.ts +2 -2
- package/dist/note/NoteReplacer.d.ts +2 -2
- package/dist/note/NoteReplacerFactory.d.ts +2 -2
- package/dist/org/OrgMessages.d.ts +2 -2
- package/dist/org/Organization.d.ts +3 -3
- package/dist/org/Organization.js +3 -3
- package/dist/org/OrganizationMessages.d.ts +3 -3
- package/dist/org/OrganizationService.d.ts +4 -3
- package/dist/org/OrganizationService.js +10 -9
- package/dist/org/au/region/vic/index.d.ts +1 -1
- package/dist/org/au/region/vic/index.js +1 -1
- package/dist/org/br/region/cw/CentralWest.js +1 -1
- package/dist/org/br/region/se/SouthEast.js +1 -1
- package/dist/org/country/region/department/city/CityService.d.ts +2 -2
- package/dist/org/country/region/department/city/CityService.js +2 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummary.d.ts +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.d.ts +4 -4
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanDatasource.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanFileDatasource.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanHttpDatasource.d.ts +6 -5
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanSummaryToCaseMapper.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestCases.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestimonial.d.ts +1 -1
- package/dist/org/us/region/fl/Florida.js +1 -1
- package/dist/org/us/region/hi/Hawaii.js +1 -1
- package/dist/org/us/region/in/Indiana.js +1 -1
- package/dist/org/us/region/va/Virginia.js +1 -1
- package/dist/org/us/region/wa/Washington.js +1 -1
- package/dist/org/us/region/wv/WestVirginia.js +1 -1
- package/dist/people/PeopleDirectoryStep.d.ts +4 -4
- package/dist/people/PeopleReplacer.d.ts +3 -3
- package/dist/people/PeopleReplacerFactory.d.ts +2 -2
- package/dist/people/PeopleService.d.ts +3 -4
- package/dist/people/PeopleService.js +3 -14
- package/dist/people/author/AuthorReplaceCommand.d.ts +2 -2
- package/dist/people/witness/WitnessReplacer.d.ts +2 -2
- package/dist/people/witness/WitnessReplacerFactory.d.ts +2 -2
- package/dist/place/GooglePlaceService.d.ts +1 -1
- package/dist/place/GooglePlaceService.js +1 -1
- package/dist/place/Place.d.ts +1 -1
- package/dist/place/Place.js +1 -1
- package/dist/place/PlaceService.d.ts +1 -1
- package/dist/place/PlaceService.js +1 -1
- package/dist/place/index.d.ts +0 -4
- package/dist/place/index.js +0 -4
- package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.d.ts +5 -5
- package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.js +1 -1
- package/dist/science/crypto/ufo/enquete/dossier/CaseService.d.ts +3 -3
- package/dist/science/crypto/ufo/enquete/dossier/CaseService.js +2 -2
- package/dist/search/SearchVisitor.d.ts +5 -5
- package/dist/source/Source.d.ts +1 -1
- package/dist/source/SourceFactory.d.ts +4 -4
- package/dist/source/SourceFactory.js +3 -2
- package/dist/source/SourceFileCounter.d.ts +2 -2
- package/dist/source/SourceRegistry.d.ts +2 -2
- package/dist/source/SourceRenderer.d.ts +3 -3
- package/dist/source/SourceRenderer.js +2 -2
- package/dist/source/SourceReplacer.d.ts +3 -3
- package/dist/source/SourceReplacerFactory.d.ts +2 -2
- package/dist/tech/info/soft/proj/impl/lang/CodeReplacer.d.ts +3 -3
- package/dist/tech/info/soft/proj/impl/lang/CodeReplacerFactory.d.ts +2 -2
- package/dist/time/CaseSummaryRenderer.d.ts +1 -1
- package/dist/time/EventRenderer.d.ts +7 -7
- package/dist/time/EventReplacerFactory.d.ts +4 -4
- package/dist/time/SsiTitleReplaceCommand.d.ts +2 -2
- package/dist/time/Time.d.ts +5 -3
- package/dist/time/Time.js +31 -5
- package/dist/time/TimeLinkDefaultHandler.d.ts +10 -9
- package/dist/time/TimeLinkDefaultHandler.js +8 -12
- package/dist/time/TimeService.d.ts +16 -7
- package/dist/time/TimeService.js +16 -22
- package/dist/time/TimeTestUtil.d.ts +16 -0
- package/dist/time/TimeTestUtil.js +29 -0
- package/dist/time/TimeUrlBuilder.d.ts +7 -3
- package/dist/time/TimeUrlBuilder.js +7 -4
- package/dist/time/datasource/AbstractDatasource.d.ts +6 -6
- package/dist/time/datasource/ChronologyReplacer.d.ts +6 -6
- package/dist/time/datasource/ChronologyReplacerFactory.d.ts +2 -2
- package/dist/time/datasource/ChronologyReplacerFactory.js +1 -1
- package/dist/time/datasource/ContextFilter.d.ts +3 -3
- package/dist/time/datasource/CsvFileSource.d.ts +2 -2
- package/dist/time/datasource/CsvMapper.d.ts +5 -5
- package/dist/time/datasource/CsvMapper.js +1 -1
- package/dist/time/datasource/Datasource.d.ts +2 -2
- package/dist/time/datasource/DatasourceTestCase.d.ts +8 -8
- package/dist/time/datasource/DatasourceTestCase.js +18 -16
- package/dist/time/datasource/FileDatasource.d.ts +2 -2
- package/dist/time/datasource/JsonMapper.d.ts +4 -4
- package/dist/time/datasource/TimeContextFilter.d.ts +3 -3
- package/dist/time/datasource/acufo/AcufoCase.d.ts +1 -1
- package/dist/time/datasource/acufo/AcufoDatasource.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummary.d.ts +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.js +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceDatasource.d.ts +2 -2
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceHttpDatasource.d.ts +6 -6
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceTestCases.js +1 -1
- package/dist/time/datasource/fufora/FuforaCaseSummary.d.ts +1 -1
- package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/fufora/FuforaDatasource.d.ts +2 -2
- package/dist/time/datasource/fufora/FuforaHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/fufora/FuforaTestCases.js +1 -1
- package/dist/time/datasource/nuforc/NuforcCaseSummary.d.ts +1 -1
- package/dist/time/datasource/nuforc/NuforcDatasource.d.ts +2 -2
- package/dist/time/datasource/nuforc/NuforcHttpDatasource.d.ts +6 -6
- package/dist/time/datasource/nuforc/NuforcRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/nuforc/NuforcRR0Mapper.js +1 -1
- package/dist/time/datasource/nuforc/NuforcTestCases.js +1 -1
- package/dist/time/datasource/rr0/NamedPlace.d.ts +7 -0
- package/dist/time/datasource/rr0/RR0CaseMapping.d.ts +2 -2
- package/dist/time/datasource/rr0/RR0CaseSummary.d.ts +0 -7
- package/dist/time/datasource/rr0/RR0CaseSummaryMapper.d.ts +3 -3
- package/dist/time/datasource/rr0/RR0FileDatasource.d.ts +5 -5
- package/dist/time/datasource/rr0/RR0HttpDatasource.d.ts +10 -9
- package/dist/time/datasource/rr0/RR0HttpDatasource.js +3 -32
- package/dist/time/datasource/rr0/RR0TestCases.js +1 -1
- package/dist/time/datasource/rr0/index.d.ts +1 -0
- package/dist/time/datasource/rr0/index.js +1 -0
- package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/sceau/SceauDatasource.d.ts +4 -4
- package/dist/time/datasource/sceau/SceauDatasource.js +1 -1
- package/dist/time/datasource/sceau/SceauHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/ufo-search/UfoSearchCase.d.ts +1 -1
- package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.d.ts +4 -4
- package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.js +10 -10
- package/dist/time/datasource/ufo-search/UfoSearchDatasource.d.ts +2 -2
- package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.d.ts +3 -3
- package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.js +1 -1
- package/dist/time/datasource/ufo-search/UfoSearchHttpDatasource.d.ts +4 -4
- package/dist/time/datasource/ufo-search/UfoSearchTestCases.js +1 -1
- package/dist/time/datasource/urecat/UrecatCase.d.ts +1 -1
- package/dist/time/datasource/urecat/UrecatHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/urecat/UrecatHttpDatasource.js +1 -1
- package/dist/time/datasource/urecat/UrecatRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/urecat/UrecatRR0Mapper.js +1 -1
- package/dist/time/datasource/urecat/UrecatTestCases.js +1 -1
- package/dist/time/html/TimeElementFactory.d.ts +15 -0
- package/dist/time/{TimeElementFactory.js → html/TimeElementFactory.js} +16 -22
- package/dist/time/html/TimeRenderer.d.ts +18 -0
- package/dist/time/html/TimeRenderer.js +46 -0
- package/dist/time/html/TimeReplacer.d.ts +12 -0
- package/dist/time/{TimeReplacer.js → html/TimeReplacer.js} +0 -3
- package/dist/time/{TimeReplacerFactory.d.ts → html/TimeReplacerFactory.d.ts} +2 -2
- package/dist/time/{TimeReplacerFactory.js → html/TimeReplacerFactory.js} +1 -1
- package/dist/time/html/index.d.ts +4 -0
- package/dist/time/html/index.js +4 -0
- package/dist/time/index.d.ts +3 -8
- package/dist/time/index.js +3 -8
- package/dist/time/{RelativeTimeTextBuilder.d.ts → text/RelativeTimeTextBuilder.d.ts} +2 -2
- package/dist/time/text/RelativeTimeTextBuilder.js +165 -0
- package/dist/time/{TimeTextBuilder.d.ts → text/TimeTextBuilder.d.ts} +2 -2
- package/dist/time/{TimeTextBuilder.js → text/TimeTextBuilder.js} +1 -1
- package/dist/time/text/index.d.ts +2 -0
- package/dist/time/text/index.js +2 -0
- package/dist/value/UnitReplaceCommand.d.ts +2 -2
- package/package.json +12 -11
- package/tsconfig.json +2 -1
- package/dist/place/PlaceLocation.d.ts +0 -26
- package/dist/place/PlaceLocation.js +0 -48
- package/dist/place/PlaceMessages.d.ts +0 -5
- package/dist/place/PlaceMessages_en.d.ts +0 -2
- package/dist/place/PlaceMessages_en.js +0 -4
- package/dist/place/PlaceMessages_fr.d.ts +0 -2
- package/dist/place/PlaceMessages_fr.js +0 -4
- package/dist/time/RelativeTimeTextBuilder.js +0 -166
- package/dist/time/TimeContext.d.ts +0 -59
- package/dist/time/TimeContext.js +0 -267
- package/dist/time/TimeElementFactory.d.ts +0 -15
- package/dist/time/TimeRenderer.d.ts +0 -19
- package/dist/time/TimeRenderer.js +0 -63
- package/dist/time/TimeReplacer.d.ts +0 -24
- /package/dist/{place/PlaceMessages.js → time/datasource/rr0/NamedPlace.js} +0 -0
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"author": "rr0@rr0.org",
|
|
5
|
-
"version": "0.1.
|
|
6
|
-
"description": "Content Management System",
|
|
4
|
+
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
5
|
+
"version": "0.1.16",
|
|
6
|
+
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=20"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"homepage": "https://github.com/RR0/cms",
|
|
13
|
+
"homepage": "https://github.com/RR0/cms#readme",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/RR0/cms.git"
|
|
@@ -20,28 +20,29 @@
|
|
|
20
20
|
"build": "rm -Rf dist && tsc --project tsconfig.prod.json",
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"test": "testscript",
|
|
23
|
-
"test-one": "rm -Rf out && tsx src/time/
|
|
23
|
+
"test-one": "rm -Rf out && tsx src/time/RelativeTimeTextBuilder.test.ts",
|
|
24
24
|
"test-ci": "rm -Rf out && testscript"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@googlemaps/google-maps-services-js": "^3.4.0",
|
|
28
|
-
"@rr0/common": "^1.
|
|
29
|
-
"@rr0/lang": "^0.1.
|
|
30
|
-
"@rr0/time": "^0.
|
|
28
|
+
"@rr0/common": "^1.1.3",
|
|
29
|
+
"@rr0/lang": "^0.1.12",
|
|
30
|
+
"@rr0/time": "^0.7.7",
|
|
31
|
+
"@rr0/place": "^0.3.2",
|
|
31
32
|
"canvas": "^2.11.2",
|
|
32
33
|
"csv-parser": "^3.0.0",
|
|
33
34
|
"glob": "^11.0.0",
|
|
34
35
|
"image-size": "^1.1.1",
|
|
35
36
|
"jsdom": "^24.1.0",
|
|
36
37
|
"selenium-webdriver": "^4.22.0",
|
|
37
|
-
"ssg-api": "^1.16.
|
|
38
|
+
"ssg-api": "^1.16.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/jsdom": "^21.1.7",
|
|
41
|
-
"typescript": "^5.
|
|
42
|
+
"typescript": "^5.6.3",
|
|
42
43
|
"@types/node": "^22.7.4",
|
|
43
44
|
"tsx": "4.17.0",
|
|
44
|
-
"@javarome/testscript": "^0.
|
|
45
|
+
"@javarome/testscript": "^0.13.0"
|
|
45
46
|
},
|
|
46
47
|
"keywords": [
|
|
47
48
|
"cms",
|
package/tsconfig.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { RR0SsgContext } from "../RR0SsgContext.js";
|
|
2
|
-
export type DMS = {
|
|
3
|
-
deg: number;
|
|
4
|
-
min: number;
|
|
5
|
-
sec: number;
|
|
6
|
-
positive: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class PlaceLocation {
|
|
9
|
-
readonly lat: number;
|
|
10
|
-
readonly lng: number;
|
|
11
|
-
static readonly DMS_PATTERN: RegExp;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {float} lat Latitude in decimal degrees. North is positive.
|
|
15
|
-
* @param {float} lng Longitude in decimal degrees. East is positive.
|
|
16
|
-
*/
|
|
17
|
-
constructor(lat: number, lng: number);
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param dms A string with deg°minutes"seconds'N|S|E|O format
|
|
21
|
-
*/
|
|
22
|
-
static fromDMS(dms: string): PlaceLocation;
|
|
23
|
-
static fromDouble(double: number): DMS;
|
|
24
|
-
protected static toDouble(m: RegExpExecArray, offset: number): number;
|
|
25
|
-
toDMS(context: RR0SsgContext): string;
|
|
26
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
export class PlaceLocation {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {float} lat Latitude in decimal degrees. North is positive.
|
|
6
|
-
* @param {float} lng Longitude in decimal degrees. East is positive.
|
|
7
|
-
*/
|
|
8
|
-
constructor(lat, lng) {
|
|
9
|
-
this.lat = lat;
|
|
10
|
-
this.lng = lng;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param dms A string with deg°minutes"seconds'N|S|E|O format
|
|
15
|
-
*/
|
|
16
|
-
static fromDMS(dms) {
|
|
17
|
-
const m = PlaceLocation.DMS_PATTERN.exec(dms.trim());
|
|
18
|
-
assert.ok(m, `Malformed degrees/minutes/seconds/direction coordinates in "${dms}"`);
|
|
19
|
-
const latitude = PlaceLocation.toDouble(m, 0);
|
|
20
|
-
const longitude = PlaceLocation.toDouble(m, 5);
|
|
21
|
-
assert.ok(Math.abs(latitude) <= 90, `Invalid latitude ${latitude}`);
|
|
22
|
-
assert.ok(Math.abs(longitude) <= 180, `Invalid longitude ${longitude}`);
|
|
23
|
-
return new PlaceLocation(latitude, longitude);
|
|
24
|
-
}
|
|
25
|
-
static fromDouble(double) {
|
|
26
|
-
const positive = double >= 0;
|
|
27
|
-
const value = Math.abs(double);
|
|
28
|
-
const deg = Math.trunc(value);
|
|
29
|
-
const minFloat = (value - deg) * 60;
|
|
30
|
-
const min = Math.trunc(minFloat);
|
|
31
|
-
const sec = Math.round((minFloat - min) * 60);
|
|
32
|
-
return { deg, min, sec, positive };
|
|
33
|
-
}
|
|
34
|
-
static toDouble(m, offset) {
|
|
35
|
-
const sign = "" === m[1 + offset] ? 1 : -1;
|
|
36
|
-
const degrees = parseFloat(m[2 + offset]);
|
|
37
|
-
const minutes = parseFloat(m[3 + offset]) || 0;
|
|
38
|
-
const seconds = parseFloat(m[4 + offset]) || 0;
|
|
39
|
-
const direction = "NE".includes(m[5 + offset]) ? 1 : -1;
|
|
40
|
-
return sign * direction * (degrees + minutes / 60 + seconds / 3600);
|
|
41
|
-
}
|
|
42
|
-
toDMS(context) {
|
|
43
|
-
const placeMsg = context.messages.place;
|
|
44
|
-
return placeMsg.dmsLat(PlaceLocation.fromDouble(this.lat)) + ","
|
|
45
|
-
+ placeMsg.dmsLng(PlaceLocation.fromDouble(this.lng));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
PlaceLocation.DMS_PATTERN = /(-?)([0-9]{1,2})°\s*([0-5]?[0-9])[′'](?:\s*([0-5]?[0-9])[″"])?\s*([NS])\s*[, ]\s*(-?)([0-1]?[0-9]{1,2})°\s*([0-9]?[0-9])[′'](?:\s*([0-5]?[0-9])["″])?\s*([EWO])/;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export class RelativeTimeTextBuilder {
|
|
2
|
-
constructor(timeTextBuilder) {
|
|
3
|
-
this.timeTextBuilder = timeTextBuilder;
|
|
4
|
-
}
|
|
5
|
-
build(oldContext, newContext) {
|
|
6
|
-
const previousTime = oldContext === null || oldContext === void 0 ? void 0 : oldContext.time;
|
|
7
|
-
if (!(previousTime === null || previousTime === void 0 ? void 0 : previousTime.isDefined())) {
|
|
8
|
-
return this.timeTextBuilder.build(newContext);
|
|
9
|
-
}
|
|
10
|
-
const deltaContext = oldContext.clone();
|
|
11
|
-
const deltaTime = deltaContext.time;
|
|
12
|
-
let dayOfMonthDelta;
|
|
13
|
-
let yearDelta;
|
|
14
|
-
let monthDelta;
|
|
15
|
-
let hourDelta;
|
|
16
|
-
let minutesDelta;
|
|
17
|
-
function shouldSetDay() {
|
|
18
|
-
return !previousTime.getMonth() || monthDelta === 0;
|
|
19
|
-
}
|
|
20
|
-
function shouldSetHour() {
|
|
21
|
-
return !previousTime.getDayOfMonth() || dayOfMonthDelta === 0;
|
|
22
|
-
}
|
|
23
|
-
function shouldSetMinutes() {
|
|
24
|
-
return !previousTime.getMinutes() || hourDelta === 0;
|
|
25
|
-
}
|
|
26
|
-
function setYear(year) {
|
|
27
|
-
const previousYear = previousTime.getYear();
|
|
28
|
-
if (previousYear) {
|
|
29
|
-
yearDelta = year - previousYear;
|
|
30
|
-
if (yearDelta != 0) {
|
|
31
|
-
deltaTime.setYear(year);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function setMonth(month) {
|
|
36
|
-
const previousMonth = previousTime.getMonth();
|
|
37
|
-
if (yearDelta === 0) {
|
|
38
|
-
monthDelta = month - (previousMonth || 0);
|
|
39
|
-
if (monthDelta != 0) {
|
|
40
|
-
deltaTime.setMonth(month);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else if (yearDelta != 0) {
|
|
44
|
-
deltaTime.setMonth(month);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function setDayOfMonth(dayOfMonth) {
|
|
48
|
-
const sameMonth = yearDelta === 0 && shouldSetDay();
|
|
49
|
-
if (sameMonth) {
|
|
50
|
-
dayOfMonthDelta = dayOfMonth - (previousTime.getDayOfMonth() || 0);
|
|
51
|
-
if (dayOfMonthDelta != 0) {
|
|
52
|
-
deltaTime.setDayOfMonth(dayOfMonth);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (monthDelta != 0) {
|
|
56
|
-
deltaTime.setDayOfMonth(dayOfMonth);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function setHour(hour) {
|
|
60
|
-
const sameDay = yearDelta === 0 && shouldSetDay() && shouldSetHour();
|
|
61
|
-
if (sameDay) {
|
|
62
|
-
hourDelta = hour - (previousTime.getHour() || 0);
|
|
63
|
-
if (hourDelta != 0) {
|
|
64
|
-
deltaTime.setHour(hour);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else if (dayOfMonthDelta != 0) {
|
|
68
|
-
deltaTime.setHour(hour);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function setMinutes(minutes) {
|
|
72
|
-
const sameHour = yearDelta === 0 && shouldSetDay() && shouldSetHour() && shouldSetMinutes();
|
|
73
|
-
if (sameHour) {
|
|
74
|
-
minutesDelta = minutes - (previousTime.getMinutes() || 0);
|
|
75
|
-
if (minutesDelta != 0) {
|
|
76
|
-
deltaTime.setMinutes(minutes);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
deltaTime.setMinutes(minutes);
|
|
80
|
-
}
|
|
81
|
-
const time = newContext.time;
|
|
82
|
-
const year = time.getYear();
|
|
83
|
-
if (year) {
|
|
84
|
-
setYear(year);
|
|
85
|
-
}
|
|
86
|
-
const month = time.getMonth();
|
|
87
|
-
if (month) {
|
|
88
|
-
setMonth(month);
|
|
89
|
-
}
|
|
90
|
-
const dayOfMonth = time.getDayOfMonth();
|
|
91
|
-
if (dayOfMonth) {
|
|
92
|
-
setDayOfMonth(dayOfMonth);
|
|
93
|
-
}
|
|
94
|
-
const hour = time.getHour();
|
|
95
|
-
if (hour) {
|
|
96
|
-
setHour(hour);
|
|
97
|
-
}
|
|
98
|
-
const minutes = time.getMinutes();
|
|
99
|
-
if (minutes) {
|
|
100
|
-
setMinutes(minutes);
|
|
101
|
-
}
|
|
102
|
-
let text;
|
|
103
|
-
let messages = newContext.messages.context.time.relative;
|
|
104
|
-
if (dayOfMonthDelta) {
|
|
105
|
-
switch (dayOfMonthDelta) {
|
|
106
|
-
case -1:
|
|
107
|
-
text = messages.day.before;
|
|
108
|
-
break;
|
|
109
|
-
case +1:
|
|
110
|
-
text = messages.day.after;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
if (!dayOfMonth) {
|
|
116
|
-
switch (monthDelta) {
|
|
117
|
-
case -1:
|
|
118
|
-
text = messages.month.before;
|
|
119
|
-
break;
|
|
120
|
-
case +1:
|
|
121
|
-
text = messages.month.after;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (!month) {
|
|
126
|
-
switch (yearDelta) {
|
|
127
|
-
case -1:
|
|
128
|
-
text = messages.year.before;
|
|
129
|
-
break;
|
|
130
|
-
case +1:
|
|
131
|
-
text = messages.year.after;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (!minutes) {
|
|
136
|
-
switch (hourDelta) {
|
|
137
|
-
case -1:
|
|
138
|
-
text = messages.hour.before;
|
|
139
|
-
break;
|
|
140
|
-
case +1:
|
|
141
|
-
text = messages.hour.after;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (!text) {
|
|
147
|
-
let print = true;
|
|
148
|
-
let defaultContext;
|
|
149
|
-
if (deltaContext.time.isDefined()) {
|
|
150
|
-
defaultContext = deltaContext;
|
|
151
|
-
const dayOfMonth = defaultContext.time.getDayOfMonth();
|
|
152
|
-
if (dayOfMonth && shouldSetDay()) {
|
|
153
|
-
defaultContext.time.setMonth(newContext.time.getMonth() || previousTime.getMonth(), false); // give month
|
|
154
|
-
defaultContext.time.setYear(newContext.time.getYear() || previousTime.getYear(), false); // give year
|
|
155
|
-
// context for the day but won't
|
|
156
|
-
print = false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
defaultContext = newContext;
|
|
161
|
-
}
|
|
162
|
-
text = this.timeTextBuilder.build(defaultContext, print);
|
|
163
|
-
}
|
|
164
|
-
return text;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { HtmlRR0SsgContext } from "../RR0SsgContext.js";
|
|
2
|
-
import { TimeParseResult } from "./TimeReplacer.js";
|
|
3
|
-
import { Level2Date as EdtfDate, Level2Duration as EdtfDuration, Level2Interval as EdtfInterval } from "@rr0/time";
|
|
4
|
-
/**
|
|
5
|
-
* Time context for a RR0 page.
|
|
6
|
-
*/
|
|
7
|
-
export declare class TimeContext {
|
|
8
|
-
static readonly dateTimeRegexp: RegExp;
|
|
9
|
-
static readonly MINUTE = 60;
|
|
10
|
-
static readonly HOUR: number;
|
|
11
|
-
static readonly DAY: number;
|
|
12
|
-
date: EdtfDate | undefined;
|
|
13
|
-
interval: EdtfInterval | undefined;
|
|
14
|
-
duration: EdtfDuration | undefined;
|
|
15
|
-
constructor(_year?: number, _month?: number, _dayOfMonth?: number, _hour?: number, _minutes?: number, _timeZone?: string, approximate?: boolean, approximateTime?: boolean,
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
from?: TimeContext | undefined,
|
|
18
|
-
/** @deprecated */
|
|
19
|
-
to?: TimeContext | undefined, duration?: number | undefined);
|
|
20
|
-
get from(): EdtfDate | undefined;
|
|
21
|
-
get to(): EdtfDate | undefined;
|
|
22
|
-
get approximate(): boolean;
|
|
23
|
-
set approximate(approx: boolean);
|
|
24
|
-
get approximateTime(): boolean;
|
|
25
|
-
static parseDateTime(timeStr: string): TimeParseResult;
|
|
26
|
-
static fromString(timeStr: string): TimeContext;
|
|
27
|
-
static fromDate(date: Date): TimeContext;
|
|
28
|
-
static fromFileName(context: HtmlRR0SsgContext, fileName?: string): TimeContext | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* @param {string} timeStr
|
|
31
|
-
* @return If the string could be parsed
|
|
32
|
-
*/
|
|
33
|
-
updateFromStr(timeStr: string): boolean;
|
|
34
|
-
getYear(): number | undefined;
|
|
35
|
-
setYear(year: number | undefined, print?: boolean): this;
|
|
36
|
-
getMonth(): number | undefined;
|
|
37
|
-
setMonth(month: number | undefined, print?: boolean): this;
|
|
38
|
-
getDayOfMonth(): number | undefined;
|
|
39
|
-
setDayOfMonth(dayOfMonth: number | undefined, print?: boolean): this;
|
|
40
|
-
getHour(): number | undefined;
|
|
41
|
-
setHour(hour: number | undefined, print?: boolean): this;
|
|
42
|
-
getMinutes(): number | undefined;
|
|
43
|
-
setMinutes(minutes: number | undefined): this;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated
|
|
46
|
-
*/
|
|
47
|
-
getTimeZone(): string | undefined;
|
|
48
|
-
getTimeshift(): string | undefined;
|
|
49
|
-
setTimeZone(timeZone: string | undefined): this;
|
|
50
|
-
isDefined(): boolean;
|
|
51
|
-
clone(): TimeContext;
|
|
52
|
-
reset(): this;
|
|
53
|
-
isBefore(other: TimeContext): boolean;
|
|
54
|
-
isAfter(other: TimeContext): boolean;
|
|
55
|
-
equals(other: TimeContext): boolean;
|
|
56
|
-
toString(): string;
|
|
57
|
-
toJSON(): string;
|
|
58
|
-
protected isSet(value: any): boolean;
|
|
59
|
-
}
|
package/dist/time/TimeContext.js
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import { Time } from "./Time.js";
|
|
2
|
-
import { Level2Date as EdtfDate, Level2Duration as EdtfDuration, Level2Interval as EdtfInterval, Level2Timeshift } from "@rr0/time";
|
|
3
|
-
/**
|
|
4
|
-
* Time context for a RR0 page.
|
|
5
|
-
*/
|
|
6
|
-
export class TimeContext {
|
|
7
|
-
constructor(_year, _month, _dayOfMonth, _hour, _minutes, _timeZone, approximate = false, approximateTime = false,
|
|
8
|
-
/** @deprecated */
|
|
9
|
-
from = undefined,
|
|
10
|
-
/** @deprecated */
|
|
11
|
-
to = undefined, duration = undefined) {
|
|
12
|
-
if (from) {
|
|
13
|
-
this.interval = new EdtfInterval(from === null || from === void 0 ? void 0 : from.date, to === null || to === void 0 ? void 0 : to.date);
|
|
14
|
-
}
|
|
15
|
-
else if (duration) {
|
|
16
|
-
this.duration = new EdtfDuration(duration);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
this.date = new EdtfDate({ year: _year, month: _month, day: _dayOfMonth, hour: _hour, minutes: _minutes, timeZone: _timeZone });
|
|
20
|
-
if (approximate) {
|
|
21
|
-
this.date.year.approximate = true;
|
|
22
|
-
}
|
|
23
|
-
if (approximateTime) {
|
|
24
|
-
if (this.date.hour) {
|
|
25
|
-
this.date.hour.approximateComponent = true;
|
|
26
|
-
}
|
|
27
|
-
if (this.date.minutes) {
|
|
28
|
-
this.date.minutes.approximateComponent = true;
|
|
29
|
-
}
|
|
30
|
-
if (this.date.seconds) {
|
|
31
|
-
this.date.seconds.approximateComponent = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
get from() {
|
|
37
|
-
var _a;
|
|
38
|
-
return (_a = this.interval) === null || _a === void 0 ? void 0 : _a.start;
|
|
39
|
-
}
|
|
40
|
-
get to() {
|
|
41
|
-
var _a;
|
|
42
|
-
return (_a = this.interval) === null || _a === void 0 ? void 0 : _a.end;
|
|
43
|
-
}
|
|
44
|
-
get approximate() {
|
|
45
|
-
var _a, _b, _c;
|
|
46
|
-
return ((_a = this.date) === null || _a === void 0 ? void 0 : _a.approximate) || ((_b = this.interval) === null || _b === void 0 ? void 0 : _b.approximate) || ((_c = this.duration) === null || _c === void 0 ? void 0 : _c.approximate);
|
|
47
|
-
}
|
|
48
|
-
set approximate(approx) {
|
|
49
|
-
this.date.approximate = approx;
|
|
50
|
-
}
|
|
51
|
-
get approximateTime() {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f;
|
|
53
|
-
return this.approximate || ((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.hour) === null || _b === void 0 ? void 0 : _b.approximate) || ((_d = (_c = this.date) === null || _c === void 0 ? void 0 : _c.minute) === null || _d === void 0 ? void 0 : _d.approximate) || ((_f = (_e = this.date) === null || _e === void 0 ? void 0 : _e.second) === null || _f === void 0 ? void 0 : _f.approximate);
|
|
54
|
-
}
|
|
55
|
-
static parseDateTime(timeStr) {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f;
|
|
57
|
-
try {
|
|
58
|
-
const date = EdtfDate.fromString(timeStr);
|
|
59
|
-
return {
|
|
60
|
-
approximate: date === null || date === void 0 ? void 0 : date.approximate,
|
|
61
|
-
yearStr: (_a = date.year) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
62
|
-
monthStr: (_b = date.month) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
63
|
-
dayOfMonthStr: (_c = date.day) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
64
|
-
hour: (_d = date.hour) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
65
|
-
minutes: (_e = date.minutes) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
66
|
-
timeZone: (_f = date.timeZone) === null || _f === void 0 ? void 0 : _f.toString()
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
static fromString(timeStr) {
|
|
74
|
-
const timeContext = new TimeContext();
|
|
75
|
-
timeContext.updateFromStr(timeStr);
|
|
76
|
-
return timeContext;
|
|
77
|
-
}
|
|
78
|
-
static fromDate(date) {
|
|
79
|
-
return new TimeContext(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), "UTC" + (date.getTimezoneOffset() < 0 ? "-" : "+") + date.getTimezoneOffset());
|
|
80
|
-
}
|
|
81
|
-
static fromFileName(context, fileName = context.file.name) {
|
|
82
|
-
let timeContext;
|
|
83
|
-
let elems;
|
|
84
|
-
if (fileName.endsWith("index.html")) {
|
|
85
|
-
while ((elems = fileName.split("/")).length < 6) {
|
|
86
|
-
fileName = elems.slice(0, elems.length - 1).join("/") + "/0/index.html";
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const timeExec = Time.parseFileName(fileName);
|
|
90
|
-
if (timeExec && timeExec.length > 5) {
|
|
91
|
-
const pageContext = context.clone();
|
|
92
|
-
timeContext = pageContext.time;
|
|
93
|
-
const m = parseInt(timeExec[2], 10);
|
|
94
|
-
const c = parseInt(timeExec[3], 10);
|
|
95
|
-
const d = parseInt(timeExec[4], 10);
|
|
96
|
-
const u = parseInt(timeExec[5], 10);
|
|
97
|
-
const year = (timeExec[1] ? -1 : 1) * (m * 1000 + c * 100 + d * 10 + u);
|
|
98
|
-
timeContext.setYear(year);
|
|
99
|
-
const monthStr = timeExec[6];
|
|
100
|
-
timeContext.setMonth(monthStr ? parseInt(monthStr, 10) : undefined);
|
|
101
|
-
const dayStr = timeExec[7];
|
|
102
|
-
timeContext.setDayOfMonth(dayStr ? parseInt(dayStr, 10) : undefined);
|
|
103
|
-
timeContext.setHour(undefined);
|
|
104
|
-
timeContext.setMinutes(undefined);
|
|
105
|
-
}
|
|
106
|
-
return timeContext;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @param {string} timeStr
|
|
110
|
-
* @return If the string could be parsed
|
|
111
|
-
*/
|
|
112
|
-
updateFromStr(timeStr) {
|
|
113
|
-
let valid = Boolean(timeStr);
|
|
114
|
-
if (valid) {
|
|
115
|
-
try {
|
|
116
|
-
this.interval = EdtfInterval.fromString(timeStr);
|
|
117
|
-
this.date = undefined;
|
|
118
|
-
this.duration = undefined;
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
try {
|
|
122
|
-
this.duration = EdtfDuration.fromString(timeStr);
|
|
123
|
-
this.interval = undefined;
|
|
124
|
-
this.date = undefined;
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
try {
|
|
128
|
-
this.date = EdtfDate.fromString(timeStr);
|
|
129
|
-
this.duration = undefined;
|
|
130
|
-
this.interval = undefined;
|
|
131
|
-
}
|
|
132
|
-
catch (e) {
|
|
133
|
-
console.warn("Could not resolve time string", timeStr, e.message);
|
|
134
|
-
valid = false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return valid;
|
|
140
|
-
}
|
|
141
|
-
getYear() {
|
|
142
|
-
var _a, _b;
|
|
143
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.year) === null || _b === void 0 ? void 0 : _b.value;
|
|
144
|
-
}
|
|
145
|
-
setYear(year, print = true) {
|
|
146
|
-
var _a, _b;
|
|
147
|
-
if (year != ((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.year) === null || _b === void 0 ? void 0 : _b.value) && print) {
|
|
148
|
-
this.setMonth(undefined, print);
|
|
149
|
-
}
|
|
150
|
-
this.date = this.date || new EdtfDate();
|
|
151
|
-
this.date.year = year;
|
|
152
|
-
return this;
|
|
153
|
-
}
|
|
154
|
-
getMonth() {
|
|
155
|
-
var _a, _b;
|
|
156
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.month) === null || _b === void 0 ? void 0 : _b.value;
|
|
157
|
-
}
|
|
158
|
-
setMonth(month, print = true) {
|
|
159
|
-
var _a, _b;
|
|
160
|
-
if (month != ((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.month) === null || _b === void 0 ? void 0 : _b.value) && print) {
|
|
161
|
-
this.setDayOfMonth(undefined, print);
|
|
162
|
-
}
|
|
163
|
-
this.date = this.date || new EdtfDate();
|
|
164
|
-
this.date.month = month;
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
getDayOfMonth() {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.value;
|
|
170
|
-
}
|
|
171
|
-
setDayOfMonth(dayOfMonth, print = true) {
|
|
172
|
-
var _a, _b;
|
|
173
|
-
if (dayOfMonth != ((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.value) && print) {
|
|
174
|
-
this.setHour(undefined, print);
|
|
175
|
-
}
|
|
176
|
-
this.date = this.date || new EdtfDate();
|
|
177
|
-
this.date.day = dayOfMonth;
|
|
178
|
-
return this;
|
|
179
|
-
}
|
|
180
|
-
getHour() {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.hour) === null || _b === void 0 ? void 0 : _b.value;
|
|
183
|
-
}
|
|
184
|
-
setHour(hour, print = true) {
|
|
185
|
-
var _a, _b;
|
|
186
|
-
if (hour != ((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.hour) === null || _b === void 0 ? void 0 : _b.value) && print) {
|
|
187
|
-
this.setMinutes(undefined);
|
|
188
|
-
}
|
|
189
|
-
this.date = this.date || new EdtfDate();
|
|
190
|
-
this.date.hour = hour;
|
|
191
|
-
return this;
|
|
192
|
-
}
|
|
193
|
-
getMinutes() {
|
|
194
|
-
var _a, _b;
|
|
195
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.minute) === null || _b === void 0 ? void 0 : _b.value;
|
|
196
|
-
}
|
|
197
|
-
setMinutes(minutes) {
|
|
198
|
-
this.date = this.date || new EdtfDate();
|
|
199
|
-
this.date.minute = minutes;
|
|
200
|
-
return this;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* @deprecated
|
|
204
|
-
*/
|
|
205
|
-
getTimeZone() {
|
|
206
|
-
var _a, _b;
|
|
207
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.timeshift) === null || _b === void 0 ? void 0 : _b.toString();
|
|
208
|
-
}
|
|
209
|
-
getTimeshift() {
|
|
210
|
-
var _a, _b;
|
|
211
|
-
return (_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.timeshift) === null || _b === void 0 ? void 0 : _b.toString();
|
|
212
|
-
}
|
|
213
|
-
setTimeZone(timeZone) {
|
|
214
|
-
this.date = this.date || new Level2Timeshift();
|
|
215
|
-
try {
|
|
216
|
-
this.date.timeshift = Level2Timeshift.fromString(timeZone);
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
console.warn("Could not resolve time zone", timeZone, e.message);
|
|
220
|
-
}
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
isDefined() {
|
|
224
|
-
var _a, _b, _c, _d, _e;
|
|
225
|
-
const date = this.date;
|
|
226
|
-
if (!date) {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
return ((_a = date.year) === null || _a === void 0 ? void 0 : _a.value) != undefined
|
|
230
|
-
|| ((_b = date.month) === null || _b === void 0 ? void 0 : _b.value) != undefined
|
|
231
|
-
|| ((_c = date.day) === null || _c === void 0 ? void 0 : _c.value) != undefined
|
|
232
|
-
|| ((_d = date.hour) === null || _d === void 0 ? void 0 : _d.value) != undefined
|
|
233
|
-
|| ((_e = date.minute) === null || _e === void 0 ? void 0 : _e.value) != undefined;
|
|
234
|
-
}
|
|
235
|
-
clone() {
|
|
236
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
237
|
-
return new TimeContext((_b = (_a = this.date) === null || _a === void 0 ? void 0 : _a.year) === null || _b === void 0 ? void 0 : _b.value, (_d = (_c = this.date) === null || _c === void 0 ? void 0 : _c.month) === null || _d === void 0 ? void 0 : _d.value, (_f = (_e = this.date) === null || _e === void 0 ? void 0 : _e.day) === null || _f === void 0 ? void 0 : _f.value, (_h = (_g = this.date) === null || _g === void 0 ? void 0 : _g.hour) === null || _h === void 0 ? void 0 : _h.value, (_k = (_j = this.date) === null || _j === void 0 ? void 0 : _j.minutes) === null || _k === void 0 ? void 0 : _k.value, (_m = (_l = this.date) === null || _l === void 0 ? void 0 : _l.timeshift) === null || _m === void 0 ? void 0 : _m.value, this.approximate, this.approximateTime, (_o = this.interval) === null || _o === void 0 ? void 0 : _o.from, (_p = this.interval) === null || _p === void 0 ? void 0 : _p.to, this.duration);
|
|
238
|
-
}
|
|
239
|
-
reset() {
|
|
240
|
-
this.date = undefined;
|
|
241
|
-
this.interval = undefined;
|
|
242
|
-
this.duration = undefined;
|
|
243
|
-
return this;
|
|
244
|
-
}
|
|
245
|
-
isBefore(other) {
|
|
246
|
-
return this.toString().localeCompare(other.toString()) < 0;
|
|
247
|
-
}
|
|
248
|
-
isAfter(other) {
|
|
249
|
-
return this.toString().localeCompare(other.toString()) > 0;
|
|
250
|
-
}
|
|
251
|
-
equals(other) {
|
|
252
|
-
return this.toString() === other.toString();
|
|
253
|
-
}
|
|
254
|
-
toString() {
|
|
255
|
-
return this.date ? this.date.toString() : "";
|
|
256
|
-
}
|
|
257
|
-
toJSON() {
|
|
258
|
-
return this.toString();
|
|
259
|
-
}
|
|
260
|
-
isSet(value) {
|
|
261
|
-
return value != void 0 && value != null;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
TimeContext.dateTimeRegexp = new RegExp("^(~)?(-?\\d{3,})?(?:-?([0-1]\\d)(?!\:))?(?:-?([0-3]\\d{1,2}(?!\:)))?(?:[T ]?(?:([0-2]\\d):([0-5]\\d))?)?(?: ?([A-Z]{3}))?");
|
|
265
|
-
TimeContext.MINUTE = 60;
|
|
266
|
-
TimeContext.HOUR = 60 * TimeContext.MINUTE;
|
|
267
|
-
TimeContext.DAY = 24 * TimeContext.HOUR;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HtmlRR0SsgContext, RR0SsgContext } from "../RR0SsgContext.js";
|
|
2
|
-
import { TimeRenderer, TimeRenderOptions } from "./TimeRenderer.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates <time> elements from time strings.
|
|
5
|
-
*/
|
|
6
|
-
export declare class TimeElementFactory {
|
|
7
|
-
readonly renderer: TimeRenderer;
|
|
8
|
-
constructor(renderer: TimeRenderer);
|
|
9
|
-
create(context: HtmlRR0SsgContext, previousContext: HtmlRR0SsgContext | undefined, options?: TimeRenderOptions): HTMLElement | undefined;
|
|
10
|
-
createInterval(fromContext: HtmlRR0SsgContext, toContext: HtmlRR0SsgContext, previousContext: HtmlRR0SsgContext, options: TimeRenderOptions): HTMLElement | undefined;
|
|
11
|
-
createStarting(fromContext: HtmlRR0SsgContext, previousContext: HtmlRR0SsgContext, options: TimeRenderOptions): HTMLElement | undefined;
|
|
12
|
-
valueReplacement(context: HtmlRR0SsgContext, previousContext: RR0SsgContext | undefined, options?: TimeRenderOptions): HTMLElement | undefined;
|
|
13
|
-
protected durationReplacement(context: HtmlRR0SsgContext): HTMLTimeElement | undefined;
|
|
14
|
-
protected dateTimeReplacement(context: HtmlRR0SsgContext, previousContext: RR0SsgContext | null, options?: TimeRenderOptions): HTMLElement | undefined;
|
|
15
|
-
}
|