lisn.js
Version:
Simply handle user gestures and actions. Includes widgets.
1 lines • 30.4 kB
Source Map (JSON)
{"version":3,"file":"dom-alter.cjs","names":["MC","_interopRequireWildcard","require","MH","_settings","_cssAlter","_domOptimize","_domQuery","_log","_text","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","wrapElementNow","element","options","wrapper","createWrapperFor","ignoreMove","from","parentOf","to","replaceWith","append","exports","wrapElement","asyncMutatorFor","wrapChildrenNow","moveChildrenNow","moveElementNow","wrapChildren","replaceElementNow","newElement","replaceElement","swapElementsNow","elementA","elementB","temp","createElement","swapElements","oldParent","newParent","child","childrenOf","moveChildren","_options$to","parentEl","position","remove","moveElement","hideAndRemoveElement","delay","hideElement","getOrAssignID","prefix","domID","id","randId","isAllowedToWrap","settings","contentWrappingAllowed","getData","PREFIX_NO_WRAP","getWrapper","_tagName","tagName","_classNames","classNames","PREFIX_WRAPPER","parent","lengthOf","isHTMLElement","hasTagName","hasAnyClass","getContentWrapper","firstChild","tryWrapNow","_tryWrapNow","tryWrap","tryWrapContentNow","tryWrapContent","unwrapContentNow","parentElement","removeClassesNow","unwrapContent","cloneElement","clone","cloneNode","setBooleanData","prefixName","insertGhostCloneNow","insertBefore","addClassesNow","PREFIX_GHOST","PREFIX_TRANSITION_DISABLE","PREFIX_ANIMATE_DISABLE","_required","_wrapper","_clone","insertGhostClone","target","_options$from","_options$to2","recordsToSkipOnce","getIgnoreMove","_recordsToSkipOnce$ge","clearIgnoreMove","setTimer","deleteKey","insertArrow","direction","tag","arrow","S_ARROW","setDataNow","newMap","isElement","isInlineTag","wrapContent","_ignoreMove","required","_requiredBy","requiredBy","getWrapperFn","wrapFn","allowedToWrap","PREFIX_INLINE_WRAPPER","logWarn"],"sources":["../../../src/ts/utils/dom-alter.ts"],"sourcesContent":["/**\n * @module Utils\n *\n * @categoryDescription DOM: Altering\n * These functions alter the DOM tree, but could lead to forced layout if not\n * scheduled using {@link Utils.waitForMutateTime}.\n *\n * @categoryDescription DOM: Altering (optimized)\n * These functions alter the DOM tree in an optimized way using\n * {@link Utils.waitForMutateTime} and so are asynchronous.\n */\n\nimport * as MC from \"@lisn/globals/minification-constants\";\nimport * as MH from \"@lisn/globals/minification-helpers\";\n\nimport { settings } from \"@lisn/globals/settings\";\n\nimport {\n hideElement,\n hasAnyClass,\n addClassesNow,\n removeClassesNow,\n getData,\n setDataNow,\n setBooleanData,\n} from \"@lisn/utils/css-alter\";\nimport { asyncMutatorFor } from \"@lisn/utils/dom-optimize\";\nimport { isInlineTag } from \"@lisn/utils/dom-query\";\nimport { logWarn } from \"@lisn/utils/log\";\nimport { randId } from \"@lisn/utils/text\";\n\n/**\n * Wraps the element in the given wrapper, or a newly created element if not given.\n *\n * @param [options.wrapper]\n * If it's an element, it is used as the wrapper. If it's a string\n * tag name, then a new element with this tag is created as the\n * wrapper. If not given, then `div` is used if the element to be\n * wrapped has an block-display tag, or otherwise `span` (if the\n * element to be wrapped has an inline tag name).\n * @param [options.ignoreMove]\n * If true, the DOM watcher instances will ignore the operation of\n * replacing the element (so as to not trigger relevant callbacks).\n * @returns The wrapper element that was either passed in options or created.\n *\n * @category DOM: Altering\n */\nexport const wrapElementNow = (\n element: Element,\n options?: {\n wrapper?: HTMLElement | keyof HTMLElementTagNameMap;\n ignoreMove?: boolean;\n },\n) => {\n const wrapper = createWrapperFor(element, options?.wrapper);\n\n if (options?.ignoreMove === true) {\n ignoreMove(element, {\n from: MH.parentOf(element),\n to: wrapper,\n });\n\n ignoreMove(wrapper, {\n to: MH.parentOf(element),\n });\n }\n\n element.replaceWith(wrapper);\n wrapper.append(element);\n\n return wrapper;\n};\n\n/**\n * Like {@link wrapElementNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const wrapElement = asyncMutatorFor(wrapElementNow);\n\n/**\n * Wraps the element's children in the given wrapper, or a newly created element\n * if not given.\n *\n * @see {@link wrapElementNow}.\n *\n * @category DOM: Altering\n */\nexport const wrapChildrenNow = (\n element: Element,\n options?: {\n wrapper?: HTMLElement | keyof HTMLElementTagNameMap;\n ignoreMove?: boolean;\n },\n) => {\n const wrapper = createWrapperFor(element, options?.wrapper);\n const { ignoreMove } = options ?? {};\n\n moveChildrenNow(element, wrapper, { ignoreMove });\n moveElementNow(wrapper, {\n to: element,\n ignoreMove,\n });\n\n return wrapper;\n};\n\n/**\n * Like {@link wrapChildrenNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const wrapChildren = asyncMutatorFor(wrapChildrenNow);\n\n/**\n * Replace an element with another one.\n *\n * @param [options.ignoreMove]\n * If true, the DOM watcher instances will ignore the operation of\n * moving the element (so as to not trigger relevant callbacks).\n *\n * @category DOM: Altering\n */\nexport const replaceElementNow = (\n element: Element,\n newElement: Element,\n options?: {\n ignoreMove?: boolean;\n },\n) => {\n if (options?.ignoreMove === true) {\n ignoreMove(\n // remove element\n element,\n { from: MH.parentOf(element) },\n );\n\n ignoreMove(\n // move newElement to element's current parent\n newElement,\n { from: MH.parentOf(newElement), to: MH.parentOf(element) },\n );\n }\n\n element.replaceWith(newElement);\n};\n\n/**\n * Like {@link replaceElementNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const replaceElement = asyncMutatorFor(replaceElementNow);\n\n/**\n * Replace an element with another one.\n *\n * @param [options.ignoreMove]\n * If true, the DOM watcher instances will ignore the operation of\n * moving the element (so as to not trigger relevant callbacks).\n *\n * @category DOM: Altering\n */\nexport const swapElementsNow = (\n elementA: Element,\n elementB: Element,\n options?: {\n ignoreMove?: boolean;\n },\n) => {\n const temp = MH.createElement(\"div\");\n replaceElementNow(elementA, temp, options);\n replaceElementNow(elementB, elementA, options);\n replaceElementNow(temp, elementB, options);\n};\n\n/**\n * Like {@link swapElementsNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const swapElements = asyncMutatorFor(swapElementsNow);\n\n// [TODO v2]: moveChildren to accept newParent as options.to\n\n/**\n * Move an element's children to a new element\n *\n * @param [options.ignoreMove]\n * If true, the DOM watcher instances will ignore the operation of\n * moving the children (so as to not trigger relevant callbacks).\n *\n * @category DOM: Altering\n */\nexport const moveChildrenNow = (\n oldParent: Element,\n newParent: Element,\n options?: {\n ignoreMove?: boolean;\n },\n) => {\n if (options?.ignoreMove === true) {\n for (const child of MH.childrenOf(oldParent)) {\n ignoreMove(child, {\n from: oldParent,\n to: newParent,\n });\n }\n }\n\n newParent.append(...MH.childrenOf(oldParent));\n};\n\n/**\n * Like {@link moveChildrenNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const moveChildren = asyncMutatorFor(moveChildrenNow);\n\n/**\n * Moves an element to a new position.\n *\n * @param [options.to] The new parent or sibling (depending on\n * `options.position`). If not given, the\n * element is removed from the DOM.\n * @param [options.position] - append (default): append to `options.to`\n * - prepend: prepend to `options.to`\n * - before: insert before `options.to`\n * - after: insert after `options.to`\n * @param [options.ignoreMove] If true, the DOM watcher instances will\n * ignore the operation of moving the element\n * (so as to not trigger relevant callbacks).\n *\n * @category DOM: Altering\n */\nexport const moveElementNow = (\n element: Element,\n options?: {\n to?: Element;\n position?: \"append\" | \"prepend\" | \"before\" | \"after\";\n ignoreMove?: boolean;\n },\n) => {\n let parentEl = options?.to ?? null;\n const position = options?.position || \"append\";\n if (position === \"before\" || position === \"after\") {\n parentEl = MH.parentOf(options?.to);\n }\n\n if (options?.ignoreMove === true) {\n ignoreMove(element, {\n from: MH.parentOf(element),\n to: parentEl,\n });\n }\n\n if (options?.to) {\n options.to[position](element);\n } else {\n MH.remove(element);\n }\n};\n\n/**\n * Like {@link moveElementNow} except it will {@link Utils.waitForMutateTime}.\n *\n * @category DOM: Altering (optimized)\n */\nexport const moveElement = asyncMutatorFor(moveElementNow);\n\n/**\n * It will {@link hideElement} and then remove it from the DOM.\n *\n * @param [options.ignoreMove]\n * If true, the DOM watcher instances will ignore the operation of\n * replacing the element (so as to not trigger relevant callbacks).\n *\n * @category DOM: Altering (optimized)\n */\nexport const hideAndRemoveElement = async (\n element: Element,\n delay = 0,\n options?: {\n ignoreMove?: boolean;\n },\n) => {\n await hideElement(element, delay);\n moveElementNow(element, options);\n};\n\n/**\n * @ignore\n * @internal\n */\nexport const getOrAssignID = (element: Element, prefix = \"\") => {\n let domID = element.id;\n if (!domID) {\n domID = `${prefix}-${randId()}`;\n element.id = domID;\n }\n\n return domID;\n};\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const isAllowedToWrap = (element: Element) =>\n settings.contentWrappingAllowed === true &&\n getData(element, MC.PREFIX_NO_WRAP) === null;\n\n/**\n * @ignore\n * @internal\n *\n * @param [options.classNames] Default is [MC.PREFIX_WRAPPER]. Pass `null` to\n * disable check.\n *\n * @since v1.2.0\n */\nexport const getWrapper = (\n element: Element,\n options?: {\n _tagName?: keyof HTMLElementTagNameMap;\n _classNames?: string[] | null;\n },\n) => {\n const { _tagName: tagName, _classNames: classNames = [MC.PREFIX_WRAPPER] } =\n options ?? {};\n const parent = MH.parentOf(element);\n if (\n MH.lengthOf(MH.childrenOf(parent)) === 1 &&\n MH.isHTMLElement(parent) &&\n (!tagName || MH.hasTagName(parent, tagName)) &&\n (!classNames || hasAnyClass(parent, ...classNames))\n ) {\n // Already wrapped\n return parent;\n }\n\n return null; // don't check the element itself, only its parent\n};\n\n/**\n * @ignore\n * @internal\n *\n * @param [options.classNames] Default is [MC.PREFIX_WRAPPER]. Pass `null` to\n * disable check.\n *\n * @since v1.2.0\n */\nexport const getContentWrapper = (\n element: Element,\n options?: {\n _tagName?: keyof HTMLElementTagNameMap;\n _classNames?: string[] | null;\n },\n) => {\n const { _tagName: tagName, _classNames: classNames = [MC.PREFIX_WRAPPER] } =\n options ?? {};\n const firstChild = MH.childrenOf(element)[0];\n if (\n MH.lengthOf(MH.childrenOf(element)) === 1 &&\n MH.isHTMLElement(firstChild) &&\n (!tagName || MH.hasTagName(firstChild, tagName)) &&\n (!classNames || hasAnyClass(firstChild, ...classNames))\n ) {\n // Already wrapped\n return firstChild;\n }\n\n return null;\n};\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const tryWrapNow = <O extends ContentWrappingOptions>(\n element: Element,\n options?: O,\n) => _tryWrapNow(element, options);\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const tryWrap = asyncMutatorFor(tryWrapNow);\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const tryWrapContentNow = <O extends ContentWrappingOptions>(\n element: Element,\n options?: O,\n) => _tryWrapNow(element, options, true);\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const tryWrapContent = asyncMutatorFor(tryWrapContentNow);\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const unwrapContentNow = (wrapper: Element, classNames?: string[]) => {\n const parent = wrapper.parentElement;\n if (parent) {\n moveChildrenNow(wrapper, parent, { ignoreMove: true });\n moveElementNow(wrapper, { ignoreMove: true });\n if (classNames) {\n removeClassesNow(wrapper, ...classNames);\n }\n }\n};\n\n/**\n * @ignore\n * @internal\n *\n * @since v1.2.0\n */\nexport const unwrapContent = asyncMutatorFor(unwrapContentNow);\n\n/**\n * @ignore\n * @internal\n */\nexport const cloneElement = <E extends Element>(element: E) => {\n const clone = element.cloneNode(true) as E;\n setBooleanData(clone, MH.prefixName(\"clone\"));\n return clone;\n};\n\n/**\n * Creates a dummy hidden clone that's got animation and transitions disabled\n * and absolute position, wrapped in a wrapper (of size 0) and inserts it just\n * before the `insertBefore` element (or if not given, the original element),\n * so that the hidden clone overlaps the actual element's regular\n * (pre-transformed) position.\n *\n * It clears the ID of the clone.\n *\n * Returns the clone.\n *\n * @ignore\n * @internal\n */\nexport const insertGhostCloneNow = <E extends Element>(\n element: E,\n insertBefore: Element | null = null,\n) => {\n const clone = cloneElement(element);\n clone.id = \"\";\n\n addClassesNow(\n clone,\n MC.PREFIX_GHOST,\n MC.PREFIX_TRANSITION_DISABLE,\n MC.PREFIX_ANIMATE_DISABLE,\n );\n\n const wrapper = _tryWrapNow(clone, { _required: true });\n\n moveElementNow(wrapper, {\n to: insertBefore ?? element,\n position: \"before\",\n ignoreMove: true,\n });\n\n return { _wrapper: wrapper, _clone: clone };\n};\n\n/**\n * @ignore\n * @internal\n *\n * Exposed via DOMWatcher\n */\nexport const insertGhostClone = asyncMutatorFor(insertGhostCloneNow);\n\n/**\n * @ignore\n * @internal\n *\n * Exposed via DOMWatcher\n */\nexport const ignoreMove = (\n target: Element,\n options: { from?: Element | null; to?: Element | null },\n) =>\n recordsToSkipOnce.set(target, {\n from: options.from ?? null,\n to: options.to ?? null,\n });\n\n/**\n * @ignore\n * @internal\n */\nexport const getIgnoreMove = (\n target: Element,\n): { from: Element | null; to: Element | null } | null =>\n recordsToSkipOnce.get(target) ?? null;\n\n/**\n * @ignore\n * @internal\n */\nexport const clearIgnoreMove = (target: Element) => {\n // We should not clear the entry the first time the operation is observed\n // (when we return true here), because there may be multiple DOMWatcher\n // instances that will observe it and need to query it. Instead do it shortly.\n MH.setTimer(() => {\n MH.deleteKey(recordsToSkipOnce, target);\n }, 100);\n};\n\n/**\n * @ignore\n * @internal\n */\nexport const insertArrow = (\n target: Element,\n direction: \"up\" | \"down\" | \"left\" | \"right\",\n position: \"prepend\" | \"append\" | \"before\" | \"after\" = \"append\",\n tag = \"span\",\n) => {\n const arrow = MH.createElement(tag);\n addClassesNow(arrow, MH.prefixName(MC.S_ARROW));\n setDataNow(arrow, MH.prefixName(\"direction\"), direction);\n moveElement(arrow, { to: target, position, ignoreMove: true });\n return arrow;\n};\n\n// ----------------------------------------\n\ntype ContentWrappingOptions = {\n _tagName?: keyof HTMLElementTagNameMap;\n _classNames?: string[]; // if the wrapper has any one of these, it will be re-used\n _ignoreMove?: boolean; // default is true here\n _required?: boolean; // if true, will ignore contentWrappingAllowed and data-lisn-no-wrap\n _requiredBy?: string; // for logging purposes\n};\n\nconst recordsToSkipOnce = MH.newMap<\n /* target being moved */ Element,\n { from: Element | null; to: Element | null }\n>();\n\nconst createWrapperFor = (\n element: Element,\n wrapper: HTMLElement | keyof HTMLElementTagNameMap | undefined,\n) => {\n if (MH.isElement(wrapper)) {\n return wrapper;\n }\n\n let tag = wrapper;\n if (!tag) {\n if (isInlineTag(MH.tagName(element))) {\n tag = \"span\";\n } else {\n tag = \"div\";\n }\n }\n\n return MH.createElement(tag);\n};\n\nconst _tryWrapNow = <O extends ContentWrappingOptions>(\n element: Element,\n options: O | undefined,\n wrapContent = false, // if true, wrap its children, otherwise given element\n) => {\n const {\n _tagName: tagName,\n _classNames: classNames = [MC.PREFIX_WRAPPER],\n _ignoreMove: ignoreMove = true,\n _required: required = false,\n _requiredBy: requiredBy = \"\",\n } = options ?? {};\n\n const getWrapperFn = wrapContent ? getContentWrapper : getWrapper;\n const wrapFn = wrapContent ? wrapChildrenNow : wrapElementNow;\n const allowedToWrap = isAllowedToWrap(element);\n\n let wrapper = getWrapperFn(element, options);\n if (!wrapper && (required || allowedToWrap)) {\n wrapper = wrapFn(element, { wrapper: tagName, ignoreMove });\n if (classNames) {\n addClassesNow(wrapper, ...classNames);\n }\n if (isInlineTag(MH.tagName(wrapper))) {\n addClassesNow(wrapper, MC.PREFIX_INLINE_WRAPPER);\n }\n\n if (!allowedToWrap && requiredBy) {\n logWarn(\n `content wrapping is disabled for element but wrapping is required by ${requiredBy}`,\n );\n }\n }\n\n return wrapper as O extends { _required: true }\n ? HTMLElement\n : HTMLElement | null;\n};\n"],"mappings":";;;;;;AAYA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,EAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GA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