@material/web 2.4.2-nightly.7baa861.0 → 2.4.2-nightly.a44effd.0

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.
@@ -37,17 +37,9 @@ export function adoptStyles(owner, styles) {
37
37
  if (!owner)
38
38
  return;
39
39
  styles = Array.isArray(styles) ? styles : [styles];
40
- const isCSSResult = (style) => 'styleSheet' in style;
41
40
  const stylesheets = styles.map((cssResultOrNative) => isCSSResult(cssResultOrNative)
42
41
  ? cssResultOrNative.styleSheet
43
42
  : cssResultOrNative);
44
- const adopt = (node, stylesheets) => {
45
- if (node && 'adoptedStyleSheets' in node) {
46
- node.adoptedStyleSheets = Array.from(new Set([...node.adoptedStyleSheets, ...stylesheets]));
47
- return true;
48
- }
49
- return false;
50
- };
51
43
  if (adopt(owner, stylesheets)) {
52
44
  // Styles adopted directly on the owner document or shadow root.
53
45
  return;
@@ -57,4 +49,14 @@ export function adoptStyles(owner, styles) {
57
49
  adopt(owner.ownerDocument, stylesheets);
58
50
  adopt(owner.getRootNode(), stylesheets);
59
51
  }
52
+ function adopt(node, stylesheets) {
53
+ if (node && 'adoptedStyleSheets' in node) {
54
+ node.adoptedStyleSheets = Array.from(new Set([...node.adoptedStyleSheets, ...stylesheets]));
55
+ return true;
56
+ }
57
+ return false;
58
+ }
59
+ function isCSSResult(style) {
60
+ return 'styleSheet' in style;
61
+ }
60
62
  //# sourceMappingURL=adopt-styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adopt-styles.js","sourceRoot":"","sources":["adopt-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,WAAW,CACzB,KAA0C,EAC1C,MAA+C;IAE/C,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,CAAC,KAAwB,EAAsB,EAAE,CACnE,YAAY,IAAI,KAAK,CAAC;IACxB,MAAM,WAAW,GAAoB,MAAM,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CACpE,WAAW,CAAC,iBAAiB,CAAC;QAC5B,CAAC,CAAC,iBAAiB,CAAC,UAAW;QAC/B,CAAC,CAAC,iBAAiB,CACtB,CAAC;IAEF,MAAM,KAAK,GAAG,CACZ,IAAwC,EACxC,WAA4B,EACE,EAAE;QAChC,IAAI,IAAI,IAAI,oBAAoB,IAAI,IAAI,EAAE,CAAC;YACzC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAClC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,GAAG,WAAW,CAAC,CAAC,CACtD,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC;QAC9B,gEAAgE;QAChE,OAAO;IACT,CAAC;IAED,4EAA4E;IAC5E,2BAA2B;IAC3B,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {type CSSResult, type CSSResultOrNative} from 'lit';\n\n/**\n * Owner types that can adopt stylesheets using `adoptStyles()`.\n */\nexport type AdoptStylesOwner = DocumentOrShadowRoot | Element;\n\n/**\n * Adopts the given stylesheets to the provided document or shadow root owner.\n *\n * @example\n * ```ts\n * import globalStylesheet from './stylesheet.css' with {type: 'css'};\n *\n * adoptStyles(document, globalStylesheet);\n * ```\n *\n * If an element is provided, the styles are adopted to the element's owner\n * document. If the element is within a shadow root, the styles are also adopted\n * to the host shadow root.\n *\n * @example\n * ```ts\n * import hostClasses from './stylesheet.css' with {type: 'css'};\n *\n * class LightDomElement extends HTMLElement {\n * connectedCallback() {\n * adoptStyles(this, hostClasses);\n * this.classList.add('host-class');\n * }\n * }\n * ```\n *\n * @param owner The owner document, shadow root, or element to adopt the\n * styles to.\n * @param styles The styles to adopt.\n */\nexport function adoptStyles(\n owner: AdoptStylesOwner | null | undefined,\n styles: CSSResultOrNative | CSSResultOrNative[],\n): void {\n if (!owner) return;\n\n styles = Array.isArray(styles) ? styles : [styles];\n const isCSSResult = (style: CSSResultOrNative): style is CSSResult =>\n 'styleSheet' in style;\n const stylesheets: CSSStyleSheet[] = styles.map((cssResultOrNative) =>\n isCSSResult(cssResultOrNative)\n ? cssResultOrNative.styleSheet!\n : cssResultOrNative,\n );\n\n const adopt = (\n node: DocumentOrShadowRoot | Node | null,\n stylesheets: CSSStyleSheet[],\n ): node is DocumentOrShadowRoot => {\n if (node && 'adoptedStyleSheets' in node) {\n node.adoptedStyleSheets = Array.from(\n new Set([...node.adoptedStyleSheets, ...stylesheets]),\n );\n return true;\n }\n return false;\n };\n\n if (adopt(owner, stylesheets)) {\n // Styles adopted directly on the owner document or shadow root.\n return;\n }\n\n // When provided an element, adopt styles to the element's document and host\n // shadow root, if present.\n adopt(owner.ownerDocument, stylesheets);\n adopt(owner.getRootNode(), stylesheets);\n}\n"]}
1
+ {"version":3,"file":"adopt-styles.js","sourceRoot":"","sources":["adopt-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,WAAW,CACzB,KAA0C,EAC1C,MAA+C;IAE/C,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,WAAW,GAAoB,MAAM,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CACpE,WAAW,CAAC,iBAAiB,CAAC;QAC5B,CAAC,CAAC,iBAAiB,CAAC,UAAW;QAC/B,CAAC,CAAC,iBAAiB,CACtB,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC;QAC9B,gEAAgE;QAChE,OAAO;IACT,CAAC;IAED,4EAA4E;IAC5E,2BAA2B;IAC3B,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,KAAK,CACZ,IAAwC,EACxC,WAA4B;IAE5B,IAAI,IAAI,IAAI,oBAAoB,IAAI,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAClC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,GAAG,WAAW,CAAC,CAAC,CACtD,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAwB;IAC3C,OAAO,YAAY,IAAI,KAAK,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {type CSSResult, type CSSResultOrNative} from 'lit';\n\n/**\n * Owner types that can adopt stylesheets using `adoptStyles()`.\n */\nexport type AdoptStylesOwner = DocumentOrShadowRoot | Element;\n\n/**\n * Adopts the given stylesheets to the provided document or shadow root owner.\n *\n * @example\n * ```ts\n * import globalStylesheet from './stylesheet.css' with {type: 'css'};\n *\n * adoptStyles(document, globalStylesheet);\n * ```\n *\n * If an element is provided, the styles are adopted to the element's owner\n * document. If the element is within a shadow root, the styles are also adopted\n * to the host shadow root.\n *\n * @example\n * ```ts\n * import hostClasses from './stylesheet.css' with {type: 'css'};\n *\n * class LightDomElement extends HTMLElement {\n * connectedCallback() {\n * adoptStyles(this, hostClasses);\n * this.classList.add('host-class');\n * }\n * }\n * ```\n *\n * @param owner The owner document, shadow root, or element to adopt the\n * styles to.\n * @param styles The styles to adopt.\n */\nexport function adoptStyles(\n owner: AdoptStylesOwner | null | undefined,\n styles: CSSResultOrNative | CSSResultOrNative[],\n): void {\n if (!owner) return;\n\n styles = Array.isArray(styles) ? styles : [styles];\n const stylesheets: CSSStyleSheet[] = styles.map((cssResultOrNative) =>\n isCSSResult(cssResultOrNative)\n ? cssResultOrNative.styleSheet!\n : cssResultOrNative,\n );\n\n if (adopt(owner, stylesheets)) {\n // Styles adopted directly on the owner document or shadow root.\n return;\n }\n\n // When provided an element, adopt styles to the element's document and host\n // shadow root, if present.\n adopt(owner.ownerDocument, stylesheets);\n adopt(owner.getRootNode(), stylesheets);\n}\n\nfunction adopt(\n node: DocumentOrShadowRoot | Node | null,\n stylesheets: CSSStyleSheet[],\n): node is DocumentOrShadowRoot {\n if (node && 'adoptedStyleSheets' in node) {\n node.adoptedStyleSheets = Array.from(\n new Set([...node.adoptedStyleSheets, ...stylesheets]),\n );\n return true;\n }\n return false;\n}\n\nfunction isCSSResult(style: CSSResultOrNative): style is CSSResult {\n return 'styleSheet' in style;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@material/web",
3
- "version": "2.4.2-nightly.7baa861.0",
3
+ "version": "2.4.2-nightly.a44effd.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },