@legendapp/state 0.14.3 → 0.14.4

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/babel.js CHANGED
@@ -5293,339 +5293,331 @@ function isValidIdentifier(name, reserved = true) {
5293
5293
 
5294
5294
  var lib = {};
5295
5295
 
5296
- var hasRequiredLib$1;
5296
+ Object.defineProperty(lib, "__esModule", {
5297
+ value: true
5298
+ });
5299
+ lib.readCodePoint = readCodePoint;
5300
+ lib.readInt = readInt;
5301
+ lib.readStringContents = readStringContents;
5297
5302
 
5298
- function requireLib$1 () {
5299
- if (hasRequiredLib$1) return lib;
5300
- hasRequiredLib$1 = 1;
5303
+ var _isDigit = function isDigit(code) {
5304
+ return code >= 48 && code <= 57;
5305
+ };
5301
5306
 
5302
- Object.defineProperty(lib, "__esModule", {
5303
- value: true
5304
- });
5305
- lib.readCodePoint = readCodePoint;
5306
- lib.readInt = readInt;
5307
- lib.readStringContents = readStringContents;
5307
+ const forbiddenNumericSeparatorSiblings = {
5308
+ decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
5309
+ hex: new Set([46, 88, 95, 120])
5310
+ };
5311
+ const isAllowedNumericSeparatorSibling = {
5312
+ bin: ch => ch === 48 || ch === 49,
5313
+ oct: ch => ch >= 48 && ch <= 55,
5314
+ dec: ch => ch >= 48 && ch <= 57,
5315
+ hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
5316
+ };
5308
5317
 
5309
- var _isDigit = function isDigit(code) {
5310
- return code >= 48 && code <= 57;
5311
- };
5318
+ function readStringContents(type, input, pos, lineStart, curLine, errors) {
5319
+ const initialPos = pos;
5320
+ const initialLineStart = lineStart;
5321
+ const initialCurLine = curLine;
5322
+ let out = "";
5323
+ let containsInvalid = false;
5324
+ let chunkStart = pos;
5325
+ const {
5326
+ length
5327
+ } = input;
5312
5328
 
5313
- const forbiddenNumericSeparatorSiblings = {
5314
- decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
5315
- hex: new Set([46, 88, 95, 120])
5316
- };
5317
- const isAllowedNumericSeparatorSibling = {
5318
- bin: ch => ch === 48 || ch === 49,
5319
- oct: ch => ch >= 48 && ch <= 55,
5320
- dec: ch => ch >= 48 && ch <= 57,
5321
- hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
5322
- };
5329
+ for (;;) {
5330
+ if (pos >= length) {
5331
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
5332
+ out += input.slice(chunkStart, pos);
5333
+ break;
5334
+ }
5323
5335
 
5324
- function readStringContents(type, input, pos, lineStart, curLine, errors) {
5325
- const initialPos = pos;
5326
- const initialLineStart = lineStart;
5327
- const initialCurLine = curLine;
5328
- let out = "";
5329
- let containsInvalid = false;
5330
- let chunkStart = pos;
5331
- const {
5332
- length
5333
- } = input;
5334
-
5335
- for (;;) {
5336
- if (pos >= length) {
5337
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
5338
- out += input.slice(chunkStart, pos);
5339
- break;
5340
- }
5336
+ const ch = input.charCodeAt(pos);
5341
5337
 
5342
- const ch = input.charCodeAt(pos);
5338
+ if (isStringEnd(type, ch, input, pos)) {
5339
+ out += input.slice(chunkStart, pos);
5340
+ break;
5341
+ }
5343
5342
 
5344
- if (isStringEnd(type, ch, input, pos)) {
5345
- out += input.slice(chunkStart, pos);
5346
- break;
5347
- }
5343
+ if (ch === 92) {
5344
+ out += input.slice(chunkStart, pos);
5345
+ let escaped;
5346
+ ({
5347
+ ch: escaped,
5348
+ pos,
5349
+ lineStart,
5350
+ curLine
5351
+ } = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors));
5348
5352
 
5349
- if (ch === 92) {
5350
- out += input.slice(chunkStart, pos);
5351
- let escaped;
5352
- ({
5353
- ch: escaped,
5354
- pos,
5355
- lineStart,
5356
- curLine
5357
- } = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors));
5358
-
5359
- if (escaped === null) {
5360
- containsInvalid = true;
5361
- } else {
5362
- out += escaped;
5363
- }
5353
+ if (escaped === null) {
5354
+ containsInvalid = true;
5355
+ } else {
5356
+ out += escaped;
5357
+ }
5364
5358
 
5365
- chunkStart = pos;
5366
- } else if (ch === 8232 || ch === 8233) {
5367
- ++pos;
5368
- ++curLine;
5369
- lineStart = pos;
5370
- } else if (ch === 10 || ch === 13) {
5371
- if (type === "template") {
5372
- out += input.slice(chunkStart, pos) + "\n";
5373
- ++pos;
5374
-
5375
- if (ch === 13 && input.charCodeAt(pos) === 10) {
5376
- ++pos;
5377
- }
5359
+ chunkStart = pos;
5360
+ } else if (ch === 8232 || ch === 8233) {
5361
+ ++pos;
5362
+ ++curLine;
5363
+ lineStart = pos;
5364
+ } else if (ch === 10 || ch === 13) {
5365
+ if (type === "template") {
5366
+ out += input.slice(chunkStart, pos) + "\n";
5367
+ ++pos;
5368
+
5369
+ if (ch === 13 && input.charCodeAt(pos) === 10) {
5370
+ ++pos;
5371
+ }
5378
5372
 
5379
- ++curLine;
5380
- chunkStart = lineStart = pos;
5381
- } else {
5382
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
5383
- }
5384
- } else {
5385
- ++pos;
5386
- }
5387
- }
5373
+ ++curLine;
5374
+ chunkStart = lineStart = pos;
5375
+ } else {
5376
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
5377
+ }
5378
+ } else {
5379
+ ++pos;
5380
+ }
5381
+ }
5388
5382
 
5389
- return {
5390
- pos,
5391
- str: out,
5392
- containsInvalid,
5393
- lineStart,
5394
- curLine
5395
- };
5396
- }
5383
+ return {
5384
+ pos,
5385
+ str: out,
5386
+ containsInvalid,
5387
+ lineStart,
5388
+ curLine
5389
+ };
5390
+ }
5397
5391
 
