react-timelane 1.2.1 → 1.2.2

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 (139) hide show
  1. package/dist/_virtual/bind-all.js +4 -0
  2. package/dist/_virtual/bind.js +4 -0
  3. package/dist/_virtual/index.js +5 -0
  4. package/dist/_virtual/index2.js +4 -0
  5. package/dist/_virtual/index3.js +5 -0
  6. package/dist/_virtual/index4.js +4 -0
  7. package/dist/_virtual/react-dom.development.js +4 -0
  8. package/dist/_virtual/react-dom.production.js +4 -0
  9. package/dist/components/Timelane/Timelane.css +1 -0
  10. package/dist/components/Timelane/Timelane.js +53 -0
  11. package/dist/components/TimelaneAllocation/TimelaneAllocation.js +49 -0
  12. package/dist/components/TimelaneAside/TimelaneAside.js +60 -0
  13. package/dist/components/TimelaneBackground/TimelaneBackground.js +46 -0
  14. package/dist/components/TimelaneBody/TimelaneBody.js +13 -0
  15. package/dist/components/TimelaneBody/TimelaneSelectionLayer.js +96 -0
  16. package/dist/components/TimelaneHeader/DaysHeader.js +30 -0
  17. package/dist/components/TimelaneHeader/MonthsHeader.js +38 -0
  18. package/dist/components/TimelaneHeader/TimelaneHeader.js +55 -0
  19. package/dist/components/TimelaneHeader/WeeksHeader.js +39 -0
  20. package/dist/components/TimelaneHeader/renderingUtils.js +26 -0
  21. package/dist/components/TimelaneItem/DragResizeComponent.js +125 -0
  22. package/dist/components/TimelaneItem/TimelaneItem.js +42 -0
  23. package/dist/components/TimelaneLane/DropPreview.js +25 -0
  24. package/dist/components/TimelaneLane/DropTarget.js +57 -0
  25. package/dist/components/TimelaneLane/OverlapIndicator.js +21 -0
  26. package/dist/components/TimelaneLane/TimelaneLane.js +164 -0
  27. package/dist/components/TimelaneLayout/TimelaneLayout.js +77 -0
  28. package/dist/components/TimelaneLayout/layout.css +1 -0
  29. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsContext.js +21 -0
  30. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.js +15 -0
  31. package/dist/components/utils.js +243 -0
  32. package/dist/hooks/useScroll.js +47 -0
  33. package/dist/hooks/useTimelaneContext.js +6 -0
  34. package/dist/index.js +36 -0
  35. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +4 -0
  36. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js +127 -0
  37. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +9 -0
  38. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +4 -0
  39. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +7 -0
  40. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js +226 -0
  41. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +107 -0
  42. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +195 -0
  43. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +21 -0
  44. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +43 -0
  45. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +253 -0
  46. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +121 -0
  47. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +12 -0
  48. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +17 -0
  49. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +9 -0
  50. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +8 -0
  51. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +57 -0
  52. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +9 -0
  53. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +13 -0
  54. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +47 -0
  55. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +17 -0
  56. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +7 -0
  57. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +10 -0
  58. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js +4 -0
  59. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +4 -0
  60. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js +4 -0
  61. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
  62. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +6 -0
  63. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
  64. package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  65. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
  66. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +21 -0
  67. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
  68. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
  69. package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +10 -0
  70. package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
  71. package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  72. package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  73. package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  74. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
  75. package/dist/node_modules/bind-event-listener/dist/bind-all.js +45 -0
  76. package/dist/node_modules/bind-event-listener/dist/bind.js +16 -0
  77. package/dist/node_modules/bind-event-listener/dist/index.js +20 -0
  78. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
  79. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  80. package/dist/node_modules/date-fns/_lib/format/formatters.js +583 -0
  81. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
  82. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
  83. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
  84. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  85. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
  86. package/dist/node_modules/date-fns/_lib/protectedTokens.js +20 -0
  87. package/dist/node_modules/date-fns/addDays.js +10 -0
  88. package/dist/node_modules/date-fns/addWeeks.js +8 -0
  89. package/dist/node_modules/date-fns/constants.js +6 -0
  90. package/dist/node_modules/date-fns/constructFrom.js +8 -0
  91. package/dist/node_modules/date-fns/differenceInCalendarDays.js +16 -0
  92. package/dist/node_modules/date-fns/eachDayOfInterval.js +17 -0
  93. package/dist/node_modules/date-fns/eachMonthOfInterval.js +17 -0
  94. package/dist/node_modules/date-fns/eachWeekOfInterval.js +22 -0
  95. package/dist/node_modules/date-fns/format.js +59 -0
  96. package/dist/node_modules/date-fns/getDay.js +8 -0
  97. package/dist/node_modules/date-fns/getDayOfYear.js +11 -0
  98. package/dist/node_modules/date-fns/getISOWeek.js +12 -0
  99. package/dist/node_modules/date-fns/getISOWeekYear.js +15 -0
  100. package/dist/node_modules/date-fns/getWeek.js +12 -0
  101. package/dist/node_modules/date-fns/getWeekYear.js +17 -0
  102. package/dist/node_modules/date-fns/isDate.js +7 -0
  103. package/dist/node_modules/date-fns/isSameDay.js +14 -0
  104. package/dist/node_modules/date-fns/isSunday.js +8 -0
  105. package/dist/node_modules/date-fns/isValid.js +9 -0
  106. package/dist/node_modules/date-fns/lastDayOfMonth.js +9 -0
  107. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  108. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
  109. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
  110. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
  111. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
  112. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
  113. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  114. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
  115. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
  116. package/dist/node_modules/date-fns/locale/en-US.js +21 -0
  117. package/dist/node_modules/date-fns/max.js +14 -0
  118. package/dist/node_modules/date-fns/min.js +14 -0
  119. package/dist/node_modules/date-fns/nextDay.js +10 -0
  120. package/dist/node_modules/date-fns/nextSunday.js +8 -0
  121. package/dist/node_modules/date-fns/setHours.js +9 -0
  122. package/dist/node_modules/date-fns/startOfDay.js +9 -0
  123. package/dist/node_modules/date-fns/startOfISOWeek.js +8 -0
  124. package/dist/node_modules/date-fns/startOfISOWeekYear.js +11 -0
  125. package/dist/node_modules/date-fns/startOfWeek.js +11 -0
  126. package/dist/node_modules/date-fns/startOfWeekYear.js +13 -0
  127. package/dist/node_modules/date-fns/startOfYear.js +9 -0
  128. package/dist/node_modules/date-fns/toDate.js +8 -0
  129. package/dist/node_modules/raf-schd/dist/raf-schd.esm.js +15 -0
  130. package/dist/node_modules/re-resizable/lib/index.js +424 -0
  131. package/dist/node_modules/re-resizable/lib/resizer.js +49 -0
  132. package/dist/node_modules/react-dom/cjs/react-dom.development.js +227 -0
  133. package/dist/node_modules/react-dom/cjs/react-dom.production.js +147 -0
  134. package/dist/node_modules/react-dom/index.js +23 -0
  135. package/dist/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +12 -0
  136. package/dist/types/Item.js +6 -0
  137. package/package.json +10 -7
  138. package/dist/react-timelane.css +0 -1
  139. package/dist/react-timelane.js +0 -4754
