yummies 7.14.2 → 7.15.1
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/assert.cjs +1 -1
- package/assert.js +1 -1
- package/{chunk-CVq3Gv4J.cjs → chunk-CZWwpsFl.cjs} +0 -7
- package/chunk-pbuEa-1d.js +13 -0
- package/css.cjs +1 -1
- package/date-time.cjs +886 -344
- package/date-time.cjs.map +1 -1
- package/date-time.d.ts +1 -1
- package/date-time.js +879 -337
- package/date-time.js.map +1 -1
- package/errors.cjs +1 -1
- package/format.cjs +1 -1
- package/format.js +1 -1
- package/html.cjs +1 -1
- package/id.cjs +1 -1
- package/imports.cjs +1 -1
- package/media.cjs +1 -1
- package/mobx.cjs +61 -1
- package/mobx.cjs.map +1 -1
- package/mobx.d.ts +36 -1
- package/mobx.js +61 -2
- package/mobx.js.map +1 -1
- package/package.json +7 -7
- package/parser.cjs +1 -1
- package/parser.js +1 -1
- package/react.cjs +1 -1
- package/type-guard.cjs +1 -1
- package/type-guard.js +1 -1
- package/chunk-YKewjYmz.js +0 -37
package/date-time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.js","names":[],"sources":["../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/duration.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/relativeTime.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/locale/ru.js","../src/date-time.ts"],"sourcesContent":["!function(t,s){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=s():\"function\"==typeof define&&define.amd?define(s):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs_plugin_duration=s()}(this,(function(){\"use strict\";var t,s,n=1e3,i=6e4,e=36e5,r=864e5,o=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,d=2628e6,a=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:u,months:d,days:r,hours:e,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof g},f=function(t,s,n){return new g(t,n,s.$l)},m=function(t){return s.p(t)+\"s\"},l=function(t){return t<0},$=function(t){return l(t)?Math.ceil(t):Math.floor(t)},y=function(t){return Math.abs(t)},v=function(t,s){return t?l(t)?{negative:!0,format:\"\"+y(t)+s}:{negative:!1,format:\"\"+t+s}:{negative:!1,format:\"\"}},g=function(){function l(t,s,n){var i=this;if(this.$d={},this.$l=n,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),s)return f(t*h[m(s)],this);if(\"number\"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if(\"object\"==typeof t)return Object.keys(t).forEach((function(s){i.$d[m(s)]=t[s]})),this.calMilliseconds(),this;if(\"string\"==typeof t){var e=t.match(a);if(e){var r=e.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var y=l.prototype;return y.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(s,n){return s+(t.$d[n]||0)*h[n]}),0)},y.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=$(t/u),t%=u,this.$d.months=$(t/d),t%=d,this.$d.days=$(t/r),t%=r,this.$d.hours=$(t/e),t%=e,this.$d.minutes=$(t/i),t%=i,this.$d.seconds=$(t/n),t%=n,this.$d.milliseconds=t},y.toISOString=function(){var t=v(this.$d.years,\"Y\"),s=v(this.$d.months,\"M\"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=v(n,\"D\"),e=v(this.$d.hours,\"H\"),r=v(this.$d.minutes,\"M\"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3,o=Math.round(1e3*o)/1e3);var u=v(o,\"S\"),d=t.negative||s.negative||i.negative||e.negative||r.negative||u.negative,a=e.format||r.format||u.format?\"T\":\"\",h=(d?\"-\":\"\")+\"P\"+t.format+s.format+i.format+a+e.format+r.format+u.format;return\"P\"===h||\"-P\"===h?\"P0D\":h},y.toJSON=function(){return this.toISOString()},y.format=function(t){var n=t||\"YYYY-MM-DDTHH:mm:ss\",i={Y:this.$d.years,YY:s.s(this.$d.years,2,\"0\"),YYYY:s.s(this.$d.years,4,\"0\"),M:this.$d.months,MM:s.s(this.$d.months,2,\"0\"),D:this.$d.days,DD:s.s(this.$d.days,2,\"0\"),H:this.$d.hours,HH:s.s(this.$d.hours,2,\"0\"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,\"0\"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,\"0\"),SSS:s.s(this.$d.milliseconds,3,\"0\")};return n.replace(o,(function(t,s){return s||String(i[t])}))},y.as=function(t){return this.$ms/h[m(t)]},y.get=function(t){var s=this.$ms,n=m(t);return\"milliseconds\"===n?s%=1e3:s=\"weeks\"===n?$(s/h[n]):this.$d[n],s||0},y.add=function(t,s,n){var i;return i=s?t*h[m(s)]:c(t)?t.$ms:f(t,this).$ms,f(this.$ms+i*(n?-1:1),this)},y.subtract=function(t,s){return this.add(t,s,!0)},y.locale=function(t){var s=this.clone();return s.$l=t,s},y.clone=function(){return f(this.$ms,this)},y.humanize=function(s){return t().add(this.$ms,\"ms\").locale(this.$l).fromNow(!s)},y.valueOf=function(){return this.asMilliseconds()},y.milliseconds=function(){return this.get(\"milliseconds\")},y.asMilliseconds=function(){return this.as(\"milliseconds\")},y.seconds=function(){return this.get(\"seconds\")},y.asSeconds=function(){return this.as(\"seconds\")},y.minutes=function(){return this.get(\"minutes\")},y.asMinutes=function(){return this.as(\"minutes\")},y.hours=function(){return this.get(\"hours\")},y.asHours=function(){return this.as(\"hours\")},y.days=function(){return this.get(\"days\")},y.asDays=function(){return this.as(\"days\")},y.weeks=function(){return this.get(\"weeks\")},y.asWeeks=function(){return this.as(\"weeks\")},y.months=function(){return this.get(\"months\")},y.asMonths=function(){return this.as(\"months\")},y.years=function(){return this.get(\"years\")},y.asYears=function(){return this.as(\"years\")},l}(),p=function(t,s,n){return t.add(s.years()*n,\"y\").add(s.months()*n,\"M\").add(s.days()*n,\"d\").add(s.hours()*n,\"h\").add(s.minutes()*n,\"m\").add(s.seconds()*n,\"s\").add(s.milliseconds()*n,\"ms\")};return function(n,i,e){t=e,s=e().$utils(),e.duration=function(t,s){var n=e.locale();return f(t,{$l:n},s)},e.isDuration=c;var r=i.prototype.add,o=i.prototype.subtract;i.prototype.add=function(t,s){return c(t)?p(this,t,1):r.bind(this)(t,s)},i.prototype.subtract=function(t,s){return c(t)?p(this,t,-1):o.bind(this)(t,s)}}}));","!function(r,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(r=\"undefined\"!=typeof globalThis?globalThis:r||self).dayjs_plugin_relativeTime=e()}(this,(function(){\"use strict\";return function(r,e,t){r=r||{};var n=e.prototype,o={future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:\"s\",r:44,d:\"second\"},{l:\"m\",r:89},{l:\"mm\",r:44,d:\"minute\"},{l:\"h\",r:89},{l:\"hh\",r:21,d:\"hour\"},{l:\"d\",r:35},{l:\"dd\",r:25,d:\"day\"},{l:\"M\",r:45},{l:\"MM\",r:10,d:\"month\"},{l:\"y\",r:17},{l:\"yy\",d:\"year\"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,!0):i.diff(e,y.d,!0));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(\"\"+p)),a=\"string\"==typeof v?v.replace(\"%d\",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return\"function\"==typeof M?M(a):M.replace(\"%s\",a)},n.to=function(r,e){return i(r,e,this,!0)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)}}}));","!function(_,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t(require(\"dayjs\")):\"function\"==typeof define&&define.amd?define([\"dayjs\"],t):(_=\"undefined\"!=typeof globalThis?globalThis:_||self).dayjs_locale_ru=t(_.dayjs)}(this,(function(_){\"use strict\";function t(_){return _&&\"object\"==typeof _&&\"default\"in _?_:{default:_}}var e=t(_),n=\"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря\".split(\"_\"),s=\"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь\".split(\"_\"),r=\"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.\".split(\"_\"),o=\"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.\".split(\"_\"),i=/D[oD]?(\\[[^[\\]]*\\]|\\s)+MMMM?/;function d(_,t,e){var n,s;return\"m\"===e?t?\"минута\":\"минуту\":_+\" \"+(n=+_,s={mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[e].split(\"_\"),n%10==1&&n%100!=11?s[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?s[1]:s[2])}var u=function(_,t){return i.test(t)?n[_.month()]:s[_.month()]};u.s=s,u.f=n;var a=function(_,t){return i.test(t)?r[_.month()]:o[_.month()]};a.s=o,a.f=r;var m={name:\"ru\",weekdays:\"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота\".split(\"_\"),weekdaysShort:\"вск_пнд_втр_срд_чтв_птн_сбт\".split(\"_\"),weekdaysMin:\"вс_пн_вт_ср_чт_пт_сб\".split(\"_\"),months:u,monthsShort:a,weekStart:1,yearStart:4,formats:{LT:\"H:mm\",LTS:\"H:mm:ss\",L:\"DD.MM.YYYY\",LL:\"D MMMM YYYY г.\",LLL:\"D MMMM YYYY г., H:mm\",LLLL:\"dddd, D MMMM YYYY г., H:mm\"},relativeTime:{future:\"через %s\",past:\"%s назад\",s:\"несколько секунд\",m:d,mm:d,h:\"час\",hh:d,d:\"день\",dd:d,M:\"месяц\",MM:d,y:\"год\",yy:d},ordinal:function(_){return _},meridiem:function(_){return _<4?\"ночи\":_<12?\"утра\":_<17?\"дня\":\"вечера\"}};return e.default.locale(m,null,!0),m}));","/**\n * ---header-docs-section---\n * # yummies/date-time\n *\n * ## Description\n *\n * Date and time formatting built on **dayjs** with locale plugins, human-readable presets, relative\n * phrases, and duration helpers tailored to UI copy. It composes with `yummies/format`, `yummies/ms`,\n * and `yummies/text` for declensions so timestamps read naturally in Russian-facing apps.\n *\n * ## Usage\n *\n * ```ts\n * import { formatDate } from \"yummies/date-time\";\n * ```\n */\n\nimport dayjs, { type Dayjs, type ManipulateType } from 'dayjs';\nimport duration from 'dayjs/plugin/duration.js';\nimport relativeTime from 'dayjs/plugin/relativeTime.js';\nimport { format } from 'yummies/format';\nimport { ms, unitsToMs } from 'yummies/ms';\nimport { declension } from 'yummies/text';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nimport 'dayjs/locale/ru.js';\n\ndayjs.extend(relativeTime);\ndayjs.extend(duration);\ndayjs.locale('ru');\n\nconst toLibFormat = (value: Maybe<RawDateToFormat>): Dayjs | null => {\n let result: Maybe<Dayjs> = null;\n if (dayjs.isDayjs(value)) {\n result = value;\n } else if (value != null) {\n result = dayjs(value);\n }\n\n if (!result?.isValid()) {\n return null;\n }\n\n return result;\n};\n\nexport type RawDateToFormat = Date | string | number | Dayjs;\n\n/**\n * Formats a date-like value using predefined presets or a custom pattern.\n *\n * @example\n * ```ts\n * formatDate('2024-03-15', { format: 'time-short' });\n * ```\n */\nexport const formatDate = (\n value: Maybe<RawDateToFormat>,\n settings?: Maybe<{\n format?:\n | 'human'\n | 'full'\n | 'short'\n | 'day'\n | 'day-only'\n | 'date'\n | 'month'\n | 'spent-time'\n | 'time'\n | 'time-short';\n pattern?: string;\n asTime?: boolean;\n }>,\n) => {\n const dateFormat = settings?.format;\n const datePattern = settings?.pattern;\n const asTime = settings?.asTime;\n\n let libDate: duration.Duration | dayjs.Dayjs | null = null;\n\n if (asTime && typeGuard.isNumber(value)) {\n libDate = dayjs.duration(value);\n } else {\n libDate = toLibFormat(value);\n }\n\n if (!libDate) {\n return format.NO_VALUE;\n }\n\n if (datePattern) {\n return libDate.format(datePattern);\n }\n\n if (dateFormat === 'human' || dateFormat === 'spent-time') {\n if ('fromNow' in libDate) {\n return libDate.fromNow(dateFormat === 'spent-time');\n } else {\n return format.NO_VALUE;\n }\n }\n\n switch (dateFormat) {\n case 'full': {\n return libDate.format('DD MMM YYYY HH:mm:ss');\n }\n case 'short': {\n return libDate.format('DD MMM HH:mm');\n }\n case 'time': {\n return libDate.format('HH:mm:ss');\n }\n case 'time-short': {\n return libDate.format('HH:mm');\n }\n case 'day': {\n return libDate.format('DD MMM YYYY');\n }\n case 'month': {\n return libDate.format('MMMM YYYY');\n }\n default: {\n return libDate.format('DD.MM.YYYY');\n }\n }\n};\n\n/**\n * Splits a duration in milliseconds into day-based time parts.\n *\n * @example\n * ```ts\n * dayTimeDuration(ms(1, 'day') + ms(2, 'hour'));\n * ```\n */\nexport const dayTimeDuration = (timeInMs: number) => {\n let left = Math.max(timeInMs, 0);\n\n const days = Math.floor(left / unitsToMs.day);\n left = left % unitsToMs.day;\n\n const hours = Math.floor(left / unitsToMs.hour);\n left = left % unitsToMs.hour;\n\n const minutes = Math.floor(left / unitsToMs.min);\n left = left % unitsToMs.min;\n\n const seconds = Math.floor(left / unitsToMs.sec);\n left = left % unitsToMs.sec;\n\n const milliseconds = Math.floor(left);\n\n return {\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n };\n};\n\ntype DateChangeParam = [amount: number, unit?: Maybe<ManipulateType>];\n\n/**\n * Applies one or more date adjustments and returns a new `Date` instance.\n *\n * @example\n * ```ts\n * changeDate(new Date(), 1, 'day', 30, 'minute');\n * ```\n */\nexport const changeDate = (\n date: Maybe<RawDateToFormat>,\n ...args: [\n ...DateChangeParam,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ]\n) => {\n let wrappedDate = toLibFormat(date)!;\n\n for (let i = 0; i < args.length; i += 2) {\n const amount = args[i] as DateChangeParam[0];\n const unit = args[i + 1] as DateChangeParam[1];\n if (unit != null) {\n wrappedDate = wrappedDate.add(amount, unit);\n }\n }\n\n return wrappedDate.toDate();\n};\n\n/**\n * Converts milliseconds into hour-based time parts without keeping full days separately.\n *\n * @example\n * ```ts\n * timeDuration(ms(1, 'hour') + ms(30, 'min'));\n * ```\n */\nexport const timeDuration = (timeInMs: number) => {\n const { days, hours, milliseconds, minutes, seconds } =\n dayTimeDuration(timeInMs);\n\n return {\n hours: hours + unitsToMs.day * days,\n milliseconds,\n minutes,\n seconds,\n };\n};\n\nconst durationFormatLabels = {\n days: { compact: 'д', full: ['день', 'дня', 'дней'] },\n hours: { compact: 'ч', full: ['час', 'часа', 'часов'] },\n minutes: { compact: 'мин', full: ['минута', 'минуты', 'минут'] },\n seconds: { compact: 'сек', full: ['секунда', 'секунды', 'секунд'] },\n} as const;\n\n/**\n * Formats a duration either from milliseconds or between two dates.\n *\n * @example\n * ```ts\n * getFormatDuration(ms(2, 'hour') + ms(15, 'min'));\n * ```\n */\nexport function getFormatDuration(\n dateA: Date,\n dateB: Date,\n compact?: boolean,\n): string;\nexport function getFormatDuration(ms: number, compact?: boolean): string;\n\nexport function getFormatDuration(...args: any[]): string {\n let compact = false;\n let diff = 0;\n\n if (args[0] instanceof Date) {\n const startedDate = dayjs(args[0]);\n const endedDate = dayjs(args[1]);\n\n diff = endedDate.diff(startedDate, 'ms');\n compact = args[2] === true;\n } else {\n diff = args[0];\n compact = args[1] === true;\n }\n\n const { days, hours, minutes, seconds } = dayTimeDuration(diff);\n\n const formattedParts: string[] = [];\n\n if (days) {\n if (compact) {\n formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);\n } else {\n formattedParts.push(\n `${days} ${declension(days, durationFormatLabels.days.full)}`,\n );\n }\n }\n\n if (hours) {\n if (compact) {\n formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);\n } else {\n formattedParts.push(\n `${hours} ${declension(hours, durationFormatLabels.hours.full)}`,\n );\n }\n }\n\n if (minutes) {\n if (compact) {\n formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);\n } else {\n formattedParts.push(\n `${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`,\n );\n }\n }\n\n if (seconds) {\n if (compact) {\n formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);\n } else {\n formattedParts.push(\n `${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`,\n );\n }\n }\n\n return formattedParts.join(' ');\n}\n\nexport type TimeDiff = {\n minutes: number;\n seconds: number;\n total: {\n ms: number;\n hours: number;\n };\n};\n\n/**\n * Calculates the difference between two dates in minutes, seconds and total units.\n *\n * @example\n * ```ts\n * getTimeDiff(new Date('2024-03-15T12:30:00'), new Date('2024-03-15T12:00:00'));\n * ```\n */\nexport const getTimeDiff = (\n dateA: RawDateToFormat,\n dateB: RawDateToFormat,\n): TimeDiff => {\n const leftDate = toLibFormat(dateA)?.toDate();\n const rightDate = toLibFormat(dateB)?.toDate();\n\n if (!leftDate || !rightDate) {\n return {\n minutes: 0,\n seconds: 0,\n total: { ms: 0, hours: 0 },\n };\n }\n\n const msDiff = leftDate.getTime() - rightDate.getTime();\n\n return {\n minutes: Math.max(Math.floor(msDiff / ms(1, 'min')), 0),\n seconds: Math.max(Math.floor((msDiff % ms(1, 'min')) / 1000), 0),\n total: {\n hours: Math.round(msDiff / ms(1, 'hour')),\n ms: msDiff,\n },\n };\n};\n\n/**\n * Returns a new date shifted forward by the provided number of days.\n *\n * @example\n * ```ts\n * addDays(new Date('2024-03-15'), 7);\n * ```\n */\nexport const addDays = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.add(count, 'd').toDate();\n\n/**\n * Returns a new date shifted backward by the provided number of days.\n *\n * @example\n * ```ts\n * subtractDays(new Date('2024-03-15'), 7);\n * ```\n */\nexport const subtractDays = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.subtract(count, 'd').toDate();\n\n/**\n * Returns a new date shifted forward by the provided number of minutes.\n *\n * @example\n * ```ts\n * addMinutes(new Date('2024-03-15T12:00:00'), 15);\n * ```\n */\nexport const addMinutes = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.add(count, 'm').toDate();\n\n/**\n * Returns a new date with the minutes field replaced.\n *\n * @example\n * ```ts\n * setMinutes(new Date('2024-03-15T12:00:00'), 45);\n * ```\n */\nexport const setMinutes = (date: RawDateToFormat, minutes: number) =>\n toLibFormat(date)?.set('m', minutes).toDate();\n\n/**\n * Returns a new date with the hours field replaced.\n *\n * @example\n * ```ts\n * setHours(new Date('2024-03-15T12:00:00'), 9);\n * ```\n */\nexport const setHours = (date: RawDateToFormat, hours: number) =>\n toLibFormat(date)?.set('h', hours).toDate();\n"],"x_google_ignoreList":[0,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AChE,OAAO;GACL,OAAO,KAAK,MAAM,SAAS,GAAG,GAAG,OAAO,CAAC;GACzC,IAAI;GACL;EACF;;;;;;;;;;AAWH,IAAa,WAAW,MAAuB,UAC7C,YAAY,KAAK,EAAE,IAAI,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAU7C,IAAa,gBAAgB,MAAuB,UAClD,YAAY,KAAK,EAAE,SAAS,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAUlD,IAAa,cAAc,MAAuB,UAChD,YAAY,KAAK,EAAE,IAAI,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAU7C,IAAa,cAAc,MAAuB,YAChD,YAAY,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,QAAQ;;;;;;;;;AAU/C,IAAa,YAAY,MAAuB,UAC9C,YAAY,KAAK,EAAE,IAAI,KAAK,MAAM,CAAC,QAAQ"}
|
|
1
|
+
{"version":3,"file":"date-time.js","names":["C.M","prettyUnit","en","wrapper","U","C.REGEX_PARSE","C.INVALID_DATE_STRING","C.Y","C.M","C.W","C.DATE","C.H","C.MIN","C.S","C.MS","C.REGEX_FORMAT","C.MILLISECONDS_A_MINUTE","C.Q","C.MILLISECONDS_A_WEEK","C.MILLISECONDS_A_DAY","C.MILLISECONDS_A_HOUR","C.MILLISECONDS_A_SECOND"],"sources":["../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/constant.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/en.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/utils.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/index.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/duration/index.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/relativeTime/index.js","../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/ru.js","../src/date-time.ts"],"sourcesContent":["export var SECONDS_A_MINUTE = 60;\nexport var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;\nexport var SECONDS_A_DAY = SECONDS_A_HOUR * 24;\nexport var SECONDS_A_WEEK = SECONDS_A_DAY * 7;\nexport var MILLISECONDS_A_SECOND = 1e3;\nexport var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;\nexport var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;\nexport var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;\nexport var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales\n\nexport var MS = 'millisecond';\nexport var S = 'second';\nexport var MIN = 'minute';\nexport var H = 'hour';\nexport var D = 'day';\nexport var W = 'week';\nexport var M = 'month';\nexport var Q = 'quarter';\nexport var Y = 'year';\nexport var DATE = 'date';\nexport var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';\nexport var INVALID_DATE_STRING = 'Invalid Date'; // regex\n\nexport var REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/;\nexport var REGEX_FORMAT = /\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;","// English [en]\n// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale\nexport default {\n name: 'en',\n weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),\n ordinal: function ordinal(n) {\n var s = ['th', 'st', 'nd', 'rd'];\n var v = n % 100;\n return \"[\" + n + (s[(v - 20) % 10] || s[v] || s[0]) + \"]\";\n }\n};","import * as C from './constant';\n\nvar padStart = function padStart(string, length, pad) {\n var s = String(string);\n if (!s || s.length >= length) return string;\n return \"\" + Array(length + 1 - s.length).join(pad) + string;\n};\n\nvar padZoneStr = function padZoneStr(instance) {\n var negMinutes = -instance.utcOffset();\n var minutes = Math.abs(negMinutes);\n var hourOffset = Math.floor(minutes / 60);\n var minuteOffset = minutes % 60;\n return \"\" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + \":\" + padStart(minuteOffset, 2, '0');\n};\n\nvar monthDiff = function monthDiff(a, b) {\n // function from moment.js in order to keep the same result\n if (a.date() < b.date()) return -monthDiff(b, a);\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());\n var anchor = a.clone().add(wholeMonthDiff, C.M);\n var c = b - anchor < 0;\n var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), C.M);\n return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);\n};\n\nvar absFloor = function absFloor(n) {\n return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);\n};\n\nvar prettyUnit = function prettyUnit(u) {\n var special = {\n M: C.M,\n y: C.Y,\n w: C.W,\n d: C.D,\n D: C.DATE,\n h: C.H,\n m: C.MIN,\n s: C.S,\n ms: C.MS,\n Q: C.Q\n };\n return special[u] || String(u || '').toLowerCase().replace(/s$/, '');\n};\n\nvar isUndefined = function isUndefined(s) {\n return s === undefined;\n};\n\nexport default {\n s: padStart,\n z: padZoneStr,\n m: monthDiff,\n a: absFloor,\n p: prettyUnit,\n u: isUndefined\n};","import * as C from './constant';\nimport en from './locale/en';\nimport U from './utils';\nvar L = 'en'; // global locale\n\nvar Ls = {}; // global loaded locale\n\nLs[L] = en;\nvar IS_DAYJS = '$isDayjsObject'; // eslint-disable-next-line no-use-before-define\n\nvar isDayjs = function isDayjs(d) {\n return d instanceof Dayjs || !!(d && d[IS_DAYJS]);\n};\n\nvar parseLocale = function parseLocale(preset, object, isLocal) {\n var l;\n if (!preset) return L;\n\n if (typeof preset === 'string') {\n var presetLower = preset.toLowerCase();\n\n if (Ls[presetLower]) {\n l = presetLower;\n }\n\n if (object) {\n Ls[presetLower] = object;\n l = presetLower;\n }\n\n var presetSplit = preset.split('-');\n\n if (!l && presetSplit.length > 1) {\n return parseLocale(presetSplit[0]);\n }\n } else {\n var name = preset.name;\n Ls[name] = preset;\n l = name;\n }\n\n if (!isLocal && l) L = l;\n return l || !isLocal && L;\n};\n\nvar dayjs = function dayjs(date, c) {\n if (isDayjs(date)) {\n return date.clone();\n } // eslint-disable-next-line no-nested-ternary\n\n\n var cfg = typeof c === 'object' ? c : {};\n cfg.date = date;\n cfg.args = arguments; // eslint-disable-line prefer-rest-params\n\n return new Dayjs(cfg); // eslint-disable-line no-use-before-define\n};\n\nvar wrapper = function wrapper(date, instance) {\n return dayjs(date, {\n locale: instance.$L,\n utc: instance.$u,\n x: instance.$x,\n $offset: instance.$offset // todo: refactor; do not use this.$offset in you code\n\n });\n};\n\nvar Utils = U; // for plugin use\n\nUtils.l = parseLocale;\nUtils.i = isDayjs;\nUtils.w = wrapper;\n\nvar parseDate = function parseDate(cfg) {\n var date = cfg.date,\n utc = cfg.utc;\n if (date === null) return new Date(NaN); // null is invalid\n\n if (Utils.u(date)) return new Date(); // today\n\n if (date instanceof Date) return new Date(date);\n\n if (typeof date === 'string' && !/Z$/i.test(date)) {\n var d = date.match(C.REGEX_PARSE);\n\n if (d) {\n var m = d[2] - 1 || 0;\n var ms = (d[7] || '0').substring(0, 3);\n\n if (utc) {\n return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));\n }\n\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n\n return new Date(date); // everything else\n};\n\nvar Dayjs = /*#__PURE__*/function () {\n function Dayjs(cfg) {\n this.$L = parseLocale(cfg.locale, null, true);\n this.parse(cfg); // for plugin\n\n this.$x = this.$x || cfg.x || {};\n this[IS_DAYJS] = true;\n }\n\n var _proto = Dayjs.prototype;\n\n _proto.parse = function parse(cfg) {\n this.$d = parseDate(cfg);\n this.init();\n };\n\n _proto.init = function init() {\n var $d = this.$d;\n this.$y = $d.getFullYear();\n this.$M = $d.getMonth();\n this.$D = $d.getDate();\n this.$W = $d.getDay();\n this.$H = $d.getHours();\n this.$m = $d.getMinutes();\n this.$s = $d.getSeconds();\n this.$ms = $d.getMilliseconds();\n } // eslint-disable-next-line class-methods-use-this\n ;\n\n _proto.$utils = function $utils() {\n return Utils;\n };\n\n _proto.isValid = function isValid() {\n return !(this.$d.toString() === C.INVALID_DATE_STRING);\n };\n\n _proto.isSame = function isSame(that, units) {\n var other = dayjs(that);\n return this.startOf(units) <= other && other <= this.endOf(units);\n };\n\n _proto.isAfter = function isAfter(that, units) {\n return dayjs(that) < this.startOf(units);\n };\n\n _proto.isBefore = function isBefore(that, units) {\n return this.endOf(units) < dayjs(that);\n };\n\n _proto.$g = function $g(input, get, set) {\n if (Utils.u(input)) return this[get];\n return this.set(set, input);\n };\n\n _proto.unix = function unix() {\n return Math.floor(this.valueOf() / 1000);\n };\n\n _proto.valueOf = function valueOf() {\n // timezone(hour) * 60 * 60 * 1000 => ms\n return this.$d.getTime();\n };\n\n _proto.startOf = function startOf(units, _startOf) {\n var _this = this;\n\n // startOf -> endOf\n var isStartOf = !Utils.u(_startOf) ? _startOf : true;\n var unit = Utils.p(units);\n\n var instanceFactory = function instanceFactory(d, m) {\n var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);\n return isStartOf ? ins : ins.endOf(C.D);\n };\n\n var instanceFactorySet = function instanceFactorySet(method, slice) {\n var argumentStart = [0, 0, 0, 0];\n var argumentEnd = [23, 59, 59, 999];\n return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread\n _this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);\n };\n\n var $W = this.$W,\n $M = this.$M,\n $D = this.$D;\n var utcPad = \"set\" + (this.$u ? 'UTC' : '');\n\n switch (unit) {\n case C.Y:\n return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);\n\n case C.M:\n return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);\n\n case C.W:\n {\n var weekStart = this.$locale().weekStart || 0;\n var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;\n return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);\n }\n\n case C.D:\n case C.DATE:\n return instanceFactorySet(utcPad + \"Hours\", 0);\n\n case C.H:\n return instanceFactorySet(utcPad + \"Minutes\", 1);\n\n case C.MIN:\n return instanceFactorySet(utcPad + \"Seconds\", 2);\n\n case C.S:\n return instanceFactorySet(utcPad + \"Milliseconds\", 3);\n\n default:\n return this.clone();\n }\n };\n\n _proto.endOf = function endOf(arg) {\n return this.startOf(arg, false);\n };\n\n _proto.$set = function $set(units, _int) {\n var _C$D$C$DATE$C$M$C$Y$C;\n\n // private set\n var unit = Utils.p(units);\n var utcPad = \"set\" + (this.$u ? 'UTC' : '');\n var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[C.D] = utcPad + \"Date\", _C$D$C$DATE$C$M$C$Y$C[C.DATE] = utcPad + \"Date\", _C$D$C$DATE$C$M$C$Y$C[C.M] = utcPad + \"Month\", _C$D$C$DATE$C$M$C$Y$C[C.Y] = utcPad + \"FullYear\", _C$D$C$DATE$C$M$C$Y$C[C.H] = utcPad + \"Hours\", _C$D$C$DATE$C$M$C$Y$C[C.MIN] = utcPad + \"Minutes\", _C$D$C$DATE$C$M$C$Y$C[C.S] = utcPad + \"Seconds\", _C$D$C$DATE$C$M$C$Y$C[C.MS] = utcPad + \"Milliseconds\", _C$D$C$DATE$C$M$C$Y$C)[unit];\n var arg = unit === C.D ? this.$D + (_int - this.$W) : _int;\n\n if (unit === C.M || unit === C.Y) {\n // clone is for badMutable plugin\n var date = this.clone().set(C.DATE, 1);\n date.$d[name](arg);\n date.init();\n this.$d = date.set(C.DATE, Math.min(this.$D, date.daysInMonth())).$d;\n } else if (name) this.$d[name](arg);\n\n this.init();\n return this;\n };\n\n _proto.set = function set(string, _int2) {\n return this.clone().$set(string, _int2);\n };\n\n _proto.get = function get(unit) {\n return this[Utils.p(unit)]();\n };\n\n _proto.add = function add(number, units) {\n var _this2 = this,\n _C$MIN$C$H$C$S$unit;\n\n number = Number(number); // eslint-disable-line no-param-reassign\n\n var unit = Utils.p(units);\n\n var instanceFactorySet = function instanceFactorySet(n) {\n var d = dayjs(_this2);\n return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);\n };\n\n if (unit === C.M) {\n return this.set(C.M, this.$M + number);\n }\n\n if (unit === C.Y) {\n return this.set(C.Y, this.$y + number);\n }\n\n if (unit === C.D) {\n return instanceFactorySet(1);\n }\n\n if (unit === C.W) {\n return instanceFactorySet(7);\n }\n\n var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[C.MIN] = C.MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[C.H] = C.MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[C.S] = C.MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms\n\n var nextTimeStamp = this.$d.getTime() + number * step;\n return Utils.w(nextTimeStamp, this);\n };\n\n _proto.subtract = function subtract(number, string) {\n return this.add(number * -1, string);\n };\n\n _proto.format = function format(formatStr) {\n var _this3 = this;\n\n var locale = this.$locale();\n if (!this.isValid()) return locale.invalidDate || C.INVALID_DATE_STRING;\n var str = formatStr || C.FORMAT_DEFAULT;\n var zoneStr = Utils.z(this);\n var $H = this.$H,\n $m = this.$m,\n $M = this.$M;\n var weekdays = locale.weekdays,\n months = locale.months,\n meridiem = locale.meridiem;\n\n var getShort = function getShort(arr, index, full, length) {\n return arr && (arr[index] || arr(_this3, str)) || full[index].slice(0, length);\n };\n\n var get$H = function get$H(num) {\n return Utils.s($H % 12 || 12, num, '0');\n };\n\n var meridiemFunc = meridiem || function (hour, minute, isLowercase) {\n var m = hour < 12 ? 'AM' : 'PM';\n return isLowercase ? m.toLowerCase() : m;\n };\n\n var matches = function matches(match) {\n switch (match) {\n case 'YY':\n return String(_this3.$y).slice(-2);\n\n case 'YYYY':\n return Utils.s(_this3.$y, 4, '0');\n\n case 'M':\n return $M + 1;\n\n case 'MM':\n return Utils.s($M + 1, 2, '0');\n\n case 'MMM':\n return getShort(locale.monthsShort, $M, months, 3);\n\n case 'MMMM':\n return getShort(months, $M);\n\n case 'D':\n return _this3.$D;\n\n case 'DD':\n return Utils.s(_this3.$D, 2, '0');\n\n case 'd':\n return String(_this3.$W);\n\n case 'dd':\n return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);\n\n case 'ddd':\n return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);\n\n case 'dddd':\n return weekdays[_this3.$W];\n\n case 'H':\n return String($H);\n\n case 'HH':\n return Utils.s($H, 2, '0');\n\n case 'h':\n return get$H(1);\n\n case 'hh':\n return get$H(2);\n\n case 'a':\n return meridiemFunc($H, $m, true);\n\n case 'A':\n return meridiemFunc($H, $m, false);\n\n case 'm':\n return String($m);\n\n case 'mm':\n return Utils.s($m, 2, '0');\n\n case 's':\n return String(_this3.$s);\n\n case 'ss':\n return Utils.s(_this3.$s, 2, '0');\n\n case 'SSS':\n return Utils.s(_this3.$ms, 3, '0');\n\n case 'Z':\n return zoneStr;\n // 'ZZ' logic below\n\n default:\n break;\n }\n\n return null;\n };\n\n return str.replace(C.REGEX_FORMAT, function (match, $1) {\n return $1 || matches(match) || zoneStr.replace(':', '');\n }); // 'ZZ'\n };\n\n _proto.utcOffset = function utcOffset() {\n // Because a bug at FF24, we're rounding the timezone offset around 15 minutes\n // https://github.com/moment/moment/pull/1871\n return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;\n };\n\n _proto.diff = function diff(input, units, _float) {\n var _this4 = this;\n\n var unit = Utils.p(units);\n var that = dayjs(input);\n var zoneDelta = (that.utcOffset() - this.utcOffset()) * C.MILLISECONDS_A_MINUTE;\n var diff = this - that;\n\n var getMonth = function getMonth() {\n return Utils.m(_this4, that);\n };\n\n var result;\n\n switch (unit) {\n case C.Y:\n result = getMonth() / 12;\n break;\n\n case C.M:\n result = getMonth();\n break;\n\n case C.Q:\n result = getMonth() / 3;\n break;\n\n case C.W:\n result = (diff - zoneDelta) / C.MILLISECONDS_A_WEEK;\n break;\n\n case C.D:\n result = (diff - zoneDelta) / C.MILLISECONDS_A_DAY;\n break;\n\n case C.H:\n result = diff / C.MILLISECONDS_A_HOUR;\n break;\n\n case C.MIN:\n result = diff / C.MILLISECONDS_A_MINUTE;\n break;\n\n case C.S:\n result = diff / C.MILLISECONDS_A_SECOND;\n break;\n\n default:\n result = diff; // milliseconds\n\n break;\n }\n\n return _float ? result : Utils.a(result);\n };\n\n _proto.daysInMonth = function daysInMonth() {\n return this.endOf(C.M).$D;\n };\n\n _proto.$locale = function $locale() {\n // get locale object\n return Ls[this.$L];\n };\n\n _proto.locale = function locale(preset, object) {\n if (!preset) return this.$L;\n var that = this.clone();\n var nextLocaleName = parseLocale(preset, object, true);\n if (nextLocaleName) that.$L = nextLocaleName;\n return that;\n };\n\n _proto.clone = function clone() {\n return Utils.w(this.$d, this);\n };\n\n _proto.toDate = function toDate() {\n return new Date(this.valueOf());\n };\n\n _proto.toJSON = function toJSON() {\n return this.isValid() ? this.toISOString() : null;\n };\n\n _proto.toISOString = function toISOString() {\n // ie 8 return\n // new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)\n // .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')\n return this.$d.toISOString();\n };\n\n _proto.toString = function toString() {\n return this.$d.toUTCString();\n };\n\n return Dayjs;\n}();\n\nvar proto = Dayjs.prototype;\ndayjs.prototype = proto;\n[['$ms', C.MS], ['$s', C.S], ['$m', C.MIN], ['$H', C.H], ['$W', C.D], ['$M', C.M], ['$y', C.Y], ['$D', C.DATE]].forEach(function (g) {\n proto[g[1]] = function (input) {\n return this.$g(input, g[0], g[1]);\n };\n});\n\ndayjs.extend = function (plugin, option) {\n if (!plugin.$i) {\n // install plugin only once\n plugin(option, Dayjs, dayjs);\n plugin.$i = true;\n }\n\n return dayjs;\n};\n\ndayjs.locale = parseLocale;\ndayjs.isDayjs = isDayjs;\n\ndayjs.unix = function (timestamp) {\n return dayjs(timestamp * 1e3);\n};\n\ndayjs.en = Ls[L];\ndayjs.Ls = Ls;\ndayjs.p = {};\nexport default dayjs;","import { MILLISECONDS_A_DAY, MILLISECONDS_A_HOUR, MILLISECONDS_A_MINUTE, MILLISECONDS_A_SECOND, MILLISECONDS_A_WEEK, REGEX_FORMAT } from '../../constant';\nvar MILLISECONDS_A_YEAR = MILLISECONDS_A_DAY * 365;\nvar MILLISECONDS_A_MONTH = MILLISECONDS_A_YEAR / 12;\nvar durationRegex = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\nvar unitToMS = {\n years: MILLISECONDS_A_YEAR,\n months: MILLISECONDS_A_MONTH,\n days: MILLISECONDS_A_DAY,\n hours: MILLISECONDS_A_HOUR,\n minutes: MILLISECONDS_A_MINUTE,\n seconds: MILLISECONDS_A_SECOND,\n milliseconds: 1,\n weeks: MILLISECONDS_A_WEEK\n};\n\nvar isDuration = function isDuration(d) {\n return d instanceof Duration;\n}; // eslint-disable-line no-use-before-define\n\n\nvar $d;\nvar $u;\n\nvar wrapper = function wrapper(input, instance, unit) {\n return new Duration(input, unit, instance.$l);\n}; // eslint-disable-line no-use-before-define\n\n\nvar prettyUnit = function prettyUnit(unit) {\n return $u.p(unit) + \"s\";\n};\n\nvar isNegative = function isNegative(number) {\n return number < 0;\n};\n\nvar roundNumber = function roundNumber(number) {\n return isNegative(number) ? Math.ceil(number) : Math.floor(number);\n};\n\nvar absolute = function absolute(number) {\n return Math.abs(number);\n};\n\nvar getNumberUnitFormat = function getNumberUnitFormat(number, unit) {\n if (!number) {\n return {\n negative: false,\n format: ''\n };\n }\n\n if (isNegative(number)) {\n return {\n negative: true,\n format: \"\" + absolute(number) + unit\n };\n }\n\n return {\n negative: false,\n format: \"\" + number + unit\n };\n};\n\nvar Duration = /*#__PURE__*/function () {\n function Duration(input, unit, locale) {\n var _this = this;\n\n this.$d = {};\n this.$l = locale;\n\n if (input === undefined) {\n this.$ms = 0;\n this.parseFromMilliseconds();\n }\n\n if (unit) {\n return wrapper(input * unitToMS[prettyUnit(unit)], this);\n }\n\n if (typeof input === 'number') {\n this.$ms = input;\n this.parseFromMilliseconds();\n return this;\n }\n\n if (typeof input === 'object') {\n Object.keys(input).forEach(function (k) {\n _this.$d[prettyUnit(k)] = input[k];\n });\n this.calMilliseconds();\n return this;\n }\n\n if (typeof input === 'string') {\n var d = input.match(durationRegex);\n\n if (d) {\n var properties = d.slice(2);\n var numberD = properties.map(function (value) {\n return value != null ? Number(value) : 0;\n });\n this.$d.years = numberD[0];\n this.$d.months = numberD[1];\n this.$d.weeks = numberD[2];\n this.$d.days = numberD[3];\n this.$d.hours = numberD[4];\n this.$d.minutes = numberD[5];\n this.$d.seconds = numberD[6];\n this.calMilliseconds();\n return this;\n }\n }\n\n return this;\n }\n\n var _proto = Duration.prototype;\n\n _proto.calMilliseconds = function calMilliseconds() {\n var _this2 = this;\n\n this.$ms = Object.keys(this.$d).reduce(function (total, unit) {\n return total + (_this2.$d[unit] || 0) * unitToMS[unit];\n }, 0);\n };\n\n _proto.parseFromMilliseconds = function parseFromMilliseconds() {\n var $ms = this.$ms;\n this.$d.years = roundNumber($ms / MILLISECONDS_A_YEAR);\n $ms %= MILLISECONDS_A_YEAR;\n this.$d.months = roundNumber($ms / MILLISECONDS_A_MONTH);\n $ms %= MILLISECONDS_A_MONTH;\n this.$d.days = roundNumber($ms / MILLISECONDS_A_DAY);\n $ms %= MILLISECONDS_A_DAY;\n this.$d.hours = roundNumber($ms / MILLISECONDS_A_HOUR);\n $ms %= MILLISECONDS_A_HOUR;\n this.$d.minutes = roundNumber($ms / MILLISECONDS_A_MINUTE);\n $ms %= MILLISECONDS_A_MINUTE;\n this.$d.seconds = roundNumber($ms / MILLISECONDS_A_SECOND);\n $ms %= MILLISECONDS_A_SECOND;\n this.$d.milliseconds = $ms;\n };\n\n _proto.toISOString = function toISOString() {\n var Y = getNumberUnitFormat(this.$d.years, 'Y');\n var M = getNumberUnitFormat(this.$d.months, 'M');\n var days = +this.$d.days || 0;\n\n if (this.$d.weeks) {\n days += this.$d.weeks * 7;\n }\n\n var D = getNumberUnitFormat(days, 'D');\n var H = getNumberUnitFormat(this.$d.hours, 'H');\n var m = getNumberUnitFormat(this.$d.minutes, 'M');\n var seconds = this.$d.seconds || 0;\n\n if (this.$d.milliseconds) {\n seconds += this.$d.milliseconds / 1000;\n seconds = Math.round(seconds * 1000) / 1000;\n }\n\n var S = getNumberUnitFormat(seconds, 'S');\n var negativeMode = Y.negative || M.negative || D.negative || H.negative || m.negative || S.negative;\n var T = H.format || m.format || S.format ? 'T' : '';\n var P = negativeMode ? '-' : '';\n var result = P + \"P\" + Y.format + M.format + D.format + T + H.format + m.format + S.format;\n return result === 'P' || result === '-P' ? 'P0D' : result;\n };\n\n _proto.toJSON = function toJSON() {\n return this.toISOString();\n };\n\n _proto.format = function format(formatStr) {\n var str = formatStr || 'YYYY-MM-DDTHH:mm:ss';\n var matches = {\n Y: this.$d.years,\n YY: $u.s(this.$d.years, 2, '0'),\n YYYY: $u.s(this.$d.years, 4, '0'),\n M: this.$d.months,\n MM: $u.s(this.$d.months, 2, '0'),\n D: this.$d.days,\n DD: $u.s(this.$d.days, 2, '0'),\n H: this.$d.hours,\n HH: $u.s(this.$d.hours, 2, '0'),\n m: this.$d.minutes,\n mm: $u.s(this.$d.minutes, 2, '0'),\n s: this.$d.seconds,\n ss: $u.s(this.$d.seconds, 2, '0'),\n SSS: $u.s(this.$d.milliseconds, 3, '0')\n };\n return str.replace(REGEX_FORMAT, function (match, $1) {\n return $1 || String(matches[match]);\n });\n };\n\n _proto.as = function as(unit) {\n return this.$ms / unitToMS[prettyUnit(unit)];\n };\n\n _proto.get = function get(unit) {\n var base = this.$ms;\n var pUnit = prettyUnit(unit);\n\n if (pUnit === 'milliseconds') {\n base %= 1000;\n } else if (pUnit === 'weeks') {\n base = roundNumber(base / unitToMS[pUnit]);\n } else {\n base = this.$d[pUnit];\n }\n\n return base || 0; // a === 0 will be true on both 0 and -0\n };\n\n _proto.add = function add(input, unit, isSubtract) {\n var another;\n\n if (unit) {\n another = input * unitToMS[prettyUnit(unit)];\n } else if (isDuration(input)) {\n another = input.$ms;\n } else {\n another = wrapper(input, this).$ms;\n }\n\n return wrapper(this.$ms + another * (isSubtract ? -1 : 1), this);\n };\n\n _proto.subtract = function subtract(input, unit) {\n return this.add(input, unit, true);\n };\n\n _proto.locale = function locale(l) {\n var that = this.clone();\n that.$l = l;\n return that;\n };\n\n _proto.clone = function clone() {\n return wrapper(this.$ms, this);\n };\n\n _proto.humanize = function humanize(withSuffix) {\n return $d().add(this.$ms, 'ms').locale(this.$l).fromNow(!withSuffix);\n };\n\n _proto.valueOf = function valueOf() {\n return this.asMilliseconds();\n };\n\n _proto.milliseconds = function milliseconds() {\n return this.get('milliseconds');\n };\n\n _proto.asMilliseconds = function asMilliseconds() {\n return this.as('milliseconds');\n };\n\n _proto.seconds = function seconds() {\n return this.get('seconds');\n };\n\n _proto.asSeconds = function asSeconds() {\n return this.as('seconds');\n };\n\n _proto.minutes = function minutes() {\n return this.get('minutes');\n };\n\n _proto.asMinutes = function asMinutes() {\n return this.as('minutes');\n };\n\n _proto.hours = function hours() {\n return this.get('hours');\n };\n\n _proto.asHours = function asHours() {\n return this.as('hours');\n };\n\n _proto.days = function days() {\n return this.get('days');\n };\n\n _proto.asDays = function asDays() {\n return this.as('days');\n };\n\n _proto.weeks = function weeks() {\n return this.get('weeks');\n };\n\n _proto.asWeeks = function asWeeks() {\n return this.as('weeks');\n };\n\n _proto.months = function months() {\n return this.get('months');\n };\n\n _proto.asMonths = function asMonths() {\n return this.as('months');\n };\n\n _proto.years = function years() {\n return this.get('years');\n };\n\n _proto.asYears = function asYears() {\n return this.as('years');\n };\n\n return Duration;\n}();\n\nvar manipulateDuration = function manipulateDuration(date, duration, k) {\n return date.add(duration.years() * k, 'y').add(duration.months() * k, 'M').add(duration.days() * k, 'd').add(duration.hours() * k, 'h').add(duration.minutes() * k, 'm').add(duration.seconds() * k, 's').add(duration.milliseconds() * k, 'ms');\n};\n\nexport default (function (option, Dayjs, dayjs) {\n $d = dayjs;\n $u = dayjs().$utils();\n\n dayjs.duration = function (input, unit) {\n var $l = dayjs.locale();\n return wrapper(input, {\n $l: $l\n }, unit);\n };\n\n dayjs.isDuration = isDuration;\n var oldAdd = Dayjs.prototype.add;\n var oldSubtract = Dayjs.prototype.subtract;\n\n Dayjs.prototype.add = function (value, unit) {\n if (isDuration(value)) {\n return manipulateDuration(this, value, 1);\n }\n\n return oldAdd.bind(this)(value, unit);\n };\n\n Dayjs.prototype.subtract = function (value, unit) {\n if (isDuration(value)) {\n return manipulateDuration(this, value, -1);\n }\n\n return oldSubtract.bind(this)(value, unit);\n };\n});","import * as C from '../../constant';\nexport default (function (o, c, d) {\n o = o || {};\n var proto = c.prototype;\n var relObj = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years'\n };\n d.en.relativeTime = relObj;\n\n proto.fromToBase = function (input, withoutSuffix, instance, isFrom, postFormat) {\n var loc = instance.$locale().relativeTime || relObj;\n var T = o.thresholds || [{\n l: 's',\n r: 44,\n d: C.S\n }, {\n l: 'm',\n r: 89\n }, {\n l: 'mm',\n r: 44,\n d: C.MIN\n }, {\n l: 'h',\n r: 89\n }, {\n l: 'hh',\n r: 21,\n d: C.H\n }, {\n l: 'd',\n r: 35\n }, {\n l: 'dd',\n r: 25,\n d: C.D\n }, {\n l: 'M',\n r: 45\n }, {\n l: 'MM',\n r: 10,\n d: C.M\n }, {\n l: 'y',\n r: 17\n }, {\n l: 'yy',\n d: C.Y\n }];\n var Tl = T.length;\n var result;\n var out;\n var isFuture;\n\n for (var i = 0; i < Tl; i += 1) {\n var t = T[i];\n\n if (t.d) {\n result = isFrom ? d(input).diff(instance, t.d, true) : instance.diff(input, t.d, true);\n }\n\n var abs = (o.rounding || Math.round)(Math.abs(result));\n isFuture = result > 0;\n\n if (abs <= t.r || !t.r) {\n if (abs <= 1 && i > 0) t = T[i - 1]; // 1 minutes -> a minute, 0 seconds -> 0 second\n\n var format = loc[t.l];\n\n if (postFormat) {\n abs = postFormat(\"\" + abs);\n }\n\n if (typeof format === 'string') {\n out = format.replace('%d', abs);\n } else {\n out = format(abs, withoutSuffix, t.l, isFuture);\n }\n\n break;\n }\n }\n\n if (withoutSuffix) return out;\n var pastOrFuture = isFuture ? loc.future : loc.past;\n\n if (typeof pastOrFuture === 'function') {\n return pastOrFuture(out);\n }\n\n return pastOrFuture.replace('%s', out);\n };\n\n function fromTo(input, withoutSuffix, instance, isFrom) {\n return proto.fromToBase(input, withoutSuffix, instance, isFrom);\n }\n\n proto.to = function (input, withoutSuffix) {\n return fromTo(input, withoutSuffix, this, true);\n };\n\n proto.from = function (input, withoutSuffix) {\n return fromTo(input, withoutSuffix, this);\n };\n\n var makeNow = function makeNow(thisDay) {\n return thisDay.$u ? d.utc() : d();\n };\n\n proto.toNow = function (withoutSuffix) {\n return this.to(makeNow(this), withoutSuffix);\n };\n\n proto.fromNow = function (withoutSuffix) {\n return this.from(makeNow(this), withoutSuffix);\n };\n});","// Russian [ru]\nimport dayjs from '../index';\nvar monthFormat = 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_');\nvar monthStandalone = 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_');\nvar monthShortFormat = 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_');\nvar monthShortStandalone = 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_');\nvar MONTHS_IN_FORMAT = /D[oD]?(\\[[^[\\]]*\\]|\\s)+MMMM?/;\n\nfunction plural(word, num) {\n var forms = word.split('_');\n return num % 10 === 1 && num % 100 !== 11 ? forms[0] : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]; // eslint-disable-line\n}\n\nfunction relativeTimeWithPlural(number, withoutSuffix, key) {\n var format = {\n mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',\n hh: 'час_часа_часов',\n dd: 'день_дня_дней',\n MM: 'месяц_месяца_месяцев',\n yy: 'год_года_лет'\n };\n\n if (key === 'm') {\n return withoutSuffix ? 'минута' : 'минуту';\n }\n\n return number + \" \" + plural(format[key], +number);\n}\n\nvar months = function months(dayjsInstance, format) {\n if (MONTHS_IN_FORMAT.test(format)) {\n return monthFormat[dayjsInstance.month()];\n }\n\n return monthStandalone[dayjsInstance.month()];\n};\n\nmonths.s = monthStandalone;\nmonths.f = monthFormat;\n\nvar monthsShort = function monthsShort(dayjsInstance, format) {\n if (MONTHS_IN_FORMAT.test(format)) {\n return monthShortFormat[dayjsInstance.month()];\n }\n\n return monthShortStandalone[dayjsInstance.month()];\n};\n\nmonthsShort.s = monthShortStandalone;\nmonthsShort.f = monthShortFormat;\nvar locale = {\n name: 'ru',\n weekdays: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'),\n weekdaysShort: 'вск_пнд_втр_срд_чтв_птн_сбт'.split('_'),\n weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'),\n months: months,\n monthsShort: monthsShort,\n weekStart: 1,\n yearStart: 4,\n formats: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD.MM.YYYY',\n LL: 'D MMMM YYYY г.',\n LLL: 'D MMMM YYYY г., H:mm',\n LLLL: 'dddd, D MMMM YYYY г., H:mm'\n },\n relativeTime: {\n future: 'через %s',\n past: '%s назад',\n s: 'несколько секунд',\n m: relativeTimeWithPlural,\n mm: relativeTimeWithPlural,\n h: 'час',\n hh: relativeTimeWithPlural,\n d: 'день',\n dd: relativeTimeWithPlural,\n M: 'месяц',\n MM: relativeTimeWithPlural,\n y: 'год',\n yy: relativeTimeWithPlural\n },\n ordinal: function ordinal(n) {\n return n;\n },\n meridiem: function meridiem(hour) {\n if (hour < 4) {\n return 'ночи';\n } else if (hour < 12) {\n return 'утра';\n } else if (hour < 17) {\n return 'дня';\n }\n\n return 'вечера';\n }\n};\ndayjs.locale(locale, null, true);\nexport default locale;","/**\n * ---header-docs-section---\n * # yummies/date-time\n *\n * ## Description\n *\n * Date and time formatting built on **dayjs** with locale plugins, human-readable presets, relative\n * phrases, and duration helpers tailored to UI copy. It composes with `yummies/format`, `yummies/ms`,\n * and `yummies/text` for declensions so timestamps read naturally in Russian-facing apps.\n *\n * ## Usage\n *\n * ```ts\n * import { formatDate } from \"yummies/date-time\";\n * ```\n */\n\nimport dayjs, { type Dayjs, type ManipulateType } from 'dayjs/esm/index.js';\nimport duration from 'dayjs/esm/plugin/duration/index.js';\nimport relativeTime from 'dayjs/esm/plugin/relativeTime/index.js';\nimport { format } from 'yummies/format';\nimport { ms, unitsToMs } from 'yummies/ms';\nimport { declension } from 'yummies/text';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nimport 'dayjs/esm/locale/ru.js';\n\ndayjs.extend(relativeTime);\ndayjs.extend(duration);\ndayjs.locale('ru');\n\nconst toLibFormat = (value: Maybe<RawDateToFormat>): Dayjs | null => {\n let result: Maybe<Dayjs> = null;\n if (dayjs.isDayjs(value)) {\n result = value;\n } else if (value != null) {\n result = dayjs(value);\n }\n\n if (!result?.isValid()) {\n return null;\n }\n\n return result;\n};\n\nexport type RawDateToFormat = Date | string | number | Dayjs;\n\n/**\n * Formats a date-like value using predefined presets or a custom pattern.\n *\n * @example\n * ```ts\n * formatDate('2024-03-15', { format: 'time-short' });\n * ```\n */\nexport const formatDate = (\n value: Maybe<RawDateToFormat>,\n settings?: Maybe<{\n format?:\n | 'human'\n | 'full'\n | 'short'\n | 'day'\n | 'day-only'\n | 'date'\n | 'month'\n | 'spent-time'\n | 'time'\n | 'time-short';\n pattern?: string;\n asTime?: boolean;\n }>,\n) => {\n const dateFormat = settings?.format;\n const datePattern = settings?.pattern;\n const asTime = settings?.asTime;\n\n let libDate: duration.Duration | dayjs.Dayjs | null = null;\n\n if (asTime && typeGuard.isNumber(value)) {\n libDate = dayjs.duration(value);\n } else {\n libDate = toLibFormat(value);\n }\n\n if (!libDate) {\n return format.NO_VALUE;\n }\n\n if (datePattern) {\n return libDate.format(datePattern);\n }\n\n if (dateFormat === 'human' || dateFormat === 'spent-time') {\n if ('fromNow' in libDate) {\n return libDate.fromNow(dateFormat === 'spent-time');\n } else {\n return format.NO_VALUE;\n }\n }\n\n switch (dateFormat) {\n case 'full': {\n return libDate.format('DD MMM YYYY HH:mm:ss');\n }\n case 'short': {\n return libDate.format('DD MMM HH:mm');\n }\n case 'time': {\n return libDate.format('HH:mm:ss');\n }\n case 'time-short': {\n return libDate.format('HH:mm');\n }\n case 'day': {\n return libDate.format('DD MMM YYYY');\n }\n case 'month': {\n return libDate.format('MMMM YYYY');\n }\n default: {\n return libDate.format('DD.MM.YYYY');\n }\n }\n};\n\n/**\n * Splits a duration in milliseconds into day-based time parts.\n *\n * @example\n * ```ts\n * dayTimeDuration(ms(1, 'day') + ms(2, 'hour'));\n * ```\n */\nexport const dayTimeDuration = (timeInMs: number) => {\n let left = Math.max(timeInMs, 0);\n\n const days = Math.floor(left / unitsToMs.day);\n left = left % unitsToMs.day;\n\n const hours = Math.floor(left / unitsToMs.hour);\n left = left % unitsToMs.hour;\n\n const minutes = Math.floor(left / unitsToMs.min);\n left = left % unitsToMs.min;\n\n const seconds = Math.floor(left / unitsToMs.sec);\n left = left % unitsToMs.sec;\n\n const milliseconds = Math.floor(left);\n\n return {\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n };\n};\n\ntype DateChangeParam = [amount: number, unit?: Maybe<ManipulateType>];\n\n/**\n * Applies one or more date adjustments and returns a new `Date` instance.\n *\n * @example\n * ```ts\n * changeDate(new Date(), 1, 'day', 30, 'minute');\n * ```\n */\nexport const changeDate = (\n date: Maybe<RawDateToFormat>,\n ...args: [\n ...DateChangeParam,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ...Partial<DateChangeParam>,\n ]\n) => {\n let wrappedDate = toLibFormat(date)!;\n\n for (let i = 0; i < args.length; i += 2) {\n const amount = args[i] as DateChangeParam[0];\n const unit = args[i + 1] as DateChangeParam[1];\n if (unit != null) {\n wrappedDate = wrappedDate.add(amount, unit);\n }\n }\n\n return wrappedDate.toDate();\n};\n\n/**\n * Converts milliseconds into hour-based time parts without keeping full days separately.\n *\n * @example\n * ```ts\n * timeDuration(ms(1, 'hour') + ms(30, 'min'));\n * ```\n */\nexport const timeDuration = (timeInMs: number) => {\n const { days, hours, milliseconds, minutes, seconds } =\n dayTimeDuration(timeInMs);\n\n return {\n hours: hours + unitsToMs.day * days,\n milliseconds,\n minutes,\n seconds,\n };\n};\n\nconst durationFormatLabels = {\n days: { compact: 'д', full: ['день', 'дня', 'дней'] },\n hours: { compact: 'ч', full: ['час', 'часа', 'часов'] },\n minutes: { compact: 'мин', full: ['минута', 'минуты', 'минут'] },\n seconds: { compact: 'сек', full: ['секунда', 'секунды', 'секунд'] },\n} as const;\n\n/**\n * Formats a duration either from milliseconds or between two dates.\n *\n * @example\n * ```ts\n * getFormatDuration(ms(2, 'hour') + ms(15, 'min'));\n * ```\n */\nexport function getFormatDuration(\n dateA: Date,\n dateB: Date,\n compact?: boolean,\n): string;\nexport function getFormatDuration(ms: number, compact?: boolean): string;\n\nexport function getFormatDuration(...args: any[]): string {\n let compact = false;\n let diff = 0;\n\n if (args[0] instanceof Date) {\n const startedDate = dayjs(args[0]);\n const endedDate = dayjs(args[1]);\n\n diff = endedDate.diff(startedDate, 'ms');\n compact = args[2] === true;\n } else {\n diff = args[0];\n compact = args[1] === true;\n }\n\n const { days, hours, minutes, seconds } = dayTimeDuration(diff);\n\n const formattedParts: string[] = [];\n\n if (days) {\n if (compact) {\n formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);\n } else {\n formattedParts.push(\n `${days} ${declension(days, durationFormatLabels.days.full)}`,\n );\n }\n }\n\n if (hours) {\n if (compact) {\n formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);\n } else {\n formattedParts.push(\n `${hours} ${declension(hours, durationFormatLabels.hours.full)}`,\n );\n }\n }\n\n if (minutes) {\n if (compact) {\n formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);\n } else {\n formattedParts.push(\n `${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`,\n );\n }\n }\n\n if (seconds) {\n if (compact) {\n formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);\n } else {\n formattedParts.push(\n `${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`,\n );\n }\n }\n\n return formattedParts.join(' ');\n}\n\nexport type TimeDiff = {\n minutes: number;\n seconds: number;\n total: {\n ms: number;\n hours: number;\n };\n};\n\n/**\n * Calculates the difference between two dates in minutes, seconds and total units.\n *\n * @example\n * ```ts\n * getTimeDiff(new Date('2024-03-15T12:30:00'), new Date('2024-03-15T12:00:00'));\n * ```\n */\nexport const getTimeDiff = (\n dateA: RawDateToFormat,\n dateB: RawDateToFormat,\n): TimeDiff => {\n const leftDate = toLibFormat(dateA)?.toDate();\n const rightDate = toLibFormat(dateB)?.toDate();\n\n if (!leftDate || !rightDate) {\n return {\n minutes: 0,\n seconds: 0,\n total: { ms: 0, hours: 0 },\n };\n }\n\n const msDiff = leftDate.getTime() - rightDate.getTime();\n\n return {\n minutes: Math.max(Math.floor(msDiff / ms(1, 'min')), 0),\n seconds: Math.max(Math.floor((msDiff % ms(1, 'min')) / 1000), 0),\n total: {\n hours: Math.round(msDiff / ms(1, 'hour')),\n ms: msDiff,\n },\n };\n};\n\n/**\n * Returns a new date shifted forward by the provided number of days.\n *\n * @example\n * ```ts\n * addDays(new Date('2024-03-15'), 7);\n * ```\n */\nexport const addDays = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.add(count, 'd').toDate();\n\n/**\n * Returns a new date shifted backward by the provided number of days.\n *\n * @example\n * ```ts\n * subtractDays(new Date('2024-03-15'), 7);\n * ```\n */\nexport const subtractDays = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.subtract(count, 'd').toDate();\n\n/**\n * Returns a new date shifted forward by the provided number of minutes.\n *\n * @example\n * ```ts\n * addMinutes(new Date('2024-03-15T12:00:00'), 15);\n * ```\n */\nexport const addMinutes = (date: RawDateToFormat, count: number) =>\n toLibFormat(date)?.add(count, 'm').toDate();\n\n/**\n * Returns a new date with the minutes field replaced.\n *\n * @example\n * ```ts\n * setMinutes(new Date('2024-03-15T12:00:00'), 45);\n * ```\n */\nexport const setMinutes = (date: RawDateToFormat, minutes: number) =>\n toLibFormat(date)?.set('m', minutes).toDate();\n\n/**\n * Returns a new date with the hours field replaced.\n *\n * @example\n * ```ts\n * setHours(new Date('2024-03-15T12:00:00'), 9);\n * ```\n */\nexport const setHours = (date: RawDateToFormat, hours: number) =>\n toLibFormat(date)?.set('h', hours).toDate();\n"],"x_google_ignoreList":[0,1,2,3,4,5,6],"mappings":";;;;AACA,IAAW,iBAAA;AACX,IAAW,gBAAgB,iBAAiB;AAC5C,IAAW,iBAAiB,gBAAgB;AAC5C,IAAW,wBAAwB;AACnC,IAAW,wBAAA,KAA2C;AACtD,IAAW,sBAA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AS,KAAK,IAAI,KAAK,MAAO,SAAS,GAAG,GAAG,MAAM,GAAI,IAAK,EAAE,EAAE;EAChE,OAAO;GACL,OAAO,KAAK,MAAM,SAAS,GAAG,GAAG,OAAO,CAAC;GACzC,IAAI;GACL;EACF;;;;;;;;;;AAWH,IAAa,WAAW,MAAuB,UAC7C,YAAY,KAAK,EAAE,IAAI,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAU7C,IAAa,gBAAgB,MAAuB,UAClD,YAAY,KAAK,EAAE,SAAS,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAUlD,IAAa,cAAc,MAAuB,UAChD,YAAY,KAAK,EAAE,IAAI,OAAO,IAAI,CAAC,QAAQ;;;;;;;;;AAU7C,IAAa,cAAc,MAAuB,YAChD,YAAY,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,QAAQ;;;;;;;;;AAU/C,IAAa,YAAY,MAAuB,UAC9C,YAAY,KAAK,EAAE,IAAI,KAAK,MAAM,CAAC,QAAQ"}
|
package/errors.cjs
CHANGED
package/format.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_chunk = require("./chunk-
|
|
2
|
+
const require_chunk = require("./chunk-CZWwpsFl.cjs");
|
|
3
3
|
let yummies_parser = require("yummies/parser");
|
|
4
4
|
let yummies_type_guard = require("yummies/type-guard");
|
|
5
5
|
//#region src/format/number.ts
|
package/format.js
CHANGED
package/html.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_chunk = require("./chunk-
|
|
2
|
+
const require_chunk = require("./chunk-CZWwpsFl.cjs");
|
|
3
3
|
let dompurify = require("dompurify");
|
|
4
4
|
dompurify = require_chunk.__toESM(dompurify);
|
|
5
5
|
let yummies_media = require("yummies/media");
|
package/id.cjs
CHANGED
package/imports.cjs
CHANGED
package/media.cjs
CHANGED
package/mobx.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./chunk-
|
|
2
|
+
require("./chunk-CZWwpsFl.cjs");
|
|
3
3
|
let yummies_type_guard = require("yummies/type-guard");
|
|
4
4
|
let mobx = require("mobx");
|
|
5
5
|
//#region src/mobx/apply-observable.ts
|
|
@@ -315,6 +315,65 @@ var DeepObservableStruct = class {
|
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
317
|
//#endregion
|
|
318
|
+
//#region src/mobx/flush-pending-reactions.ts
|
|
319
|
+
/** Same cap as MobX's internal `MAX_REACTION_ITERATIONS` (not exported from the package). */
|
|
320
|
+
var DEFAULT_MAX_REACTION_ITERATIONS = 100;
|
|
321
|
+
/**
|
|
322
|
+
* Synchronously runs MobX reactions from the internal `pendingReactions` queue when they piled up
|
|
323
|
+
* during a batch (`inBatch > 0`, e.g. inside `runInAction`).
|
|
324
|
+
*
|
|
325
|
+
* While a batch is open, MobX only enqueues reactions; this call temporarily resets the batch
|
|
326
|
+
* counter, drains the queue, and restores state—useful in tests and when you need side effects
|
|
327
|
+
* before leaving the action.
|
|
328
|
+
*
|
|
329
|
+
* If there are no pending reactions, a reaction run is already in progress (`isRunningReactions`),
|
|
330
|
+
* or the iteration cap is hit (cycle guard), there is no extra work; when the cap is exceeded the
|
|
331
|
+
* queue is cleared, matching MobX's internal safety behavior.
|
|
332
|
+
*
|
|
333
|
+
* @param maxCount - Maximum iterations of the outer drain loop (default 100, same idea as MobX's internal limit).
|
|
334
|
+
* Pass `Number.POSITIVE_INFINITY` to disable this cap only when you trust the reaction graph to settle;
|
|
335
|
+
* a non-converging cycle will then keep looping until the queue empties (or effectively hang).
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* import { observable, reaction, runInAction } from "mobx";
|
|
340
|
+
* import { flushPendingReactions } from "yummies/mobx";
|
|
341
|
+
*
|
|
342
|
+
* const state = observable({ count: 0 });
|
|
343
|
+
* const log: number[] = [];
|
|
344
|
+
* reaction(() => state.count, (n) => log.push(n));
|
|
345
|
+
*
|
|
346
|
+
* runInAction(() => {
|
|
347
|
+
* state.count = 1;
|
|
348
|
+
* flushPendingReactions();
|
|
349
|
+
* });
|
|
350
|
+
*
|
|
351
|
+
* // log === [1] — the reaction ran before the action finished
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
function flushPendingReactions(maxCount = DEFAULT_MAX_REACTION_ITERATIONS) {
|
|
355
|
+
const gs = (0, mobx._getGlobalState)();
|
|
356
|
+
if (gs.isRunningReactions || gs.pendingReactions.length === 0) return;
|
|
357
|
+
const savedInBatch = gs.inBatch;
|
|
358
|
+
gs.inBatch = 0;
|
|
359
|
+
try {
|
|
360
|
+
gs.isRunningReactions = true;
|
|
361
|
+
const queue = gs.pendingReactions;
|
|
362
|
+
let iterations = 0;
|
|
363
|
+
while (queue.length > 0) {
|
|
364
|
+
if (++iterations === maxCount) {
|
|
365
|
+
queue.splice(0);
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
const batch = queue.splice(0);
|
|
369
|
+
for (let i = 0; i < batch.length; i++) batch[i].runReaction_();
|
|
370
|
+
}
|
|
371
|
+
} finally {
|
|
372
|
+
gs.isRunningReactions = false;
|
|
373
|
+
gs.inBatch = savedInBatch;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
//#endregion
|
|
318
377
|
//#region src/mobx/get-mobx-administration.ts
|
|
319
378
|
/**
|
|
320
379
|
* ---header-docs-section---
|
|
@@ -456,6 +515,7 @@ exports.DeepObservableStruct = DeepObservableStruct;
|
|
|
456
515
|
exports.applyObservable = applyObservable;
|
|
457
516
|
exports.createEnhancedAtom = createEnhancedAtom;
|
|
458
517
|
exports.createRef = createRef;
|
|
518
|
+
exports.flushPendingReactions = flushPendingReactions;
|
|
459
519
|
exports.getMobxAdministration = getMobxAdministration;
|
|
460
520
|
exports.isRef = isRef;
|
|
461
521
|
exports.lazyObserve = lazyObserve;
|
package/mobx.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobx.cjs","names":[],"sources":["../src/mobx/apply-observable.ts","../src/mobx/create-enhanced-atom.ts","../src/mobx/create-ref.ts","../src/mobx/deep-observable-struct.ts","../src/mobx/get-mobx-administration.ts","../src/mobx/lazy-observe.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Compact **MobX `makeObservable`** wiring from tuple lists of annotations and keys. Reduces boilerplate\n * when many fields share `observable`, `action`, or `computed` decorators and you want one call site\n * instead of sprawling annotation maps across large stores.\n *\n * ## Usage\n *\n * ```ts\n * import { applyObservable } from \"yummies/mobx\";\n * ```\n */\n\nimport { type AnnotationMapEntry, makeObservable } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport type ObservableAnnotationsArray<T extends AnyObject = AnyObject> = [\n AnnotationMapEntry,\n ...(keyof T | (string & {}))[],\n][];\n\n/**\n * Applies a compact list of MobX annotations to an object using either\n * decorator-style invocation or the annotation map form accepted by `makeObservable`.\n *\n * @template T Target object type.\n * @param context Object that should become observable.\n * @param annotationsArray Tuples of annotation followed by annotated field names.\n * @param useDecorators Enables decorator-style application before calling `makeObservable`.\n *\n * @example\n * ```ts\n * applyObservable(store, [[observable, 'items'], [action, 'setItems']]);\n * ```\n *\n * @example\n * ```ts\n * applyObservable(viewModel, [[computed, 'fullName']], true);\n * ```\n */\nexport const applyObservable = <T extends AnyObject>(\n context: T,\n annotationsArray: ObservableAnnotationsArray<T>,\n useDecorators?: boolean,\n) => {\n if (useDecorators) {\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n // @ts-expect-error\n annotation(context, field);\n });\n });\n\n makeObservable(context);\n } else {\n const annotationsObject: AnyObject = {};\n\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n annotationsObject[field] = annotation;\n });\n });\n\n makeObservable(context, annotationsObject);\n }\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **`createAtom` wrapper** that attaches arbitrary metadata and keeps MobX’s observed/unobserved\n * hooks in one place. Useful for custom reactive primitives, async resources, or debugging atoms\n * where the stock API is too bare.\n *\n * ## Usage\n *\n * ```ts\n * import { createEnhancedAtom } from \"yummies/mobx\";\n * ```\n */\n\nimport { createAtom, type IAtom } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport interface IEnhancedAtom<TMeta extends AnyObject = AnyObject>\n extends IAtom {\n meta: TMeta;\n}\n\n/**\n * Creates a MobX atom extended with metadata and bound reporting methods.\n *\n * @template TMeta Metadata object stored on the atom.\n * @param name Atom name used by MobX for debugging.\n * @param onBecomeObservedHandler Callback fired when the atom becomes observed.\n * @param onBecomeUnobservedHandler Callback fired when the atom is no longer observed.\n * @param meta Optional metadata attached to the atom.\n * @returns Atom instance with `meta`, `reportChanged` and `reportObserved`.\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('user-status');\n * atom.reportChanged();\n * ```\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('cache', undefined, undefined, { scope: 'users' });\n * atom.meta.scope;\n * ```\n */\nexport const createEnhancedAtom = <TMeta extends AnyObject>(\n name: string,\n onBecomeObservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n onBecomeUnobservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n meta?: TMeta,\n): IEnhancedAtom<TMeta> => {\n const atom = createAtom(\n name,\n onBecomeObservedHandler && (() => onBecomeObservedHandler(atom)),\n onBecomeUnobservedHandler && (() => onBecomeUnobservedHandler(atom)),\n ) as IEnhancedAtom<TMeta>;\n atom.meta = meta ?? ({} as TMeta);\n atom.reportChanged = atom.reportChanged.bind(atom);\n atom.reportObserved = atom.reportObserved.bind(atom);\n return atom;\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Observable ref** pattern for MobX: boxed mutable references with change listeners, metadata,\n * and optional custom equality. Bridges React-style ref holders and MobX reactivity when a single\n * mutable cell must notify dependents without replacing the whole parent object graph.\n *\n * ## Usage\n *\n * ```ts\n * import { createRef } from \"yummies/mobx\";\n * ```\n */\n\nimport {\n type IEqualsComparer,\n makeObservable,\n comparer as mobxComparer,\n observable,\n runInAction,\n} from 'mobx';\nimport type { AnyObject, Maybe } from 'yummies/types';\n\n/**\n * You can return `false` if you don't want to change the value in this ref\n */\nexport type RefChangeListener<T> = (\n value: T | null,\n prevValue: T | undefined,\n) => void | false;\n\n/**\n * Alternative to React.createRef but works in MobX world.\n * Typically it the should be the same React.LegacyRef (fn style)\n */\nexport interface Ref<T = any, TMeta = AnyObject> {\n /**\n * Setter function\n */\n (value: Maybe<T>): void;\n\n set(value: Maybe<T>): void;\n listeners: Set<RefChangeListener<NoInfer<T>>>;\n current: NoInfer<T> | null;\n meta: TMeta;\n}\n\nexport interface CreateRefConfig<T = any, TMeta = AnyObject> {\n onSet?: (node: T, prevValue: T | undefined) => void;\n onUnset?: (lastValue: T | undefined) => void;\n onChange?: RefChangeListener<T>;\n meta?: TMeta;\n initial?: Maybe<T>;\n comparer?: IEqualsComparer<T | null>;\n}\n\n/**\n * Creates a MobX-aware ref that behaves like a callback ref and exposes\n * observable `current` and `meta` fields.\n *\n * @template T Referenced value type.\n * @template TMeta Additional observable metadata stored on the ref.\n * @param cfg Optional callbacks, initial value and comparer configuration.\n * @returns Observable ref function object.\n *\n * @example\n * ```ts\n * const inputRef = createRef<HTMLInputElement>();\n * inputRef.set(document.createElement('input'));\n * ```\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * ref(3);\n * ref.current; // 3\n * ```\n *\n * @example\n * ```ts\n * const nodeRef = createRef({\n * onUnset: () => console.log('detached'),\n * meta: { mounted: false },\n * });\n * ```\n */\nexport const createRef = <T = any, TMeta = AnyObject>(\n cfg?: CreateRefConfig<T, TMeta>,\n): Ref<T, TMeta> => {\n let lastValue: T | undefined;\n const comparer = cfg?.comparer ?? mobxComparer.default;\n\n const setValue: Ref<T, TMeta>['set'] = (value) => {\n const nextValue = value ?? null;\n\n if (comparer(ref.current, nextValue)) {\n return;\n }\n\n runInAction(() => {\n const prevLastValue = lastValue;\n lastValue = ref.current ?? undefined;\n ref.current = nextValue;\n\n let isNextValueIgnored = false;\n\n ref.listeners.forEach((listener) => {\n const listenerResult = listener(ref.current, lastValue);\n\n if (listenerResult === false) {\n isNextValueIgnored = true;\n }\n });\n\n if (isNextValueIgnored) {\n lastValue = prevLastValue;\n ref.current = lastValue ?? null;\n } else if (ref.current === null && lastValue !== undefined) {\n lastValue = undefined;\n }\n });\n };\n\n const ref = setValue as Ref<T, TMeta>;\n\n ref.set = setValue;\n\n ref.listeners = new Set(cfg?.onChange ? [cfg.onChange] : []);\n\n if (cfg?.onSet || cfg?.onUnset) {\n ref.listeners.add((value, prevValue) => {\n if (value) {\n cfg.onSet?.(value, prevValue);\n } else {\n cfg.onUnset?.(prevValue);\n }\n });\n }\n\n ref.current = cfg?.initial ?? null;\n ref.meta = cfg?.meta ?? ({} as TMeta);\n\n makeObservable(ref, {\n current: observable.ref,\n meta: observable,\n });\n\n return ref;\n};\n\n/**\n * Checks whether the provided value is a ref created by `createRef`.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Value to inspect.\n * @returns `true` when the value is a ref-like function with `current`.\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * isRef(ref); // true\n * ```\n *\n * @example\n * ```ts\n * isRef({ current: 1 }); // false\n * ```\n */\nexport const isRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n): value is Ref<T, TMeta> => {\n return typeof value === 'function' && 'current' in value;\n};\n\n/**\n * Normalizes a plain value or an existing ref into a `Ref` instance.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Existing ref or initial plain value.\n * @param cfg Optional ref configuration applied when a new ref is created.\n * @returns Existing ref or a newly created ref initialized with `value`.\n *\n * @example\n * ```ts\n * const ref = toRef(document.body);\n * ref.current === document.body;\n * ```\n *\n * @example\n * ```ts\n * const existingRef = createRef<number>();\n * const sameRef = toRef(existingRef);\n * ```\n */\nexport const toRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n cfg?: Omit<CreateRefConfig<T, TMeta>, 'initial'>,\n): Ref<T, TMeta> => {\n return isRef(value) ? value : createRef({ initial: value, ...cfg });\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Deep observable object** with structural `set` patches that reuse nested observables when keys\n * overlap. Helps store trees (forms, filters, entities) under MobX without wholesale replacement\n * and without manual `observable.map` wiring for every level.\n *\n * ## Usage\n *\n * ```ts\n * import { DeepObservableStruct } from \"yummies/mobx\";\n * ```\n */\n\nimport { action, makeObservable, observable } from 'mobx';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { AnyObject } from 'yummies/types';\n\n/**\n * Wraps a plain object into a deeply observable structure and allows\n * patch-like updates while preserving nested observable references where possible.\n *\n * @template TData Observable object shape.\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ user: { name: 'Ann' } });\n * state.set({ user: { name: 'Bob' } });\n * ```\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ filters: { active: true } });\n * state.set({ filters: { active: false, archived: true } });\n * ```\n */\nexport class DeepObservableStruct<TData extends AnyObject> {\n data: TData;\n\n constructor(data: TData) {\n this.data = data;\n\n makeObservable(this, {\n data: observable.deep,\n set: action,\n });\n }\n\n set(newData: Partial<TData>) {\n type StackItem = [key: string, currObservable: AnyObject, new: AnyObject];\n\n const stack: StackItem[] = Object.keys(this.data).map((key) => [\n key,\n this.data,\n newData,\n ]);\n\n let currentIndex = 0;\n let stackLength = stack.length;\n\n while (currentIndex < stackLength) {\n const [key, currObservableData, newData] = stack[currentIndex];\n const newValue = newData[key];\n const currValue = currObservableData[key];\n\n currentIndex++;\n\n if (key in newData) {\n if (typeGuard.isObject(newValue) && typeGuard.isObject(currValue)) {\n const newValueKeys = Object.keys(newValue);\n\n Object.keys(currValue).forEach((childKey) => {\n if (!(childKey in newValue)) {\n delete currObservableData[key][childKey];\n }\n });\n\n newValueKeys.forEach((childKey) => {\n const length = stack.push([\n childKey,\n currObservableData[key],\n newValue,\n ]);\n stackLength = length;\n });\n } else if (newValue !== currValue) {\n currObservableData[key] = newValue;\n }\n } else {\n delete currObservableData[key];\n }\n }\n\n Object.keys(newData).forEach((newDataKey) => {\n if (!this.data[newDataKey]) {\n // @ts-expect-error\n this.data[newDataKey] = newData[newDataKey];\n }\n });\n }\n}\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Typed access to MobX **internal administration** (`$mobx`) for advanced tooling, migration scripts,\n * or introspection. Prefer public MobX APIs in application code; reach for this when you must align\n * with library internals or patch behavior at the administration layer.\n *\n * ## Usage\n *\n * ```ts\n * import { getMobxAdministration } from \"yummies/mobx\";\n * ```\n */\n\nimport { $mobx, type AnnotationMapEntry } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\ntype ObservableObjectAdministration = Parameters<\n Exclude<AnnotationMapEntry, boolean>['make_']\n>[0];\n\n/**\n * Returns the internal MobX administration object associated with an observable target.\n *\n * @param context Observable object instance.\n * @returns MobX administration internals stored under `$mobx`.\n *\n * @example\n * ```ts\n * const admin = getMobxAdministration(store);\n * admin.name_;\n * ```\n *\n * @example\n * ```ts\n * const values = getMobxAdministration(formState).values_;\n * ```\n */\nexport const getMobxAdministration = (\n context: AnyObject,\n): ObservableObjectAdministration => context[$mobx];\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Lazy subscriptions** tied to MobX observation: start work when the first reaction observes\n * tracked keys, stop when nothing listens anymore (optionally after a delay). Ideal for polling,\n * WebSocket feeds, or expensive caches that should idle when the UI is not mounted.\n *\n * ## Usage\n *\n * ```ts\n * import { lazyObserve } from \"yummies/mobx\";\n * ```\n */\n\nimport { onBecomeObserved, onBecomeUnobserved } from 'mobx';\n\n/**\n * Starts side effects only while one or more MobX observables are being observed.\n *\n * When the first property becomes observed, `onStart` is called. When all tracked\n * properties become unobserved, `onEnd` is called with the value returned by\n * `onStart`. Cleanup can be delayed via `endDelay`.\n *\n * It uses MobX `onBecomeObserved` and `onBecomeUnobserved` hooks to perform\n * lazy subscription management.\n *\n * @template TMetaData Data returned from `onStart` and forwarded to `onEnd`.\n * @param config Configuration for tracked properties and lifecycle callbacks.\n * @returns Cleanup function that clears the tracked state and runs `onEnd`.\n *\n * @example\n * ```ts\n * const stop = lazyObserve({\n * context: store,\n * property: 'items',\n * onStart: () => api.subscribe(),\n * onEnd: (subscription) => subscription.unsubscribe(),\n * });\n * ```\n *\n * @example\n * ```ts\n * lazyObserve({\n * property: [boxA, boxB],\n * onStart: () => console.log('observed'),\n * endDelay: 300,\n * });\n * ```\n */\nexport const lazyObserve = <TMetaData = void>({\n context,\n property,\n onStart,\n onEnd,\n endDelay = false,\n}: {\n context?: any;\n property: any | any[];\n onStart?: () => TMetaData;\n onEnd?: (metaData: TMetaData, cleanupFn: VoidFunction) => void;\n endDelay?: number | false;\n}) => {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let metaData: TMetaData | undefined;\n const observingProps = new Set<string>();\n const properties = Array.isArray(property) ? property : [property];\n\n const cleanup = () => {\n observingProps.clear();\n\n if (endDelay === false) {\n onEnd?.(metaData!, cleanup);\n metaData = undefined;\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n timeoutId = setTimeout(() => {\n onEnd?.(metaData!, cleanup);\n timeoutId = undefined;\n metaData = undefined;\n }, endDelay);\n };\n\n const start = (property: string) => {\n const isAlreadyObserving = observingProps.size > 0;\n observingProps.add(property);\n\n if (isAlreadyObserving) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n metaData = onStart?.();\n };\n\n const stop = (property: string) => {\n const isAlreadyNotObserving = !observingProps.size;\n\n observingProps.delete(property);\n\n const isObserving = observingProps.size > 0;\n\n if (isAlreadyNotObserving || isObserving) {\n return;\n }\n\n cleanup();\n };\n\n properties.forEach((property) => {\n if (context) {\n onBecomeObserved(context, property, () => start(property));\n onBecomeUnobserved(context, property, () => stop(property));\n } else {\n onBecomeObserved(property, () => start(property));\n onBecomeUnobserved(property, () => stop(property));\n }\n });\n\n return cleanup;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,mBACX,SACA,kBACA,kBACG;AACH,KAAI,eAAe;AACjB,mBAAiB,SAAS,CAAC,YAAY,GAAG,YAAY;AACpD,UAAO,SAAS,UAAU;AAExB,eAAW,SAAS,MAAM;KAC1B;IACF;AAEF,GAAA,GAAA,KAAA,gBAAe,QAAQ;QAClB;EACL,MAAM,oBAA+B,EAAE;AAEvC,mBAAiB,SAAS,CAAC,YAAY,GAAG,YAAY;AACpD,UAAO,SAAS,UAAU;AACxB,sBAAkB,SAAS;KAC3B;IACF;AAEF,GAAA,GAAA,KAAA,gBAAe,SAAS,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpB9C,IAAa,sBACX,MACA,yBACA,2BACA,SACyB;CACzB,MAAM,QAAA,GAAA,KAAA,YACJ,MACA,kCAAkC,wBAAwB,KAAK,GAC/D,oCAAoC,0BAA0B,KAAK,EACpE;AACD,MAAK,OAAO,QAAS,EAAE;AACvB,MAAK,gBAAgB,KAAK,cAAc,KAAK,KAAK;AAClD,MAAK,iBAAiB,KAAK,eAAe,KAAK,KAAK;AACpD,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC4BT,IAAa,aACX,QACkB;CAClB,IAAI;CACJ,MAAM,WAAW,KAAK,YAAY,KAAA,SAAa;CAE/C,MAAM,YAAkC,UAAU;EAChD,MAAM,YAAY,SAAS;AAE3B,MAA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ACb,gBAAa,UAAU;AACvB,eAAY,KAAA;;AAGd,cAAY,iBAAiB;AAC3B,WAAQ,UAAW,QAAQ;AAC3B,eAAY,KAAA;AACZ,cAAW,KAAA;KACV,SAAS;;CAGd,MAAM,SAAS,aAAqB;EAClC,MAAM,qBAAqB,eAAe,OAAO;AACjD,iBAAe,IAAI,SAAS;AAE5B,MAAI,mBACF;AAGF,MAAI,WAAW;AACb,gBAAa,UAAU;AACvB,eAAY,KAAA;;AAGd,aAAW,WAAW;;CAGxB,MAAM,QAAQ,aAAqB;EACjC,MAAM,wBAAwB,CAAC,eAAe;AAE9C,iBAAe,OAAO,SAAS;EAE/B,MAAM,cAAc,eAAe,OAAO;AAE1C,MAAI,yBAAyB,YAC3B;AAGF,WAAS;;AAGX,YAAW,SAAS,aAAa;AAC/B,MAAI,SAAS;AACX,IAAA,GAAA,KAAA,kBAAiB,SAAS,gBAAgB,MAAM,SAAS,CAAC;AAC1D,IAAA,GAAA,KAAA,oBAAmB,SAAS,gBAAgB,KAAK,SAAS,CAAC;SACtD;AACL,IAAA,GAAA,KAAA,kBAAiB,gBAAgB,MAAM,SAAS,CAAC;AACjD,IAAA,GAAA,KAAA,oBAAmB,gBAAgB,KAAK,SAAS,CAAC;;GAEpD;AAEF,QAAO"}
|
|
1
|
+
{"version":3,"file":"mobx.cjs","names":[],"sources":["../src/mobx/apply-observable.ts","../src/mobx/create-enhanced-atom.ts","../src/mobx/create-ref.ts","../src/mobx/deep-observable-struct.ts","../src/mobx/flush-pending-reactions.ts","../src/mobx/get-mobx-administration.ts","../src/mobx/lazy-observe.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Compact **MobX `makeObservable`** wiring from tuple lists of annotations and keys. Reduces boilerplate\n * when many fields share `observable`, `action`, or `computed` decorators and you want one call site\n * instead of sprawling annotation maps across large stores.\n *\n * ## Usage\n *\n * ```ts\n * import { applyObservable } from \"yummies/mobx\";\n * ```\n */\n\nimport { type AnnotationMapEntry, makeObservable } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport type ObservableAnnotationsArray<T extends AnyObject = AnyObject> = [\n AnnotationMapEntry,\n ...(keyof T | (string & {}))[],\n][];\n\n/**\n * Applies a compact list of MobX annotations to an object using either\n * decorator-style invocation or the annotation map form accepted by `makeObservable`.\n *\n * @template T Target object type.\n * @param context Object that should become observable.\n * @param annotationsArray Tuples of annotation followed by annotated field names.\n * @param useDecorators Enables decorator-style application before calling `makeObservable`.\n *\n * @example\n * ```ts\n * applyObservable(store, [[observable, 'items'], [action, 'setItems']]);\n * ```\n *\n * @example\n * ```ts\n * applyObservable(viewModel, [[computed, 'fullName']], true);\n * ```\n */\nexport const applyObservable = <T extends AnyObject>(\n context: T,\n annotationsArray: ObservableAnnotationsArray<T>,\n useDecorators?: boolean,\n) => {\n if (useDecorators) {\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n // @ts-expect-error\n annotation(context, field);\n });\n });\n\n makeObservable(context);\n } else {\n const annotationsObject: AnyObject = {};\n\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n annotationsObject[field] = annotation;\n });\n });\n\n makeObservable(context, annotationsObject);\n }\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **`createAtom` wrapper** that attaches arbitrary metadata and keeps MobX’s observed/unobserved\n * hooks in one place. Useful for custom reactive primitives, async resources, or debugging atoms\n * where the stock API is too bare.\n *\n * ## Usage\n *\n * ```ts\n * import { createEnhancedAtom } from \"yummies/mobx\";\n * ```\n */\n\nimport { createAtom, type IAtom } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport interface IEnhancedAtom<TMeta extends AnyObject = AnyObject>\n extends IAtom {\n meta: TMeta;\n}\n\n/**\n * Creates a MobX atom extended with metadata and bound reporting methods.\n *\n * @template TMeta Metadata object stored on the atom.\n * @param name Atom name used by MobX for debugging.\n * @param onBecomeObservedHandler Callback fired when the atom becomes observed.\n * @param onBecomeUnobservedHandler Callback fired when the atom is no longer observed.\n * @param meta Optional metadata attached to the atom.\n * @returns Atom instance with `meta`, `reportChanged` and `reportObserved`.\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('user-status');\n * atom.reportChanged();\n * ```\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('cache', undefined, undefined, { scope: 'users' });\n * atom.meta.scope;\n * ```\n */\nexport const createEnhancedAtom = <TMeta extends AnyObject>(\n name: string,\n onBecomeObservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n onBecomeUnobservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n meta?: TMeta,\n): IEnhancedAtom<TMeta> => {\n const atom = createAtom(\n name,\n onBecomeObservedHandler && (() => onBecomeObservedHandler(atom)),\n onBecomeUnobservedHandler && (() => onBecomeUnobservedHandler(atom)),\n ) as IEnhancedAtom<TMeta>;\n atom.meta = meta ?? ({} as TMeta);\n atom.reportChanged = atom.reportChanged.bind(atom);\n atom.reportObserved = atom.reportObserved.bind(atom);\n return atom;\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Observable ref** pattern for MobX: boxed mutable references with change listeners, metadata,\n * and optional custom equality. Bridges React-style ref holders and MobX reactivity when a single\n * mutable cell must notify dependents without replacing the whole parent object graph.\n *\n * ## Usage\n *\n * ```ts\n * import { createRef } from \"yummies/mobx\";\n * ```\n */\n\nimport {\n type IEqualsComparer,\n makeObservable,\n comparer as mobxComparer,\n observable,\n runInAction,\n} from 'mobx';\nimport type { AnyObject, Maybe } from 'yummies/types';\n\n/**\n * You can return `false` if you don't want to change the value in this ref\n */\nexport type RefChangeListener<T> = (\n value: T | null,\n prevValue: T | undefined,\n) => void | false;\n\n/**\n * Alternative to React.createRef but works in MobX world.\n * Typically it the should be the same React.LegacyRef (fn style)\n */\nexport interface Ref<T = any, TMeta = AnyObject> {\n /**\n * Setter function\n */\n (value: Maybe<T>): void;\n\n set(value: Maybe<T>): void;\n listeners: Set<RefChangeListener<NoInfer<T>>>;\n current: NoInfer<T> | null;\n meta: TMeta;\n}\n\nexport interface CreateRefConfig<T = any, TMeta = AnyObject> {\n onSet?: (node: T, prevValue: T | undefined) => void;\n onUnset?: (lastValue: T | undefined) => void;\n onChange?: RefChangeListener<T>;\n meta?: TMeta;\n initial?: Maybe<T>;\n comparer?: IEqualsComparer<T | null>;\n}\n\n/**\n * Creates a MobX-aware ref that behaves like a callback ref and exposes\n * observable `current` and `meta` fields.\n *\n * @template T Referenced value type.\n * @template TMeta Additional observable metadata stored on the ref.\n * @param cfg Optional callbacks, initial value and comparer configuration.\n * @returns Observable ref function object.\n *\n * @example\n * ```ts\n * const inputRef = createRef<HTMLInputElement>();\n * inputRef.set(document.createElement('input'));\n * ```\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * ref(3);\n * ref.current; // 3\n * ```\n *\n * @example\n * ```ts\n * const nodeRef = createRef({\n * onUnset: () => console.log('detached'),\n * meta: { mounted: false },\n * });\n * ```\n */\nexport const createRef = <T = any, TMeta = AnyObject>(\n cfg?: CreateRefConfig<T, TMeta>,\n): Ref<T, TMeta> => {\n let lastValue: T | undefined;\n const comparer = cfg?.comparer ?? mobxComparer.default;\n\n const setValue: Ref<T, TMeta>['set'] = (value) => {\n const nextValue = value ?? null;\n\n if (comparer(ref.current, nextValue)) {\n return;\n }\n\n runInAction(() => {\n const prevLastValue = lastValue;\n lastValue = ref.current ?? undefined;\n ref.current = nextValue;\n\n let isNextValueIgnored = false;\n\n ref.listeners.forEach((listener) => {\n const listenerResult = listener(ref.current, lastValue);\n\n if (listenerResult === false) {\n isNextValueIgnored = true;\n }\n });\n\n if (isNextValueIgnored) {\n lastValue = prevLastValue;\n ref.current = lastValue ?? null;\n } else if (ref.current === null && lastValue !== undefined) {\n lastValue = undefined;\n }\n });\n };\n\n const ref = setValue as Ref<T, TMeta>;\n\n ref.set = setValue;\n\n ref.listeners = new Set(cfg?.onChange ? [cfg.onChange] : []);\n\n if (cfg?.onSet || cfg?.onUnset) {\n ref.listeners.add((value, prevValue) => {\n if (value) {\n cfg.onSet?.(value, prevValue);\n } else {\n cfg.onUnset?.(prevValue);\n }\n });\n }\n\n ref.current = cfg?.initial ?? null;\n ref.meta = cfg?.meta ?? ({} as TMeta);\n\n makeObservable(ref, {\n current: observable.ref,\n meta: observable,\n });\n\n return ref;\n};\n\n/**\n * Checks whether the provided value is a ref created by `createRef`.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Value to inspect.\n * @returns `true` when the value is a ref-like function with `current`.\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * isRef(ref); // true\n * ```\n *\n * @example\n * ```ts\n * isRef({ current: 1 }); // false\n * ```\n */\nexport const isRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n): value is Ref<T, TMeta> => {\n return typeof value === 'function' && 'current' in value;\n};\n\n/**\n * Normalizes a plain value or an existing ref into a `Ref` instance.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Existing ref or initial plain value.\n * @param cfg Optional ref configuration applied when a new ref is created.\n * @returns Existing ref or a newly created ref initialized with `value`.\n *\n * @example\n * ```ts\n * const ref = toRef(document.body);\n * ref.current === document.body;\n * ```\n *\n * @example\n * ```ts\n * const existingRef = createRef<number>();\n * const sameRef = toRef(existingRef);\n * ```\n */\nexport const toRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n cfg?: Omit<CreateRefConfig<T, TMeta>, 'initial'>,\n): Ref<T, TMeta> => {\n return isRef(value) ? value : createRef({ initial: value, ...cfg });\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Deep observable object** with structural `set` patches that reuse nested observables when keys\n * overlap. Helps store trees (forms, filters, entities) under MobX without wholesale replacement\n * and without manual `observable.map` wiring for every level.\n *\n * ## Usage\n *\n * ```ts\n * import { DeepObservableStruct } from \"yummies/mobx\";\n * ```\n */\n\nimport { action, makeObservable, observable } from 'mobx';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { AnyObject } from 'yummies/types';\n\n/**\n * Wraps a plain object into a deeply observable structure and allows\n * patch-like updates while preserving nested observable references where possible.\n *\n * @template TData Observable object shape.\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ user: { name: 'Ann' } });\n * state.set({ user: { name: 'Bob' } });\n * ```\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ filters: { active: true } });\n * state.set({ filters: { active: false, archived: true } });\n * ```\n */\nexport class DeepObservableStruct<TData extends AnyObject> {\n data: TData;\n\n constructor(data: TData) {\n this.data = data;\n\n makeObservable(this, {\n data: observable.deep,\n set: action,\n });\n }\n\n set(newData: Partial<TData>) {\n type StackItem = [key: string, currObservable: AnyObject, new: AnyObject];\n\n const stack: StackItem[] = Object.keys(this.data).map((key) => [\n key,\n this.data,\n newData,\n ]);\n\n let currentIndex = 0;\n let stackLength = stack.length;\n\n while (currentIndex < stackLength) {\n const [key, currObservableData, newData] = stack[currentIndex];\n const newValue = newData[key];\n const currValue = currObservableData[key];\n\n currentIndex++;\n\n if (key in newData) {\n if (typeGuard.isObject(newValue) && typeGuard.isObject(currValue)) {\n const newValueKeys = Object.keys(newValue);\n\n Object.keys(currValue).forEach((childKey) => {\n if (!(childKey in newValue)) {\n delete currObservableData[key][childKey];\n }\n });\n\n newValueKeys.forEach((childKey) => {\n const length = stack.push([\n childKey,\n currObservableData[key],\n newValue,\n ]);\n stackLength = length;\n });\n } else if (newValue !== currValue) {\n currObservableData[key] = newValue;\n }\n } else {\n delete currObservableData[key];\n }\n }\n\n Object.keys(newData).forEach((newDataKey) => {\n if (!this.data[newDataKey]) {\n // @ts-expect-error\n this.data[newDataKey] = newData[newDataKey];\n }\n });\n }\n}\n","import { _getGlobalState } from 'mobx';\nimport type { MobXGlobals } from 'mobx/dist/internal.js';\n\n/** Same cap as MobX's internal `MAX_REACTION_ITERATIONS` (not exported from the package). */\nconst DEFAULT_MAX_REACTION_ITERATIONS = 100;\n\n/**\n * Synchronously runs MobX reactions from the internal `pendingReactions` queue when they piled up\n * during a batch (`inBatch > 0`, e.g. inside `runInAction`).\n *\n * While a batch is open, MobX only enqueues reactions; this call temporarily resets the batch\n * counter, drains the queue, and restores state—useful in tests and when you need side effects\n * before leaving the action.\n *\n * If there are no pending reactions, a reaction run is already in progress (`isRunningReactions`),\n * or the iteration cap is hit (cycle guard), there is no extra work; when the cap is exceeded the\n * queue is cleared, matching MobX's internal safety behavior.\n *\n * @param maxCount - Maximum iterations of the outer drain loop (default 100, same idea as MobX's internal limit).\n * Pass `Number.POSITIVE_INFINITY` to disable this cap only when you trust the reaction graph to settle;\n * a non-converging cycle will then keep looping until the queue empties (or effectively hang).\n *\n * @example\n * ```ts\n * import { observable, reaction, runInAction } from \"mobx\";\n * import { flushPendingReactions } from \"yummies/mobx\";\n *\n * const state = observable({ count: 0 });\n * const log: number[] = [];\n * reaction(() => state.count, (n) => log.push(n));\n *\n * runInAction(() => {\n * state.count = 1;\n * flushPendingReactions();\n * });\n *\n * // log === [1] — the reaction ran before the action finished\n * ```\n */\nexport function flushPendingReactions(\n maxCount = DEFAULT_MAX_REACTION_ITERATIONS,\n): void {\n const gs: MobXGlobals = _getGlobalState();\n\n if (gs.isRunningReactions || gs.pendingReactions.length === 0) {\n return;\n }\n\n const savedInBatch = gs.inBatch;\n gs.inBatch = 0;\n\n try {\n gs.isRunningReactions = true;\n const queue = gs.pendingReactions;\n let iterations = 0;\n\n while (queue.length > 0) {\n if (++iterations === maxCount) {\n queue.splice(0);\n break;\n }\n\n const batch = queue.splice(0);\n for (let i = 0; i < batch.length; i++) {\n batch[i].runReaction_();\n }\n }\n } finally {\n gs.isRunningReactions = false;\n gs.inBatch = savedInBatch;\n }\n}\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Typed access to MobX **internal administration** (`$mobx`) for advanced tooling, migration scripts,\n * or introspection. Prefer public MobX APIs in application code; reach for this when you must align\n * with library internals or patch behavior at the administration layer.\n *\n * ## Usage\n *\n * ```ts\n * import { getMobxAdministration } from \"yummies/mobx\";\n * ```\n */\n\nimport { $mobx, type AnnotationMapEntry } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\ntype ObservableObjectAdministration = Parameters<\n Exclude<AnnotationMapEntry, boolean>['make_']\n>[0];\n\n/**\n * Returns the internal MobX administration object associated with an observable target.\n *\n * @param context Observable object instance.\n * @returns MobX administration internals stored under `$mobx`.\n *\n * @example\n * ```ts\n * const admin = getMobxAdministration(store);\n * admin.name_;\n * ```\n *\n * @example\n * ```ts\n * const values = getMobxAdministration(formState).values_;\n * ```\n */\nexport const getMobxAdministration = (\n context: AnyObject,\n): ObservableObjectAdministration => context[$mobx];\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Lazy subscriptions** tied to MobX observation: start work when the first reaction observes\n * tracked keys, stop when nothing listens anymore (optionally after a delay). Ideal for polling,\n * WebSocket feeds, or expensive caches that should idle when the UI is not mounted.\n *\n * ## Usage\n *\n * ```ts\n * import { lazyObserve } from \"yummies/mobx\";\n * ```\n */\n\nimport { onBecomeObserved, onBecomeUnobserved } from 'mobx';\n\n/**\n * Starts side effects only while one or more MobX observables are being observed.\n *\n * When the first property becomes observed, `onStart` is called. When all tracked\n * properties become unobserved, `onEnd` is called with the value returned by\n * `onStart`. Cleanup can be delayed via `endDelay`.\n *\n * It uses MobX `onBecomeObserved` and `onBecomeUnobserved` hooks to perform\n * lazy subscription management.\n *\n * @template TMetaData Data returned from `onStart` and forwarded to `onEnd`.\n * @param config Configuration for tracked properties and lifecycle callbacks.\n * @returns Cleanup function that clears the tracked state and runs `onEnd`.\n *\n * @example\n * ```ts\n * const stop = lazyObserve({\n * context: store,\n * property: 'items',\n * onStart: () => api.subscribe(),\n * onEnd: (subscription) => subscription.unsubscribe(),\n * });\n * ```\n *\n * @example\n * ```ts\n * lazyObserve({\n * property: [boxA, boxB],\n * onStart: () => console.log('observed'),\n * endDelay: 300,\n * });\n * ```\n */\nexport const lazyObserve = <TMetaData = void>({\n context,\n property,\n onStart,\n onEnd,\n endDelay = false,\n}: {\n context?: any;\n property: any | any[];\n onStart?: () => TMetaData;\n onEnd?: (metaData: TMetaData, cleanupFn: VoidFunction) => void;\n endDelay?: number | false;\n}) => {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let metaData: TMetaData | undefined;\n const observingProps = new Set<string>();\n const properties = Array.isArray(property) ? property : [property];\n\n const cleanup = () => {\n observingProps.clear();\n\n if (endDelay === false) {\n onEnd?.(metaData!, cleanup);\n metaData = undefined;\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n timeoutId = setTimeout(() => {\n onEnd?.(metaData!, cleanup);\n timeoutId = undefined;\n metaData = undefined;\n }, endDelay);\n };\n\n const start = (property: string) => {\n const isAlreadyObserving = observingProps.size > 0;\n observingProps.add(property);\n\n if (isAlreadyObserving) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n metaData = onStart?.();\n };\n\n const stop = (property: string) => {\n const isAlreadyNotObserving = !observingProps.size;\n\n observingProps.delete(property);\n\n const isObserving = observingProps.size > 0;\n\n if (isAlreadyNotObserving || isObserving) {\n return;\n }\n\n cleanup();\n };\n\n properties.forEach((property) => {\n if (context) {\n onBecomeObserved(context, property, () => start(property));\n onBecomeUnobserved(context, property, () => stop(property));\n } else {\n onBecomeObserved(property, () => start(property));\n onBecomeUnobserved(property, () => stop(property));\n }\n });\n\n return cleanup;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,mBACX,SACA,kBACA,kBACG;AACH,KAAI,eAAe;AACjB,mBAAiB,SAAS,CAAC,YAAY,GAAG,YAAY;AACpD,UAAO,SAAS,UAAU;AAExB,eAAW,SAAS,MAAM;KAC1B;IACF;AAEF,GAAA,GAAA,KAAA,gBAAe,QAAQ;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KAAA;AACX;;AAGF,MAAI,WAAW;AACb,gBAAa,UAAU;AACvB,eAAY,KAAA;;AAGd,cAAY,iBAAiB;AAC3B,WAAQ,UAAW,QAAQ;AAC3B,eAAY,KAAA;AACZ,cAAW,KAAA;KACV,SAAS;;CAGd,MAAM,SAAS,aAAqB;EAClC,MAAM,qBAAqB,eAAe,OAAO;AACjD,iBAAe,IAAI,SAAS;AAE5B,MAAI,mBACF;AAGF,MAAI,WAAW;AACb,gBAAa,UAAU;AACvB,eAAY,KAAA;;AAGd,aAAW,WAAW;;CAGxB,MAAM,QAAQ,aAAqB;EACjC,MAAM,wBAAwB,CAAC,eAAe;AAE9C,iBAAe,OAAO,SAAS;EAE/B,MAAM,cAAc,eAAe,OAAO;AAE1C,MAAI,yBAAyB,YAC3B;AAGF,WAAS;;AAGX,YAAW,SAAS,aAAa;AAC/B,MAAI,SAAS;AACX,IAAA,GAAA,KAAA,kBAAiB,SAAS,gBAAgB,MAAM,SAAS,CAAC;AAC1D,IAAA,GAAA,KAAA,oBAAmB,SAAS,gBAAgB,KAAK,SAAS,CAAC;SACtD;AACL,IAAA,GAAA,KAAA,kBAAiB,gBAAgB,MAAM,SAAS,CAAC;AACjD,IAAA,GAAA,KAAA,oBAAmB,gBAAgB,KAAK,SAAS,CAAC;;GAEpD;AAEF,QAAO"}
|
package/mobx.d.ts
CHANGED
|
@@ -245,6 +245,41 @@ declare class DeepObservableStruct<TData extends AnyObject> {
|
|
|
245
245
|
set(newData: Partial<TData>): void;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Synchronously runs MobX reactions from the internal `pendingReactions` queue when they piled up
|
|
250
|
+
* during a batch (`inBatch > 0`, e.g. inside `runInAction`).
|
|
251
|
+
*
|
|
252
|
+
* While a batch is open, MobX only enqueues reactions; this call temporarily resets the batch
|
|
253
|
+
* counter, drains the queue, and restores state—useful in tests and when you need side effects
|
|
254
|
+
* before leaving the action.
|
|
255
|
+
*
|
|
256
|
+
* If there are no pending reactions, a reaction run is already in progress (`isRunningReactions`),
|
|
257
|
+
* or the iteration cap is hit (cycle guard), there is no extra work; when the cap is exceeded the
|
|
258
|
+
* queue is cleared, matching MobX's internal safety behavior.
|
|
259
|
+
*
|
|
260
|
+
* @param maxCount - Maximum iterations of the outer drain loop (default 100, same idea as MobX's internal limit).
|
|
261
|
+
* Pass `Number.POSITIVE_INFINITY` to disable this cap only when you trust the reaction graph to settle;
|
|
262
|
+
* a non-converging cycle will then keep looping until the queue empties (or effectively hang).
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```ts
|
|
266
|
+
* import { observable, reaction, runInAction } from "mobx";
|
|
267
|
+
* import { flushPendingReactions } from "yummies/mobx";
|
|
268
|
+
*
|
|
269
|
+
* const state = observable({ count: 0 });
|
|
270
|
+
* const log: number[] = [];
|
|
271
|
+
* reaction(() => state.count, (n) => log.push(n));
|
|
272
|
+
*
|
|
273
|
+
* runInAction(() => {
|
|
274
|
+
* state.count = 1;
|
|
275
|
+
* flushPendingReactions();
|
|
276
|
+
* });
|
|
277
|
+
*
|
|
278
|
+
* // log === [1] — the reaction ran before the action finished
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
declare function flushPendingReactions(maxCount?: number): void;
|
|
282
|
+
|
|
248
283
|
/**
|
|
249
284
|
* ---header-docs-section---
|
|
250
285
|
* # yummies/mobx
|
|
@@ -339,5 +374,5 @@ declare const lazyObserve: <TMetaData = void>({ context, property, onStart, onEn
|
|
|
339
374
|
endDelay?: number | false;
|
|
340
375
|
}) => () => void;
|
|
341
376
|
|
|
342
|
-
export { DeepObservableStruct, applyObservable, createEnhancedAtom, createRef, getMobxAdministration, isRef, lazyObserve, toRef };
|
|
377
|
+
export { DeepObservableStruct, applyObservable, createEnhancedAtom, createRef, flushPendingReactions, getMobxAdministration, isRef, lazyObserve, toRef };
|
|
343
378
|
export type { CreateRefConfig, IEnhancedAtom, ObservableAnnotationsArray, Ref, RefChangeListener };
|