@bbn/bbn 2.0.237 → 2.0.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/$.js +1 -1
- package/dist/bbn.js +3 -3
- package/dist/bbn.js.map +1 -1
- package/dist/bbn.sw.js +3 -3
- package/dist/bbn.sw.js.map +1 -1
- package/dist/com.js +13 -21
- package/dist/{vars.d.ts → data.d.ts} +1 -0
- package/dist/{vars.js → data.js} +1 -0
- package/dist/db/classes/Center.d.ts +10 -0
- package/dist/db/classes/Center.js +88 -0
- package/dist/db/classes/Object.d.ts +3 -0
- package/dist/db/classes/Object.js +469 -0
- package/dist/db/classes/ObjectProxy.d.ts +18 -0
- package/dist/db/classes/ObjectProxy.js +79 -0
- package/dist/db/classes/Proxy.d.ts +10 -0
- package/dist/db/classes/Proxy.js +52 -0
- package/dist/db/functions/fieldsFromFilter.d.ts +1 -0
- package/dist/db/functions/fieldsFromFilter.js +33 -0
- package/dist/db/functions/getPrimaryKey.d.ts +2 -0
- package/dist/db/functions/getPrimaryKey.js +8 -0
- package/dist/db/functions/requestToPromise.d.ts +1 -0
- package/dist/db/functions/requestToPromise.js +6 -0
- package/dist/db/functions/transactionDone.d.ts +1 -0
- package/dist/db/functions/transactionDone.js +7 -0
- package/dist/db/functions/transformResult.d.ts +1 -0
- package/dist/db/functions/transformResult.js +16 -0
- package/dist/db/types.d.ts +56 -0
- package/dist/db/types.js +1 -0
- package/dist/db.d.ts +3 -66
- package/dist/db.js +3 -558
- package/dist/dt/classes/{date.d.ts → Date.d.ts} +1 -1
- package/dist/dt/classes/{date.js → Date.js} +8 -3
- package/dist/dt/classes/{dateTime.d.ts → DateTime.d.ts} +1 -1
- package/dist/dt/classes/{dateTime.js → DateTime.js} +9 -3
- package/dist/dt/classes/{dt.d.ts → Dt.d.ts} +1 -1
- package/dist/dt/classes/{dt.js → Dt.js} +36 -48
- package/dist/dt/classes/Duration.js +193 -0
- package/dist/dt/classes/{monthDay.d.ts → MonthDay.d.ts} +1 -1
- package/dist/dt/classes/{monthDay.js → MonthDay.js} +2 -2
- package/dist/dt/classes/{time.d.ts → Time.d.ts} +1 -1
- package/dist/dt/classes/{time.js → Time.js} +2 -2
- package/dist/dt/classes/{yearMonth.d.ts → YearMonth.d.ts} +1 -1
- package/dist/dt/classes/{yearMonth.js → YearMonth.js} +2 -2
- package/dist/dt/classes/{zoned.d.ts → Zoned.d.ts} +1 -1
- package/dist/dt/classes/{zoned.js → Zoned.js} +9 -3
- package/dist/dt/functions/buildLocaleFromIntl.js +1 -1
- package/dist/dt/functions/guessFormat.js +1 -1
- package/dist/dt/functions/intl-weekinfo-polyfill.js +11 -4
- package/dist/dt/functions/parse.js +20 -22
- package/dist/dt/functions/setupIntl.js +33 -44
- package/dist/dt.d.ts +1 -1
- package/dist/dt.js +9 -8
- package/dist/env.d.ts +1 -1
- package/dist/env.js +6 -7
- package/dist/fn/ajax/abort.js +1 -1
- package/dist/fn/ajax/ajax.d.ts +1 -1
- package/dist/fn/ajax/ajax.js +2 -2
- package/dist/fn/ajax/download.js +1 -1
- package/dist/fn/ajax/getFileContent.js +2 -3
- package/dist/fn/ajax/link.js +2 -2
- package/dist/fn/ajax/stream.js +5 -4
- package/dist/fn/browser/executeSlowly.js +11 -22
- package/dist/fn/browser/log.js +5 -3
- package/dist/fn/browser/yieldToBrowser.js +7 -19
- package/dist/fn/html/makeReactive.js +2 -2
- package/dist/fn/init.d.ts +1 -1
- package/dist/fn/init.js +4 -5
- package/dist/fn/object/_filter.js +3 -2
- package/dist/fn/object/filter.js +2 -1
- package/dist/fn/phone/fphone.js +1 -2
- package/dist/fn/string/cast.js +1 -2
- package/dist/fn/string/shorten.js +1 -1
- package/dist/fn/string/treatForHash.js +1 -1
- package/dist/fn/style/addColors.d.ts +1 -1
- package/dist/fn/style/addColors.js +4 -4
- package/dist/fn/type/checkType.js +1 -2
- package/dist/fn/type/isCp.js +1 -2
- package/dist/fn/type/isHostname.js +1 -1
- package/dist/fn/type/isIP.js +1 -1
- package/dist/fn/type/isSame.js +2 -2
- package/dist/fn/type/isURL.js +1 -1
- package/dist/index-no-dep.js +11 -4
- package/dist/index.js +13 -4
- package/package.json +1 -1
- package/dist/dt/classes/duration.js +0 -199
- /package/dist/dt/classes/{duration.d.ts → Duration.d.ts} +0 -0
package/dist/fn/type/isIP.js
CHANGED
package/dist/fn/type/isSame.js
CHANGED
|
@@ -48,8 +48,8 @@ export default function isSame(obj1, obj2, done) {
|
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
50
50
|
if (obj1 && obj2 && typeof obj1 === 'object' && typeof obj2 === 'object') {
|
|
51
|
-
if (![undefined, Object, Array, null].includes(obj1
|
|
52
|
-
|| ![undefined, Object, Array, null].includes(obj2
|
|
51
|
+
if (![undefined, Object, Array, null].includes(obj1?.constructor)
|
|
52
|
+
|| ![undefined, Object, Array, null].includes(obj2?.constructor)) {
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
55
|
let tmp1 = Object.keys(obj1).sort(), tmp2 = Object.keys(obj2).sort();
|
package/dist/fn/type/isURL.js
CHANGED
package/dist/index-no-dep.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _ from './_.js';
|
|
2
2
|
import $ from './$.js';
|
|
3
3
|
import lng from './lng.js';
|
|
4
|
-
import
|
|
4
|
+
import data from './data.js';
|
|
5
5
|
import env from './env.js';
|
|
6
6
|
import com from './com.js';
|
|
7
|
-
import
|
|
7
|
+
import { bbnDb, bbnDbProxy } from './db.js';
|
|
8
8
|
import fn from './fn.js';
|
|
9
9
|
import dt from './dt.js';
|
|
10
|
+
import buildLocaleFromIntl from './dt/functions/buildLocaleFromIntl.js';
|
|
10
11
|
const bbn = {
|
|
11
12
|
version: "1.0.1",
|
|
12
13
|
opt: {
|
|
@@ -16,11 +17,16 @@ const bbn = {
|
|
|
16
17
|
_,
|
|
17
18
|
$,
|
|
18
19
|
lng,
|
|
19
|
-
|
|
20
|
+
data,
|
|
20
21
|
dt,
|
|
21
22
|
com,
|
|
22
23
|
env,
|
|
23
|
-
db
|
|
24
|
+
get db() {
|
|
25
|
+
if (navigator.serviceWorker?.controller) {
|
|
26
|
+
return bbnDbProxy;
|
|
27
|
+
}
|
|
28
|
+
return bbnDb;
|
|
29
|
+
},
|
|
24
30
|
fn,
|
|
25
31
|
info: [
|
|
26
32
|
{
|
|
@@ -91,4 +97,5 @@ const bbn = {
|
|
|
91
97
|
}
|
|
92
98
|
]
|
|
93
99
|
};
|
|
100
|
+
buildLocaleFromIntl();
|
|
94
101
|
export default bbn;
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,14 @@ import { Temporal } from 'temporal-polyfill';
|
|
|
2
2
|
import _ from './_.js';
|
|
3
3
|
import $ from './$.js';
|
|
4
4
|
import lng from './lng.js';
|
|
5
|
-
import
|
|
5
|
+
import data from './data.js';
|
|
6
6
|
import env from './env.js';
|
|
7
7
|
import com from './com.js';
|
|
8
|
-
import
|
|
8
|
+
import { bbnDb, bbnDbProxy } from './db.js';
|
|
9
|
+
import bbnDbCenter from './db/classes/Center.js';
|
|
9
10
|
import fn from './fn.js';
|
|
10
11
|
import dt from './dt.js';
|
|
12
|
+
import buildLocaleFromIntl from './dt/functions/buildLocaleFromIntl.js';
|
|
11
13
|
const bbn = {
|
|
12
14
|
version: "1.0.1",
|
|
13
15
|
opt: {
|
|
@@ -17,11 +19,17 @@ const bbn = {
|
|
|
17
19
|
_,
|
|
18
20
|
$,
|
|
19
21
|
lng,
|
|
20
|
-
|
|
22
|
+
data,
|
|
21
23
|
dt,
|
|
22
24
|
com,
|
|
23
25
|
env,
|
|
24
|
-
db
|
|
26
|
+
get db() {
|
|
27
|
+
if (navigator.serviceWorker?.controller) {
|
|
28
|
+
return bbnDbProxy;
|
|
29
|
+
}
|
|
30
|
+
return bbnDb;
|
|
31
|
+
},
|
|
32
|
+
dbCenter: () => new bbnDbCenter(),
|
|
25
33
|
fn,
|
|
26
34
|
info: [
|
|
27
35
|
{
|
|
@@ -98,4 +106,5 @@ if ('undefined' !== typeof globalThis) {
|
|
|
98
106
|
globalThis.Temporal = Temporal;
|
|
99
107
|
}
|
|
100
108
|
}
|
|
109
|
+
buildLocaleFromIntl();
|
|
101
110
|
export { bbn as default, bbn, Temporal };
|
package/package.json
CHANGED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _bbnDtDuration_instances, _bbnDtDuration_value, _bbnDtDuration_unit, _bbnDtDuration_getUnitValue;
|
|
13
|
-
import { Temporal } from 'temporal-polyfill';
|
|
14
|
-
import { units, unitsCorrespondence } from '../vars/units.js';
|
|
15
|
-
import getRow from '../../fn/object/getRow.js';
|
|
16
|
-
const DURATION_RELATIVE_TO = Temporal.ZonedDateTime.from('1970-01-01T00:00Z[UTC]');
|
|
17
|
-
class bbnDtDuration {
|
|
18
|
-
static fromUnit(value, unit) {
|
|
19
|
-
const realUnit = unitsCorrespondence[unit] || 'ms';
|
|
20
|
-
if (!realUnit) {
|
|
21
|
-
throw new Error('Invalid unit for duration: ' + unit);
|
|
22
|
-
}
|
|
23
|
-
const ctx = [
|
|
24
|
-
realUnit === 'y' ? value : 0,
|
|
25
|
-
realUnit === 'm' ? value : 0,
|
|
26
|
-
realUnit === 'w' ? value : 0,
|
|
27
|
-
realUnit === 'd' ? value : 0,
|
|
28
|
-
realUnit === 'h' ? value : 0,
|
|
29
|
-
realUnit === 'i' ? value : 0,
|
|
30
|
-
realUnit === 's' ? value : 0,
|
|
31
|
-
['y', 'm', 'w', 'd', 'h', 'i', 's'].includes(realUnit) ? 0 : value
|
|
32
|
-
];
|
|
33
|
-
const dur = new Temporal.Duration(...ctx);
|
|
34
|
-
return new bbnDtDuration(dur);
|
|
35
|
-
}
|
|
36
|
-
constructor(y, m, w, d, h, i, s, ms, unit) {
|
|
37
|
-
_bbnDtDuration_instances.add(this);
|
|
38
|
-
_bbnDtDuration_value.set(this, void 0);
|
|
39
|
-
_bbnDtDuration_unit.set(this, void 0);
|
|
40
|
-
if (y instanceof Temporal.Duration) {
|
|
41
|
-
__classPrivateFieldSet(this, _bbnDtDuration_value, y, "f");
|
|
42
|
-
}
|
|
43
|
-
else if (typeof y === 'object') {
|
|
44
|
-
__classPrivateFieldSet(this, _bbnDtDuration_value, new Temporal.Duration(y.years || 0, y.months || 0, y.weeks || 0, y.days || 0, y.hours || 0, y.minutes || 0, y.seconds || 0, y.milliseconds || 0, 0, 0), "f");
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
__classPrivateFieldSet(this, _bbnDtDuration_value, new Temporal.Duration(y || 0, m || 0, w || 0, d || 0, h || 0, i || 0, s || 0, ms || 0, 0, 0), "f");
|
|
48
|
-
}
|
|
49
|
-
const realUnit = unitsCorrespondence[unit || ''] || unit;
|
|
50
|
-
__classPrivateFieldSet(this, _bbnDtDuration_unit, realUnit || 'ms', "f");
|
|
51
|
-
const row = getRow(units, (a) => a[0] === realUnit);
|
|
52
|
-
if (!row) {
|
|
53
|
-
//throw new Error('Invalid unit for duration: ' + realUnit);
|
|
54
|
-
}
|
|
55
|
-
Object.defineProperty(this, 'isValid', {
|
|
56
|
-
value: false,
|
|
57
|
-
writable: false,
|
|
58
|
-
configurable: true
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
setValid(isValid) {
|
|
62
|
-
Object.defineProperty(this, 'isValid', {
|
|
63
|
-
value: isValid,
|
|
64
|
-
writable: false,
|
|
65
|
-
configurable: false
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
get value() {
|
|
69
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f");
|
|
70
|
-
}
|
|
71
|
-
// -----------------------
|
|
72
|
-
// Public getters
|
|
73
|
-
// -----------------------
|
|
74
|
-
years(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'year', remaining); }
|
|
75
|
-
months(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'month', remaining); }
|
|
76
|
-
weeks(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'week', remaining); }
|
|
77
|
-
days(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'day', remaining); }
|
|
78
|
-
hours(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'hour', remaining); }
|
|
79
|
-
minutes(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'minute', remaining); }
|
|
80
|
-
seconds(remaining = false) { return __classPrivateFieldGet(this, _bbnDtDuration_instances, "m", _bbnDtDuration_getUnitValue).call(this, 'second', remaining); }
|
|
81
|
-
// -----------------------
|
|
82
|
-
// Day.js style
|
|
83
|
-
// "asX" conversions
|
|
84
|
-
// -----------------------
|
|
85
|
-
toJSON() {
|
|
86
|
-
return this.value.toJSON();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the full duration expressed as X (float), like Day.js.
|
|
90
|
-
*/
|
|
91
|
-
asYears() {
|
|
92
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
93
|
-
unit: 'year',
|
|
94
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
asMonths() {
|
|
98
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
99
|
-
unit: 'month',
|
|
100
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
asWeeks() {
|
|
104
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
105
|
-
unit: 'week',
|
|
106
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
asDays() {
|
|
110
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
111
|
-
unit: 'day',
|
|
112
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
asHours() {
|
|
116
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
117
|
-
unit: 'hour',
|
|
118
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
asMinutes() {
|
|
122
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
123
|
-
unit: 'minute',
|
|
124
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
asSeconds() {
|
|
128
|
-
return __classPrivateFieldGet(this, _bbnDtDuration_value, "f").total({
|
|
129
|
-
unit: 'second',
|
|
130
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Add any unit (or instance default).
|
|
135
|
-
*/
|
|
136
|
-
add(value, unit) {
|
|
137
|
-
let targetUnit = __classPrivateFieldGet(this, _bbnDtDuration_unit, "f");
|
|
138
|
-
if (unit) {
|
|
139
|
-
if (unitsCorrespondence[unit]) {
|
|
140
|
-
const realUnit = getRow(units, (a) => a[0] === unitsCorrespondence[unit]);
|
|
141
|
-
if (realUnit) {
|
|
142
|
-
targetUnit = realUnit[1];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
targetUnit = unit;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Map to Temporal.DurationLike field name, e.g. 'year' → 'years'
|
|
150
|
-
const field = (targetUnit + 's');
|
|
151
|
-
if (!['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'].includes(field)) {
|
|
152
|
-
throw new Error('Invalid unit for duration: ' + (unit !== null && unit !== void 0 ? unit : targetUnit));
|
|
153
|
-
}
|
|
154
|
-
const delta = { [field]: value };
|
|
155
|
-
const newDuration = __classPrivateFieldGet(this, _bbnDtDuration_value, "f").add(delta);
|
|
156
|
-
// Adapt this constructor call to however you now construct your duration:
|
|
157
|
-
return new bbnDtDuration(newDuration, undefined, undefined, undefined, undefined, undefined, undefined, undefined, __classPrivateFieldGet(this, _bbnDtDuration_unit, "f"));
|
|
158
|
-
}
|
|
159
|
-
subtract(value, unit) {
|
|
160
|
-
return this.add(-value, unit);
|
|
161
|
-
}
|
|
162
|
-
toMilliseconds() {
|
|
163
|
-
const d = __classPrivateFieldGet(this, _bbnDtDuration_value, "f");
|
|
164
|
-
// If there are no calendar units, we can let Temporal do it directly:
|
|
165
|
-
if (!d.years && !d.months && !d.weeks && !d.days) {
|
|
166
|
-
return d.total({ unit: 'millisecond' });
|
|
167
|
-
}
|
|
168
|
-
// Otherwise we must supply a relativeTo (same as in asX)
|
|
169
|
-
return d.total({
|
|
170
|
-
unit: 'millisecond',
|
|
171
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
_bbnDtDuration_value = new WeakMap(), _bbnDtDuration_unit = new WeakMap(), _bbnDtDuration_instances = new WeakSet(), _bbnDtDuration_getUnitValue = function _bbnDtDuration_getUnitValue(name, remaining) {
|
|
176
|
-
const d = __classPrivateFieldGet(this, _bbnDtDuration_value, "f"); // Temporal.Duration
|
|
177
|
-
if (remaining) {
|
|
178
|
-
switch (name) {
|
|
179
|
-
case 'year': return d.years;
|
|
180
|
-
case 'month': return d.months;
|
|
181
|
-
case 'week': return d.weeks;
|
|
182
|
-
case 'day': return d.days;
|
|
183
|
-
case 'hour': return d.hours;
|
|
184
|
-
case 'minute': return d.minutes;
|
|
185
|
-
case 'second':
|
|
186
|
-
// seconds component only; sub-second parts go to milliseconds in toJSON()
|
|
187
|
-
return d.seconds;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// Total units: use Duration.total()
|
|
191
|
-
const total = d.total({
|
|
192
|
-
unit: name,
|
|
193
|
-
relativeTo: DURATION_RELATIVE_TO
|
|
194
|
-
});
|
|
195
|
-
// Keep same semantics as old code (Math.floor on totals)
|
|
196
|
-
return Math.floor(total);
|
|
197
|
-
};
|
|
198
|
-
export default bbnDtDuration;
|
|
199
|
-
;
|
|
File without changes
|