@@ -0,0 +1,583 @@
1
+ import { getDayOfYear as m } from "../../getDayOfYear.js";
2
+ import { getISOWeek as g } from "../../getISOWeek.js";
3
+ import { getISOWeekYear as w } from "../../getISOWeekYear.js";
4
+ import { getWeek as b } from "../../getWeek.js";
5
+ import { getWeekYear as x } from "../../getWeekYear.js";
6
+ import { addLeadingZeros as i } from "../addLeadingZeros.js";
7
+ import { lightFormatters as u } from "./lightFormatters.js";
8
+ const s = {
9
+ midnight: "midnight",
10
+ noon: "noon",
11
+ morning: "morning",
12
+ afternoon: "afternoon",
13
+ evening: "evening",
14
+ night: "night"
15
+ }, L = {
16
+ // Era
17
+ G: function(n, r, e) {
18
+ const t = n.getFullYear() > 0 ? 1 : 0;
19
+ switch (r) {
20
+ // AD, BC
21
+ case "G":
22
+ case "GG":
23
+ case "GGG":
24
+ return e.era(t, { width: "abbreviated" });
25
+ // A, B
26
+ case "GGGGG":
27
+ return e.era(t, { width: "narrow" });
28
+ // Anno Domini, Before Christ
29
+ case "GGGG":
30
+ default:
31
+ return e.era(t, { width: "wide" });
32
+ }
33
+ },
34
+ // Year
35
+ y: function(n, r, e) {
36
+ if (r === "yo") {
37
+ const t = n.getFullYear(), a = t > 0 ? t : 1 - t;
38
+ return e.ordinalNumber(a, { unit: "year" });
39
+ }
40
+ return u.y(n, r);
41
+ },
42
+ // Local week-numbering year
43
+ Y: function(n, r, e, t) {
44
+ const a = x(n, t), o = a > 0 ? a : 1 - a;
45
+ if (r === "YY") {
46
+ const h = o % 100;
47
+ return i(h, 2);
48
+ }
49
+ return r === "Yo" ? e.ordinalNumber(o, { unit: "year" }) : i(o, r.length);
50
+ },
51
+ // ISO week-numbering year
52
+ R: function(n, r) {
53
+ const e = w(n);
54
+ return i(e, r.length);
55
+ },
56
+ // Extended year. This is a single number designating the year of this calendar system.
57
+ // The main difference between `y` and `u` localizers are B.C. years:
58
+ // | Year | `y` | `u` |
59
+ // |------|-----|-----|
60
+ // | AC 1 | 1 | 1 |
61
+ // | BC 1 | 1 | 0 |
62
+ // | BC 2 | 2 | -1 |
63
+ // Also `yy` always returns the last two digits of a year,
64
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
65
+ u: function(n, r) {
66
+ const e = n.getFullYear();
67
+ return i(e, r.length);
68
+ },
69
+ // Quarter
70
+ Q: function(n, r, e) {
71
+ const t = Math.ceil((n.getMonth() + 1) / 3);
72
+ switch (r) {
73
+ // 1, 2, 3, 4
74
+ case "Q":
75
+ return String(t);
76
+ // 01, 02, 03, 04
77
+ case "QQ":
78
+ return i(t, 2);
79
+ // 1st, 2nd, 3rd, 4th
80
+ case "Qo":
81
+ return e.ordinalNumber(t, { unit: "quarter" });
82
+ // Q1, Q2, Q3, Q4
83
+ case "QQQ":
84
+ return e.quarter(t, {
85
+ width: "abbreviated",
86
+ context: "formatting"
87
+ });
88
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
89
+ case "QQQQQ":
90
+ return e.quarter(t, {
91
+ width: "narrow",
92
+ context: "formatting"
93
+ });
94
+ // 1st quarter, 2nd quarter, ...
95
+ case "QQQQ":
96
+ default:
97
+ return e.quarter(t, {
98
+ width: "wide",
99
+ context: "formatting"
100
+ });
101
+ }
102
+ },
103
+ // Stand-alone quarter
104
+ q: function(n, r, e) {
105
+ const t = Math.ceil((n.getMonth() + 1) / 3);
106
+ switch (r) {
107
+ // 1, 2, 3, 4
108
+ case "q":
109
+ return String(t);
110
+ // 01, 02, 03, 04
111
+ case "qq":
112
+ return i(t, 2);
113
+ // 1st, 2nd, 3rd, 4th
114
+ case "qo":
115
+ return e.ordinalNumber(t, { unit: "quarter" });
116
+ // Q1, Q2, Q3, Q4
117
+ case "qqq":
118
+ return e.quarter(t, {
119
+ width: "abbreviated",
120
+ context: "standalone"
121
+ });
122
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
123
+ case "qqqqq":
124
+ return e.quarter(t, {
125
+ width: "narrow",
126
+ context: "standalone"
127
+ });
128
+ // 1st quarter, 2nd quarter, ...
129
+ case "qqqq":
130
+ default:
131
+ return e.quarter(t, {
132
+ width: "wide",
133
+ context: "standalone"
134
+ });
135
+ }
136
+ },
137
+ // Month
138
+ M: function(n, r, e) {
139
+ const t = n.getMonth();
140
+ switch (r) {
141
+ case "M":
142
+ case "MM":
143
+ return u.M(n, r);
144
+ // 1st, 2nd, ..., 12th
145
+ case "Mo":
146
+ return e.ordinalNumber(t + 1, { unit: "month" });
147
+ // Jan, Feb, ..., Dec
148
+ case "MMM":
149
+ return e.month(t, {
150
+ width: "abbreviated",
151
+ context: "formatting"
152
+ });
153
+ // J, F, ..., D
154
+ case "MMMMM":
155
+ return e.month(t, {
156
+ width: "narrow",
157
+ context: "formatting"
158
+ });
159
+ // January, February, ..., December
160
+ case "MMMM":
161
+ default:
162
+ return e.month(t, { width: "wide", context: "formatting" });
163
+ }
164
+ },
165
+ // Stand-alone month
166
+ L: function(n, r, e) {
167
+ const t = n.getMonth();
168
+ switch (r) {
169
+ // 1, 2, ..., 12
170
+ case "L":
171
+ return String(t + 1);
172
+ // 01, 02, ..., 12
173
+ case "LL":
174
+ return i(t + 1, 2);
175
+ // 1st, 2nd, ..., 12th
176
+ case "Lo":
177
+ return e.ordinalNumber(t + 1, { unit: "month" });
178
+ // Jan, Feb, ..., Dec
179
+ case "LLL":
180
+ return e.month(t, {
181
+ width: "abbreviated",
182
+ context: "standalone"
183
+ });
184
+ // J, F, ..., D
185
+ case "LLLLL":
186
+ return e.month(t, {
187
+ width: "narrow",
188
+ context: "standalone"
189
+ });
190
+ // January, February, ..., December
191
+ case "LLLL":
192
+ default:
193
+ return e.month(t, { width: "wide", context: "standalone" });
194
+ }
195
+ },
196
+ // Local week of year
197
+ w: function(n, r, e, t) {
198
+ const a = b(n, t);
199
+ return r === "wo" ? e.ordinalNumber(a, { unit: "week" }) : i(a, r.length);
200
+ },
201
+ // ISO week of year
202
+ I: function(n, r, e) {
203
+ const t = g(n);
204
+ return r === "Io" ? e.ordinalNumber(t, { unit: "week" }) : i(t, r.length);
205
+ },
206
+ // Day of the month
207
+ d: function(n, r, e) {
208
+ return r === "do" ? e.ordinalNumber(n.getDate(), { unit: "date" }) : u.d(n, r);
209
+ },
210
+ // Day of year
211
+ D: function(n, r, e) {
212
+ const t = m(n);
213
+ return r === "Do" ? e.ordinalNumber(t, { unit: "dayOfYear" }) : i(t, r.length);
214
+ },
215
+ // Day of week
216
+ E: function(n, r, e) {
217
+ const t = n.getDay();
218
+ switch (r) {
219
+ // Tue
220
+ case "E":
221
+ case "EE":
222
+ case "EEE":
223
+ return e.day(t, {
224
+ width: "abbreviated",
225
+ context: "formatting"
226
+ });
227
+ // T
228
+ case "EEEEE":
229
+ return e.day(t, {
230
+ width: "narrow",
231
+ context: "formatting"
232
+ });
233
+ // Tu
234
+ case "EEEEEE":
235
+ return e.day(t, {
236
+ width: "short",
237
+ context: "formatting"
238
+ });
239
+ // Tuesday
240
+ case "EEEE":
241
+ default:
242
+ return e.day(t, {
243
+ width: "wide",
244
+ context: "formatting"
245
+ });
246
+ }
247
+ },
248
+ // Local day of week
249
+ e: function(n, r, e, t) {
250
+ const a = n.getDay(), o = (a - t.weekStartsOn + 8) % 7 || 7;
251
+ switch (r) {
252
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
253
+ case "e":
254
+ return String(o);
255
+ // Padded numerical value
256
+ case "ee":
257
+ return i(o, 2);
258
+ // 1st, 2nd, ..., 7th
259
+ case "eo":
260
+ return e.ordinalNumber(o, { unit: "day" });
261
+ case "eee":
262
+ return e.day(a, {
263
+ width: "abbreviated",
264
+ context: "formatting"
265
+ });
266
+ // T
267
+ case "eeeee":
268
+ return e.day(a, {
269
+ width: "narrow",
270
+ context: "formatting"
271
+ });
272
+ // Tu
273
+ case "eeeeee":
274
+ return e.day(a, {
275
+ width: "short",
276
+ context: "formatting"
277
+ });
278
+ // Tuesday
279
+ case "eeee":
280
+ default:
281
+ return e.day(a, {
282
+ width: "wide",
283
+ context: "formatting"
284
+ });
285
+ }
286
+ },
287
+ // Stand-alone local day of week
288
+ c: function(n, r, e, t) {
289
+ const a = n.getDay(), o = (a - t.weekStartsOn + 8) % 7 || 7;
290
+ switch (r) {
291
+ // Numerical value (same as in `e`)
292
+ case "c":
293
+ return String(o);
294
+ // Padded numerical value
295
+ case "cc":
296
+ return i(o, r.length);
297
+ // 1st, 2nd, ..., 7th
298
+ case "co":
299
+ return e.ordinalNumber(o, { unit: "day" });
300
+ case "ccc":
301
+ return e.day(a, {
302
+ width: "abbreviated",
303
+ context: "standalone"
304
+ });
305
+ // T
306
+ case "ccccc":
307
+ return e.day(a, {
308
+ width: "narrow",
309
+ context: "standalone"
310
+ });
311
+ // Tu
312
+ case "cccccc":
313
+ return e.day(a, {
314
+ width: "short",
315
+ context: "standalone"
316
+ });
317
+ // Tuesday
318
+ case "cccc":
319
+ default:
320
+ return e.day(a, {
321
+ width: "wide",
322
+ context: "standalone"
323
+ });
324
+ }
325
+ },
326
+ // ISO day of week
327
+ i: function(n, r, e) {
328
+ const t = n.getDay(), a = t === 0 ? 7 : t;
329
+ switch (r) {
330
+ // 2
331
+ case "i":
332
+ return String(a);
333
+ // 02
334
+ case "ii":
335
+ return i(a, r.length);
336
+ // 2nd
337
+ case "io":
338
+ return e.ordinalNumber(a, { unit: "day" });
339
+ // Tue
340
+ case "iii":
341
+ return e.day(t, {
342
+ width: "abbreviated",
343
+ context: "formatting"
344
+ });
345
+ // T
346
+ case "iiiii":
347
+ return e.day(t, {
348
+ width: "narrow",
349
+ context: "formatting"
350
+ });
351
+ // Tu
352
+ case "iiiiii":
353
+ return e.day(t, {
354
+ width: "short",
355
+ context: "formatting"
356
+ });
357
+ // Tuesday
358
+ case "iiii":
359
+ default:
360
+ return e.day(t, {
361
+ width: "wide",
362
+ context: "formatting"
363
+ });
364
+ }
365
+ },
366
+ // AM or PM
367
+ a: function(n, r, e) {
368
+ const a = n.getHours() / 12 >= 1 ? "pm" : "am";
369
+ switch (r) {
370
+ case "a":
371
+ case "aa":
372
+ return e.dayPeriod(a, {
373
+ width: "abbreviated",
374
+ context: "formatting"
375
+ });
376
+ case "aaa":
377
+ return e.dayPeriod(a, {
378
+ width: "abbreviated",
379
+ context: "formatting"
380
+ }).toLowerCase();
381
+ case "aaaaa":
382
+ return e.dayPeriod(a, {
383
+ width: "narrow",
384
+ context: "formatting"
385
+ });
386
+ case "aaaa":
387
+ default:
388
+ return e.dayPeriod(a, {
389
+ width: "wide",
390
+ context: "formatting"
391
+ });
392
+ }
393
+ },
394
+ // AM, PM, midnight, noon
395
+ b: function(n, r, e) {
396
+ const t = n.getHours();
397
+ let a;
398
+ switch (t === 12 ? a = s.noon : t === 0 ? a = s.midnight : a = t / 12 >= 1 ? "pm" : "am", r) {
399
+ case "b":
400
+ case "bb":
401
+ return e.dayPeriod(a, {
402
+ width: "abbreviated",
403
+ context: "formatting"
404
+ });
405
+ case "bbb":
406
+ return e.dayPeriod(a, {
407
+ width: "abbreviated",
408
+ context: "formatting"
409
+ }).toLowerCase();
410
+ case "bbbbb":
411
+ return e.dayPeriod(a, {
412
+ width: "narrow",
413
+ context: "formatting"
414
+ });
415
+ case "bbbb":
416
+ default:
417
+ return e.dayPeriod(a, {
418
+ width: "wide",
419
+ context: "formatting"
420
+ });
421
+ }
422
+ },
423
+ // in the morning, in the afternoon, in the evening, at night
424
+ B: function(n, r, e) {
425
+ const t = n.getHours();
426
+ let a;
427
+ switch (t >= 17 ? a = s.evening : t >= 12 ? a = s.afternoon : t >= 4 ? a = s.morning : a = s.night, r) {
428
+ case "B":
429
+ case "BB":
430
+ case "BBB":
431
+ return e.dayPeriod(a, {
432
+ width: "abbreviated",
433
+ context: "formatting"
434
+ });
435
+ case "BBBBB":
436
+ return e.dayPeriod(a, {
437
+ width: "narrow",
438
+ context: "formatting"
439
+ });
440
+ case "BBBB":
441
+ default:
442
+ return e.dayPeriod(a, {
443
+ width: "wide",
444
+ context: "formatting"
445
+ });
446
+ }
447
+ },
448
+ // Hour [1-12]
449
+ h: function(n, r, e) {
450
+ if (r === "ho") {
451
+ let t = n.getHours() % 12;
452
+ return t === 0 && (t = 12), e.ordinalNumber(t, { unit: "hour" });
453
+ }
454
+ return u.h(n, r);
455
+ },
456
+ // Hour [0-23]
457
+ H: function(n, r, e) {
458
+ return r === "Ho" ? e.ordinalNumber(n.getHours(), { unit: "hour" }) : u.H(n, r);
459
+ },
460
+ // Hour [0-11]
461
+ K: function(n, r, e) {
462
+ const t = n.getHours() % 12;
463
+ return r === "Ko" ? e.ordinalNumber(t, { unit: "hour" }) : i(t, r.length);
464
+ },
465
+ // Hour [1-24]
466
+ k: function(n, r, e) {
467
+ let t = n.getHours();
468
+ return t === 0 && (t = 24), r === "ko" ? e.ordinalNumber(t, { unit: "hour" }) : i(t, r.length);
469
+ },
470
+ // Minute
471
+ m: function(n, r, e) {
472
+ return r === "mo" ? e.ordinalNumber(n.getMinutes(), { unit: "minute" }) : u.m(n, r);
473
+ },
474
+ // Second
475
+ s: function(n, r, e) {
476
+ return r === "so" ? e.ordinalNumber(n.getSeconds(), { unit: "second" }) : u.s(n, r);
477
+ },
478
+ // Fraction of second
479
+ S: function(n, r) {
480
+ return u.S(n, r);
481
+ },
482
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
483
+ X: function(n, r, e) {
484
+ const t = n.getTimezoneOffset();
485
+ if (t === 0)
486
+ return "Z";
487
+ switch (r) {
488
+ // Hours and optional minutes
489
+ case "X":
490
+ return f(t);
491
+ // Hours, minutes and optional seconds without `:` delimiter
492
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
493
+ // so this token always has the same output as `XX`
494
+ case "XXXX":
495
+ case "XX":
496
+ return c(t);
497
+ // Hours, minutes and optional seconds with `:` delimiter
498
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
499
+ // so this token always has the same output as `XXX`
500
+ case "XXXXX":
501
+ case "XXX":
502
+ // Hours and minutes with `:` delimiter
503
+ default:
504
+ return c(t, ":");
505
+ }
506
+ },
507
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
508
+ x: function(n, r, e) {
509
+ const t = n.getTimezoneOffset();
510
+ switch (r) {
511
+ // Hours and optional minutes
512
+ case "x":
513
+ return f(t);
514
+ // Hours, minutes and optional seconds without `:` delimiter
515
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
516
+ // so this token always has the same output as `xx`
517
+ case "xxxx":
518
+ case "xx":
519
+ return c(t);
520
+ // Hours, minutes and optional seconds with `:` delimiter
521
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
522
+ // so this token always has the same output as `xxx`
523
+ case "xxxxx":
524
+ case "xxx":
525
+ // Hours and minutes with `:` delimiter
526
+ default:
527
+ return c(t, ":");
528
+ }
529
+ },
530
+ // Timezone (GMT)
531
+ O: function(n, r, e) {
532
+ const t = n.getTimezoneOffset();
533
+ switch (r) {
534
+ // Short
535
+ case "O":
536
+ case "OO":
537
+ case "OOO":
538
+ return "GMT" + d(t, ":");
539
+ // Long
540
+ case "OOOO":
541
+ default:
542
+ return "GMT" + c(t, ":");
543
+ }
544
+ },
545
+ // Timezone (specific non-location)
546
+ z: function(n, r, e) {
547
+ const t = n.getTimezoneOffset();
548
+ switch (r) {
549
+ // Short
550
+ case "z":
551
+ case "zz":
552
+ case "zzz":
553
+ return "GMT" + d(t, ":");
554
+ // Long
555
+ case "zzzz":
556
+ default:
557
+ return "GMT" + c(t, ":");
558
+ }
559
+ },
560
+ // Seconds timestamp
561
+ t: function(n, r, e) {
562
+ const t = Math.trunc(+n / 1e3);
563
+ return i(t, r.length);
564
+ },
565
+ // Milliseconds timestamp
566
+ T: function(n, r, e) {
567
+ return i(+n, r.length);
568
+ }
569
+ };
570
+ function d(n, r = "") {
571
+ const e = n > 0 ? "-" : "+", t = Math.abs(n), a = Math.trunc(t / 60), o = t % 60;
572
+ return o === 0 ? e + String(a) : e + String(a) + r + i(o, 2);
573
+ }
574
+ function f(n, r) {
575
+ return n % 60 === 0 ? (n > 0 ? "-" : "+") + i(Math.abs(n) / 60, 2) : c(n, r);
576
+ }
577
+ function c(n, r = "") {
578
+ const e = n > 0 ? "-" : "+", t = Math.abs(n), a = i(Math.trunc(t / 60), 2), o = i(t % 60, 2);
579
+ return e + a + r + o;
580
+ }
581
+ export {
582
+ L as formatters
583
+ };
@@ -0,0 +1,59 @@
1
+ import { addLeadingZeros as n } from "../addLeadingZeros.js";
2
+ const g = {
3
+ // Year
4
+ y(e, t) {
5
+ const r = e.getFullYear(), a = r > 0 ? r : 1 - r;
6
+ return n(t === "yy" ? a % 100 : a, t.length);
7
+ },
8
+ // Month
9
+ M(e, t) {
10
+ const r = e.getMonth();
11
+ return t === "M" ? String(r + 1) : n(r + 1, 2);
12
+ },
13
+ // Day of the month
14
+ d(e, t) {
15
+ return n(e.getDate(), t.length);
16
+ },
17
+ // AM or PM
18
+ a(e, t) {
19
+ const r = e.getHours() / 12 >= 1 ? "pm" : "am";
20
+ switch (t) {
21
+ case "a":
22
+ case "aa":
23
+ return r.toUpperCase();
24
+ case "aaa":
25
+ return r;
26
+ case "aaaaa":
27
+ return r[0];
28
+ case "aaaa":
29
+ default:
30
+ return r === "am" ? "a.m." : "p.m.";
31
+ }
32
+ },
33
+ // Hour [1-12]
34
+ h(e, t) {
35
+ return n(e.getHours() % 12 || 12, t.length);
36
+ },
37
+ // Hour [0-23]
38
+ H(e, t) {
39
+ return n(e.getHours(), t.length);
40
+ },
41
+ // Minute
42
+ m(e, t) {
43
+ return n(e.getMinutes(), t.length);
44
+ },
45
+ // Second
46
+ s(e, t) {
47
+ return n(e.getSeconds(), t.length);
48
+ },
49
+ // Fraction of second
50
+ S(e, t) {
51
+ const r = t.length, a = e.getMilliseconds(), s = Math.trunc(
52
+ a * Math.pow(10, r - 3)
53
+ );
54
+ return n(s, t.length);
55
+ }
56
+ };
57
+ export {
58
+ g as lightFormatters
59
+ };
@@ -0,0 +1,52 @@
1
+ const s = (t, e) => {
2
+ switch (t) {
3
+ case "P":
4
+ return e.date({ width: "short" });
5
+ case "PP":
6
+ return e.date({ width: "medium" });
7
+ case "PPP":
8
+ return e.date({ width: "long" });
9
+ case "PPPP":
10
+ default:
11
+ return e.date({ width: "full" });
12
+ }
13
+ }, c = (t, e) => {
14
+ switch (t) {
15
+ case "p":
16
+ return e.time({ width: "short" });
17
+ case "pp":
18
+ return e.time({ width: "medium" });
19
+ case "ppp":
20
+ return e.time({ width: "long" });
21
+ case "pppp":
22
+ default:
23
+ return e.time({ width: "full" });
24
+ }
25
+ }, P = (t, e) => {
26
+ const d = t.match(/(P+)(p+)?/) || [], a = d[1], r = d[2];
27
+ if (!r)
28
+ return s(t, e);
29
+ let i;
30
+ switch (a) {
31
+ case "P":
32
+ i = e.dateTime({ width: "short" });
33
+ break;
34
+ case "PP":
35
+ i = e.dateTime({ width: "medium" });
36
+ break;
37
+ case "PPP":
38
+ i = e.dateTime({ width: "long" });
39
+ break;
40
+ case "PPPP":
41
+ default:
42
+ i = e.dateTime({ width: "full" });
43
+ break;
44
+ }
45
+ return i.replace("{{date}}", s(a, e)).replace("{{time}}", c(r, e));
46
+ }, h = {
47
+ p: c,
48
+ P
49
+ };
50
+ export {
51
+ h as longFormatters
52
+ };
@@ -0,0 +1,18 @@
1
+ import { toDate as o } from "../toDate.js";
2
+ function l(t) {
3
+ const e = o(t), n = new Date(
4
+ Date.UTC(
5
+ e.getFullYear(),
6
+ e.getMonth(),
7
+ e.getDate(),
8
+ e.getHours(),
9
+ e.getMinutes(),
10
+ e.getSeconds(),
11
+ e.getMilliseconds()
12
+ )
13
+ );
14
+ return n.setUTCFullYear(e.getFullYear()), +t - +n;
15
+ }
16
+ export {
17
+ l as getTimezoneOffsetInMilliseconds
18
+ };