5398
- function isStringEnd(type, ch, input, pos) {
5399
- if (type === "template") {
5400
- return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
5401
- }
5392
+ function isStringEnd(type, ch, input, pos) {
5393
+ if (type === "template") {
5394
+ return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
5395
+ }
5402
5396
 
5403
- return ch === (type === "double" ? 34 : 39);
5404
- }
5397
+ return ch === (type === "double" ? 34 : 39);
5398
+ }
5405
5399
 
5406
- function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
5407
- const throwOnInvalid = !inTemplate;
5408
- pos++;
5400
+ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
5401
+ const throwOnInvalid = !inTemplate;
5402
+ pos++;
5409
5403
 
5410
- const res = ch => ({
5411
- pos,
5412
- ch,
5413
- lineStart,
5414
- curLine
5415
- });
5404
+ const res = ch => ({
5405
+ pos,
5406
+ ch,
5407
+ lineStart,
5408
+ curLine
5409
+ });
5416
5410
 
5417
- const ch = input.charCodeAt(pos++);
5411
+ const ch = input.charCodeAt(pos++);
5418
5412
 
5419
- switch (ch) {
5420
- case 110:
5421
- return res("\n");
5413
+ switch (ch) {
5414
+ case 110:
5415
+ return res("\n");
5422
5416
 
5423
- case 114:
5424
- return res("\r");
5417
+ case 114:
5418
+ return res("\r");
5425
5419
 
5426
- case 120:
5427
- {
5428
- let code;
5429
- ({
5430
- code,
5431
- pos
5432
- } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
5433
- return res(code === null ? null : String.fromCharCode(code));
5434
- }
5420
+ case 120:
5421
+ {
5422
+ let code;
5423
+ ({
5424
+ code,
5425
+ pos
5426
+ } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
5427
+ return res(code === null ? null : String.fromCharCode(code));
5428
+ }
5435
5429
 
5436
- case 117:
5437
- {
5438
- let code;
5439
- ({
5440
- code,
5441
- pos
5442
- } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
5443
- return res(code === null ? null : String.fromCodePoint(code));
5444
- }
5430
+ case 117:
5431
+ {
5432
+ let code;
5433
+ ({
5434
+ code,
5435
+ pos
5436
+ } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
5437
+ return res(code === null ? null : String.fromCodePoint(code));
5438
+ }
5445
5439
 
5446
- case 116:
5447
- return res("\t");
5440
+ case 116:
5441
+ return res("\t");
5448
5442
 
5449
- case 98:
5450
- return res("\b");
5443
+ case 98:
5444
+ return res("\b");
5451
5445
 
5452
- case 118:
5453
- return res("\u000b");
5446
+ case 118:
5447
+ return res("\u000b");
5454
5448
 
5455
- case 102:
5456
- return res("\f");
5449
+ case 102:
5450
+ return res("\f");
5457
5451
 
5458
- case 13:
5459
- if (input.charCodeAt(pos) === 10) {
5460
- ++pos;
5461
- }
5452
+ case 13:
5453
+ if (input.charCodeAt(pos) === 10) {
5454
+ ++pos;
5455
+ }
5462
5456
 
5463
- case 10:
5464
- lineStart = pos;
5465
- ++curLine;
5457
+ case 10:
5458
+ lineStart = pos;
5459
+ ++curLine;
5466
5460
 
5467
- case 8232:
5468
- case 8233:
5469
- return res("");
5461
+ case 8232:
5462
+ case 8233:
5463
+ return res("");
5470
5464
 
5471
- case 56:
5472
- case 57:
5473
- if (inTemplate) {
5474
- return res(null);
5475
- } else {
5476
- errors.strictNumericEscape(pos - 1, lineStart, curLine);
5477
- }
5465
+ case 56:
5466
+ case 57:
5467
+ if (inTemplate) {
5468
+ return res(null);
5469
+ } else {
5470
+ errors.strictNumericEscape(pos - 1, lineStart, curLine);
5471
+ }
5478
5472
 
5479
- default:
5480
- if (ch >= 48 && ch <= 55) {
5481
- const startPos = pos - 1;
5482
- const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
5483
- let octalStr = match[0];
5484
- let octal = parseInt(octalStr, 8);
5473
+ default:
5474
+ if (ch >= 48 && ch <= 55) {
5475
+ const startPos = pos - 1;
5476
+ const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
5477
+ let octalStr = match[0];
5478
+ let octal = parseInt(octalStr, 8);
5485
5479
 
5486
- if (octal > 255) {
5487
- octalStr = octalStr.slice(0, -1);
5488
- octal = parseInt(octalStr, 8);
5489
- }
5480
+ if (octal > 255) {
5481
+ octalStr = octalStr.slice(0, -1);
5482
+ octal = parseInt(octalStr, 8);
5483
+ }
5490
5484
 
5491
- pos += octalStr.length - 1;
5492
- const next = input.charCodeAt(pos);
5485
+ pos += octalStr.length - 1;
5486
+ const next = input.charCodeAt(pos);
5493
5487
 
5494
- if (octalStr !== "0" || next === 56 || next === 57) {
5495
- if (inTemplate) {
5496
- return res(null);
5497
- } else {
5498
- errors.strictNumericEscape(startPos, lineStart, curLine);
5499
- }
5500
- }
5488
+ if (octalStr !== "0" || next === 56 || next === 57) {
5489
+ if (inTemplate) {
5490
+ return res(null);
5491
+ } else {
5492
+ errors.strictNumericEscape(startPos, lineStart, curLine);
5493
+ }
5494
+ }
5501
5495
 
5502
- return res(String.fromCharCode(octal));
5503
- }
5496
+ return res(String.fromCharCode(octal));
5497
+ }
5504
5498
 
5505
- return res(String.fromCharCode(ch));
5506
- }
5507
- }
5499
+ return res(String.fromCharCode(ch));
5500
+ }
5501
+ }
5508
5502
 
5509
- function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
5510
- const initialPos = pos;
5511
- let n;
5512
- ({
5513
- n,
5514
- pos
5515
- } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors));
5503
+ function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
5504
+ const initialPos = pos;
5505
+ let n;
5506
+ ({
5507
+ n,
5508
+ pos
5509
+ } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors));
5516
5510
 
