smoothly 1.0.0-alpha.130 → 1.0.0-alpha.132

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 (42) hide show
  1. package/dist/cjs/{getLanguage-28ce96e4.js → getLanguage-9f898047.js} +43 -34
  2. package/dist/cjs/getLanguage-9f898047.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/smoothly-accordion_70.cjs.entry.js +87 -6090
  5. package/dist/cjs/smoothly-accordion_70.cjs.entry.js.map +1 -1
  6. package/dist/cjs/smoothly-country.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly.cjs.js +1 -1
  8. package/dist/collection/components/app/index.js +6 -2
  9. package/dist/collection/components/app/index.js.map +1 -1
  10. package/dist/collection/components/display-demo/index.js +1 -1
  11. package/dist/collection/components/display-demo/index.js.map +1 -1
  12. package/dist/collection/components/icon/index.js +5 -7
  13. package/dist/collection/components/icon/index.js.map +1 -1
  14. package/dist/collection/components/input/demo/index.js +17 -1
  15. package/dist/collection/components/input/demo/index.js.map +1 -1
  16. package/dist/custom-elements/index.js +413 -6407
  17. package/dist/custom-elements/index.js.map +1 -1
  18. package/dist/esm/{getLanguage-5233a597.js → getLanguage-02b3c8d3.js} +42 -33
  19. package/dist/esm/getLanguage-02b3c8d3.js.map +1 -0
  20. package/dist/esm/loader.js +1 -1
  21. package/dist/esm/smoothly-accordion_70.entry.js +101 -6104
  22. package/dist/esm/smoothly-accordion_70.entry.js.map +1 -1
  23. package/dist/esm/smoothly-country.entry.js +1 -1
  24. package/dist/esm/smoothly.js +1 -1
  25. package/dist/smoothly/p-1a108f60.js +2 -0
  26. package/dist/smoothly/p-1a108f60.js.map +1 -0
  27. package/dist/smoothly/p-99d32826.entry.js +2 -0
  28. package/dist/smoothly/p-99d32826.entry.js.map +1 -0
  29. package/dist/smoothly/{p-bf63d2e6.entry.js → p-fd6ce760.entry.js} +2 -2
  30. package/dist/smoothly/smoothly.esm.js +1 -1
  31. package/dist/smoothly/smoothly.esm.js.map +1 -1
  32. package/dist/types/components/app/index.d.ts +1 -1
  33. package/dist/types/components/icon/index.d.ts +0 -1
  34. package/dist/types/components/input/demo/index.d.ts +2 -0
  35. package/package.json +3 -3
  36. package/dist/cjs/getLanguage-28ce96e4.js.map +0 -1
  37. package/dist/esm/getLanguage-5233a597.js.map +0 -1
  38. package/dist/smoothly/p-2a0c2387.js +0 -2
  39. package/dist/smoothly/p-2a0c2387.js.map +0 -1
  40. package/dist/smoothly/p-d6185f62.entry.js +0 -2
  41. package/dist/smoothly/p-d6185f62.entry.js.map +0 -1
  42. /package/dist/smoothly/{p-bf63d2e6.entry.js.map → p-fd6ce760.entry.js.map} +0 -0
@@ -5962,7 +5962,7 @@ var TimeRange$1;
5962
5962
  TimeRange.create = create;
5963
5963
  })(TimeRange$1 || (TimeRange$1 = {}));
5964
5964
 
