@sbb-esta/lyne-elements-experimental 0.0.0 → 0.52.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.
Files changed (123) hide show
  1. package/README.md +55 -0
  2. package/constants-ClrwyPF-.js +12 -0
  3. package/core/datetime/date-helper.d.ts +27 -0
  4. package/core/datetime/date-helper.d.ts.map +1 -0
  5. package/core/datetime.d.ts +2 -0
  6. package/core/datetime.d.ts.map +1 -0
  7. package/core/datetime.js +199 -0
  8. package/core/timetable/access-leg-helper.d.ts +26 -0
  9. package/core/timetable/access-leg-helper.d.ts.map +1 -0
  10. package/core/timetable/timetable-helper.d.ts +9 -0
  11. package/core/timetable/timetable-helper.d.ts.map +1 -0
  12. package/core/timetable/timetable-properties.d.ts +308 -0
  13. package/core/timetable/timetable-properties.d.ts.map +1 -0
  14. package/core/timetable.d.ts +4 -0
  15. package/core/timetable.d.ts.map +1 -0
  16. package/core/timetable.js +123 -0
  17. package/custom-elements.json +1606 -0
  18. package/development/constants-D72r1E-c.js +22 -0
  19. package/development/core/datetime/date-helper.d.ts +27 -0
  20. package/development/core/datetime/date-helper.d.ts.map +1 -0
  21. package/development/core/datetime.d.ts +2 -0
  22. package/development/core/datetime.d.ts.map +1 -0
  23. package/development/core/datetime.js +297 -0
  24. package/development/core/timetable/access-leg-helper.d.ts +26 -0
  25. package/development/core/timetable/access-leg-helper.d.ts.map +1 -0
  26. package/development/core/timetable/timetable-helper.d.ts +9 -0
  27. package/development/core/timetable/timetable-helper.d.ts.map +1 -0
  28. package/development/core/timetable/timetable-properties.d.ts +308 -0
  29. package/development/core/timetable/timetable-properties.d.ts.map +1 -0
  30. package/development/core/timetable.d.ts +4 -0
  31. package/development/core/timetable.d.ts.map +1 -0
  32. package/development/core/timetable.js +164 -0
  33. package/development/differenceInMinutes-D47vcSvy.js +21 -0
  34. package/development/format-WI2gcVKN.js +1379 -0
  35. package/development/isValid-YTpbhEHG.js +52 -0
  36. package/development/journey-summary/journey-summary.d.ts +57 -0
  37. package/development/journey-summary/journey-summary.d.ts.map +1 -0
  38. package/development/journey-summary.d.ts +2 -0
  39. package/development/journey-summary.d.ts.map +1 -0
  40. package/development/journey-summary.js +210 -0
  41. package/development/pearl-chain/pearl-chain.d.ts +41 -0
  42. package/development/pearl-chain/pearl-chain.d.ts.map +1 -0
  43. package/development/pearl-chain/pearl-chain.sample-data.d.ts +121 -0
  44. package/development/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -0
  45. package/development/pearl-chain-time/pearl-chain-time.d.ts +44 -0
  46. package/development/pearl-chain-time/pearl-chain-time.d.ts.map +1 -0
  47. package/development/pearl-chain-time.d.ts +2 -0
  48. package/development/pearl-chain-time.d.ts.map +1 -0
  49. package/development/pearl-chain-time.js +209 -0
  50. package/development/pearl-chain-vertical/pearl-chain-vertical.d.ts +17 -0
  51. package/development/pearl-chain-vertical/pearl-chain-vertical.d.ts.map +1 -0
  52. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts +35 -0
  53. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts.map +1 -0
  54. package/development/pearl-chain-vertical-item.d.ts +2 -0
  55. package/development/pearl-chain-vertical-item.d.ts.map +1 -0
  56. package/development/pearl-chain-vertical-item.js +369 -0
  57. package/development/pearl-chain-vertical.d.ts +2 -0
  58. package/development/pearl-chain-vertical.d.ts.map +1 -0
  59. package/development/pearl-chain-vertical.js +59 -0
  60. package/development/pearl-chain.d.ts +2 -0
  61. package/development/pearl-chain.d.ts.map +1 -0
  62. package/development/pearl-chain.js +599 -0
  63. package/development/timetable-duration/timetable-duration.d.ts +23 -0
  64. package/development/timetable-duration/timetable-duration.d.ts.map +1 -0
  65. package/development/timetable-duration/timetable-duration.sample-data.d.ts +6 -0
  66. package/development/timetable-duration/timetable-duration.sample-data.d.ts.map +1 -0
  67. package/development/timetable-duration.d.ts +2 -0
  68. package/development/timetable-duration.d.ts.map +1 -0
  69. package/development/timetable-duration.js +107 -0
  70. package/development/timetable-row/timetable-row.d.ts +79 -0
  71. package/development/timetable-row/timetable-row.d.ts.map +1 -0
  72. package/development/timetable-row/timetable-row.sample-data.d.ts +24 -0
  73. package/development/timetable-row/timetable-row.sample-data.d.ts.map +1 -0
  74. package/development/timetable-row.d.ts +2 -0
  75. package/development/timetable-row.d.ts.map +1 -0
  76. package/development/timetable-row.js +696 -0
  77. package/differenceInMinutes-CDpgJIgL.js +19 -0
  78. package/format-CEz7IGRJ.js +1168 -0
  79. package/index.d.ts +19 -0
  80. package/index.js +17 -0
  81. package/isValid-Df_caLp4.js +40 -0
  82. package/journey-summary/journey-summary.d.ts +57 -0
  83. package/journey-summary/journey-summary.d.ts.map +1 -0
  84. package/journey-summary.d.ts +2 -0
  85. package/journey-summary.d.ts.map +1 -0
  86. package/journey-summary.js +130 -0
  87. package/package.json +79 -2
  88. package/pearl-chain/pearl-chain.d.ts +41 -0
  89. package/pearl-chain/pearl-chain.d.ts.map +1 -0
  90. package/pearl-chain/pearl-chain.sample-data.d.ts +121 -0
  91. package/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -0
  92. package/pearl-chain-time/pearl-chain-time.d.ts +44 -0
  93. package/pearl-chain-time/pearl-chain-time.d.ts.map +1 -0
  94. package/pearl-chain-time.d.ts +2 -0
  95. package/pearl-chain-time.d.ts.map +1 -0
  96. package/pearl-chain-time.js +90 -0
  97. package/pearl-chain-vertical/pearl-chain-vertical.d.ts +17 -0
  98. package/pearl-chain-vertical/pearl-chain-vertical.d.ts.map +1 -0
  99. package/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts +35 -0
  100. package/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts.map +1 -0
  101. package/pearl-chain-vertical-item.d.ts +2 -0
  102. package/pearl-chain-vertical-item.d.ts.map +1 -0
  103. package/pearl-chain-vertical-item.js +48 -0
  104. package/pearl-chain-vertical.d.ts +2 -0
  105. package/pearl-chain-vertical.d.ts.map +1 -0
  106. package/pearl-chain-vertical.js +24 -0
  107. package/pearl-chain.d.ts +2 -0
  108. package/pearl-chain.d.ts.map +1 -0
  109. package/pearl-chain.js +148 -0
  110. package/timetable-duration/timetable-duration.d.ts +23 -0
  111. package/timetable-duration/timetable-duration.d.ts.map +1 -0
  112. package/timetable-duration/timetable-duration.sample-data.d.ts +6 -0
  113. package/timetable-duration/timetable-duration.sample-data.d.ts.map +1 -0
  114. package/timetable-duration.d.ts +2 -0
  115. package/timetable-duration.d.ts.map +1 -0
  116. package/timetable-duration.js +37 -0
  117. package/timetable-row/timetable-row.d.ts +79 -0
  118. package/timetable-row/timetable-row.d.ts.map +1 -0
  119. package/timetable-row/timetable-row.sample-data.d.ts +24 -0
  120. package/timetable-row/timetable-row.sample-data.d.ts.map +1 -0
  121. package/timetable-row.d.ts +2 -0
  122. package/timetable-row.d.ts.map +1 -0
  123. package/timetable-row.js +392 -0
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Lyne Components
2
+
3
+ > Lyne Components are the building blocks of the Lyne Design System
4
+ > and are based on standard compliant Web Components
5
+ > created using [Lit](https://lit.dev/) and
6
+ > browsable through [Storybook](https://lyne-storybook.app.sbb.ch/)
7
+
8
+ ## 🎯 Our aim
9
+
10
+ To fulfill our [Vision](./docs/VISION.md), we are building and maintaining Lyne, our Design System, which is and acts
11
+ as our common language — our Single Source of Truth.
12
+ For this purpose we use [Design Tokens](https://github.com/sbb-design-systems/lyne-design-tokens) as our design abstractions.
13
+ Those [Design Tokens](https://github.com/sbb-design-systems/lyne-design-tokens) are consumed by Lyne Components and are integrated within our documentation.
14
+
15
+ Lyne Design Tokens and Lyne Components are available for developers and designers.
16
+
17
+ ## 📚 Documentation
18
+
19
+ - General docs: [digital.sbb.ch](https://digital.sbb.ch)
20
+ - Component docs: [Storybook](https://lyne-storybook.app.sbb.ch)
21
+ - [Getting started guide](./docs/GETTING_STARTED.md)
22
+
23
+ ## 🔗 Packages
24
+
25
+ | Package | Description |
26
+ | ---------------------------------- | --------------------------------------------------------------------------- |
27
+ | `@lyne-esta/elements` | Web components built on top of the Lyne Design System |
28
+ | `@lyne-esta/elements-experimental` | Web components that do not yet align with our architecture or testing goals |
29
+ | `@lyne-esta/react` | React wrappers for `@lyne-esta/elements` |
30
+ | `@lyne-esta/react-experimental` | React wrappers for `@lyne-esta/elements-experimental` |
31
+
32
+ - [NPM Packages](https://www.npmjs.com/search?q=%40sbb-esta%2Flyne-)
33
+
34
+ ## 🖥 Browser and screen reader support
35
+
36
+ This library supports the most recent two versions of all major browsers: Chrome (including Android), Firefox, Safari (including iOS), and Edge.
37
+
38
+ We aim for great user experience with the following screen readers:
39
+
40
+ Windows: NVDA and JAWS with FF / Chrome.
41
+ macOS: VoiceOver with Safari / Chrome.
42
+ iOS: VoiceOver with Safari
43
+ Android: Android Accessibility Suite (formerly TalkBack) with Chrome.
44
+
45
+ ## 🙌 Contributing
46
+
47
+ - [General contribution guide](./docs/CONTRIBUTING.md)
48
+ - [Developer guide](./docs/DEVELOPER.md) for developers to get started working with this repo.
49
+ - [Coding standards](./docs/CODING_STANDARDS.md) for developers.
50
+ - [Code of conduct](./docs/CODE_OF_CONDUCT.md)
51
+
52
+ ## 📝 License
53
+
54
+ This software is published by SBB-CFF-FFS under the [MIT](/LICENSE) licence and unsupported unless otherwise clearly stated.
55
+ Use at your own risk.
@@ -0,0 +1,12 @@
1
+ function o(t) {
2
+ const e = Object.prototype.toString.call(t);
3
+ return t instanceof Date || typeof t == "object" && e === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || e === "[object Number]" || typeof t == "string" || e === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN);
4
+ }
5
+ const s = 6048e5, n = 864e5, c = 6e4, i = 36e5;
6
+ export {
7
+ i as a,
8
+ c as b,
9
+ n as c,
10
+ s as m,
11
+ o as t
12
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This function removes the offset of a ISO date string. This needs to be done to make sure that the offset is ignored.
3
+ * If it is not removed the time would be converted to the browsers local time.
4
+ * Example: "2022-08-29T09:30:00+03:00" would be changed to "2022-08-29T08:30:00+02:00" --> not the desired outcome, as we want to use the time in the timezone and not the local time.
5
+ *
6
+ * After the offset is removed a new date is created in the browsers local time. This ensures that the time of the ISO date string is displayed and not a converted time.
7
+ * Example: "2022-08-29T09:30:00+03:00" would be changed to "2022-08-29T09:30:00+02:00" --> desired outcome
8
+ * Attention: This function does not convert the time to the correct time in the local timezone. It is a workaround to make sure, that the given time is displayed without being converted.
9
+ *
10
+ * Offset: Difference between the timezone and Coordinated Universal Time.
11
+ *
12
+ * @param isoTime - the iso time with the timezone offset
13
+ * @returns a new date with the local timezone with the local offset
14
+ */
15
+ export declare function removeTimezoneFromISOTimeString(isoTime?: string): Date | undefined;
16
+ /**
17
+ * This function converts a duration number to date string with specific format
18
+ *
19
+ * @param duration - duration in minutes
20
+ * @param currentLanguage - currentLanguage
21
+ * @returns an Object with two strings in the format "dd hh mm" (short) an "x Day(s) x Hour(s) x Minute(s) (long)"
22
+ * */
23
+ export declare const durationToTime: (duration: number, currentLanguage?: string) => {
24
+ short: string;
25
+ long: string;
26
+ };
27
+ //# sourceMappingURL=date-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-helper.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/core/datetime/date-helper.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAsBlF;AAED;;;;;;KAMK;AAEL,eAAO,MAAM,cAAc,aACf,MAAM,oBACE,MAAM,KACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAoD/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './datetime/date-helper.js';
2
+ //# sourceMappingURL=datetime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/core/datetime.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,199 @@
1
+ import { i18nDurationDay as g, i18nDurationHour as N, i18nDurationMinute as T } from "@sbb-esta/lyne-elements/core/i18n.js";
2
+ import { t as d, a as D, b as p } from "../constants-ClrwyPF-.js";
3
+ import { c as w, d as $, i as y } from "../isValid-Df_caLp4.js";
4
+ import { a as U, g as C, d as Y } from "../differenceInMinutes-CDpgJIgL.js";
5
+ function F(t, e) {
6
+ const n = d(t);
7
+ return isNaN(e) ? w(t, NaN) : (e && n.setDate(n.getDate() + e), n);
8
+ }
9
+ function M(t, e) {
10
+ const n = +d(t);
11
+ return w(t, n + e);
12
+ }
13
+ function x(t, e) {
14
+ return M(t, e * D);
15
+ }
16
+ function H(t, e) {
17
+ return M(t, e * p);
18
+ }
19
+ function S(t, e) {
20
+ const n = d(t), r = d(e), s = h(n, r), i = Math.abs($(n, r));
21
+ n.setDate(n.getDate() - s * i);
22
+ const a = +(h(n, r) === -s), u = s * (i - a);
23
+ return u === 0 ? 0 : u;
24
+ }
25
+ function h(t, e) {
26
+ const n = t.getFullYear() - e.getFullYear() || t.getMonth() - e.getMonth() || t.getDate() - e.getDate() || t.getHours() - e.getHours() || t.getMinutes() - e.getMinutes() || t.getSeconds() - e.getSeconds() || t.getMilliseconds() - e.getMilliseconds();
27
+ return n < 0 ? -1 : n > 0 ? 1 : n;
28
+ }
29
+ function z(t, e, n) {
30
+ const r = U(t, e) / D;
31
+ return C(n == null ? void 0 : n.roundingMethod)(r);
32
+ }
33
+ function Z(t, e) {
34
+ return F(t, -e);
35
+ }
36
+ function O(t, e) {
37
+ const r = W(t);
38
+ let s;
39
+ if (r.date) {
40
+ const o = _(r.date, 2);
41
+ s = j(o.restDateString, o.year);
42
+ }
43
+ if (!s || isNaN(s.getTime()))
44
+ return /* @__PURE__ */ new Date(NaN);
45
+ const i = s.getTime();
46
+ let a = 0, u;
47
+ if (r.time && (a = A(r.time), isNaN(a)))
48
+ return /* @__PURE__ */ new Date(NaN);
49
+ if (r.timezone) {
50
+ if (u = E(r.timezone), isNaN(u))
51
+ return /* @__PURE__ */ new Date(NaN);
52
+ } else {
53
+ const o = new Date(i + a), c = /* @__PURE__ */ new Date(0);
54
+ return c.setFullYear(
55
+ o.getUTCFullYear(),
56
+ o.getUTCMonth(),
57
+ o.getUTCDate()
58
+ ), c.setHours(
59
+ o.getUTCHours(),
60
+ o.getUTCMinutes(),
61
+ o.getUTCSeconds(),
62
+ o.getUTCMilliseconds()
63
+ ), c;
64
+ }
65
+ return new Date(i + a + u);
66
+ }
67
+ const f = {
68
+ dateTimeDelimiter: /[T ]/,
69
+ timeZoneDelimiter: /[Z ]/i,
70
+ timezone: /([Z+-].*)$/
71
+ }, b = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, v = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, k = /^([+-])(\d{2})(?::?(\d{2}))?$/;
72
+ function W(t) {
73
+ const e = {}, n = t.split(f.dateTimeDelimiter);
74
+ let r;
75
+ if (n.length > 2)
76
+ return e;
77
+ if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], f.timeZoneDelimiter.test(e.date) && (e.date = t.split(f.timeZoneDelimiter)[0], r = t.substr(
78
+ e.date.length,
79
+ t.length
80
+ ))), r) {
81
+ const s = f.timezone.exec(r);
82
+ s ? (e.time = r.replace(s[1], ""), e.timezone = s[1]) : e.time = r;
83
+ }
84
+ return e;
85
+ }
86
+ function _(t, e) {
87
+ const n = new RegExp(
88
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
89
+ ), r = t.match(n);
90
+ if (!r)
91
+ return { year: NaN, restDateString: "" };
92
+ const s = r[1] ? parseInt(r[1]) : null, i = r[2] ? parseInt(r[2]) : null;
93
+ return {
94
+ year: i === null ? s : i * 100,
95
+ restDateString: t.slice((r[1] || r[2]).length)
96
+ };
97
+ }
98
+ function j(t, e) {
99
+ if (e === null)
100
+ return /* @__PURE__ */ new Date(NaN);
101
+ const n = t.match(b);
102
+ if (!n)
103
+ return /* @__PURE__ */ new Date(NaN);
104
+ const r = !!n[4], s = l(n[1]), i = l(n[2]) - 1, a = l(n[3]), u = l(n[4]), o = l(n[5]) - 1;
105
+ if (r)
106
+ return B(e, u, o) ? J(e, u, o) : /* @__PURE__ */ new Date(NaN);
107
+ {
108
+ const c = /* @__PURE__ */ new Date(0);
109
+ return !V(e, i, a) || !q(e, s) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, i, Math.max(s, a)), c);
110
+ }
111
+ }
112
+ function l(t) {
113
+ return t ? parseInt(t) : 1;
114
+ }
115
+ function A(t) {
116
+ const e = t.match(v);
117
+ if (!e)
118
+ return NaN;
119
+ const n = m(e[1]), r = m(e[2]), s = m(e[3]);
120
+ return G(n, r, s) ? n * D + r * p + s * 1e3 : NaN;
121
+ }
122
+ function m(t) {
123
+ return t && parseFloat(t.replace(",", ".")) || 0;
124
+ }
125
+ function E(t) {
126
+ if (t === "Z")
127
+ return 0;
128
+ const e = t.match(k);
129
+ if (!e)
130
+ return 0;
131
+ const n = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), s = e[3] && parseInt(e[3]) || 0;
132
+ return K(r, s) ? n * (r * D + s * p) : NaN;
133
+ }
134
+ function J(t, e, n) {
135
+ const r = /* @__PURE__ */ new Date(0);
136
+ r.setUTCFullYear(t, 0, 4);
137
+ const s = r.getUTCDay() || 7, i = (e - 1) * 7 + n + 1 - s;
138
+ return r.setUTCDate(r.getUTCDate() + i), r;
139
+ }
140
+ const R = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
141
+ function I(t) {
142
+ return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
143
+ }
144
+ function V(t, e, n) {
145
+ return e >= 0 && e <= 11 && n >= 1 && n <= (R[e] || (I(t) ? 29 : 28));
146
+ }
147
+ function q(t, e) {
148
+ return e >= 1 && e <= (I(t) ? 366 : 365);
149
+ }
150
+ function B(t, e, n) {
151
+ return e >= 1 && e <= 53 && n >= 0 && n <= 6;
152
+ }
153
+ function G(t, e, n) {
154
+ return t === 24 ? e === 0 && n === 0 : n >= 0 && n < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
155
+ }
156
+ function K(t, e) {
157
+ return e >= 0 && e <= 59;
158
+ }
159
+ function P(t, e) {
160
+ return x(t, -e);
161
+ }
162
+ function te(t) {
163
+ if (!t)
164
+ return;
165
+ const e = O(t);
166
+ if (y(e)) {
167
+ if (t.includes("Z"))
168
+ return new Date(t.replace("Z", ""));
169
+ if (t.includes("T")) {
170
+ const n = t.split("T");
171
+ if (n[1] && (n[1].includes("+") || n[1].includes("-")))
172
+ return /* @__PURE__ */ new Date(`${n[0]}T${n[1].split(/[+-]/)[0]}`);
173
+ }
174
+ return new Date(t);
175
+ }
176
+ }
177
+ const ne = (t, e) => {
178
+ const n = [], r = [];
179
+ let i = H(0, t);
180
+ const a = S(i, 0);
181
+ a > 0 && (n.push(`${a} d`), e && r.push(
182
+ `${a} ${a > 1 ? g.multiple.long[e] : g.single.long[e]}`
183
+ ), i = Z(i, a));
184
+ const u = z(i, 0);
185
+ u > 0 && (n.push(`${u} h`), e && r.push(
186
+ `${u} ${u > 1 ? N.multiple.long[e] : N.single.long[e]}`
187
+ ), i = P(i, u));
188
+ const o = Y(i, 0);
189
+ return o > 0 && (n.push(`${o} min`), e && r.push(
190
+ `${o} ${o > 1 ? T.multiple.long[e] : T.single.long[e]}`
191
+ )), {
192
+ short: n.join(" "),
193
+ long: r.join(" ")
194
+ };
195
+ };
196
+ export {
197
+ ne as durationToTime,
198
+ te as removeTimezoneFromISOTimeString
199
+ };
@@ -0,0 +1,26 @@
1
+ import { TemplateResult } from 'lit';
2
+ import { Leg } from './timetable-properties.js';
3
+
4
+ interface IAccessAttribute {
5
+ duration: number;
6
+ text: string;
7
+ icon: string;
8
+ }
9
+ /**
10
+ * @param legs: An array of Leg objects representing the journey legs.
11
+ * @param departureWalk: The walking distance in minutes from the departure point to the first leg.
12
+ * @param arrivalWalk: The walking distance in minutes from the last leg to the arrival point.
13
+ * @param currentLanguage: The current language for localization.
14
+ * @returns renderDepartureTimeAttribute: A function that renders the element for the departure time attribute.
15
+ * @returns renderArrivalTimeAttribute: A function that renders the element for the arrival time attribute.
16
+ * @returns arrivalTimeAttribute: The access attribute for the arrival time.
17
+ * @returns departureTimeAttribute: The access attribute for the departure time.
18
+ */
19
+ export declare function getDepartureArrivalTimeAttribute(legs: Leg[], departureWalk: number, arrivalWalk: number, currentLanguage: string): {
20
+ renderDepartureTimeAttribute: () => TemplateResult;
21
+ renderArrivalTimeAttribute: () => TemplateResult;
22
+ departureTimeAttribute: IAccessAttribute | null;
23
+ arrivalTimeAttribute: IAccessAttribute | null;
24
+ };
25
+ export {};
26
+ //# sourceMappingURL=access-leg-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-leg-helper.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/core/timetable/access-leg-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ1C,OAAO,KAAK,EAAE,GAAG,EAA8B,MAAM,2BAA2B,CAAC;AAEjF,OAAO,iCAAiC,CAAC;AAEzC,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AA2HD;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,GAAG,EAAE,EACX,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB;IACD,4BAA4B,EAAE,MAAM,cAAc,CAAC;IACnD,0BAA0B,EAAE,MAAM,cAAc,CAAC;IACjD,sBAAsB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChD,oBAAoB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC/C,CAyGA"}
@@ -0,0 +1,9 @@
1
+ import { Notice } from './timetable-properties.js';
2
+
3
+ export declare const isRideLeg: (leg: any) => leg is never;
4
+ export declare const isConnectionLeg: (leg: any) => leg is never;
5
+ export declare const extractTimeAndStringFromNoticeText: (notice?: Notice) => {
6
+ duration: number;
7
+ text: string;
8
+ };
9
+ //# sourceMappingURL=timetable-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timetable-helper.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/core/timetable/timetable-helper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,SAAS,QAAS,GAAG,iBAEjC,CAAC;AAEF,eAAO,MAAM,eAAe,QACrB,GAAG,iBAGT,CAAC;AAEF,eAAO,MAAM,kCAAkC,YACpC,MAAM,KACd;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAWlC,CAAC"}
@@ -0,0 +1,308 @@
1
+ export interface ScheduledStopPointDetail {
2
+ /** delay at arrival/departure (in minutes) */
3
+ delay?: number;
4
+ /** reason for delayed arrival/departure */
5
+ delayText?: string | null;
6
+ /** True if platform change (de:Gleis-/Kante-/Steg-Änderung) */
7
+ quayChanged: boolean;
8
+ /** Enduser text, saying whether there is a Quay change */
9
+ quayChangedText?: string | null;
10
+ /** A Quay (or platform or track) for any means of transport-mode / VehicleMode (train, bus, boat, etc.). */
11
+ quayFormatted?: string | null;
12
+ /** planned arrival/departure time */
13
+ time: string;
14
+ }
15
+ export interface ServiceAlteration {
16
+ /** If (partially) cancelled, enduser cancellation info. */
17
+ cancelledText?: string | null;
18
+ /** true: Journey is (partially) cancelled (default=false) */
19
+ cancelled: boolean;
20
+ /**
21
+ * Enduser text, saying whether there is a delay on PTRideLeg (referring to first/last Stop).
22
+ *
23
+ */
24
+ delayText: string;
25
+ /** Journey is partially cancelled at beginning or end */
26
+ partiallyCancelled: boolean;
27
+ /** If partiallyCancelled, enduser info */
28
+ partiallyCancelledText?: string | null;
29
+ /** Enduser text, saying whether there is a Quay change */
30
+ quayChangedText?: string | null;
31
+ /** true: journey is redirected */
32
+ redirected: boolean;
33
+ redirectedFormatted?: string | null;
34
+ redirectedText: string;
35
+ /**
36
+ * true: transport-product change from PTRideLeg to PTRideLeg is reachable
37
+ * (de: Anschluss kann gehalten werden, see Trip::valid);
38
+ * false: de:nicht mehr erreichbare Fahrt
39
+ *
40
+ */
41
+ reachable: boolean;
42
+ reachableText?: string | null;
43
+ /** Text intended for passengers about an additional non-planned stop at a station */
44
+ unplannedStopPointsText?: string | null;
45
+ }
46
+ /** Text template with optional formattable parameters. Useful to represent in UIs as clickable features like an e-Mail, phone or URL. */
47
+ export type LinkedText = {
48
+ /** End-user text. */
49
+ template?: string | null;
50
+ };
51
+ /** vehicle journeys stop point state */
52
+ export type StopStatusEnum = 'BEGIN_PARTIAL_CANCELLATION' | 'CANCELLED' | 'END_PARTIAL_CANCELLATION' | 'NOT_SERVICED' | 'PLANNED' | 'UNPLANNED';
53
+ /** Stop point on a vehicle journey */
54
+ export interface ScheduledStopPoint {
55
+ stopStatus?: StopStatusEnum;
56
+ }
57
+ /** Most critical boarding/alighting accessibility */
58
+ export type BoardingAlightingAccessibilityEnum = 'BOARDING_ALIGHTING_BY_CREW' | 'BOARDING_ALIGHTING_BY_NOTIFICATION' | 'BOARDING_ALIGHTING_NOT_POSSIBLE' | 'BOARDING_ALIGHTING_SELF';
59
+ /** A classification of what caused a Situation (HIM category) */
60
+ export type PtSituationCauseEnum = 'CONSTRUCTION_SITE' | 'DELAY' | 'DISTURBANCE' | 'END_MESSAGE' | 'INFORMATION' | 'TRAIN_REPLACEMENT_BY_BUS';
61
+ export type OccupancyEnum = 'HIGH' | 'LOW' | 'MEDIUM' | 'UNKNOWN';
62
+ /** Type of Notice */
63
+ export type NoticeTypeEnum = 'ATTRIBUTE' | 'INFO';
64
+ /** Mode of public transportation */
65
+ export type VehicleModeEnum = 'BUS' | 'CABLEWAY' | 'CHAIRLIFT' | 'COG_RAILWAY' | 'ELEVATOR' | 'GONDOLA' | 'METRO' | 'PLANE' | 'SHIP' | 'TAXI' | 'TRAIN' | 'TRAMWAY' | 'UNKNOWN';
66
+ export type Leg = {
67
+ /** duration from previous transfer point to current in minutes */
68
+ duration?: number | null;
69
+ /** Unique Index ordered within Trip */
70
+ id: string;
71
+ };
72
+ /** Wrapper for a Notice with image/picto name and text */
73
+ export type Notice = {
74
+ __typename?: 'Notice';
75
+ /** Hint whether a passenger should see such a Notice being advertised */
76
+ advertised?: boolean | null;
77
+ /**
78
+ * A two letter key, that might relate to MERITS codes for e.g. UIC Code 916-1 'reservation system code',
79
+ * though they are specified by SBB Data-Mgmt.
80
+ */
81
+ name: string;
82
+ /** Priority - A lower priority value means a higher importance */
83
+ priority: number;
84
+ /** Text format with linkable parameters */
85
+ text?: LinkedText | null;
86
+ /** Type of Notice */
87
+ type: NoticeTypeEnum;
88
+ };
89
+ /** A period during which the situation should be published. */
90
+ export type PublicationWindow = {
91
+ /** Situation within this publication window. */
92
+ dailyDuration?: string | null;
93
+ dailyStartingAt?: string | null;
94
+ /** Local end date of situation */
95
+ endDate?: string | null;
96
+ endTime?: string | null;
97
+ /** Local start date of situation */
98
+ startDate?: string | null;
99
+ startTime?: string | null;
100
+ };
101
+ /** A public transportation situation broadcast message affecting the planned PT operation */
102
+ export type PtSituationMessage = {
103
+ /** Complete Footer/text of message */
104
+ detail: string;
105
+ /** Abbreviated Footer/text of message */
106
+ detailShort?: string | null;
107
+ /** A period during which the situation should be published. */
108
+ distributionPeriod?: PublicationWindow | null;
109
+ id: string;
110
+ /** Priority rank: default = 100, low = 80, medium = 60, high = 40, de:Großereignis = 20 */
111
+ priority: number;
112
+ /** Heading of message */
113
+ title: string;
114
+ };
115
+ /** A public transportation situation message affecting the planned PT operation */
116
+ export type PtSituation = {
117
+ /** Index of first involved StopPoint in the PT situation */
118
+ affectedStopPointFromIdx?: number | null;
119
+ /** Index of last involved StopPoint in the PT situation */
120
+ affectedStopPointToIdx?: number | null;
121
+ /** Priority value: lowest = 80, medium = 60, highest = 40, de: Großereignis = 20 */
122
+ broadcastMessages: PtSituationMessage[];
123
+ /** A classification of what caused the SITUATION (HIM category) */
124
+ cause?: PtSituationCauseEnum | null;
125
+ };
126
+ export type Occupancy = {
127
+ /** occupancy first class */
128
+ firstClass?: OccupancyEnum | null;
129
+ /** occupancy second class */
130
+ secondClass?: OccupancyEnum | null;
131
+ };
132
+ /**
133
+ * A passenger carrying Service (physical public transport vehicle)
134
+ * provided and operated by a certain Operator allocated to a concrete ServiceJourney
135
+ */
136
+ export type ServiceProduct = {
137
+ /** Icon-identifier to represent the specific submode e.g. the symbol for an EC 1 */
138
+ corporateIdentityIcon?: string | null;
139
+ /** Corporate Identity Pictogram for e.g. Train 'SBB_oev_b_t02' */
140
+ corporateIdentityPictogram?: string;
141
+ /**
142
+ * Usually referring to a specific commercial PT route (where direction might be either way), shown on vehicle displays. If this value is missing, it is probably a single-journey (de:Einzelfahrt)
143
+ * example: 1
144
+ */
145
+ line?: string | null;
146
+ /** Product name for e.g. "IC 1 753" */
147
+ name: string;
148
+ /**
149
+ * Unique per OperatingDay and name (where 'IC 1' can run several times per day in either of opposite directions)
150
+ * example: 753
151
+ */
152
+ number?: string | null;
153
+ /** Defines the first ScheduledStop::routeIndex where this product is valid on a Line, null if unknown. */
154
+ routeIndexFrom?: number | null;
155
+ /** Defines the last ScheduledStop::routeIndex where this product is valid on a Line, null if unknown. */
156
+ routeIndexTo?: number | null;
157
+ /** A characterisation of the public transport operation according to the means of transport. */
158
+ vehicleMode: VehicleModeEnum;
159
+ /**
160
+ * Short, displayable name of product-category (related to Vehicle).
161
+ * example: IC
162
+ */
163
+ vehicleSubModeShortName?: string | null;
164
+ };
165
+ /** Realtime status of a Trip */
166
+ export type TripStatus = {
167
+ /** false: Planned connection; true: Realtime alternative */
168
+ alternative: boolean;
169
+ /** Text intended for passengers about an alternative Trip, relates to alternative. */
170
+ alternativeText?: string | null;
171
+ /** PTRideLeg cancelled (de:Ausfall) */
172
+ cancelled: boolean;
173
+ /** reason for cancellation */
174
+ cancelledText?: string | null;
175
+ /** Contains at least one delay (de:Verspätung) on any PTRideLeg. */
176
+ delayed: boolean;
177
+ /** Contains at lease one unknown delay (de:Unbestimmte Verspätung) on any PTRideLeg. */
178
+ delayedUnknown: boolean;
179
+ /** PTRideLeg partially cancelled (de:Teilausfall). */
180
+ partiallyCancelled: boolean;
181
+ /** Contains at least one platform change (de:Gleis-/Kante-/Steg-Änderung) on any PTRideLeg */
182
+ quayChanged: boolean;
183
+ };
184
+ /** Summary of most relevant aspects of the given Trip */
185
+ export type TripSummary = {
186
+ arrival?: ScheduledStopPointDetail | null;
187
+ /** minutes to walk from arrival station to home/searched arrival */
188
+ arrivalWalk: number;
189
+ /** Most critical boarding/alighting accessibility over all PTRideLeg boarding/alighting ScheduledStopPoints */
190
+ boardingAlightingAccessibility?: BoardingAlightingAccessibilityEnum | null;
191
+ departure?: ScheduledStopPointDetail | null;
192
+ /** minutes to walk from home/start point to departure station */
193
+ departureWalk: number;
194
+ /** Direction of first Leg/ServiceJourney */
195
+ direction?: string | null;
196
+ /** duration in minutes */
197
+ duration: number;
198
+ /** Highest occupancyAverage on any PTRideLeg */
199
+ occupancy: Occupancy;
200
+ /** Passenger carrying Service for first Leg/ServiceJourney */
201
+ product?: ServiceProduct | null;
202
+ /** Overall Realtime status */
203
+ tripStatus: TripStatus;
204
+ };
205
+ /** public transport journey connection */
206
+ export type ITripItem = {
207
+ /** contains all info for ZVS::Reise to get TripOffer price from NOVA */
208
+ id: string;
209
+ /** List of transfer points */
210
+ legs: Leg[];
211
+ /**
212
+ * List of legs travel hints
213
+ * Useful for level 1, may be useful for legend, in bottom of results, in level 2
214
+ */
215
+ notices: Notice[];
216
+ /** A hint/explanation is given if Trip was not found by a direct (first) search. In such a case origin/destination might not match exactly to request parameters. */
217
+ searchHint?: string | null;
218
+ /**
219
+ * List of legs situation messages
220
+ * Useful for level 1, may not be needed for level 2
221
+ */
222
+ situations: PtSituation[];
223
+ /**
224
+ * Summary of most relevant aspects of the given Trip and its PTRideLeg's
225
+ * Useful for level 1, not needed for level 2
226
+ */
227
+ summary?: TripSummary | null;
228
+ /** Rideable whole Trip should be true to book, otherwise TariffOffer makes no sense */
229
+ valid: boolean;
230
+ };
231
+ /** Country of start and end Stop */
232
+ export type LegCountryCodes = {
233
+ __typename?: 'LegCountryCodes';
234
+ end?: string | null;
235
+ start?: string | null;
236
+ };
237
+ export type Coordinate = {
238
+ __typename?: 'Coordinate';
239
+ latitude: number;
240
+ longitude: number;
241
+ };
242
+ export type Place = {
243
+ centroid?: Coordinate | null;
244
+ id: string;
245
+ name: string;
246
+ };
247
+ /** Public Transport Leg */
248
+ export type PtRideLeg = Leg & {
249
+ __typename?: 'PTRideLeg';
250
+ /** arrival time and quay */
251
+ arrival: ScheduledStopPointDetail;
252
+ /** Country of first and last Stop */
253
+ countryCodes: LegCountryCodes;
254
+ /** departure time and quay */
255
+ departure: ScheduledStopPointDetail;
256
+ /** duration from previous transfer point to current in minutes */
257
+ duration?: number | null;
258
+ /** End point */
259
+ end?: Place | null;
260
+ /** Unique Index ordered within Trip */
261
+ id: string;
262
+ /** (partial) journey details */
263
+ serviceJourney: ServiceJourney;
264
+ /** Start point */
265
+ start?: Place | null;
266
+ };
267
+ export type StopPlace = Place & {
268
+ __typename?: 'StopPlace';
269
+ centroid?: Coordinate | null;
270
+ id: string;
271
+ name: string;
272
+ };
273
+ /** StopPlace to StopPlace transfer (up to passenger to find a proper service). */
274
+ export type PtConnectionLeg = Leg & {
275
+ __typename?: 'PTConnectionLeg';
276
+ /** Duration of LEG in minutes */
277
+ duration?: number | null;
278
+ /** Stop point */
279
+ end?: StopPlace | null;
280
+ /** Unique Index ordered within Trip */
281
+ id: string;
282
+ /** List of ServiceProduct attributes and journey hints */
283
+ notices: Notice[];
284
+ /** Start point */
285
+ start?: StopPlace | null;
286
+ };
287
+ /** A passenger carrying vehicle journey for one specified operation day */
288
+ export type ServiceJourney = {
289
+ /** (last) Direction information correlating to vehicle or perron (platform) display */
290
+ direction?: string | null;
291
+ /** ServiceJourney ID */
292
+ id: string;
293
+ /** List of ServiceProduct attributes and journey hints */
294
+ notices: Notice[];
295
+ /** Depending on a train, ship or whatever Vehicle there is a specific terminology for its appropriate quay-name. */
296
+ quayTypeName?: string | null;
297
+ /** Abbreviation for related quayTypeName. */
298
+ quayTypeShortName?: string | null;
299
+ /** Status (realtime changes) to Journey. */
300
+ serviceAlteration: ServiceAlteration;
301
+ /** Line operated by Vehicle operator(s) (list represents partial changes on the Line like Line::number, Line::operator). */
302
+ serviceProducts: ServiceProduct[];
303
+ /** List of situation messages */
304
+ situations: PtSituation[];
305
+ /** List of stop points */
306
+ stopPoints: ScheduledStopPoint[];
307
+ };
308
+ //# sourceMappingURL=timetable-properties.d.ts.map