5517
- if (n === null) {
5518
- if (throwOnInvalid) {
5519
- errors.invalidEscapeSequence(initialPos, lineStart, curLine);
5520
- } else {
5521
- pos = initialPos - 1;
5522
- }
5523
- }
5511
+ if (n === null) {
5512
+ if (throwOnInvalid) {
5513
+ errors.invalidEscapeSequence(initialPos, lineStart, curLine);
5514
+ } else {
5515
+ pos = initialPos - 1;
5516
+ }
5517
+ }
5524
5518
 
5525
- return {
5526
- code: n,
5527
- pos
5528
- };
5529
- }
5519
+ return {
5520
+ code: n,
5521
+ pos
5522
+ };
5523
+ }
5530
5524
 
5531
- function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors) {
5532
- const start = pos;
5533
- const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
5534
- const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
5535
- let invalid = false;
5536
- let total = 0;
5525
+ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors) {
5526
+ const start = pos;
5527
+ const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
5528
+ const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
5529
+ let invalid = false;
5530
+ let total = 0;
5537
5531
 
5538
- for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
5539
- const code = input.charCodeAt(pos);
5540
- let val;
5532
+ for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
5533
+ const code = input.charCodeAt(pos);
5534
+ let val;
5541
5535
 
5542
- if (code === 95 && allowNumSeparator !== "bail") {
5543
- const prev = input.charCodeAt(pos - 1);
5544
- const next = input.charCodeAt(pos + 1);
5536
+ if (code === 95 && allowNumSeparator !== "bail") {
5537
+ const prev = input.charCodeAt(pos - 1);
5538
+ const next = input.charCodeAt(pos + 1);
5545
5539
 
5546
- if (!allowNumSeparator) {
5547
- errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
5548
- } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
5549
- errors.unexpectedNumericSeparator(pos, lineStart, curLine);
5550
- }
5540
+ if (!allowNumSeparator) {
5541
+ errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
5542
+ } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
5543
+ errors.unexpectedNumericSeparator(pos, lineStart, curLine);
5544
+ }
5551
5545
 
5552
- ++pos;
5553
- continue;
5554
- }
5546
+ ++pos;
5547
+ continue;
5548
+ }
5555
5549
 
