bkui-vue 2.1.0-dev-beta.11 → 2.1.0-dev-beta.13
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/index.cjs.js +65 -70
- package/dist/index.esm.js +15934 -17165
- package/dist/index.umd.js +65 -70
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/code-diff/index.js +73 -32
- package/lib/index.js +1 -1
- package/lib/popover/index.js +72 -64
- package/lib/tree/index.d.ts +12 -0
- package/lib/tree/index.js +360 -3630
- package/lib/tree/props.d.ts +22 -7
- package/lib/tree/tree.css +28 -70
- package/lib/tree/tree.d.ts +7 -0
- package/lib/tree/tree.less +35 -85
- package/lib/tree/tree.variable.css +28 -70
- package/package.json +1 -2
package/lib/code-diff/index.js
CHANGED
|
@@ -3282,7 +3282,46 @@ function hasOnlyWinLineEndings(string) {
|
|
|
3282
3282
|
function hasOnlyUnixLineEndings(string) {
|
|
3283
3283
|
return !string.includes('\r\n') && string.includes('\n');
|
|
3284
3284
|
}
|
|
3285
|
-
|
|
3285
|
+
/**
|
|
3286
|
+
* Split a string into segments using a word segmenter, merging consecutive
|
|
3287
|
+
* segments if they are both whitespace segments. Whitespace segments can
|
|
3288
|
+
* appear adjacent to one another for two reasons:
|
|
3289
|
+
* - newlines always get their own segment
|
|
3290
|
+
* - where a diacritic is attached to a whitespace character in the text, the
|
|
3291
|
+
* segment ends after the diacritic, so e.g. " \u0300 " becomes two segments.
|
|
3292
|
+
* This function therefore runs the segmenter's .segment() method and then
|
|
3293
|
+
* merges consecutive segments of whitespace into a single part.
|
|
3294
|
+
*/
|
|
3295
|
+
function segment(string, segmenter) {
|
|
3296
|
+
const parts = [];
|
|
3297
|
+
for (const segmentObj of Array.from(segmenter.segment(string))) {
|
|
3298
|
+
const segment = segmentObj.segment;
|
|
3299
|
+
if (parts.length && (/\s/).test(parts[parts.length - 1]) && (/\s/).test(segment)) {
|
|
3300
|
+
parts[parts.length - 1] += segment;
|
|
3301
|
+
}
|
|
3302
|
+
else {
|
|
3303
|
+
parts.push(segment);
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
return parts;
|
|
3307
|
+
}
|
|
3308
|
+
// The functions below take a `segmenter` argument so that, when called from
|
|
3309
|
+
// diffWords when it is using a segmenter, they can use a notion of what
|
|
3310
|
+
// constitutes "whitespace" that is consistent with the segmenter.
|
|
3311
|
+
//
|
|
3312
|
+
// USUALLY this will be identical to the result of the non-segmenter-based
|
|
3313
|
+
// logic, but it differs in at least one case: when whitespace characters are
|
|
3314
|
+
// modified by diacritics. A word segmenter considers these diacritics to be
|
|
3315
|
+
// part of the whitespace, whereas our non-segmenter-based logic does not.
|
|
3316
|
+
//
|
|
3317
|
+
// Because the segmenter-based approach necessarily requires segmenting the
|
|
3318
|
+
// entire string, we offer a leadingAndTrailingWs function to allow getting the
|
|
3319
|
+
// whitespace prefix AND whitespace suffix with a single call to the segmenter,
|
|
3320
|
+
// for efficiency's sake.
|
|
3321
|
+
function trailingWs(string, segmenter) {
|
|
3322
|
+
if (segmenter) {
|
|
3323
|
+
return leadingAndTrailingWs(string, segmenter)[1];
|
|
3324
|
+
}
|
|
3286
3325
|
// Yes, this looks overcomplicated and dumb - why not replace the whole function with
|
|
3287
3326
|
// return string.match(/\s*$/)[0]
|
|
3288
3327
|
// you ask? Because:
|
|
@@ -3302,11 +3341,28 @@ function trailingWs(string) {
|
|
|
3302
3341
|
}
|
|
3303
3342
|
return string.substring(i + 1);
|
|
3304
3343
|
}
|
|
3305
|
-
function leadingWs(string) {
|
|
3344
|
+
function leadingWs(string, segmenter) {
|
|
3345
|
+
if (segmenter) {
|
|
3346
|
+
return leadingAndTrailingWs(string, segmenter)[0];
|
|
3347
|
+
}
|
|
3306
3348
|
// Thankfully the annoying considerations described in trailingWs don't apply here:
|
|
3307
3349
|
const match = string.match(/^\s*/);
|
|
3308
3350
|
return match ? match[0] : '';
|
|
3309
3351
|
}
|
|
3352
|
+
function leadingAndTrailingWs(string, segmenter) {
|
|
3353
|
+
if (!segmenter) {
|
|
3354
|
+
return [leadingWs(string), trailingWs(string)];
|
|
3355
|
+
}
|
|
3356
|
+
if (segmenter.resolvedOptions().granularity != 'word') {
|
|
3357
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
3358
|
+
}
|
|
3359
|
+
const segments = segment(string, segmenter);
|
|
3360
|
+
const firstSeg = segments[0];
|
|
3361
|
+
const lastSeg = segments[segments.length - 1];
|
|
3362
|
+
const head = (/\s/).test(firstSeg) ? firstSeg : '';
|
|
3363
|
+
const tail = (/\s/).test(lastSeg) ? lastSeg : '';
|
|
3364
|
+
return [head, tail];
|
|
3365
|
+
}
|
|
3310
3366
|
|
|
3311
3367
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/node_modules/diff/libesm/diff/word.js
|
|
3312
3368
|
|
|
@@ -3375,22 +3431,9 @@ class WordDiff extends base_Diff {
|
|
|
3375
3431
|
// We want `parts` to be an array whose elements alternate between being
|
|
3376
3432
|
// pure whitespace and being pure non-whitespace. This is ALMOST what the
|
|
3377
3433
|
// segments returned by a word-based Intl.Segmenter already look like,
|
|
3378
|
-
//
|
|
3379
|
-
//
|
|
3380
|
-
|
|
3381
|
-
// newline character gets its own segment, instead of sharing a segment
|
|
3382
|
-
// with other surrounding whitespace. We therefore need to manually merge
|
|
3383
|
-
// consecutive segments of whitespace into a single part:
|
|
3384
|
-
parts = [];
|
|
3385
|
-
for (const segmentObj of Array.from(segmenter.segment(value))) {
|
|
3386
|
-
const segment = segmentObj.segment;
|
|
3387
|
-
if (parts.length && (/\s/).test(parts[parts.length - 1]) && (/\s/).test(segment)) {
|
|
3388
|
-
parts[parts.length - 1] += segment;
|
|
3389
|
-
}
|
|
3390
|
-
else {
|
|
3391
|
-
parts.push(segment);
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3434
|
+
// but not quite - see explanation in the docs of our custom segment()
|
|
3435
|
+
// function.
|
|
3436
|
+
parts = segment(value, segmenter);
|
|
3394
3437
|
}
|
|
3395
3438
|
else {
|
|
3396
3439
|
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
@@ -3454,7 +3497,7 @@ class WordDiff extends base_Diff {
|
|
|
3454
3497
|
}
|
|
3455
3498
|
else {
|
|
3456
3499
|
if (insertion || deletion) { // May be false at start of text
|
|
3457
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
3500
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options.intlSegmenter);
|
|
3458
3501
|
}
|
|
3459
3502
|
lastKeep = change;
|
|
3460
3503
|
insertion = null;
|
|
@@ -3462,7 +3505,7 @@ class WordDiff extends base_Diff {
|
|
|
3462
3505
|
}
|
|
3463
3506
|
});
|
|
3464
3507
|
if (insertion || deletion) {
|
|
3465
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
3508
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options.intlSegmenter);
|
|
3466
3509
|
}
|
|
3467
3510
|
return changes;
|
|
3468
3511
|
}
|
|
@@ -3478,7 +3521,7 @@ function word_diffWords(oldStr, newStr, options) {
|
|
|
3478
3521
|
}
|
|
3479
3522
|
return word_wordDiff.diff(oldStr, newStr, options);
|
|
3480
3523
|
}
|
|
3481
|
-
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
3524
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter) {
|
|
3482
3525
|
// Before returning, we tidy up the leading and trailing whitespace of the
|
|
3483
3526
|
// change objects to eliminate cases where trailing whitespace in one object
|
|
3484
3527
|
// is repeated as leading whitespace in the next.
|
|
@@ -3521,10 +3564,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
|
|
|
3521
3564
|
// * Just a "delete"
|
|
3522
3565
|
// We handle the three cases separately.
|
|
3523
3566
|
if (deletion && insertion) {
|
|
3524
|
-
const oldWsPrefix =
|
|
3525
|
-
const
|
|
3526
|
-
const newWsPrefix = leadingWs(insertion.value);
|
|
3527
|
-
const newWsSuffix = trailingWs(insertion.value);
|
|
3567
|
+
const [oldWsPrefix, oldWsSuffix] = leadingAndTrailingWs(deletion.value, segmenter);
|
|
3568
|
+
const [newWsPrefix, newWsSuffix] = leadingAndTrailingWs(insertion.value, segmenter);
|
|
3528
3569
|
if (startKeep) {
|
|
3529
3570
|
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
3530
3571
|
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
@@ -3546,17 +3587,17 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
|
|
|
3546
3587
|
// whitespace and deleting duplicate leading whitespace where
|
|
3547
3588
|
// present.
|
|
3548
3589
|
if (startKeep) {
|
|
3549
|
-
const ws = leadingWs(insertion.value);
|
|
3590
|
+
const ws = leadingWs(insertion.value, segmenter);
|
|
3550
3591
|
insertion.value = insertion.value.substring(ws.length);
|
|
3551
3592
|
}
|
|
3552
3593
|
if (endKeep) {
|
|
3553
|
-
const ws = leadingWs(endKeep.value);
|
|
3594
|
+
const ws = leadingWs(endKeep.value, segmenter);
|
|
3554
3595
|
endKeep.value = endKeep.value.substring(ws.length);
|
|
3555
3596
|
}
|
|
3556
3597
|
// otherwise we've got a deletion and no insertion
|
|
3557
3598
|
}
|
|
3558
3599
|
else if (startKeep && endKeep) {
|
|
3559
|
-
const newWsFull = leadingWs(endKeep.value), delWsStart
|
|
3600
|
+
const newWsFull = leadingWs(endKeep.value, segmenter), [delWsStart, delWsEnd] = leadingAndTrailingWs(deletion.value, segmenter);
|
|
3560
3601
|
// Any whitespace that comes straight after startKeep in both the old and
|
|
3561
3602
|
// new texts, assign to startKeep and remove from the deletion.
|
|
3562
3603
|
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
@@ -3575,8 +3616,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
|
|
|
3575
3616
|
// We are at the start of the text. Preserve all the whitespace on
|
|
3576
3617
|
// endKeep, and just remove whitespace from the end of deletion to the
|
|
3577
3618
|
// extent that it overlaps with the start of endKeep.
|
|
3578
|
-
const endKeepWsPrefix = leadingWs(endKeep.value);
|
|
3579
|
-
const deletionWsSuffix = trailingWs(deletion.value);
|
|
3619
|
+
const endKeepWsPrefix = leadingWs(endKeep.value, segmenter);
|
|
3620
|
+
const deletionWsSuffix = trailingWs(deletion.value, segmenter);
|
|
3580
3621
|
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
3581
3622
|
deletion.value = removeSuffix(deletion.value, overlap);
|
|
3582
3623
|
}
|
|
@@ -3584,8 +3625,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
|
|
|
3584
3625
|
// We are at the END of the text. Preserve all the whitespace on
|
|
3585
3626
|
// startKeep, and just remove whitespace from the start of deletion to
|
|
3586
3627
|
// the extent that it overlaps with the end of startKeep.
|
|
3587
|
-
const startKeepWsSuffix = trailingWs(startKeep.value);
|
|
3588
|
-
const deletionWsPrefix = leadingWs(deletion.value);
|
|
3628
|
+
const startKeepWsSuffix = trailingWs(startKeep.value, segmenter);
|
|
3629
|
+
const deletionWsPrefix = leadingWs(deletion.value, segmenter);
|
|
3589
3630
|
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
3590
3631
|
deletion.value = removePrefix(deletion.value, overlap);
|
|
3591
3632
|
}
|
package/lib/index.js
CHANGED
package/lib/popover/index.js
CHANGED
|
@@ -410,10 +410,6 @@ const oppositeSideMap = {
|
|
|
410
410
|
bottom: 'top',
|
|
411
411
|
top: 'bottom'
|
|
412
412
|
};
|
|
413
|
-
const oppositeAlignmentMap = {
|
|
414
|
-
start: 'end',
|
|
415
|
-
end: 'start'
|
|
416
|
-
};
|
|
417
413
|
function clamp(start, value, end) {
|
|
418
414
|
return floating_ui_utils_max(start, floating_ui_utils_min(value, end));
|
|
419
415
|
}
|
|
@@ -432,9 +428,9 @@ function floating_ui_utils_getOppositeAxis(axis) {
|
|
|
432
428
|
function getAxisLength(axis) {
|
|
433
429
|
return axis === 'y' ? 'height' : 'width';
|
|
434
430
|
}
|
|
435
|
-
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
436
431
|
function floating_ui_utils_getSideAxis(placement) {
|
|
437
|
-
|
|
432
|
+
const firstChar = placement[0];
|
|
433
|
+
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
438
434
|
}
|
|
439
435
|
function getAlignmentAxis(placement) {
|
|
440
436
|
return floating_ui_utils_getOppositeAxis(floating_ui_utils_getSideAxis(placement));
|
|
@@ -457,7 +453,7 @@ function getExpandedPlacements(placement) {
|
|
|
457
453
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
458
454
|
}
|
|
459
455
|
function getOppositeAlignmentPlacement(placement) {
|
|
460
|
-
return placement.replace(
|
|
456
|
+
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
461
457
|
}
|
|
462
458
|
const lrPlacement = ['left', 'right'];
|
|
463
459
|
const rlPlacement = ['right', 'left'];
|
|
@@ -488,7 +484,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
|
488
484
|
return list;
|
|
489
485
|
}
|
|
490
486
|
function getOppositePlacement(placement) {
|
|
491
|
-
|
|
487
|
+
const side = floating_ui_utils_getSide(placement);
|
|
488
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
492
489
|
}
|
|
493
490
|
function expandPaddingObject(padding) {
|
|
494
491
|
return {
|
|
@@ -653,6 +650,9 @@ async function detectOverflow(state, options) {
|
|
|
653
650
|
};
|
|
654
651
|
}
|
|
655
652
|
|
|
653
|
+
// Maximum number of resets that can occur before bailing to avoid infinite reset loops.
|
|
654
|
+
const MAX_RESET_COUNT = 50;
|
|
655
|
+
|
|
656
656
|
/**
|
|
657
657
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
658
658
|
* next to a given reference element.
|
|
@@ -667,7 +667,10 @@ const computePosition = async (reference, floating, config) => {
|
|
|
667
667
|
middleware = [],
|
|
668
668
|
platform
|
|
669
669
|
} = config;
|
|
670
|
-
const
|
|
670
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
671
|
+
...platform,
|
|
672
|
+
detectOverflow
|
|
673
|
+
};
|
|
671
674
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
672
675
|
let rects = await platform.getElementRects({
|
|
673
676
|
reference,
|
|
@@ -679,14 +682,17 @@ const computePosition = async (reference, floating, config) => {
|
|
|
679
682
|
y
|
|
680
683
|
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
681
684
|
let statefulPlacement = placement;
|
|
682
|
-
let middlewareData = {};
|
|
683
685
|
let resetCount = 0;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
+
const middlewareData = {};
|
|
687
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
688
|
+
const currentMiddleware = middleware[i];
|
|
689
|
+
if (!currentMiddleware) {
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
686
692
|
const {
|
|
687
693
|
name,
|
|
688
694
|
fn
|
|
689
|
-
} =
|
|
695
|
+
} = currentMiddleware;
|
|
690
696
|
const {
|
|
691
697
|
x: nextX,
|
|
692
698
|
y: nextY,
|
|
@@ -700,10 +706,7 @@ const computePosition = async (reference, floating, config) => {
|
|
|
700
706
|
strategy,
|
|
701
707
|
middlewareData,
|
|
702
708
|
rects,
|
|
703
|
-
platform:
|
|
704
|
-
...platform,
|
|
705
|
-
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
706
|
-
},
|
|
709
|
+
platform: platformWithDetectOverflow,
|
|
707
710
|
elements: {
|
|
708
711
|
reference,
|
|
709
712
|
floating
|
|
@@ -711,14 +714,11 @@ const computePosition = async (reference, floating, config) => {
|
|
|
711
714
|
});
|
|
712
715
|
x = nextX != null ? nextX : x;
|
|
713
716
|
y = nextY != null ? nextY : y;
|
|
714
|
-
middlewareData = {
|
|
715
|
-
...middlewareData,
|
|
716
|
-
|
|
717
|
-
...middlewareData[name],
|
|
718
|
-
...data
|
|
719
|
-
}
|
|
717
|
+
middlewareData[name] = {
|
|
718
|
+
...middlewareData[name],
|
|
719
|
+
...data
|
|
720
720
|
};
|
|
721
|
-
if (reset && resetCount
|
|
721
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
722
722
|
resetCount++;
|
|
723
723
|
if (typeof reset === 'object') {
|
|
724
724
|
if (reset.placement) {
|
|
@@ -1630,7 +1630,6 @@ function isShadowRoot(value) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1632
1632
|
}
|
|
1633
|
-
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
1634
1633
|
function isOverflowElement(element) {
|
|
1635
1634
|
const {
|
|
1636
1635
|
overflow,
|
|
@@ -1638,32 +1637,35 @@ function isOverflowElement(element) {
|
|
|
1638
1637
|
overflowY,
|
|
1639
1638
|
display
|
|
1640
1639
|
} = floating_ui_utils_dom_getComputedStyle(element);
|
|
1641
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) &&
|
|
1640
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
1642
1641
|
}
|
|
1643
|
-
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
1644
1642
|
function isTableElement(element) {
|
|
1645
|
-
return
|
|
1643
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
1646
1644
|
}
|
|
1647
|
-
const topLayerSelectors = [':popover-open', ':modal'];
|
|
1648
1645
|
function isTopLayer(element) {
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
return
|
|
1652
|
-
} catch (_e) {
|
|
1653
|
-
return false;
|
|
1646
|
+
try {
|
|
1647
|
+
if (element.matches(':popover-open')) {
|
|
1648
|
+
return true;
|
|
1654
1649
|
}
|
|
1655
|
-
})
|
|
1650
|
+
} catch (_e) {
|
|
1651
|
+
// no-op
|
|
1652
|
+
}
|
|
1653
|
+
try {
|
|
1654
|
+
return element.matches(':modal');
|
|
1655
|
+
} catch (_e) {
|
|
1656
|
+
return false;
|
|
1657
|
+
}
|
|
1656
1658
|
}
|
|
1657
|
-
const
|
|
1658
|
-
const
|
|
1659
|
-
const
|
|
1659
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
1660
|
+
const containRe = /paint|layout|strict|content/;
|
|
1661
|
+
const isNotNone = value => !!value && value !== 'none';
|
|
1662
|
+
let isWebKitValue;
|
|
1660
1663
|
function isContainingBlock(elementOrCss) {
|
|
1661
|
-
const webkit = isWebKit();
|
|
1662
1664
|
const css = isElement(elementOrCss) ? floating_ui_utils_dom_getComputedStyle(elementOrCss) : elementOrCss;
|
|
1663
1665
|
|
|
1664
1666
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1665
1667
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
1666
|
-
return
|
|
1668
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
|
1667
1669
|
}
|
|
1668
1670
|
function getContainingBlock(element) {
|
|
1669
1671
|
let currentNode = getParentNode(element);
|
|
@@ -1678,12 +1680,13 @@ function getContainingBlock(element) {
|
|
|
1678
1680
|
return null;
|
|
1679
1681
|
}
|
|
1680
1682
|
function isWebKit() {
|
|
1681
|
-
if (
|
|
1682
|
-
|
|
1683
|
+
if (isWebKitValue == null) {
|
|
1684
|
+
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
1685
|
+
}
|
|
1686
|
+
return isWebKitValue;
|
|
1683
1687
|
}
|
|
1684
|
-
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
1685
1688
|
function isLastTraversableNode(node) {
|
|
1686
|
-
return
|
|
1689
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
1687
1690
|
}
|
|
1688
1691
|
function floating_ui_utils_dom_getComputedStyle(element) {
|
|
1689
1692
|
return getWindow(element).getComputedStyle(element);
|
|
@@ -1739,8 +1742,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1739
1742
|
if (isBody) {
|
|
1740
1743
|
const frameElement = getFrameElement(win);
|
|
1741
1744
|
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1745
|
+
} else {
|
|
1746
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1742
1747
|
}
|
|
1743
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1744
1748
|
}
|
|
1745
1749
|
function getFrameElement(win) {
|
|
1746
1750
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
@@ -1925,7 +1929,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1925
1929
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1926
1930
|
scroll = getNodeScroll(offsetParent);
|
|
1927
1931
|
}
|
|
1928
|
-
if (
|
|
1932
|
+
if (isOffsetParentAnElement) {
|
|
1929
1933
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1930
1934
|
scale = getScale(offsetParent);
|
|
1931
1935
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
@@ -2013,7 +2017,6 @@ function getViewportRect(element, strategy) {
|
|
|
2013
2017
|
};
|
|
2014
2018
|
}
|
|
2015
2019
|
|
|
2016
|
-
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
2017
2020
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2018
2021
|
function getInnerBoundingClientRect(element, strategy) {
|
|
2019
2022
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -2078,7 +2081,7 @@ function getClippingElementAncestors(element, cache) {
|
|
|
2078
2081
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2079
2082
|
currentContainingBlockComputedStyle = null;
|
|
2080
2083
|
}
|
|
2081
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
2084
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2082
2085
|
if (shouldDropCurrentNode) {
|
|
2083
2086
|
// Drop non-containing blocks.
|
|
2084
2087
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -2103,20 +2106,23 @@ function getClippingRect(_ref) {
|
|
|
2103
2106
|
} = _ref;
|
|
2104
2107
|
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2105
2108
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2109
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
2110
|
+
let top = firstRect.top;
|
|
2111
|
+
let right = firstRect.right;
|
|
2112
|
+
let bottom = firstRect.bottom;
|
|
2113
|
+
let left = firstRect.left;
|
|
2114
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
2115
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
2116
|
+
top = floating_ui_utils_max(rect.top, top);
|
|
2117
|
+
right = floating_ui_utils_min(rect.right, right);
|
|
2118
|
+
bottom = floating_ui_utils_min(rect.bottom, bottom);
|
|
2119
|
+
left = floating_ui_utils_max(rect.left, left);
|
|
2120
|
+
}
|
|
2115
2121
|
return {
|
|
2116
|
-
width:
|
|
2117
|
-
height:
|
|
2118
|
-
x:
|
|
2119
|
-
y:
|
|
2122
|
+
width: right - left,
|
|
2123
|
+
height: bottom - top,
|
|
2124
|
+
x: left,
|
|
2125
|
+
y: top
|
|
2120
2126
|
};
|
|
2121
2127
|
}
|
|
2122
2128
|
|
|
@@ -2367,7 +2373,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2367
2373
|
animationFrame = false
|
|
2368
2374
|
} = options;
|
|
2369
2375
|
const referenceEl = unwrapElement(reference);
|
|
2370
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
2376
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
|
2371
2377
|
ancestors.forEach(ancestor => {
|
|
2372
2378
|
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
2373
2379
|
passive: true
|
|
@@ -2380,7 +2386,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2380
2386
|
if (elementResize) {
|
|
2381
2387
|
resizeObserver = new ResizeObserver(_ref => {
|
|
2382
2388
|
let [firstEntry] = _ref;
|
|
2383
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
2389
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2384
2390
|
// Prevent update loops when using the `size` middleware.
|
|
2385
2391
|
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
2386
2392
|
resizeObserver.unobserve(floating);
|
|
@@ -2395,7 +2401,9 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2395
2401
|
if (referenceEl && !animationFrame) {
|
|
2396
2402
|
resizeObserver.observe(referenceEl);
|
|
2397
2403
|
}
|
|
2398
|
-
|
|
2404
|
+
if (floating) {
|
|
2405
|
+
resizeObserver.observe(floating);
|
|
2406
|
+
}
|
|
2399
2407
|
}
|
|
2400
2408
|
let frameId;
|
|
2401
2409
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
package/lib/tree/index.d.ts
CHANGED
|
@@ -80,6 +80,9 @@ declare const BkTree: {
|
|
|
80
80
|
dragSortMode: import("vue-types").VueTypeDef<string> & {
|
|
81
81
|
default: string;
|
|
82
82
|
};
|
|
83
|
+
dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
83
86
|
selectable: import("vue-types").VueTypeDef<any> & {
|
|
84
87
|
default: any;
|
|
85
88
|
};
|
|
@@ -191,6 +194,7 @@ declare const BkTree: {
|
|
|
191
194
|
dragThreshold: number;
|
|
192
195
|
dragSort: boolean;
|
|
193
196
|
dragSortMode: string;
|
|
197
|
+
dragTargetOpenState: string;
|
|
194
198
|
selectable: any;
|
|
195
199
|
disabledFolderSelectable: boolean;
|
|
196
200
|
showCheckbox: any;
|
|
@@ -291,6 +295,9 @@ declare const BkTree: {
|
|
|
291
295
|
dragSortMode: import("vue-types").VueTypeDef<string> & {
|
|
292
296
|
default: string;
|
|
293
297
|
};
|
|
298
|
+
dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
|
|
299
|
+
default: string;
|
|
300
|
+
};
|
|
294
301
|
selectable: import("vue-types").VueTypeDef<any> & {
|
|
295
302
|
default: any;
|
|
296
303
|
};
|
|
@@ -387,6 +394,7 @@ declare const BkTree: {
|
|
|
387
394
|
dragThreshold: number;
|
|
388
395
|
dragSort: boolean;
|
|
389
396
|
dragSortMode: string;
|
|
397
|
+
dragTargetOpenState: string;
|
|
390
398
|
selectable: any;
|
|
391
399
|
disabledFolderSelectable: boolean;
|
|
392
400
|
showCheckbox: any;
|
|
@@ -484,6 +492,9 @@ declare const BkTree: {
|
|
|
484
492
|
dragSortMode: import("vue-types").VueTypeDef<string> & {
|
|
485
493
|
default: string;
|
|
486
494
|
};
|
|
495
|
+
dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
|
|
496
|
+
default: string;
|
|
497
|
+
};
|
|
487
498
|
selectable: import("vue-types").VueTypeDef<any> & {
|
|
488
499
|
default: any;
|
|
489
500
|
};
|
|
@@ -595,6 +606,7 @@ declare const BkTree: {
|
|
|
595
606
|
dragThreshold: number;
|
|
596
607
|
dragSort: boolean;
|
|
597
608
|
dragSortMode: string;
|
|
609
|
+
dragTargetOpenState: string;
|
|
598
610
|
selectable: any;
|
|
599
611
|
disabledFolderSelectable: boolean;
|
|
600
612
|
showCheckbox: any;
|