@legendapp/state 0.18.0 → 0.18.2

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