@jsenv/navi 0.28.3 → 0.28.6
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/jsenv_navi.js +195 -72
- package/dist/jsenv_navi.js.map +8 -6
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -19321,7 +19321,11 @@ const formatTime = (date, lang) => {
|
|
|
19321
19321
|
* "compact" uses our own notation that omits the minute symbol when hours are present.
|
|
19322
19322
|
*
|
|
19323
19323
|
* @param {number} minutes
|
|
19324
|
-
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact", clockStyle?: boolean }} [options]
|
|
19324
|
+
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact", clockStyle?: boolean, forceUnit?: boolean }} [options]
|
|
19325
|
+
* @param {boolean} [options.forceUnit=false] - Keep the value in minutes
|
|
19326
|
+
* however big it gets ("2160 minutes" instead of "1 jour et 12 heures").
|
|
19327
|
+
* Past 24 hours the default promotes to days, which reads better but hides
|
|
19328
|
+
* the unit the caller works in.
|
|
19325
19329
|
* @param {boolean} [options.clockStyle=false] - Set this when `minutes`
|
|
19326
19330
|
* represents a time-of-day rather than a real duration (used by
|
|
19327
19331
|
* `<Time type="time">`, see time.jsx's own TimeTime) — affects two
|
|
@@ -19333,7 +19337,10 @@ const formatTime = (date, lang) => {
|
|
|
19333
19337
|
* doesn't collapse to something indistinguishable from an actual
|
|
19334
19338
|
* 5-minute duration.
|
|
19335
19339
|
* - `format: "compact"` also zero-pads a single-digit hour to 2 digits
|
|
19336
|
-
* (e.g. "5h30" → "05h30")
|
|
19340
|
+
* (e.g. "5h30" → "05h30") and keeps a zero-valued minute (e.g. "10h" →
|
|
19341
|
+
* "10h00"), so it reads closer to a "05:30"/"10:00" clock. The other
|
|
19342
|
+
* formats spell out their units, so "10 heures"/"10h" reads fine there
|
|
19343
|
+
* and only "compact" needs the clock shape.
|
|
19337
19344
|
* Must not be set for plain duration formatting.
|
|
19338
19345
|
*
|
|
19339
19346
|
* @example
|
|
@@ -19344,39 +19351,85 @@ const formatTime = (date, lang) => {
|
|
|
19344
19351
|
* formatMinuteDuration(45, { lang: "en", format: "compact" }) // "45min"
|
|
19345
19352
|
* formatMinuteDuration(5, { lang: "fr", format: "narrow", clockStyle: true }) // "0h 5min"
|
|
19346
19353
|
* formatMinuteDuration(330, { lang: "fr", format: "compact", clockStyle: true }) // "05h30"
|
|
19354
|
+
* formatMinuteDuration(600, { lang: "fr", format: "compact", clockStyle: true }) // "10h00"
|
|
19355
|
+
* formatMinuteDuration(2160, { lang: "fr" }) // "1 jour et 12 heures"
|
|
19356
|
+
* formatMinuteDuration(2160, { lang: "fr", forceUnit: true }) // "2 160 minutes"
|
|
19347
19357
|
*/
|
|
19348
19358
|
const formatMinuteDuration = (
|
|
19349
19359
|
minutes,
|
|
19350
|
-
{
|
|
19360
|
+
{
|
|
19361
|
+
lang = languagesSignal.value,
|
|
19362
|
+
format = "long",
|
|
19363
|
+
clockStyle = false,
|
|
19364
|
+
forceUnit = false,
|
|
19365
|
+
} = {},
|
|
19351
19366
|
) => {
|
|
19352
|
-
|
|
19367
|
+
if (minutes < 0) {
|
|
19368
|
+
// the d/h/m split below only holds for a positive value; formatting the
|
|
19369
|
+
// magnitude and putting the sign back is the only reading that works
|
|
19370
|
+
return `-${formatMinuteDuration(-minutes, { lang, format, clockStyle, forceUnit })}`;
|
|
19371
|
+
}
|
|
19372
|
+
if (forceUnit || (minutes === 0 && !clockStyle)) {
|
|
19373
|
+
// a zero has nothing to promote to, and rendering it as an empty string
|
|
19374
|
+
// would be indistinguishable from a missing value
|
|
19375
|
+
return formatSingleUnit(minutes, "minute", { lang, format });
|
|
19376
|
+
}
|
|
19377
|
+
const totalHours = Math.floor(minutes / 60);
|
|
19353
19378
|
const m = minutes % 60;
|
|
19379
|
+
// a time of day never goes past 24h, and its hour part is the clock hour
|
|
19380
|
+
const d = clockStyle ? 0 : Math.floor(totalHours / 24);
|
|
19381
|
+
const h = clockStyle ? totalHours : totalHours % 24;
|
|
19354
19382
|
if (format !== "compact" && typeof Intl.DurationFormat !== "undefined") {
|
|
19355
19383
|
const fmt = new Intl.DurationFormat(lang, {
|
|
19356
19384
|
style: format, // "long", "short", or "narrow"
|
|
19357
19385
|
...(clockStyle ? { hoursDisplay: "always" } : {}),
|
|
19358
19386
|
});
|
|
19359
|
-
|
|
19360
|
-
|
|
19387
|
+
const duration = {};
|
|
19388
|
+
if (d > 0) {
|
|
19389
|
+
duration.days = d;
|
|
19390
|
+
}
|
|
19391
|
+
if (h > 0 || clockStyle || d > 0) {
|
|
19392
|
+
duration.hours = h;
|
|
19361
19393
|
}
|
|
19362
|
-
if (m === 0) {
|
|
19363
|
-
|
|
19394
|
+
if (m > 0 || (d === 0 && h === 0)) {
|
|
19395
|
+
duration.minutes = m;
|
|
19364
19396
|
}
|
|
19365
|
-
return fmt.format(
|
|
19397
|
+
return fmt.format(duration);
|
|
19366
19398
|
}
|
|
19367
|
-
// format="compact": "1h30", "45min", "2h" — no minute symbol when hours are present
|
|
19399
|
+
// format="compact": "1j12h", "1h30", "45min", "2h" — no minute symbol when hours are present
|
|
19400
|
+
const dSym = naviI18n("time.duration.day_symbol", undefined, { lang });
|
|
19368
19401
|
const hSym = naviI18n("time.duration.hour_symbol", undefined, { lang });
|
|
19369
19402
|
const mSym = naviI18n("time.duration.minute_symbol", undefined, { lang });
|
|
19403
|
+
const dStr = d > 0 ? `${formatCompactNumber(d, lang)}${dSym}` : "";
|
|
19370
19404
|
const hStr = clockStyle
|
|
19371
19405
|
? String(h).padStart(2, "0")
|
|
19372
19406
|
: formatCompactNumber(h, lang);
|
|
19373
|
-
if (h === 0 && !clockStyle) {
|
|
19407
|
+
if (d === 0 && h === 0 && !clockStyle) {
|
|
19374
19408
|
return `${m}${mSym}`;
|
|
19375
19409
|
}
|
|
19376
19410
|
if (m === 0) {
|
|
19377
|
-
|
|
19411
|
+
if (clockStyle) {
|
|
19412
|
+
// "10h00" on a clock, "2h" for a real 2 hours duration
|
|
19413
|
+
return `${hStr}${hSym}00`;
|
|
19414
|
+
}
|
|
19415
|
+
return h === 0 ? dStr : `${dStr}${hStr}${hSym}`;
|
|
19378
19416
|
}
|
|
19379
|
-
return `${hStr}${hSym}${String(m).padStart(2, "0")}`;
|
|
19417
|
+
return `${dStr}${hStr}${hSym}${String(m).padStart(2, "0")}`;
|
|
19418
|
+
};
|
|
19419
|
+
|
|
19420
|
+
// "forceUnit": stay in the unit the value is expressed in, however big it gets
|
|
19421
|
+
const formatSingleUnit = (value, unit, { lang, format }) => {
|
|
19422
|
+
if (format !== "compact" && typeof Intl.DurationFormat !== "undefined") {
|
|
19423
|
+
return new Intl.DurationFormat(lang, {
|
|
19424
|
+
style: format,
|
|
19425
|
+
// Intl drops a zero-valued unit, and "0 minute" is the whole point here
|
|
19426
|
+
[`${unit}sDisplay`]: "always",
|
|
19427
|
+
}).format({
|
|
19428
|
+
[`${unit}s`]: value,
|
|
19429
|
+
});
|
|
19430
|
+
}
|
|
19431
|
+
const symbol = naviI18n(`time.duration.${unit}_symbol`, undefined, { lang });
|
|
19432
|
+
return `${formatCompactNumber(value, lang)}${symbol}`;
|
|
19380
19433
|
};
|
|
19381
19434
|
|
|
19382
19435
|
/**
|
|
@@ -19384,16 +19437,26 @@ const formatMinuteDuration = (
|
|
|
19384
19437
|
* Delegates to {@link formatMinuteDuration} after converting hours to minutes.
|
|
19385
19438
|
*
|
|
19386
19439
|
* @param {number} hours
|
|
19387
|
-
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact" }} [options]
|
|
19440
|
+
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact", forceUnit?: boolean }} [options]
|
|
19441
|
+
* @param {boolean} [options.forceUnit=false] - Keep the value in hours however
|
|
19442
|
+
* big it gets ("36 heures" instead of "1 jour et 12 heures"). Ignored for a
|
|
19443
|
+
* fractional value, which has no single-unit spelling.
|
|
19388
19444
|
*
|
|
19389
19445
|
* @example
|
|
19390
19446
|
* formatHourDuration(1.5, { lang: "fr" }) // "1 heure 30 minutes" (long, default)
|
|
19391
19447
|
* formatHourDuration(1.5, { lang: "fr", format: "compact" }) // "1h30"
|
|
19392
19448
|
* formatHourDuration(2, { lang: "en", format: "compact" }) // "2h"
|
|
19449
|
+
* formatHourDuration(36, { lang: "fr" }) // "1 jour et 12 heures"
|
|
19450
|
+
* formatHourDuration(36, { lang: "fr", forceUnit: true }) // "36 heures"
|
|
19393
19451
|
*/
|
|
19394
|
-
const formatHourDuration = (hours, options) => {
|
|
19452
|
+
const formatHourDuration = (hours, options = {}) => {
|
|
19453
|
+
const { lang = languagesSignal.value, format = "long", forceUnit } = options;
|
|
19454
|
+
if (hours === 0 || (forceUnit && Number.isInteger(hours))) {
|
|
19455
|
+
return formatSingleUnit(hours, "hour", { lang, format });
|
|
19456
|
+
}
|
|
19457
|
+
// a fractional value has no single-unit spelling, it needs its minutes
|
|
19395
19458
|
const totalMinutes = Math.round(hours * 60);
|
|
19396
|
-
return formatMinuteDuration(totalMinutes, options);
|
|
19459
|
+
return formatMinuteDuration(totalMinutes, { ...options, forceUnit: false });
|
|
19397
19460
|
};
|
|
19398
19461
|
|
|
19399
19462
|
/**
|
|
@@ -19402,7 +19465,9 @@ const formatHourDuration = (hours, options) => {
|
|
|
19402
19465
|
* "compact" uses our own symbol-based notation.
|
|
19403
19466
|
*
|
|
19404
19467
|
* @param {number} seconds
|
|
19405
|
-
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact" }} [options]
|
|
19468
|
+
* @param {{ lang?: string, format?: "long"|"short"|"narrow"|"compact", forceUnit?: boolean }} [options]
|
|
19469
|
+
* @param {boolean} [options.forceUnit=false] - Keep the value in seconds
|
|
19470
|
+
* however big it gets ("90 000 secondes" instead of "1 jour et 1 heure").
|
|
19406
19471
|
*
|
|
19407
19472
|
* @example
|
|
19408
19473
|
* formatSecondDuration(90, { lang: "fr" }) // "1 minute 30 secondes" (long, default)
|
|
@@ -19413,27 +19478,40 @@ const formatHourDuration = (hours, options) => {
|
|
|
19413
19478
|
*/
|
|
19414
19479
|
const formatSecondDuration = (
|
|
19415
19480
|
seconds,
|
|
19416
|
-
{ lang = languagesSignal.value, format = "long" } = {},
|
|
19481
|
+
{ lang = languagesSignal.value, format = "long", forceUnit = false } = {},
|
|
19417
19482
|
) => {
|
|
19418
|
-
|
|
19483
|
+
if (seconds < 0) {
|
|
19484
|
+
// the d/h/m/s split below only holds for a positive value; formatting the
|
|
19485
|
+
// magnitude and putting the sign back is the only reading that works
|
|
19486
|
+
return `-${formatSecondDuration(-seconds, { lang, format, forceUnit })}`;
|
|
19487
|
+
}
|
|
19488
|
+
if (forceUnit || seconds === 0) {
|
|
19489
|
+
return formatSingleUnit(seconds, "second", { lang, format });
|
|
19490
|
+
}
|
|
19491
|
+
const totalHours = Math.floor(seconds / 3600);
|
|
19492
|
+
const d = Math.floor(totalHours / 24);
|
|
19493
|
+
const h = totalHours % 24;
|
|
19419
19494
|
const m = Math.floor((seconds % 3600) / 60);
|
|
19420
19495
|
const s = seconds % 60;
|
|
19421
19496
|
if (format !== "compact" && typeof Intl.DurationFormat !== "undefined") {
|
|
19422
19497
|
const fmt = new Intl.DurationFormat(lang, { style: format });
|
|
19423
19498
|
const duration = {};
|
|
19499
|
+
if (d > 0) duration.days = d;
|
|
19424
19500
|
if (h > 0) duration.hours = h;
|
|
19425
19501
|
if (m > 0) duration.minutes = m;
|
|
19426
|
-
if (s > 0 || (h === 0 && m === 0)) duration.seconds = s;
|
|
19502
|
+
if (s > 0 || (d === 0 && h === 0 && m === 0)) duration.seconds = s;
|
|
19427
19503
|
return fmt.format(duration);
|
|
19428
19504
|
}
|
|
19429
|
-
// compact: "1h30m45s", "1m30s", "45s"
|
|
19505
|
+
// compact: "1d1h30m45s", "1h30m45s", "1m30s", "45s"
|
|
19506
|
+
const dSym = naviI18n("time.duration.day_symbol", undefined, { lang });
|
|
19430
19507
|
const hSym = naviI18n("time.duration.hour_symbol", undefined, { lang });
|
|
19431
19508
|
const mSym = naviI18n("time.duration.minute_symbol", undefined, { lang });
|
|
19432
19509
|
const sSym = naviI18n("time.duration.second_symbol", undefined, { lang });
|
|
19433
19510
|
const parts = [];
|
|
19434
|
-
// m/s are
|
|
19511
|
+
// h/m/s are bounded by construction (never need grouping); d can be
|
|
19435
19512
|
// arbitrarily large for a long duration.
|
|
19436
|
-
if (
|
|
19513
|
+
if (d > 0) parts.push(`${formatCompactNumber(d, lang)}${dSym}`);
|
|
19514
|
+
if (h > 0) parts.push(`${h}${hSym}`);
|
|
19437
19515
|
if (m > 0) parts.push(`${m}${mSym}`);
|
|
19438
19516
|
if (s > 0 || parts.length === 0) parts.push(`${s}${sSym}`);
|
|
19439
19517
|
return parts.join("");
|
|
@@ -19455,6 +19533,7 @@ const formatSecondDuration = (
|
|
|
19455
19533
|
* formatDuration({ hours: 2, minutes: 15 }, { lang: "fr", format: "narrow" }) // "2h 15min" (Intl narrow)
|
|
19456
19534
|
* formatDuration({ hours: 2, minutes: 15 }, { lang: "fr", format: "compact" }) // "2h15" (custom, no minute symbol)
|
|
19457
19535
|
* formatDuration({ minutes: 45 }, { lang: "fr", format: "compact" }) // "45min"
|
|
19536
|
+
* formatDuration({ hours: 0, minutes: 0 }, { lang: "fr" }) // "0 minute"
|
|
19458
19537
|
* formatDuration({ hours: "2a", minutes: "15" }, { lang: "fr", format: "compact" }) // "2ah15"
|
|
19459
19538
|
*/
|
|
19460
19539
|
const formatDuration = (
|
|
@@ -19512,6 +19591,12 @@ const formatDuration = (
|
|
|
19512
19591
|
Object.keys(intlDuration).length > 0 &&
|
|
19513
19592
|
!(hasNegative && hasPositive)
|
|
19514
19593
|
) {
|
|
19594
|
+
if (!hasNegative && !hasPositive) {
|
|
19595
|
+
return formatSingleUnit(0, smallestUnitOf(intlDuration), {
|
|
19596
|
+
lang,
|
|
19597
|
+
format,
|
|
19598
|
+
});
|
|
19599
|
+
}
|
|
19515
19600
|
return new Intl.DurationFormat(lang, { style: format }).format(
|
|
19516
19601
|
intlDuration,
|
|
19517
19602
|
);
|
|
@@ -19526,7 +19611,8 @@ const formatDuration = (
|
|
|
19526
19611
|
// it's dropped here too, regardless of whether the caller included the
|
|
19527
19612
|
// key at all. Non-numeric mid-edit values (e.g. "2a") still count as
|
|
19528
19613
|
// present — Number("2a") is NaN, never === 0 — so those keep rendering
|
|
19529
|
-
// as-is with their own unit symbol.
|
|
19614
|
+
// as-is with their own unit symbol. When every component is zero there is
|
|
19615
|
+
// nothing left to drop, so the zero itself is rendered — see below.
|
|
19530
19616
|
const hasNonZero = (key) => has(key) && Number(duration[key]) !== 0;
|
|
19531
19617
|
|
|
19532
19618
|
const sym = (key) =>
|
|
@@ -19562,14 +19648,41 @@ const formatDuration = (
|
|
|
19562
19648
|
}
|
|
19563
19649
|
|
|
19564
19650
|
if (hasNonZero("seconds")) {
|
|
19565
|
-
parts.push(
|
|
19651
|
+
parts.push(
|
|
19652
|
+
`${formatCompactNumber(duration.seconds, lang)}${sym("second")}`,
|
|
19653
|
+
);
|
|
19566
19654
|
}
|
|
19567
19655
|
if (hasNonZero("milliseconds")) {
|
|
19568
19656
|
parts.push(
|
|
19569
19657
|
`${formatCompactNumber(duration.milliseconds, lang)}${sym("millisecond")}`,
|
|
19570
19658
|
);
|
|
19571
19659
|
}
|
|
19572
|
-
|
|
19660
|
+
if (parts.length > 0) {
|
|
19661
|
+
return parts.join("");
|
|
19662
|
+
}
|
|
19663
|
+
// everything was zero: say so in the smallest unit the caller mentioned,
|
|
19664
|
+
// rather than a bare "0" whose unit the reader has to guess
|
|
19665
|
+
const smallestUnit = smallestUnitOf(duration);
|
|
19666
|
+
return smallestUnit ? `0${sym(smallestUnit)}` : "0";
|
|
19667
|
+
};
|
|
19668
|
+
|
|
19669
|
+
const UNIT_KEYS = [
|
|
19670
|
+
"years",
|
|
19671
|
+
"months",
|
|
19672
|
+
"weeks",
|
|
19673
|
+
"days",
|
|
19674
|
+
"hours",
|
|
19675
|
+
"minutes",
|
|
19676
|
+
"seconds",
|
|
19677
|
+
"milliseconds",
|
|
19678
|
+
];
|
|
19679
|
+
const smallestUnitOf = (duration) => {
|
|
19680
|
+
for (const key of [...UNIT_KEYS].reverse()) {
|
|
19681
|
+
if (duration[key] !== undefined && duration[key] !== null) {
|
|
19682
|
+
return key.slice(0, -1); // "seconds" -> "second"
|
|
19683
|
+
}
|
|
19684
|
+
}
|
|
19685
|
+
return null;
|
|
19573
19686
|
};
|
|
19574
19687
|
|
|
19575
19688
|
/**
|
|
@@ -40322,10 +40435,11 @@ const TimeTime = ({
|
|
|
40322
40435
|
}
|
|
40323
40436
|
return null;
|
|
40324
40437
|
});
|
|
40325
|
-
|
|
40438
|
+
// toDate turns a non-finite number into an Invalid Date, which is an object
|
|
40439
|
+
if (!date || isNaN(date.getTime())) {
|
|
40326
40440
|
return jsx(TimeText, {
|
|
40327
40441
|
...props,
|
|
40328
|
-
children: children
|
|
40442
|
+
children: String(children)
|
|
40329
40443
|
});
|
|
40330
40444
|
}
|
|
40331
40445
|
const hh = String(date.getHours()).padStart(2, "0");
|
|
@@ -40423,6 +40537,7 @@ const TimeMinute = ({
|
|
|
40423
40537
|
children,
|
|
40424
40538
|
lang = languagesSignal.value,
|
|
40425
40539
|
format = "long",
|
|
40540
|
+
forceUnit = false,
|
|
40426
40541
|
...props
|
|
40427
40542
|
}) => {
|
|
40428
40543
|
if (children === undefined) {
|
|
@@ -40431,18 +40546,12 @@ const TimeMinute = ({
|
|
|
40431
40546
|
children: format === "timestring" ? "--:--" : "--"
|
|
40432
40547
|
});
|
|
40433
40548
|
}
|
|
40434
|
-
|
|
40435
|
-
if (
|
|
40436
|
-
|
|
40437
|
-
|
|
40438
|
-
|
|
40439
|
-
|
|
40440
|
-
return jsx(TimeText, {
|
|
40441
|
-
...props,
|
|
40442
|
-
children: children
|
|
40443
|
-
});
|
|
40444
|
-
}
|
|
40445
|
-
minutes = childrenAsNumber;
|
|
40549
|
+
const minutes = Number(children);
|
|
40550
|
+
if (!Number.isFinite(minutes)) {
|
|
40551
|
+
return jsx(TimeText, {
|
|
40552
|
+
...props,
|
|
40553
|
+
children: String(children)
|
|
40554
|
+
});
|
|
40446
40555
|
}
|
|
40447
40556
|
const totalHours = Math.floor(minutes / 60);
|
|
40448
40557
|
const remainingMinutes = minutes % 60;
|
|
@@ -40456,7 +40565,8 @@ const TimeMinute = ({
|
|
|
40456
40565
|
} else {
|
|
40457
40566
|
text = formatMinuteDuration(minutes, {
|
|
40458
40567
|
lang,
|
|
40459
|
-
format
|
|
40568
|
+
format,
|
|
40569
|
+
forceUnit
|
|
40460
40570
|
});
|
|
40461
40571
|
}
|
|
40462
40572
|
return jsx(TimeText, {
|
|
@@ -40469,6 +40579,7 @@ const TimeSecond = ({
|
|
|
40469
40579
|
children,
|
|
40470
40580
|
lang = languagesSignal.value,
|
|
40471
40581
|
format = "long",
|
|
40582
|
+
forceUnit = false,
|
|
40472
40583
|
...props
|
|
40473
40584
|
}) => {
|
|
40474
40585
|
if (children === undefined) {
|
|
@@ -40477,18 +40588,12 @@ const TimeSecond = ({
|
|
|
40477
40588
|
children: format === "timestring" ? "--:--:--" : "--"
|
|
40478
40589
|
});
|
|
40479
40590
|
}
|
|
40480
|
-
|
|
40481
|
-
if (
|
|
40482
|
-
|
|
40483
|
-
|
|
40484
|
-
|
|
40485
|
-
|
|
40486
|
-
return jsx(TimeText, {
|
|
40487
|
-
...props,
|
|
40488
|
-
children: children
|
|
40489
|
-
});
|
|
40490
|
-
}
|
|
40491
|
-
seconds = n;
|
|
40591
|
+
const seconds = Number(children);
|
|
40592
|
+
if (!Number.isFinite(seconds)) {
|
|
40593
|
+
return jsx(TimeText, {
|
|
40594
|
+
...props,
|
|
40595
|
+
children: String(children)
|
|
40596
|
+
});
|
|
40492
40597
|
}
|
|
40493
40598
|
const h = Math.floor(seconds / 3600);
|
|
40494
40599
|
const m = Math.floor(seconds % 3600 / 60);
|
|
@@ -40501,7 +40606,8 @@ const TimeSecond = ({
|
|
|
40501
40606
|
} else {
|
|
40502
40607
|
text = formatSecondDuration(seconds, {
|
|
40503
40608
|
lang,
|
|
40504
|
-
format
|
|
40609
|
+
format,
|
|
40610
|
+
forceUnit
|
|
40505
40611
|
});
|
|
40506
40612
|
}
|
|
40507
40613
|
return jsx(TimeText, {
|
|
@@ -40514,6 +40620,7 @@ const TimeHour = ({
|
|
|
40514
40620
|
children,
|
|
40515
40621
|
lang = languagesSignal.value,
|
|
40516
40622
|
format = "long",
|
|
40623
|
+
forceUnit = false,
|
|
40517
40624
|
...props
|
|
40518
40625
|
}) => {
|
|
40519
40626
|
if (children === undefined) {
|
|
@@ -40522,18 +40629,12 @@ const TimeHour = ({
|
|
|
40522
40629
|
children: format === "timestring" ? "--:--" : "--"
|
|
40523
40630
|
});
|
|
40524
40631
|
}
|
|
40525
|
-
|
|
40526
|
-
if (
|
|
40527
|
-
|
|
40528
|
-
|
|
40529
|
-
|
|
40530
|
-
|
|
40531
|
-
return jsx(TimeText, {
|
|
40532
|
-
...props,
|
|
40533
|
-
children: children
|
|
40534
|
-
});
|
|
40535
|
-
}
|
|
40536
|
-
hours = childrenAsNumber;
|
|
40632
|
+
const hours = Number(children);
|
|
40633
|
+
if (!Number.isFinite(hours)) {
|
|
40634
|
+
return jsx(TimeText, {
|
|
40635
|
+
...props,
|
|
40636
|
+
children: String(children)
|
|
40637
|
+
});
|
|
40537
40638
|
}
|
|
40538
40639
|
if (format === "timestring") {
|
|
40539
40640
|
const totalMinutes = Math.round(hours * 60);
|
|
@@ -40545,7 +40646,8 @@ const TimeHour = ({
|
|
|
40545
40646
|
}
|
|
40546
40647
|
const text = formatHourDuration(hours, {
|
|
40547
40648
|
lang,
|
|
40548
|
-
format
|
|
40649
|
+
format,
|
|
40650
|
+
forceUnit
|
|
40549
40651
|
});
|
|
40550
40652
|
return jsx(TimeText, {
|
|
40551
40653
|
...props,
|
|
@@ -42516,12 +42618,20 @@ const ListUI = props => {
|
|
|
42516
42618
|
});
|
|
42517
42619
|
} else if (loading && loadingFallback) {
|
|
42518
42620
|
if (loadingFallback === "skeleton") {
|
|
42621
|
+
// Skeleton rows draw their own separators: they never reach ListItemUI
|
|
42622
|
+
// (where real items get theirs from SeparatorContext), and without them
|
|
42623
|
+
// the list would visibly gain its dividers only once loaded.
|
|
42519
42624
|
const template = loadingSkeletonTemplate ?? jsx(ListItem, {
|
|
42520
42625
|
skeleton: true
|
|
42521
42626
|
});
|
|
42522
42627
|
const skeletons = [];
|
|
42523
42628
|
let skeletonIndex = 0;
|
|
42524
42629
|
while (skeletonIndex < loadingSkeletonCount) {
|
|
42630
|
+
if (separator && skeletonIndex > 0) {
|
|
42631
|
+
skeletons.push(cloneElement(resolveSeparatorVnode(separator, skeletonIndex - 1), {
|
|
42632
|
+
key: `navi-list-skeleton-separator-${skeletonIndex}`
|
|
42633
|
+
}));
|
|
42634
|
+
}
|
|
42525
42635
|
skeletons.push(cloneElement(template, {
|
|
42526
42636
|
key: `navi-list-skeleton-${skeletonIndex}`
|
|
42527
42637
|
}));
|
|
@@ -42677,9 +42787,7 @@ const ListContent = ({
|
|
|
42677
42787
|
loading: loading,
|
|
42678
42788
|
error: error,
|
|
42679
42789
|
searchNoMatchMode: searchNoMatchMode,
|
|
42680
|
-
separator: separator
|
|
42681
|
-
margin: "0"
|
|
42682
|
-
}) : separator,
|
|
42790
|
+
separator: separator,
|
|
42683
42791
|
expandX: expandX
|
|
42684
42792
|
// Deliberately not expandY here (unlike expandX above): the outer
|
|
42685
42793
|
// .navi_list_container already gets its own expandY treatment (see
|
|
@@ -43511,7 +43619,7 @@ const ListItemUI = props => {
|
|
|
43511
43619
|
}
|
|
43512
43620
|
// separatorIndex is only used as the function-form argument (gap index)
|
|
43513
43621
|
const separatorIndex = groupVisibleIndex === null ? visibleIndex : groupVisibleIndex;
|
|
43514
|
-
const separatorVnode =
|
|
43622
|
+
const separatorVnode = resolveSeparatorVnode(separator, separatorIndex - 1);
|
|
43515
43623
|
return jsxs(Fragment$1, {
|
|
43516
43624
|
children: [separatorVnode, listItemVnode]
|
|
43517
43625
|
});
|
|
@@ -43723,6 +43831,21 @@ const ListItemGroup = ({
|
|
|
43723
43831
|
});
|
|
43724
43832
|
};
|
|
43725
43833
|
|
|
43834
|
+
// The `separator` prop accepts `true` (the default divider), a vnode, or a
|
|
43835
|
+
// function receiving the gap index — this turns any of them into the vnode to
|
|
43836
|
+
// render at that gap.
|
|
43837
|
+
const resolveSeparatorVnode = (separator, gapIndex) => {
|
|
43838
|
+
if (separator === true) {
|
|
43839
|
+
return jsx(Separator, {
|
|
43840
|
+
margin: "0"
|
|
43841
|
+
});
|
|
43842
|
+
}
|
|
43843
|
+
if (typeof separator === "function") {
|
|
43844
|
+
return separator(gapIndex);
|
|
43845
|
+
}
|
|
43846
|
+
return separator;
|
|
43847
|
+
};
|
|
43848
|
+
|
|
43726
43849
|
const PickerNaviTime = props => {
|
|
43727
43850
|
const Next = useNextResolver();
|
|
43728
43851
|
const {
|
|
@@ -44627,6 +44750,7 @@ installImportMetaCssBuild(import.meta);const css$l = /* css */`
|
|
|
44627
44750
|
flex-grow: 1;
|
|
44628
44751
|
justify-content: inherit;
|
|
44629
44752
|
pointer-events: none;
|
|
44753
|
+
user-select: none;
|
|
44630
44754
|
|
|
44631
44755
|
&[navi-placeholder] {
|
|
44632
44756
|
color: var(--picker-placeholder-color);
|
|
@@ -44665,7 +44789,6 @@ installImportMetaCssBuild(import.meta);const css$l = /* css */`
|
|
|
44665
44789
|
outline: none;
|
|
44666
44790
|
cursor: inherit;
|
|
44667
44791
|
pointer-events: auto;
|
|
44668
|
-
user-select: all;
|
|
44669
44792
|
|
|
44670
44793
|
&::-webkit-calendar-picker-indicator {
|
|
44671
44794
|
cursor: inherit;
|