5556
- if (code >= 97) {
5557
- val = code - 97 + 10;
5558
- } else if (code >= 65) {
5559
- val = code - 65 + 10;
5560
- } else if (_isDigit(code)) {
5561
- val = code - 48;
5562
- } else {
5563
- val = Infinity;
5564
- }
5550
+ if (code >= 97) {
5551
+ val = code - 97 + 10;
5552
+ } else if (code >= 65) {
5553
+ val = code - 65 + 10;
5554
+ } else if (_isDigit(code)) {
5555
+ val = code - 48;
5556
+ } else {
5557
+ val = Infinity;
5558
+ }
5565
5559
 
5566
- if (val >= radix) {
5567
- if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
5568
- val = 0;
5569
- } else if (forceLen) {
5570
- val = 0;
5571
- invalid = true;
5572
- } else {
5573
- break;
5574
- }
5575
- }
5560
+ if (val >= radix) {
5561
+ if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
5562
+ val = 0;
5563
+ } else if (forceLen) {
5564
+ val = 0;
5565
+ invalid = true;
5566
+ } else {
5567
+ break;
5568
+ }
5569
+ }
5576
5570
 
5577
- ++pos;
5578
- total = total * radix + val;
5579
- }
5571
+ ++pos;
5572
+ total = total * radix + val;
5573
+ }
5580
5574
 
5581
- if (pos === start || len != null && pos - start !== len || invalid) {
5582
- return {
5583
- n: null,
5584
- pos
5585
- };
5586
- }
5575
+ if (pos === start || len != null && pos - start !== len || invalid) {
5576
+ return {
5577
+ n: null,
5578
+ pos
5579
+ };
5580
+ }
5587
5581
 
5588
- return {
5589
- n: total,
5590
- pos
5591
- };
5592
- }
5582
+ return {
5583
+ n: total,
5584
+ pos
5585
+ };
5586
+ }
5593
5587
 
5594
- function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5595
- const ch = input.charCodeAt(pos);
5596
- let code;
5588
+ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5589
+ const ch = input.charCodeAt(pos);
5590
+ let code;
5597
5591
 
5598
- if (ch === 123) {
5599
- ++pos;
5600
- ({
5601
- code,
5602
- pos
5603
- } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5604
- ++pos;
5592
+ if (ch === 123) {
5593
+ ++pos;
5594
+ ({
5595
+ code,
5596
+ pos
5597
+ } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5598
+ ++pos;
5605
5599
 
5606
- if (code !== null && code > 0x10ffff) {
5607
- if (throwOnInvalid) {
5608
- errors.invalidCodePoint(pos, lineStart, curLine);
5609
- } else {
5610
- return {
5611
- code: null,
5612
- pos
5613
- };
5614
- }
5615
- }
5616
- } else {
5617
- ({
5618
- code,
5619
- pos
5620
- } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5621
- }
5600
+ if (code !== null && code > 0x10ffff) {
5601
+ if (throwOnInvalid) {
5602
+ errors.invalidCodePoint(pos, lineStart, curLine);
5603
+ } else {
5604
+ return {
5605
+ code: null,
5606
+ pos
5607
+ };
5608
+ }
5609
+ }
5610
+ } else {
5611
+ ({
5612
+ code,
5613
+ pos
5614
+ } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5615
+ }
5622
5616
 
5623
- return {
5624
- code,
5625
- pos
5626
- };
5627
- }
5628
- return lib;
5617
+ return {
5618
+ code,
5619
+ pos
5620
+ };
5629
5621
  }
5630
5622
 
5631
5623
  var constants = {};
@@ -6047,7 +6039,7 @@ function requireCore () {
6047
6039
 
6048
6040
  var _helperValidatorIdentifier = lib$1;
6049
6041
 
6050
- var _helperStringParser = requireLib$1();
6042
+ var _helperStringParser = lib;
6051
6043
 
6052
6044
  var _constants = constants;
6053
6045