Skip to content
Snippets Groups Projects
Select Git revision
  • 55db077b199223170be473437a94ccfb329dbed8
  • master default protected
  • 1.31
  • 4.24.3
  • 4.24.2
  • 4.24.1
  • 4.24.0
  • 4.23.6
  • 4.23.5
  • 4.23.4
  • 4.23.3
  • 4.23.2
  • 4.23.1
  • 4.23.0
  • 4.22.3
  • 4.22.2
  • 4.22.1
  • 4.22.0
  • 4.21.0
  • 4.20.1
  • 4.20.0
  • 4.19.0
  • 4.18.0
23 results

popper.mjs

Blame
  • updater.mjs 30.78 KiB
    /**
     * Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
     * Node module: @schukai/monster
     *
     * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
     * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
     *
     * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
     * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
     * For more information about purchasing a commercial license, please contact schukai GmbH.
     *
     * SPDX-License-Identifier: AGPL-3.0
     */
    
    import {internalSymbol} from "../constants.mjs";
    import {diff} from "../data/diff.mjs";
    import {Pathfinder} from "../data/pathfinder.mjs";
    import {Pipe} from "../data/pipe.mjs";
    import {
        ATTRIBUTE_ERRORMESSAGE,
        ATTRIBUTE_UPDATER_ATTRIBUTES,
        ATTRIBUTE_UPDATER_BIND,
        ATTRIBUTE_UPDATER_BIND_TYPE,
        ATTRIBUTE_UPDATER_INSERT,
        ATTRIBUTE_UPDATER_INSERT_REFERENCE,
        ATTRIBUTE_UPDATER_REMOVE,
        ATTRIBUTE_UPDATER_REPLACE,
        ATTRIBUTE_UPDATER_SELECT_THIS,
    } from "./constants.mjs";
    
    import {Base} from "../types/base.mjs";
    import {isArray, isString, isInstance, isIterable} from "../types/is.mjs";
    import {Observer} from "../types/observer.mjs";
    import {ProxyObserver} from "../types/proxyobserver.mjs";
    import {validateArray, validateInstance} from "../types/validate.mjs";
    import {clone} from "../util/clone.mjs";
    import {trimSpaces} from "../util/trimspaces.mjs";
    import {addAttributeToken, addToObjectLink} from "./attributes.mjs";
    import {updaterTransformerMethodsSymbol} from "./customelement.mjs";
    import {findTargetElementFromEvent} from "./events.mjs";
    import {findDocumentTemplate} from "./template.mjs";
    import {getWindow} from "./util.mjs";
    
    export {Updater, addObjectWithUpdaterToElement};
    
    /**
     * The updater class connects an object with the DOM. In this way, structures and contents in the DOM can be
     * programmatically adapted via attributes.
     *
     * For example, to include a string from an object, the attribute `data-monster-replace` can be used.
     * a further explanation can be found under [monsterjs.org](https://monsterjs.org/)
     *
     * Changes to attributes are made only when the direct values are changed. If you want to assign changes
     * to other values as well, you have to insert the attribute `data-monster-select-this`. This should be
     * done with care, as it can reduce performance.
     *
     * @example /examples/libraries/dom/updater/simple/ Simple example
     *
     * @license AGPLv3
     * @since 1.8.0
     * @copyright schukai GmbH
     * @throws {Error} the value is not iterable
     * @throws {Error} pipes are not allowed when cloning a node.
     * @throws {Error} no template was found with the specified key.
     * @throws {Error} the maximum depth for the recursion is reached.
     * @throws {TypeError} value is not a object
     * @throws {TypeError} value is not an instance of HTMLElement
     * @summary The updater class connects an object with the dom
     */
    class Updater extends Base {