5965
- var TimeSpan$1;
5965
+ exports.TimeSpan = void 0;
5966
5966
  (function (TimeSpan) {
5967
5967
  function is(value) {
5968
5968
  return (typeof value == "object" &&
@@ -6010,20 +6010,15 @@ var TimeSpan$1;
6010
6010
  return performRound$1(result, round);
6011
6011
  }
6012
6012
  TimeSpan.toMilliseconds = toMilliseconds;
6013
- function sum(...addends) {
6014
- return addends.reduce((result, addend) => Object.entries(addend).reduce((result, [key, addend]) => {
6015
- const sum = (result[key] ?? 0) + addend;
6016
- return !sum
6017
- ? (({ [key]: _, ...result }) => result)(result)
6018
- : Object.assign(result, { [key]: (result[key] ?? 0) + addend });
6019
- }, result), {});
6013
+ function unitByUnit(operation, left, ...rights) {
6014
+ return rights.reduce((result, span) => Object.entries(span).reduce((result, [key, right]) => (({ [key]: left, ...result }) => Object.assign(result, { [key]: +operation(left ?? 0, right ?? 0).toFixed(9) }))(result), result), left);
6020
6015
  }
6021
6016
  function add(...addends) {
6022
- return addends.reduce((result, addend) => Object.entries(addend).reduce((result, [key, addend]) => (({ [key]: value, ...result }) => sum(result, from[key]((value ?? 0) + addend)))(result), result), {});
6017
+ return normalize(unitByUnit((left, right) => left + right, {}, ...addends));
6023
6018
  }
6024
6019
  TimeSpan.add = add;
6025
6020
  function subtract(minuend, ...subtrahends) {
6026
- return subtrahends.reduce((result, subtrahend) => Object.entries(subtrahend).reduce((result, [key, subtrahend]) => (({ [key]: value, ...result }) => sum(result, from[key]((value ?? 0) - subtrahend)))(result), result), minuend);
6021
+ return normalize(unitByUnit((left, right) => left - right, minuend, ...subtrahends));
6027
6022
  }
6028
6023
  TimeSpan.subtract = subtract;
6029
6024
  function fromHours(value, options) {
@@ -6032,13 +6027,11 @@ var TimeSpan$1;
6032
6027
  const hours = Math.trunc(value);
6033
6028
  const remainder = +(value % 1).toFixed(9);
6034
6029
  if (precision != "hours") {
6035
- result = fromMinutes(remainder * 60, { precision });
6036
- if (hours)
6037
- result.hours = hours;
6030
+ result = { hours: hours, ...fromMinutes(remainder * 60, { precision, normalize: false }) };
6038
6031
  }
6039
6032
  else
6040
- result = sum({ hours: hours + Math.round(remainder) });
6041
- return result;
6033
+ result = { hours: hours + Math.round(remainder) };
6034
+ return options?.normalize == false ? result : normalize(result);
6042
6035
  }
6043
6036
  TimeSpan.fromHours = fromHours;
6044
6037
  function fromMinutes(value, options) {
@@ -6047,12 +6040,12 @@ var TimeSpan$1;
6047
6040
  const minutes = Math.trunc(value);
6048
6041
  const remainder = +(value % 1).toFixed(7);
6049
6042
  if (precision != "minutes")
6050
- result = sum({ minutes: minutes % 60 }, fromSeconds(remainder * 60, { precision }), Math.abs(minutes) < 60 ? {} : fromHours(Math.trunc(minutes / 60), { precision: "hours" }));
6043
+ result = { minutes: minutes, ...fromSeconds(remainder * 60, { precision, normalize: false }) };
6051
6044
  else {
6052
6045
  const rounded = minutes + Math.round(remainder);
6053
- result = sum({ minutes: rounded % 60 }, fromHours(Math.trunc(rounded / 60), { precision: "hours" }));
6046
+ result = add({ minutes: rounded % 60 }, fromHours(Math.trunc(rounded / 60), { precision: "hours", normalize: false }));
6054
6047
  }
6055
- return result;
6048
+ return options?.normalize == false ? result : normalize(result);
6056
6049
  }
6057
6050
  TimeSpan.fromMinutes = fromMinutes;
6058
6051
  function fromSeconds(value, options) {
@@ -6061,29 +6054,45 @@ var TimeSpan$1;
6061
6054
  const seconds = Math.trunc(value);
6062
6055
  const remainder = +(value % 1).toFixed(5);
6063
6056
  if (precision != "seconds")
6064
- result = sum({ seconds: seconds % 60 }, fromMilliseconds(remainder * 1000), Math.abs(seconds) < 60 ? {} : fromMinutes(Math.trunc(seconds / 60), { precision: "minutes" }));
6057
+ result = { ...(seconds && { seconds: seconds }), ...fromMilliseconds(remainder * 1000, { normalize: false }) };
6065
6058
  else {
6066
6059
  const rounded = seconds + Math.round(remainder);
6067
- result = sum({ seconds: rounded % 60 }, fromMinutes(Math.trunc(rounded / 60), { precision: "minutes" }));
6060
+ result = add({ seconds: rounded % 60 }, fromMinutes(Math.trunc(rounded / 60), { precision: "minutes", normalize: false }));
6068
6061
  }
6069
- return result;
6062
+ return options?.normalize == false ? result : normalize(result);
6070
6063
  }
6071
6064
  TimeSpan.fromSeconds = fromSeconds;
6072
- function fromMilliseconds(value) {
6065
+ function fromMilliseconds(value, options) {
6073
6066
  const rounded = Math.round(value);
6074
- return sum({ milliseconds: rounded % 1000 }, Math.abs(rounded) < 1000 ? {} : fromSeconds(Math.trunc(rounded / 1000), { precision: "seconds" }));
6067
+ const result = add(!rounded ? {} : { milliseconds: rounded % 1000 }, Math.abs(rounded) < 1000
6068
+ ? {}
6069
+ : fromSeconds(Math.trunc(rounded / 1000), { precision: "seconds", normalize: false }));
6070
+ return options?.normalize == false ? result : normalize(result);
6075
6071
  }
6076
6072
  TimeSpan.fromMilliseconds = fromMilliseconds;
6077
- const from = {
6078
- years: (value) => ({ ...(value && { years: value }) }),
6079
- months: (value) => ({ ...(value && { months: value }) }),
6080
- days: (value) => ({ ...(value && { days: value }) }),
6081
- hours: fromHours,
6082
- minutes: fromMinutes,
6083
- seconds: fromSeconds,
6084
- milliseconds: fromMilliseconds,
6085
- };
6086
- })(TimeSpan$1 || (TimeSpan$1 = {}));
6073
+ function normalize(value) {
6074
+ const result = {
6075
+ milliseconds: Math.round(toMilliseconds(value) % 1000),
6076
+ seconds: Math.trunc(toSeconds(value) % 60),
6077
+ minutes: Math.trunc(toMinutes(value) % 60),
6078
+ hours: Math.trunc(toHours(value)),
6079
+ };
6080
+ if (!(-1000 < result.milliseconds && result.milliseconds < 1000)) {
6081
+ result.seconds += Math.trunc(result.milliseconds / 1000);
6082
+ result.milliseconds = result.milliseconds % 1000;
6083
+ }
6084
+ if (!(-60 < result.seconds && result.seconds < 60)) {
6085
+ result.minutes += Math.trunc(result.seconds / 60);
6086
+ result.seconds = result.seconds % 60;
6087
+ }
6088
+ if (!(-60 < result.minutes && result.minutes < 60)) {
6089
+ result.hours += Math.trunc(result.minutes);
6090
+ result.minutes = result.minutes % 60;
6091
+ }
6092
+ return Object.fromEntries(Object.entries(result).filter(([, value]) => !!value));
6093
+ }
6094
+ TimeSpan.normalize = normalize;
6095
+ })(exports.TimeSpan || (exports.TimeSpan = {}));
6087
6096
  function dateToMilliseconds$1(span) {
6088
6097
  const now = Date.UTC(0, 0);
6089
6098
  const date = new Date(now);
@@ -12230,4 +12239,4 @@ function convert(language) {
12230
12239
 
12231
12240
  exports.getLanguage = getLanguage;
12232
12241
 
12233
- //# sourceMappingURL=getLanguage-28ce96e4.js.map
12242
+ //# sourceMappingURL=getLanguage-9f898047.js.map