@ni/spright-components 6.4.22 → 6.4.24
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.
|
@@ -76889,7 +76889,7 @@ focus outline in that case.
|
|
|
76889
76889
|
/**
|
|
76890
76890
|
* A formatter for units that can be formatted/translated by Intl.NumberFormat
|
|
76891
76891
|
*/
|
|
76892
|
-
class
|
|
76892
|
+
class ScaledUnitFormatIntlNumberFormat extends ScaledUnitFormat {
|
|
76893
76893
|
constructor(scaledUnitFormatFactoryOptions, unitSpecificIntlNumberFormatOptions) {
|
|
76894
76894
|
super(scaledUnitFormatFactoryOptions);
|
|
76895
76895
|
this.formatter = new Intl.NumberFormat(this.locale, {
|
|
@@ -76899,7 +76899,7 @@ focus outline in that case.
|
|
|
76899
76899
|
});
|
|
76900
76900
|
}
|
|
76901
76901
|
static createFactory(unitSpecificIntlNumberFormatOptions) {
|
|
76902
|
-
return (scaledUnitFormatFactoryOptions) => new
|
|
76902
|
+
return (scaledUnitFormatFactoryOptions) => new ScaledUnitFormatIntlNumberFormat(scaledUnitFormatFactoryOptions, unitSpecificIntlNumberFormatOptions);
|
|
76903
76903
|
}
|
|
76904
76904
|
format(value) {
|
|
76905
76905
|
return this.formatter.format(value);
|
|
@@ -76971,14 +76971,14 @@ focus outline in that case.
|
|
|
76971
76971
|
/**
|
|
76972
76972
|
* Unit scale that is used to passthrough a number without applying scaling or units
|
|
76973
76973
|
*/
|
|
76974
|
-
class
|
|
76974
|
+
class UnitScalePassthrough extends UnitScale {
|
|
76975
76975
|
constructor() {
|
|
76976
76976
|
super([
|
|
76977
|
-
new ScaledUnit(10 ** 0,
|
|
76977
|
+
new ScaledUnit(10 ** 0, ScaledUnitFormatIntlNumberFormat.createFactory({}))
|
|
76978
76978
|
]);
|
|
76979
76979
|
}
|
|
76980
76980
|
}
|
|
76981
|
-
const
|
|
76981
|
+
const unitScalePassthrough = new UnitScalePassthrough();
|
|
76982
76982
|
|
|
76983
76983
|
// Workaround to avoid ts errors about signDisplay not accepting the value 'negative'.
|
|
76984
76984
|
// It has been supported by browsers since 8/23, but TypeScript still hasn't
|
|
@@ -76988,15 +76988,15 @@ focus outline in that case.
|
|
|
76988
76988
|
* Format for numbers with units to show in a tabular form.
|
|
76989
76989
|
* Large and tiny numbers are shown exponentially and the rest as decimal.
|
|
76990
76990
|
*/
|
|
76991
|
-
class
|
|
76992
|
-
constructor(locale, { unitScale =
|
|
76993
|
-
unitScale:
|
|
76991
|
+
class UnitFormatDefault extends UnitFormat {
|
|
76992
|
+
constructor(locale, { unitScale = unitScalePassthrough } = {
|
|
76993
|
+
unitScale: unitScalePassthrough
|
|
76994
76994
|
}) {
|
|
76995
76995
|
super();
|
|
76996
76996
|
// Format options to use by default. It renders the number with a maximum of 6 signficant digits (including zero before decimal point).
|
|
76997
76997
|
this.defaultIntlNumberFormatOptions = {
|
|
76998
|
-
maximumSignificantDigits:
|
|
76999
|
-
maximumFractionDigits:
|
|
76998
|
+
maximumSignificantDigits: UnitFormatDefault.maximumDigits,
|
|
76999
|
+
maximumFractionDigits: UnitFormatDefault.maximumDigits - 1,
|
|
77000
77000
|
roundingPriority: 'lessPrecision',
|
|
77001
77001
|
signDisplay
|
|
77002
77002
|
};
|
|
@@ -77004,7 +77004,7 @@ focus outline in that case.
|
|
|
77004
77004
|
// Format options for numbers that should be displayed in exponential notation. This should be used
|
|
77005
77005
|
// for numbers with magintudes over 'exponentialUpperBound' or under 'exponentialLowerBound'.
|
|
77006
77006
|
this.exponentialIntlNumberFormatOptions = {
|
|
77007
|
-
maximumSignificantDigits:
|
|
77007
|
+
maximumSignificantDigits: UnitFormatDefault.maximumDigits,
|
|
77008
77008
|
notation: 'scientific',
|
|
77009
77009
|
signDisplay
|
|
77010
77010
|
};
|
|
@@ -77029,8 +77029,8 @@ focus outline in that case.
|
|
|
77029
77029
|
const { scaledValue, scaledUnit } = this.unitScale.scaleNumber(number);
|
|
77030
77030
|
const absoluteValue = Math.abs(scaledValue);
|
|
77031
77031
|
const useExponential = absoluteValue !== 0
|
|
77032
|
-
&& (absoluteValue >=
|
|
77033
|
-
|| absoluteValue <
|
|
77032
|
+
&& (absoluteValue >= UnitFormatDefault.exponentialUpperBound
|
|
77033
|
+
|| absoluteValue < UnitFormatDefault.exponentialLowerBound);
|
|
77034
77034
|
return useExponential
|
|
77035
77035
|
? this.exponentialScaledUnitFormatter.format(number)
|
|
77036
77036
|
: this.defaultScaledUnitFormatters
|
|
@@ -77039,23 +77039,23 @@ focus outline in that case.
|
|
|
77039
77039
|
}
|
|
77040
77040
|
}
|
|
77041
77041
|
// The maximum number of digits that should be rendered for any given value.
|
|
77042
|
-
|
|
77042
|
+
UnitFormatDefault.maximumDigits = 6;
|
|
77043
77043
|
// Use exponential notation for numbers that will be rendered with 3 leading 0s or more.
|
|
77044
77044
|
// Because a maximum of 6 digits are rendered, showing more than 3 leading 0s is not ideal
|
|
77045
77045
|
// because then at least half of the displayed digits will be leading 0s.
|
|
77046
|
-
|
|
77046
|
+
UnitFormatDefault.exponentialLowerBound = 0.000995;
|
|
77047
77047
|
// Use exponential formatting for numbers whose magnitude cannot otherwise be displayed
|
|
77048
77048
|
// with 6 digits or less.
|
|
77049
|
-
|
|
77049
|
+
UnitFormatDefault.exponentialUpperBound = 999999.5;
|
|
77050
77050
|
|
|
77051
77051
|
/**
|
|
77052
77052
|
* Format for decimal numbers with units.
|
|
77053
77053
|
*/
|
|
77054
|
-
class
|
|
77055
|
-
constructor(locale, { minimumFractionDigits = 0, maximumFractionDigits = Math.max(3, minimumFractionDigits), unitScale =
|
|
77054
|
+
class UnitFormatDecimal extends UnitFormat {
|
|
77055
|
+
constructor(locale, { minimumFractionDigits = 0, maximumFractionDigits = Math.max(3, minimumFractionDigits), unitScale = unitScalePassthrough } = {
|
|
77056
77056
|
minimumFractionDigits: 0,
|
|
77057
77057
|
maximumFractionDigits: 3,
|
|
77058
|
-
unitScale:
|
|
77058
|
+
unitScale: unitScalePassthrough
|
|
77059
77059
|
}) {
|
|
77060
77060
|
super();
|
|
77061
77061
|
this.scaledUnitFormatters = new Map();
|
|
@@ -77095,7 +77095,7 @@ focus outline in that case.
|
|
|
77095
77095
|
/**
|
|
77096
77096
|
* Format for numbers (with optional units) in a number-text table column.
|
|
77097
77097
|
*/
|
|
77098
|
-
class
|
|
77098
|
+
class UnitFormatNumberText extends UnitFormat {
|
|
77099
77099
|
constructor(locale, options) {
|
|
77100
77100
|
super();
|
|
77101
77101
|
this._resolvedOptions = this.resolveOptions(options);
|
|
@@ -77120,18 +77120,18 @@ focus outline in that case.
|
|
|
77120
77120
|
resolveUnitFormat(locale, options) {
|
|
77121
77121
|
const { numberTextFormat, decimalMaximumDigits, decimalDigits, unitScale } = options;
|
|
77122
77122
|
if (numberTextFormat === NumberTextFormat.default) {
|
|
77123
|
-
return new
|
|
77123
|
+
return new UnitFormatDefault(locale, {
|
|
77124
77124
|
unitScale
|
|
77125
77125
|
});
|
|
77126
77126
|
}
|
|
77127
77127
|
if (typeof decimalDigits === 'number') {
|
|
77128
|
-
return new
|
|
77128
|
+
return new UnitFormatDecimal(locale, {
|
|
77129
77129
|
minimumFractionDigits: decimalDigits,
|
|
77130
77130
|
maximumFractionDigits: decimalDigits,
|
|
77131
77131
|
unitScale
|
|
77132
77132
|
});
|
|
77133
77133
|
}
|
|
77134
|
-
return new
|
|
77134
|
+
return new UnitFormatDecimal(locale, {
|
|
77135
77135
|
minimumFractionDigits: 0,
|
|
77136
77136
|
maximumFractionDigits: decimalMaximumDigits,
|
|
77137
77137
|
unitScale
|
|
@@ -77143,7 +77143,7 @@ focus outline in that case.
|
|
|
77143
77143
|
numberTextFormat: NumberTextFormat.default,
|
|
77144
77144
|
decimalDigits: undefined,
|
|
77145
77145
|
decimalMaximumDigits: undefined,
|
|
77146
|
-
unitScale: options?.unitScale ??
|
|
77146
|
+
unitScale: options?.unitScale ?? unitScalePassthrough
|
|
77147
77147
|
};
|
|
77148
77148
|
}
|
|
77149
77149
|
const hasDecimalDigits = typeof options.decimalDigits === 'number';
|
|
@@ -77154,20 +77154,20 @@ focus outline in that case.
|
|
|
77154
77154
|
if (!hasDecimalDigits && !hasDecimalMaximumDigits) {
|
|
77155
77155
|
return {
|
|
77156
77156
|
numberTextFormat: NumberTextFormat.decimal,
|
|
77157
|
-
decimalDigits:
|
|
77157
|
+
decimalDigits: UnitFormatNumberText.defaultDecimalDigits,
|
|
77158
77158
|
decimalMaximumDigits: undefined,
|
|
77159
|
-
unitScale: options.unitScale ??
|
|
77159
|
+
unitScale: options.unitScale ?? unitScalePassthrough
|
|
77160
77160
|
};
|
|
77161
77161
|
}
|
|
77162
77162
|
return {
|
|
77163
77163
|
numberTextFormat: NumberTextFormat.decimal,
|
|
77164
77164
|
decimalDigits: options.decimalDigits,
|
|
77165
77165
|
decimalMaximumDigits: options.decimalMaximumDigits,
|
|
77166
|
-
unitScale: options.unitScale ??
|
|
77166
|
+
unitScale: options.unitScale ?? unitScalePassthrough
|
|
77167
77167
|
};
|
|
77168
77168
|
}
|
|
77169
77169
|
}
|
|
77170
|
-
|
|
77170
|
+
UnitFormatNumberText.defaultDecimalDigits = 2;
|
|
77171
77171
|
|
|
77172
77172
|
const numberTextValidityFlagNames = [
|
|
77173
77173
|
'invalidDecimalDigits',
|
|
@@ -77326,7 +77326,7 @@ focus outline in that case.
|
|
|
77326
77326
|
}
|
|
77327
77327
|
createFormatter() {
|
|
77328
77328
|
const unitScale = this.unit?.resolvedUnitScale;
|
|
77329
|
-
return new
|
|
77329
|
+
return new UnitFormatNumberText(lang.getValueFor(this), {
|
|
77330
77330
|
// Attribute values sometimes resolve to either null or undefined
|
|
77331
77331
|
// See https://github.com/microsoft/fast/issues/6630
|
|
77332
77332
|
numberTextFormat: this.format ?? undefined,
|
|
@@ -78922,8 +78922,6 @@ focus outline in that case.
|
|
|
78922
78922
|
});
|
|
78923
78923
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTreeView());
|
|
78924
78924
|
|
|
78925
|
-
const template$5 = html `<template slot="unit"></template>`;
|
|
78926
|
-
|
|
78927
78925
|
/**
|
|
78928
78926
|
* Representations of a unit in a particular language
|
|
78929
78927
|
*/
|
|
@@ -78937,7 +78935,7 @@ focus outline in that case.
|
|
|
78937
78935
|
/**
|
|
78938
78936
|
* A formatter for units that are not supported by Intl.NumberFormat
|
|
78939
78937
|
*/
|
|
78940
|
-
class
|
|
78938
|
+
class ScaledUnitFormatManuallyTranslated extends ScaledUnitFormat {
|
|
78941
78939
|
constructor(scaledUnitFormatFactoryOptions, { unitTranslations, scaledPrefixText }) {
|
|
78942
78940
|
super(scaledUnitFormatFactoryOptions);
|
|
78943
78941
|
if (!unitTranslations.get('en')) {
|
|
@@ -78948,8 +78946,8 @@ focus outline in that case.
|
|
|
78948
78946
|
this.unitTranslation = this.getTranslationToUse(unitTranslations, this.locale);
|
|
78949
78947
|
this.scaledPrefixText = scaledPrefixText;
|
|
78950
78948
|
}
|
|
78951
|
-
static createFactory(
|
|
78952
|
-
return (scaledUnitFormatFactoryOptions) => new
|
|
78949
|
+
static createFactory(scaledUnitFormatManuallyTranslatedOptions) {
|
|
78950
|
+
return (scaledUnitFormatFactoryOptions) => new ScaledUnitFormatManuallyTranslated(scaledUnitFormatFactoryOptions, scaledUnitFormatManuallyTranslatedOptions);
|
|
78953
78951
|
}
|
|
78954
78952
|
format(value) {
|
|
78955
78953
|
const formatted = this.formatter.format(value);
|
|
@@ -79004,17 +79002,17 @@ focus outline in that case.
|
|
|
79004
79002
|
/**
|
|
79005
79003
|
* Byte units (1024-based)
|
|
79006
79004
|
*/
|
|
79007
|
-
class
|
|
79005
|
+
class UnitScaleByte1024 extends UnitScale {
|
|
79008
79006
|
constructor() {
|
|
79009
|
-
super(byte1024Prefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor,
|
|
79007
|
+
super(byte1024Prefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ScaledUnitFormatManuallyTranslated.createFactory({
|
|
79010
79008
|
unitTranslations: unitTranslations$1,
|
|
79011
79009
|
scaledPrefixText
|
|
79012
79010
|
}))));
|
|
79013
79011
|
}
|
|
79014
79012
|
}
|
|
79015
|
-
const
|
|
79013
|
+
const unitScaleByte1024 = new UnitScaleByte1024();
|
|
79016
79014
|
|
|
79017
|
-
const
|
|
79015
|
+
const unitScaleByteConfig = [
|
|
79018
79016
|
[1000 ** 0, 'byte', 'long'],
|
|
79019
79017
|
[1000 ** 1, 'kilobyte', 'short'],
|
|
79020
79018
|
[1000 ** 2, 'megabyte', 'short'],
|
|
@@ -79025,16 +79023,18 @@ focus outline in that case.
|
|
|
79025
79023
|
/**
|
|
79026
79024
|
* Byte units (1000-based)
|
|
79027
79025
|
*/
|
|
79028
|
-
class
|
|
79026
|
+
class UnitScaleByte extends UnitScale {
|
|
79029
79027
|
constructor() {
|
|
79030
|
-
super(
|
|
79028
|
+
super(unitScaleByteConfig.map(([scaleFactor, unit, unitDisplay]) => new ScaledUnit(scaleFactor, ScaledUnitFormatIntlNumberFormat.createFactory({
|
|
79031
79029
|
style: 'unit',
|
|
79032
79030
|
unit,
|
|
79033
79031
|
unitDisplay
|
|
79034
79032
|
}))));
|
|
79035
79033
|
}
|
|
79036
79034
|
}
|
|
79037
|
-
const
|
|
79035
|
+
const unitScaleByte = new UnitScaleByte();
|
|
79036
|
+
|
|
79037
|
+
const template$5 = html `<template slot="unit"></template>`;
|
|
79038
79038
|
|
|
79039
79039
|
const styles$5 = css `
|
|
79040
79040
|
${display$1('none')}
|
|
@@ -79051,12 +79051,12 @@ focus outline in that case.
|
|
|
79051
79051
|
* the default of decimal (base 1000 scale with metric prefixes)
|
|
79052
79052
|
*/
|
|
79053
79053
|
this.binary = false;
|
|
79054
|
-
this.resolvedUnitScale =
|
|
79054
|
+
this.resolvedUnitScale = unitScaleByte;
|
|
79055
79055
|
}
|
|
79056
79056
|
binaryChanged() {
|
|
79057
79057
|
this.resolvedUnitScale = this.binary
|
|
79058
|
-
?
|
|
79059
|
-
:
|
|
79058
|
+
? unitScaleByte1024
|
|
79059
|
+
: unitScaleByte;
|
|
79060
79060
|
}
|
|
79061
79061
|
}
|
|
79062
79062
|
__decorate([
|
|
@@ -79096,15 +79096,15 @@ focus outline in that case.
|
|
|
79096
79096
|
/**
|
|
79097
79097
|
* Voltage unit scale
|
|
79098
79098
|
*/
|
|
79099
|
-
class
|
|
79099
|
+
class UnitScaleVolt extends UnitScale {
|
|
79100
79100
|
constructor() {
|
|
79101
|
-
super(metricPrefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor,
|
|
79101
|
+
super(metricPrefixes.map(([scaleFactor, scaledPrefixText]) => new ScaledUnit(scaleFactor, ScaledUnitFormatManuallyTranslated.createFactory({
|
|
79102
79102
|
unitTranslations,
|
|
79103
79103
|
scaledPrefixText
|
|
79104
79104
|
}))));
|
|
79105
79105
|
}
|
|
79106
79106
|
}
|
|
79107
|
-
const
|
|
79107
|
+
const unitScaleVolt = new UnitScaleVolt();
|
|
79108
79108
|
|
|
79109
79109
|
/**
|
|
79110
79110
|
* Element representing units for volts
|
|
@@ -79112,7 +79112,7 @@ focus outline in that case.
|
|
|
79112
79112
|
class UnitVolt extends Unit {
|
|
79113
79113
|
constructor() {
|
|
79114
79114
|
super();
|
|
79115
|
-
this.resolvedUnitScale =
|
|
79115
|
+
this.resolvedUnitScale = unitScaleVolt;
|
|
79116
79116
|
}
|
|
79117
79117
|
}
|
|
79118
79118
|
const nimbleUnitVolt = UnitVolt.compose({
|
|
@@ -83207,28 +83207,33 @@ focus outline in that case.
|
|
|
83207
83207
|
return this.bytes_.length;
|
|
83208
83208
|
}
|
|
83209
83209
|
readInt8(offset) {
|
|
83210
|
-
return this.readUint8(offset) << 24 >> 24;
|
|
83210
|
+
return (this.readUint8(offset) << 24) >> 24;
|
|
83211
83211
|
}
|
|
83212
83212
|
readUint8(offset) {
|
|
83213
83213
|
return this.bytes_[offset];
|
|
83214
83214
|
}
|
|
83215
83215
|
readInt16(offset) {
|
|
83216
|
-
return this.readUint16(offset) << 16 >> 16;
|
|
83216
|
+
return (this.readUint16(offset) << 16) >> 16;
|
|
83217
83217
|
}
|
|
83218
83218
|
readUint16(offset) {
|
|
83219
|
-
return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
|
|
83219
|
+
return this.bytes_[offset] | (this.bytes_[offset + 1] << 8);
|
|
83220
83220
|
}
|
|
83221
83221
|
readInt32(offset) {
|
|
83222
|
-
return this.bytes_[offset] |
|
|
83222
|
+
return (this.bytes_[offset] |
|
|
83223
|
+
(this.bytes_[offset + 1] << 8) |
|
|
83224
|
+
(this.bytes_[offset + 2] << 16) |
|
|
83225
|
+
(this.bytes_[offset + 3] << 24));
|
|
83223
83226
|
}
|
|
83224
83227
|
readUint32(offset) {
|
|
83225
83228
|
return this.readInt32(offset) >>> 0;
|
|
83226
83229
|
}
|
|
83227
83230
|
readInt64(offset) {
|
|
83228
|
-
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) +
|
|
83231
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) +
|
|
83232
|
+
(BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
83229
83233
|
}
|
|
83230
83234
|
readUint64(offset) {
|
|
83231
|
-
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) +
|
|
83235
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) +
|
|
83236
|
+
(BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
83232
83237
|
}
|
|
83233
83238
|
readFloat32(offset) {
|
|
83234
83239
|
int32[0] = this.readInt32(offset);
|
|
@@ -83288,11 +83293,11 @@ focus outline in that case.
|
|
|
83288
83293
|
* start of a the root vtable).
|
|
83289
83294
|
*/
|
|
83290
83295
|
getBufferIdentifier() {
|
|
83291
|
-
if (this.bytes_.length <
|
|
83292
|
-
FILE_IDENTIFIER_LENGTH) {
|
|
83296
|
+
if (this.bytes_.length <
|
|
83297
|
+
this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
|
|
83293
83298
|
throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
|
|
83294
83299
|
}
|
|
83295
|
-
let result =
|
|
83300
|
+
let result = '';
|
|
83296
83301
|
for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {
|
|
83297
83302
|
result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));
|
|
83298
83303
|
}
|
|
@@ -83304,7 +83309,9 @@ focus outline in that case.
|
|
|
83304
83309
|
*/
|
|
83305
83310
|
__offset(bb_pos, vtable_offset) {
|
|
83306
83311
|
const vtable = bb_pos - this.readInt32(bb_pos);
|
|
83307
|
-
return vtable_offset < this.readInt16(vtable)
|
|
83312
|
+
return vtable_offset < this.readInt16(vtable)
|
|
83313
|
+
? this.readInt16(vtable + vtable_offset)
|
|
83314
|
+
: 0;
|
|
83308
83315
|
}
|
|
83309
83316
|
/**
|
|
83310
83317
|
* Initialize any Table-derived type to point to the union at the given offset.
|
|
@@ -83368,8 +83375,7 @@ focus outline in that case.
|
|
|
83368
83375
|
}
|
|
83369
83376
|
__has_identifier(ident) {
|
|
83370
83377
|
if (ident.length != FILE_IDENTIFIER_LENGTH) {
|
|
83371
|
-
throw new Error('FlatBuffers: file identifier must be length ' +
|
|
83372
|
-
FILE_IDENTIFIER_LENGTH);
|
|
83378
|
+
throw new Error('FlatBuffers: file identifier must be length ' + FILE_IDENTIFIER_LENGTH);
|
|
83373
83379
|
}
|
|
83374
83380
|
for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {
|
|
83375
83381
|
if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {
|
|
@@ -83482,7 +83488,9 @@ focus outline in that case.
|
|
|
83482
83488
|
* called finish().
|
|
83483
83489
|
*/
|
|
83484
83490
|
asUint8Array() {
|
|
83485
|
-
return this.bb
|
|
83491
|
+
return this.bb
|
|
83492
|
+
.bytes()
|
|
83493
|
+
.subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
83486
83494
|
}
|
|
83487
83495
|
/**
|
|
83488
83496
|
* Prepare to write an element of `size` after `additional_bytes` have been
|
|
@@ -83500,7 +83508,7 @@ focus outline in that case.
|
|
|
83500
83508
|
}
|
|
83501
83509
|
// Find the amount of alignment needed such that `size` is properly
|
|
83502
83510
|
// aligned after `additional_bytes`
|
|
83503
|
-
const align_size = (
|
|
83511
|
+
const align_size = (~(this.bb.capacity() - this.space + additional_bytes) + 1) & (size - 1);
|
|
83504
83512
|
// Reallocate the buffer if needed.
|
|
83505
83513
|
while (this.space < align_size + size + additional_bytes) {
|
|
83506
83514
|
const old_buf_size = this.bb.capacity();
|
|
@@ -83515,22 +83523,22 @@ focus outline in that case.
|
|
|
83515
83523
|
}
|
|
83516
83524
|
}
|
|
83517
83525
|
writeInt8(value) {
|
|
83518
|
-
this.bb.writeInt8(this.space -= 1, value);
|
|
83526
|
+
this.bb.writeInt8((this.space -= 1), value);
|
|
83519
83527
|
}
|
|
83520
83528
|
writeInt16(value) {
|
|
83521
|
-
this.bb.writeInt16(this.space -= 2, value);
|
|
83529
|
+
this.bb.writeInt16((this.space -= 2), value);
|
|
83522
83530
|
}
|
|
83523
83531
|
writeInt32(value) {
|
|
83524
|
-
this.bb.writeInt32(this.space -= 4, value);
|
|
83532
|
+
this.bb.writeInt32((this.space -= 4), value);
|
|
83525
83533
|
}
|
|
83526
83534
|
writeInt64(value) {
|
|
83527
|
-
this.bb.writeInt64(this.space -= 8, value);
|
|
83535
|
+
this.bb.writeInt64((this.space -= 8), value);
|
|
83528
83536
|
}
|
|
83529
83537
|
writeFloat32(value) {
|
|
83530
|
-
this.bb.writeFloat32(this.space -= 4, value);
|
|
83538
|
+
this.bb.writeFloat32((this.space -= 4), value);
|
|
83531
83539
|
}
|
|
83532
83540
|
writeFloat64(value) {
|
|
83533
|
-
this.bb.writeFloat64(this.space -= 8, value);
|
|
83541
|
+
this.bb.writeFloat64((this.space -= 8), value);
|
|
83534
83542
|
}
|
|
83535
83543
|
/**
|
|
83536
83544
|
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
@@ -83678,7 +83686,7 @@ focus outline in that case.
|
|
|
83678
83686
|
static growByteBuffer(bb) {
|
|
83679
83687
|
const old_buf_size = bb.capacity();
|
|
83680
83688
|
// Ensure we don't grow beyond what fits in an int.
|
|
83681
|
-
if (old_buf_size &
|
|
83689
|
+
if (old_buf_size & 0xc0000000) {
|
|
83682
83690
|
throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
|
|
83683
83691
|
}
|
|
83684
83692
|
const new_buf_size = old_buf_size << 1;
|
|
@@ -83777,8 +83785,7 @@ focus outline in that case.
|
|
|
83777
83785
|
const size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
|
|
83778
83786
|
if (opt_file_identifier) {
|
|
83779
83787
|
const file_identifier = opt_file_identifier;
|
|
83780
|
-
this.prep(this.minalign, SIZEOF_INT +
|
|
83781
|
-
FILE_IDENTIFIER_LENGTH + size_prefix);
|
|
83788
|
+
this.prep(this.minalign, SIZEOF_INT + FILE_IDENTIFIER_LENGTH + size_prefix);
|
|
83782
83789
|
if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
|
|
83783
83790
|
throw new TypeError('FlatBuffers: file identifier must be length ' +
|
|
83784
83791
|
FILE_IDENTIFIER_LENGTH);
|
|
@@ -83881,7 +83888,7 @@ focus outline in that case.
|
|
|
83881
83888
|
}
|
|
83882
83889
|
this.addInt8(0);
|
|
83883
83890
|
this.startVector(1, utf8.length, 1);
|
|
83884
|
-
this.bb.setPosition(this.space -= utf8.length);
|
|
83891
|
+
this.bb.setPosition((this.space -= utf8.length));
|
|
83885
83892
|
this.bb.bytes().set(utf8, this.space);
|
|
83886
83893
|
return this.endVector();
|
|
83887
83894
|
}
|
|
@@ -83896,7 +83903,7 @@ focus outline in that case.
|
|
|
83896
83903
|
return 0;
|
|
83897
83904
|
}
|
|
83898
83905
|
this.startVector(1, v.length, 1);
|
|
83899
|
-
this.bb.setPosition(this.space -= v.length);
|
|
83906
|
+
this.bb.setPosition((this.space -= v.length));
|
|
83900
83907
|
this.bb.bytes().set(v, this.space);
|
|
83901
83908
|
return this.endVector();
|
|
83902
83909
|
}
|