@material/base

  • Version 11.0.0
  • Published
  • 127 kB
  • 1 dependency
  • MIT license

Install

npm i @material/base
yarn add @material/base
pnpm add @material/base

Overview

The set of base classes for Material Components for the web

Index

Namespaces

namespace @material/base

module '@material/base' {}

    class MDCComponent

    class MDCComponent<FoundationType extends MDCFoundation> {}

      constructor

      constructor(root: Element, foundation?: MDCFoundation<{}>, ...args: unknown[]);

        property foundation

        protected foundation: MDCFoundation<{}>;

          property root

          root: Element;

            method attachTo

            static attachTo: (root: Element) => MDCComponent<MDCFoundation<{}>>;

              method destroy

              destroy: () => void;

                method emit

                emit: <T extends object>(
                evtType: string,
                evtData: T,
                shouldBubble?: boolean
                ) => void;
                • Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.

                method getDefaultFoundation

                getDefaultFoundation: () => FoundationType;

                  method initialize

                  initialize: (..._args: Array<unknown>) => void;

                    method initialSyncWithDOM

                    initialSyncWithDOM: () => void;

                      method listen

                      listen: {
                      <K extends keyof GlobalEventHandlersEventMap>(
                      evtType: K,
                      handler: SpecificEventListener<K>,
                      options?: AddEventListenerOptions | boolean
                      ): void;
                      <E extends Event>(
                      evtType: string,
                      handler: CustomEventListener<E>,
                      options?: boolean | AddEventListenerOptions
                      ): void;
                      };
                      • Wrapper method to add an event listener to the component's root element. This is most useful when listening for custom events.

                      method unlisten

                      unlisten: {
                      <K extends keyof GlobalEventHandlersEventMap>(
                      evtType: K,
                      handler: SpecificEventListener<K>,
                      options?: AddEventListenerOptions | boolean
                      ): void;
                      <E extends Event>(
                      evtType: string,
                      handler: CustomEventListener<E>,
                      options?: boolean | AddEventListenerOptions
                      ): void;
                      };
                      • Wrapper method to remove an event listener to the component's root element. This is most useful when unlistening for custom events.

                      class MDCFoundation

                      class MDCFoundation<AdapterType extends {} = {}> {}
                      • Copyright 2016 Google Inc.

                        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                      constructor

                      constructor(adapter?: {});

                        property adapter

                        protected adapter: {};

                          property cssClasses

                          static readonly cssClasses: { [key: string]: string };

                            property defaultAdapter

                            static readonly defaultAdapter: {};

                              property numbers

                              static readonly numbers: { [key: string]: number };

                                property strings

                                static readonly strings: { [key: string]: string };

                                  method destroy

                                  destroy: () => void;

                                    method init

                                    init: () => void;

                                      interface MDCFoundationConstructor

                                      interface MDCFoundationConstructor<AdapterType extends object = any> {}
                                      • The constructor for MDCFoundation.

                                      property prototype

                                      readonly prototype: MDCFoundation<AdapterType>;

                                        construct signature

                                        new (adapter: AdapterType): MDCFoundation<AdapterType>;

                                          interface MDCFoundationDeprecatedConstructor

                                          interface MDCFoundationDeprecatedConstructor<AdapterType extends object = any> {}
                                          • The deprecated constructor for MDCFoundation.

                                          property cssClasses

                                          readonly cssClasses: Record<string, string>;

                                            property defaultAdapter

                                            readonly defaultAdapter: AdapterType;

                                              property numbers

                                              readonly numbers: Record<string, number>;

                                                property prototype

                                                readonly prototype: MDCFoundation<AdapterType>;

                                                  property strings

                                                  readonly strings: Record<string, string>;

                                                    construct signature

                                                    new (adapter?: Partial<AdapterType>): MDCFoundation<AdapterType>;

                                                      type Constructor

                                                      type Constructor<T = any> = {
                                                      new (...args: any[]): T;
                                                      };
                                                      • A generic type for the constructor of an instance type. Note that this type does not preserve accurate constructor parameters.

                                                        T The instance type.

                                                      type CustomEventListener

                                                      type CustomEventListener<E extends Event> = (evt: E) => void;

                                                        type EventType

                                                        type EventType = keyof GlobalEventHandlersEventMap;
                                                        • Copyright 2019 Google Inc.

                                                          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                          The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                          THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                        type MDCFoundationAdapter

                                                        type MDCFoundationAdapter<T> = T extends MDCFoundation<infer A> ? A : never;
                                                        • Retrieves the AdapaterType from the provided MDCFoundation generic type.

                                                        type SpecificEventListener

                                                        type SpecificEventListener<K extends EventType> = (
                                                        evt: GlobalEventHandlersEventMap[K]
                                                        ) => void;

                                                          type SpecificWindowEventListener

                                                          type SpecificWindowEventListener<K extends WindowEventType> = (
                                                          evt: WindowEventMap[K]
                                                          ) => void;

                                                            type WindowEventType

                                                            type WindowEventType = keyof WindowEventMap;

                                                              namespace @material/base/component

                                                              module '@material/base/component' {}

                                                                class MDCComponent

                                                                class MDCComponent<FoundationType extends MDCFoundation> {}

                                                                  constructor

                                                                  constructor(root: Element, foundation?: MDCFoundation<{}>, ...args: unknown[]);

                                                                    property foundation

                                                                    protected foundation: MDCFoundation<{}>;

                                                                      property root

                                                                      root: Element;

                                                                        method attachTo

                                                                        static attachTo: (root: Element) => MDCComponent<MDCFoundation<{}>>;

                                                                          method destroy

                                                                          destroy: () => void;

                                                                            method emit

                                                                            emit: <T extends object>(
                                                                            evtType: string,
                                                                            evtData: T,
                                                                            shouldBubble?: boolean
                                                                            ) => void;
                                                                            • Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.

                                                                            method getDefaultFoundation

                                                                            getDefaultFoundation: () => FoundationType;

                                                                              method initialize

                                                                              initialize: (..._args: Array<unknown>) => void;

                                                                                method initialSyncWithDOM

                                                                                initialSyncWithDOM: () => void;

                                                                                  method listen

                                                                                  listen: {
                                                                                  <K extends keyof GlobalEventHandlersEventMap>(
                                                                                  evtType: K,
                                                                                  handler: SpecificEventListener<K>,
                                                                                  options?: AddEventListenerOptions | boolean
                                                                                  ): void;
                                                                                  <E extends Event>(
                                                                                  evtType: string,
                                                                                  handler: CustomEventListener<E>,
                                                                                  options?: boolean | AddEventListenerOptions
                                                                                  ): void;
                                                                                  };
                                                                                  • Wrapper method to add an event listener to the component's root element. This is most useful when listening for custom events.

                                                                                  method unlisten

                                                                                  unlisten: {
                                                                                  <K extends keyof GlobalEventHandlersEventMap>(
                                                                                  evtType: K,
                                                                                  handler: SpecificEventListener<K>,
                                                                                  options?: AddEventListenerOptions | boolean
                                                                                  ): void;
                                                                                  <E extends Event>(
                                                                                  evtType: string,
                                                                                  handler: CustomEventListener<E>,
                                                                                  options?: boolean | AddEventListenerOptions
                                                                                  ): void;
                                                                                  };
                                                                                  • Wrapper method to remove an event listener to the component's root element. This is most useful when unlistening for custom events.

                                                                                  namespace @material/base/foundation

                                                                                  module '@material/base/foundation' {}

                                                                                    class MDCFoundation

                                                                                    class MDCFoundation<AdapterType extends {} = {}> {}
                                                                                    • Copyright 2016 Google Inc.

                                                                                      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                                                      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                                                      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                                                    constructor

                                                                                    constructor(adapter?: {});

                                                                                      property adapter

                                                                                      protected adapter: {};

                                                                                        property cssClasses

                                                                                        static readonly cssClasses: { [key: string]: string };

                                                                                          property defaultAdapter

                                                                                          static readonly defaultAdapter: {};

                                                                                            property numbers

                                                                                            static readonly numbers: { [key: string]: number };

                                                                                              property strings

                                                                                              static readonly strings: { [key: string]: string };

                                                                                                method destroy

                                                                                                destroy: () => void;

                                                                                                  method init

                                                                                                  init: () => void;

                                                                                                    interface MDCFoundationConstructor

                                                                                                    interface MDCFoundationConstructor<AdapterType extends object = any> {}
                                                                                                    • The constructor for MDCFoundation.

                                                                                                    property prototype

                                                                                                    readonly prototype: MDCFoundation<AdapterType>;

                                                                                                      construct signature

                                                                                                      new (adapter: AdapterType): MDCFoundation<AdapterType>;

                                                                                                        interface MDCFoundationDeprecatedConstructor

                                                                                                        interface MDCFoundationDeprecatedConstructor<AdapterType extends object = any> {}
                                                                                                        • The deprecated constructor for MDCFoundation.

                                                                                                        property cssClasses

                                                                                                        readonly cssClasses: Record<string, string>;

                                                                                                          property defaultAdapter

                                                                                                          readonly defaultAdapter: AdapterType;

                                                                                                            property numbers

                                                                                                            readonly numbers: Record<string, number>;

                                                                                                              property prototype

                                                                                                              readonly prototype: MDCFoundation<AdapterType>;

                                                                                                                property strings

                                                                                                                readonly strings: Record<string, string>;

                                                                                                                  construct signature

                                                                                                                  new (adapter?: Partial<AdapterType>): MDCFoundation<AdapterType>;

                                                                                                                    type MDCFoundationAdapter

                                                                                                                    type MDCFoundationAdapter<T> = T extends MDCFoundation<infer A> ? A : never;
                                                                                                                    • Retrieves the AdapaterType from the provided MDCFoundation generic type.

                                                                                                                    namespace @material/base/types

                                                                                                                    module '@material/base/types' {}

                                                                                                                      type Constructor

                                                                                                                      type Constructor<T = any> = {
                                                                                                                      new (...args: any[]): T;
                                                                                                                      };
                                                                                                                      • A generic type for the constructor of an instance type. Note that this type does not preserve accurate constructor parameters.

                                                                                                                        T The instance type.

                                                                                                                      type CustomEventListener

                                                                                                                      type CustomEventListener<E extends Event> = (evt: E) => void;

                                                                                                                        type EventType

                                                                                                                        type EventType = keyof GlobalEventHandlersEventMap;
                                                                                                                        • Copyright 2019 Google Inc.

                                                                                                                          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                                                                                          The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                                                                                          THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                                                                                        type SpecificEventListener

                                                                                                                        type SpecificEventListener<K extends EventType> = (
                                                                                                                        evt: GlobalEventHandlersEventMap[K]
                                                                                                                        ) => void;

                                                                                                                          type SpecificWindowEventListener

                                                                                                                          type SpecificWindowEventListener<K extends WindowEventType> = (
                                                                                                                          evt: WindowEventMap[K]
                                                                                                                          ) => void;

                                                                                                                            type WindowEventType

                                                                                                                            type WindowEventType = keyof WindowEventMap;

                                                                                                                              Package Files (1)

                                                                                                                              Dependencies (1)

                                                                                                                              Dev Dependencies (0)

                                                                                                                              No dev dependencies.

                                                                                                                              Peer Dependencies (0)

                                                                                                                              No peer dependencies.

                                                                                                                              Badge

                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@material/base.

                                                                                                                              • Markdown
                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@material/base)
                                                                                                                              • HTML
                                                                                                                                <a href="https://www.jsdocs.io/package/@material/base"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>