@material/web 1.3.1-nightly.c35bad0.0 → 1.3.1-nightly.c3d303e.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@material/web",
3
- "version": "1.3.1-nightly.c35bad0.0",
3
+ "version": "1.3.1-nightly.c3d303e.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,7 +34,6 @@ export declare class Tab extends tabBaseClass {
34
34
  **/
35
35
  active: boolean;
36
36
  /**
37
- * TODO(b/293476210): remove after migrating
38
37
  * @deprecated use `active`
39
38
  */
40
39
  get selected(): boolean;
@@ -30,7 +30,6 @@ const tabBaseClass = mixinFocusable(LitElement);
30
30
  */
31
31
  export class Tab extends tabBaseClass {
32
32
  /**
33
- * TODO(b/293476210): remove after migrating
34
33
  * @deprecated use `active`
35
34
  */
36
35
  get selected() {
@@ -1 +1 @@
1
- {"version":3,"file":"tab.js","sourceRoot":"","sources":["tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAC,MAAM,EAAC,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAEjE;;;GAGG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA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D,SAAS,kBAAkB;IACzB,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n state,\n} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\n\nimport {EASING} from '../../internal/motion/animation.js';\nimport {mixinFocusable} from '../../labs/behaviors/focusable.js';\n\n/**\n * Symbol for tabs to use to animate their indicators based off another tab's\n * indicator.\n */\nconst INDICATOR = Symbol('indicator');\n\n/**\n * Symbol used by the tab bar to request a tab to animate its indicator from a\n * previously selected tab.\n */\nexport const ANIMATE_INDICATOR = Symbol('animateIndicator');\n\n// Separate variable needed for closure.\nconst tabBaseClass = mixinFocusable(LitElement);\n\n/**\n * Tab component.\n */\nexport class Tab extends tabBaseClass {\n /**\n * The attribute `md-tab` indicates that the element is a tab for the parent\n * element, `<md-tabs>`. Make sure if you're implementing your own `md-tab`\n * component that you have an `md-tab` attribute set.\n */\n @property({type: Boolean, reflect: true, attribute: 'md-tab'})\n readonly isTab = true;\n\n /**\n * Whether or not the tab is selected.\n **/\n @property({type: Boolean, reflect: true}) active = false;\n\n /**\n * TODO(b/293476210): remove after migrating\n * @deprecated use `active`\n */\n @property({type: Boolean})\n get selected() {\n return this.active;\n }\n set selected(active: boolean) {\n this.active = active;\n }\n\n /**\n * In SSR, set this to true when an icon is present.\n */\n @property({type: Boolean, attribute: 'has-icon'}) hasIcon = false;\n\n /**\n * In SSR, set this to true when there is no label and only an icon.\n */\n @property({type: Boolean, attribute: 'icon-only'}) iconOnly = false;\n\n @query('.indicator') readonly [INDICATOR]!: HTMLElement | null;\n @state() protected fullWidthIndicator = false;\n @queryAssignedNodes({flatten: true})\n private readonly assignedDefaultNodes!: Node[];\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'tab';\n this.addEventListener('keydown', this.handleKeydown.bind(this));\n }\n }\n\n protected override render() {\n const indicator = html`<div class=\"indicator\"></div>`;\n return html`<div\n class=\"button\"\n role=\"presentation\"\n @click=${this.handleContentClick}>\n <md-focus-ring part=\"focus-ring\" inward .control=${this}></md-focus-ring>\n <md-elevation></md-elevation>\n <md-ripple .control=${this}></md-ripple>\n <div\n class=\"content ${classMap(this.getContentClasses())}\"\n role=\"presentation\">\n <slot name=\"icon\" @slotchange=${this.handleIconSlotChange}></slot>\n <slot @slotchange=${this.handleSlotChange}></slot>\n ${this.fullWidthIndicator ? nothing : indicator}\n </div>\n ${this.fullWidthIndicator ? indicator : nothing}\n </div>`;\n }\n\n protected getContentClasses(): ClassInfo {\n return {\n 'has-icon': this.hasIcon,\n 'has-label': !this.iconOnly,\n };\n }\n\n protected override updated() {\n this.internals.ariaSelected = String(this.active);\n }\n\n private async handleKeydown(event: KeyboardEvent) {\n // Allow event to bubble.\n await 0;\n if (event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n // Prevent default behavior such as scrolling when pressing spacebar.\n event.preventDefault();\n this.click();\n }\n }\n\n private handleContentClick(event: Event) {\n // Ensure the \"click\" target is always the tab, and not content, by stopping\n // propagation of content clicks and re-clicking the host.\n event.stopPropagation();\n this.click();\n }\n\n [ANIMATE_INDICATOR](previousTab: Tab) {\n if (!this[INDICATOR]) {\n return;\n }\n\n this[INDICATOR].getAnimations().forEach((a) => {\n a.cancel();\n });\n const frames = this.getKeyframes(previousTab);\n if (frames !== null) {\n this[INDICATOR].animate(frames, {\n duration: 250,\n easing: EASING.EMPHASIZED,\n });\n }\n }\n\n private getKeyframes(previousTab: Tab) {\n const reduceMotion = shouldReduceMotion();\n if (!this.active) {\n return reduceMotion ? [{'opacity': 1}, {'transform': 'none'}] : null;\n }\n\n const from: Keyframe = {};\n const fromRect =\n previousTab[INDICATOR]?.getBoundingClientRect() ?? ({} as DOMRect);\n const fromPos = fromRect.left;\n const fromExtent = fromRect.width;\n const toRect = this[INDICATOR]!.getBoundingClientRect();\n const toPos = toRect.left;\n const toExtent = toRect.width;\n const scale = fromExtent / toExtent;\n if (\n !reduceMotion &&\n fromPos !== undefined &&\n toPos !== undefined &&\n !isNaN(scale)\n ) {\n from['transform'] = `translateX(${(fromPos - toPos).toFixed(\n 4,\n )}px) scaleX(${scale.toFixed(4)})`;\n } else {\n from['opacity'] = 0;\n }\n // note, including `transform: none` avoids quirky Safari behavior\n // that can hide the animation.\n return [from, {'transform': 'none'}];\n }\n\n private handleSlotChange() {\n this.iconOnly = false;\n // Check if there's any label text or elements. If not, then there is only\n // an icon.\n for (const node of this.assignedDefaultNodes) {\n const hasTextContent =\n node.nodeType === Node.TEXT_NODE &&\n !!(node as Text).wholeText.match(/\\S/);\n if (node.nodeType === Node.ELEMENT_NODE || hasTextContent) {\n return;\n }\n }\n\n this.iconOnly = true;\n }\n\n private handleIconSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n}\n\nfunction shouldReduceMotion() {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n"]}
1
+ {"version":3,"file":"tab.js","sourceRoot":"","sources":["tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,GACN,MAAM,mBAAmB,CAAC;A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,EAAC,CAAC;qCAAkB;AAEtC;IAA7B,KAAK,CAAC,YAAY,CAAC;6BAA2C;AAC5C;IAAlB,KAAK,EAAE;+CAAsC;AAE7B;IADhB,kBAAkB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;iDACW;AAE9B;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CACN;AAuIjD,SAAS,kBAAkB;IACzB,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n state,\n} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\n\nimport {EASING} from '../../internal/motion/animation.js';\nimport {mixinFocusable} from '../../labs/behaviors/focusable.js';\n\n/**\n * Symbol for tabs to use to animate their indicators based off another tab's\n * indicator.\n */\nconst INDICATOR = Symbol('indicator');\n\n/**\n * Symbol used by the tab bar to request a tab to animate its indicator from a\n * previously selected tab.\n */\nexport const ANIMATE_INDICATOR = Symbol('animateIndicator');\n\n// Separate variable needed for closure.\nconst tabBaseClass = mixinFocusable(LitElement);\n\n/**\n * Tab component.\n */\nexport class Tab extends tabBaseClass {\n /**\n * The attribute `md-tab` indicates that the element is a tab for the parent\n * element, `<md-tabs>`. Make sure if you're implementing your own `md-tab`\n * component that you have an `md-tab` attribute set.\n */\n @property({type: Boolean, reflect: true, attribute: 'md-tab'})\n readonly isTab = true;\n\n /**\n * Whether or not the tab is selected.\n **/\n @property({type: Boolean, reflect: true}) active = false;\n\n /**\n * @deprecated use `active`\n */\n @property({type: Boolean})\n get selected() {\n return this.active;\n }\n set selected(active: boolean) {\n this.active = active;\n }\n\n /**\n * In SSR, set this to true when an icon is present.\n */\n @property({type: Boolean, attribute: 'has-icon'}) hasIcon = false;\n\n /**\n * In SSR, set this to true when there is no label and only an icon.\n */\n @property({type: Boolean, attribute: 'icon-only'}) iconOnly = false;\n\n @query('.indicator') readonly [INDICATOR]!: HTMLElement | null;\n @state() protected fullWidthIndicator = false;\n @queryAssignedNodes({flatten: true})\n private readonly assignedDefaultNodes!: Node[];\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'tab';\n this.addEventListener('keydown', this.handleKeydown.bind(this));\n }\n }\n\n protected override render() {\n const indicator = html`<div class=\"indicator\"></div>`;\n return html`<div\n class=\"button\"\n role=\"presentation\"\n @click=${this.handleContentClick}>\n <md-focus-ring part=\"focus-ring\" inward .control=${this}></md-focus-ring>\n <md-elevation></md-elevation>\n <md-ripple .control=${this}></md-ripple>\n <div\n class=\"content ${classMap(this.getContentClasses())}\"\n role=\"presentation\">\n <slot name=\"icon\" @slotchange=${this.handleIconSlotChange}></slot>\n <slot @slotchange=${this.handleSlotChange}></slot>\n ${this.fullWidthIndicator ? nothing : indicator}\n </div>\n ${this.fullWidthIndicator ? indicator : nothing}\n </div>`;\n }\n\n protected getContentClasses(): ClassInfo {\n return {\n 'has-icon': this.hasIcon,\n 'has-label': !this.iconOnly,\n };\n }\n\n protected override updated() {\n this.internals.ariaSelected = String(this.active);\n }\n\n private async handleKeydown(event: KeyboardEvent) {\n // Allow event to bubble.\n await 0;\n if (event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n // Prevent default behavior such as scrolling when pressing spacebar.\n event.preventDefault();\n this.click();\n }\n }\n\n private handleContentClick(event: Event) {\n // Ensure the \"click\" target is always the tab, and not content, by stopping\n // propagation of content clicks and re-clicking the host.\n event.stopPropagation();\n this.click();\n }\n\n [ANIMATE_INDICATOR](previousTab: Tab) {\n if (!this[INDICATOR]) {\n return;\n }\n\n this[INDICATOR].getAnimations().forEach((a) => {\n a.cancel();\n });\n const frames = this.getKeyframes(previousTab);\n if (frames !== null) {\n this[INDICATOR].animate(frames, {\n duration: 250,\n easing: EASING.EMPHASIZED,\n });\n }\n }\n\n private getKeyframes(previousTab: Tab) {\n const reduceMotion = shouldReduceMotion();\n if (!this.active) {\n return reduceMotion ? [{'opacity': 1}, {'transform': 'none'}] : null;\n }\n\n const from: Keyframe = {};\n const fromRect =\n previousTab[INDICATOR]?.getBoundingClientRect() ?? ({} as DOMRect);\n const fromPos = fromRect.left;\n const fromExtent = fromRect.width;\n const toRect = this[INDICATOR]!.getBoundingClientRect();\n const toPos = toRect.left;\n const toExtent = toRect.width;\n const scale = fromExtent / toExtent;\n if (\n !reduceMotion &&\n fromPos !== undefined &&\n toPos !== undefined &&\n !isNaN(scale)\n ) {\n from['transform'] = `translateX(${(fromPos - toPos).toFixed(\n 4,\n )}px) scaleX(${scale.toFixed(4)})`;\n } else {\n from['opacity'] = 0;\n }\n // note, including `transform: none` avoids quirky Safari behavior\n // that can hide the animation.\n return [from, {'transform': 'none'}];\n }\n\n private handleSlotChange() {\n this.iconOnly = false;\n // Check if there's any label text or elements. If not, then there is only\n // an icon.\n for (const node of this.assignedDefaultNodes) {\n const hasTextContent =\n node.nodeType === Node.TEXT_NODE &&\n !!(node as Text).wholeText.match(/\\S/);\n if (node.nodeType === Node.ELEMENT_NODE || hasTextContent) {\n return;\n }\n }\n\n this.iconOnly = true;\n }\n\n private handleIconSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n}\n\nfunction shouldReduceMotion() {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n"]}
@@ -150,8 +150,6 @@ $_default: (
150
150
  // TODO(b/259455114): remove when focus tokens update to 3px
151
151
  'text-field-focus-active-indicator-height':
152
152
  if($exclude-hardcoded-values, null, 3px),
153
- // TODO(b/292242500): remove once we upgrade tokens
154
- 'text-field-leading-icon-size': if($exclude-hardcoded-values, null, 24px),
155
153
  // go/keep-sorted end
156
154
  );
157
155
  }
@@ -39,8 +39,6 @@ $unsupported-tokens: (
39
39
  // go/keep-sorted end
40
40
  );
41
41
 
42
- // TODO(b/275045611) may need to update based on resolution of design
43
- // for buffer and background animation.
44
42
  @function values(
45
43
  $deps: $_default,
46
44
  $exclude-hardcoded-values: false,