@ni/nimble-components 24.1.9 → 24.1.10
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/all-components-bundle.js +55 -37
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +4246 -4244
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/anchor-menu-item/index.js +1 -15
- package/dist/esm/anchor-menu-item/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1715,8 +1715,20 @@
|
|
|
1715
1715
|
return prev.concat(curr);
|
|
1716
1716
|
}, null);
|
|
1717
1717
|
}
|
|
1718
|
+
/**
|
|
1719
|
+
* A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.
|
|
1720
|
+
* @public
|
|
1721
|
+
*/
|
|
1722
|
+
const prependToAdoptedStyleSheetsSymbol = Symbol("prependToAdoptedStyleSheets");
|
|
1723
|
+
function separateSheetsToPrepend(sheets) {
|
|
1724
|
+
const prepend = [];
|
|
1725
|
+
const append = [];
|
|
1726
|
+
sheets.forEach(x => (x[prependToAdoptedStyleSheetsSymbol] ? prepend : append).push(x));
|
|
1727
|
+
return { prepend, append };
|
|
1728
|
+
}
|
|
1718
1729
|
let addAdoptedStyleSheets = (target, sheets) => {
|
|
1719
|
-
|
|
1730
|
+
const { prepend, append } = separateSheetsToPrepend(sheets);
|
|
1731
|
+
target.adoptedStyleSheets = [...prepend, ...target.adoptedStyleSheets, ...append];
|
|
1720
1732
|
};
|
|
1721
1733
|
let removeAdoptedStyleSheets = (target, sheets) => {
|
|
1722
1734
|
target.adoptedStyleSheets = target.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);
|
|
@@ -1731,7 +1743,9 @@
|
|
|
1731
1743
|
document.adoptedStyleSheets.push();
|
|
1732
1744
|
document.adoptedStyleSheets.splice();
|
|
1733
1745
|
addAdoptedStyleSheets = (target, sheets) => {
|
|
1734
|
-
|
|
1746
|
+
const { prepend, append } = separateSheetsToPrepend(sheets);
|
|
1747
|
+
target.adoptedStyleSheets.splice(0, 0, ...prepend);
|
|
1748
|
+
target.adoptedStyleSheets.push(...append);
|
|
1735
1749
|
};
|
|
1736
1750
|
removeAdoptedStyleSheets = (target, sheets) => {
|
|
1737
1751
|
for (const sheet of sheets) {
|
|
@@ -9040,6 +9054,7 @@
|
|
|
9040
9054
|
constructor(source) {
|
|
9041
9055
|
super();
|
|
9042
9056
|
const sheet = new CSSStyleSheet();
|
|
9057
|
+
sheet[prependToAdoptedStyleSheetsSymbol] = true;
|
|
9043
9058
|
this.target = sheet.cssRules[sheet.insertRule(":host{}")].style;
|
|
9044
9059
|
source.$fastController.addStyles(ElementStyles.create([sheet]));
|
|
9045
9060
|
}
|
|
@@ -9476,23 +9491,7 @@
|
|
|
9476
9491
|
if (token) {
|
|
9477
9492
|
// Notify any token subscribers
|
|
9478
9493
|
token.notify(this.target);
|
|
9479
|
-
|
|
9480
|
-
const parent = this.parent;
|
|
9481
|
-
const reflecting = this.isReflecting(token);
|
|
9482
|
-
if (parent) {
|
|
9483
|
-
const parentValue = parent.get(token);
|
|
9484
|
-
const sourceValue = source.get(token);
|
|
9485
|
-
if (parentValue !== sourceValue && !reflecting) {
|
|
9486
|
-
this.reflectToCSS(token);
|
|
9487
|
-
}
|
|
9488
|
-
else if (parentValue === sourceValue && reflecting) {
|
|
9489
|
-
this.stopReflectToCSS(token);
|
|
9490
|
-
}
|
|
9491
|
-
}
|
|
9492
|
-
else if (!reflecting) {
|
|
9493
|
-
this.reflectToCSS(token);
|
|
9494
|
-
}
|
|
9495
|
-
}
|
|
9494
|
+
this.updateCSSTokenReflection(source, token);
|
|
9496
9495
|
}
|
|
9497
9496
|
},
|
|
9498
9497
|
};
|
|
@@ -9566,6 +9565,25 @@
|
|
|
9566
9565
|
get parent() {
|
|
9567
9566
|
return childToParent.get(this) || null;
|
|
9568
9567
|
}
|
|
9568
|
+
updateCSSTokenReflection(source, token) {
|
|
9569
|
+
if (DesignTokenImpl.isCSSDesignToken(token)) {
|
|
9570
|
+
const parent = this.parent;
|
|
9571
|
+
const reflecting = this.isReflecting(token);
|
|
9572
|
+
if (parent) {
|
|
9573
|
+
const parentValue = parent.get(token);
|
|
9574
|
+
const sourceValue = source.get(token);
|
|
9575
|
+
if (parentValue !== sourceValue && !reflecting) {
|
|
9576
|
+
this.reflectToCSS(token);
|
|
9577
|
+
}
|
|
9578
|
+
else if (parentValue === sourceValue && reflecting) {
|
|
9579
|
+
this.stopReflectToCSS(token);
|
|
9580
|
+
}
|
|
9581
|
+
}
|
|
9582
|
+
else if (!reflecting) {
|
|
9583
|
+
this.reflectToCSS(token);
|
|
9584
|
+
}
|
|
9585
|
+
}
|
|
9586
|
+
}
|
|
9569
9587
|
/**
|
|
9570
9588
|
* Checks if a token has been assigned an explicit value the node.
|
|
9571
9589
|
* @param token - the token to check.
|
|
@@ -9731,6 +9749,7 @@
|
|
|
9731
9749
|
return;
|
|
9732
9750
|
}
|
|
9733
9751
|
this.hydrate(token, this.getRaw(token));
|
|
9752
|
+
this.updateCSSTokenReflection(this.store, token);
|
|
9734
9753
|
}
|
|
9735
9754
|
/**
|
|
9736
9755
|
* Hydrates a token with a DesignTokenValue, making retrieval available.
|
|
@@ -11220,7 +11239,7 @@
|
|
|
11220
11239
|
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
11221
11240
|
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
11222
11241
|
item.addEventListener("focus", this.handleItemFocus);
|
|
11223
|
-
if (item instanceof MenuItem$1) {
|
|
11242
|
+
if (item instanceof MenuItem$1 || "startColumnCount" in item) {
|
|
11224
11243
|
item.startColumnCount = indent;
|
|
11225
11244
|
}
|
|
11226
11245
|
});
|
|
@@ -13869,6 +13888,15 @@
|
|
|
13869
13888
|
</template>
|
|
13870
13889
|
`;
|
|
13871
13890
|
|
|
13891
|
+
// returns the active element in the shadow context of the element in question.
|
|
13892
|
+
function getRootActiveElement(element) {
|
|
13893
|
+
const rootNode = element.getRootNode();
|
|
13894
|
+
if (rootNode instanceof ShadowRoot) {
|
|
13895
|
+
return rootNode.activeElement;
|
|
13896
|
+
}
|
|
13897
|
+
return document.activeElement;
|
|
13898
|
+
}
|
|
13899
|
+
|
|
13872
13900
|
/**
|
|
13873
13901
|
* A map for directionality derived from keyboard input strings,
|
|
13874
13902
|
* visual orientation, and text direction.
|
|
@@ -14053,10 +14081,14 @@
|
|
|
14053
14081
|
* @internal
|
|
14054
14082
|
*/
|
|
14055
14083
|
setFocusedElement(activeIndex = this.activeIndex) {
|
|
14056
|
-
var _a;
|
|
14057
14084
|
this.activeIndex = activeIndex;
|
|
14058
14085
|
this.setFocusableElements();
|
|
14059
|
-
(
|
|
14086
|
+
if (this.focusableElements[this.activeIndex] &&
|
|
14087
|
+
// Don't focus the toolbar element if some event handlers moved
|
|
14088
|
+
// the focus on another element in the page.
|
|
14089
|
+
this.contains(getRootActiveElement(this))) {
|
|
14090
|
+
this.focusableElements[this.activeIndex].focus();
|
|
14091
|
+
}
|
|
14060
14092
|
}
|
|
14061
14093
|
/**
|
|
14062
14094
|
* Reduce a collection to only its focusable elements.
|
|
@@ -16301,7 +16333,7 @@
|
|
|
16301
16333
|
|
|
16302
16334
|
/**
|
|
16303
16335
|
* Do not edit directly
|
|
16304
|
-
* Generated on
|
|
16336
|
+
* Generated on Wed, 10 Apr 2024 00:13:11 GMT
|
|
16305
16337
|
*/
|
|
16306
16338
|
|
|
16307
16339
|
const Information100DarkUi = "#a46eff";
|
|
@@ -17941,20 +17973,6 @@
|
|
|
17941
17973
|
DesignSystem.getOrCreate()
|
|
17942
17974
|
.withPrefix('nimble')
|
|
17943
17975
|
.register(nimbleAnchorMenuItem());
|
|
17944
|
-
// This is a workaround for the fact that FAST's menu uses `instanceof MenuItem`
|
|
17945
|
-
// in their logic for indenting menu items. Since our AnchorMenuItem derives from
|
|
17946
|
-
// AnchorBase and not FAST's MenuItem, we need to change their MenuItem's definition
|
|
17947
|
-
// of `hasInstance` so that it includes our AnchorMenuItem, too.
|
|
17948
|
-
//
|
|
17949
|
-
// If/when we change FAST to test for the presence of `startColumnCount` instead
|
|
17950
|
-
// of using `instanceof MenuItem`, we can remove this workaround. Here is the
|
|
17951
|
-
// PR into FAST: https://github.com/microsoft/fast/pull/6667
|
|
17952
|
-
const originalInstanceOf = MenuItem$1[Symbol.hasInstance].bind(MenuItem$1);
|
|
17953
|
-
Object.defineProperty(MenuItem$1, Symbol.hasInstance, {
|
|
17954
|
-
value(instance) {
|
|
17955
|
-
return (originalInstanceOf(instance) || instance instanceof AnchorMenuItem);
|
|
17956
|
-
}
|
|
17957
|
-
});
|
|
17958
17976
|
|
|
17959
17977
|
const styles$S = css `
|
|
17960
17978
|
${display('inline-flex')}
|