stimulus_reflex 3.5.0.pre9 → 3.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +122 -127
  4. data/README.md +13 -19
  5. data/app/assets/javascripts/stimulus_reflex.js +1017 -523
  6. data/app/assets/javascripts/stimulus_reflex.umd.js +940 -496
  7. data/app/channels/stimulus_reflex/channel.rb +9 -24
  8. data/bin/console +0 -2
  9. data/bin/standardize +2 -1
  10. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +68 -9
  11. data/lib/generators/stimulus_reflex/templates/app/controllers/examples_controller.rb.tt +9 -0
  12. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/consumer.js.tt +6 -0
  13. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.esbuild.tt +4 -0
  14. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.importmap.tt +2 -0
  15. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.shakapacker.tt +5 -0
  16. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.vite.tt +1 -0
  17. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.webpacker.tt +5 -0
  18. data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +4 -0
  19. data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +2 -0
  20. data/lib/generators/stimulus_reflex/templates/app/javascript/config/mrujs.js.tt +9 -0
  21. data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +5 -0
  22. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +141 -0
  23. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +11 -0
  24. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +74 -0
  25. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.esbuild.tt +7 -0
  26. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt +5 -0
  27. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.shakapacker.tt +5 -0
  28. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.vite.tt +5 -0
  29. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.webpacker.tt +5 -0
  30. data/{test/tmp/app/reflexes/user_reflex.rb → lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt} +38 -9
  31. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +27 -0
  32. data/lib/generators/stimulus_reflex/templates/app/views/examples/show.html.erb.tt +207 -0
  33. data/lib/generators/stimulus_reflex/templates/config/initializers/cable_ready.rb +27 -0
  34. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +18 -13
  35. data/lib/generators/stimulus_reflex/templates/esbuild.config.mjs.tt +94 -0
  36. data/lib/install/action_cable.rb +155 -0
  37. data/lib/install/broadcaster.rb +90 -0
  38. data/lib/install/bundle.rb +56 -0
  39. data/lib/install/compression.rb +41 -0
  40. data/lib/install/config.rb +87 -0
  41. data/lib/install/development.rb +110 -0
  42. data/lib/install/esbuild.rb +114 -0
  43. data/lib/install/example.rb +22 -0
  44. data/lib/install/importmap.rb +133 -0
  45. data/lib/install/initializers.rb +25 -0
  46. data/lib/install/mrujs.rb +133 -0
  47. data/lib/install/npm_packages.rb +25 -0
  48. data/lib/install/reflexes.rb +25 -0
  49. data/lib/install/shakapacker.rb +64 -0
  50. data/lib/install/spring.rb +54 -0
  51. data/lib/install/updatable.rb +34 -0
  52. data/lib/install/vite.rb +64 -0
  53. data/lib/install/webpacker.rb +90 -0
  54. data/lib/install/yarn.rb +55 -0
  55. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +15 -8
  56. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +7 -8
  57. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +10 -10
  58. data/lib/stimulus_reflex/broadcasters/update.rb +3 -0
  59. data/lib/stimulus_reflex/cable_readiness.rb +29 -0
  60. data/lib/stimulus_reflex/cable_ready_channels.rb +6 -5
  61. data/lib/stimulus_reflex/callbacks.rb +17 -1
  62. data/lib/stimulus_reflex/concern_enhancer.rb +6 -4
  63. data/lib/stimulus_reflex/configuration.rb +12 -2
  64. data/lib/stimulus_reflex/dataset.rb +11 -1
  65. data/lib/stimulus_reflex/engine.rb +16 -9
  66. data/lib/stimulus_reflex/html/document.rb +59 -0
  67. data/lib/stimulus_reflex/html/document_fragment.rb +13 -0
  68. data/lib/stimulus_reflex/importmap.rb +6 -3
  69. data/lib/stimulus_reflex/installer.rb +274 -0
  70. data/lib/stimulus_reflex/open_struct_fix.rb +2 -0
  71. data/lib/stimulus_reflex/reflex.rb +40 -31
  72. data/lib/stimulus_reflex/reflex_data.rb +19 -3
  73. data/lib/stimulus_reflex/reflex_factory.rb +6 -3
  74. data/lib/stimulus_reflex/request_parameters.rb +2 -0
  75. data/lib/stimulus_reflex/utils/logger.rb +10 -0
  76. data/lib/stimulus_reflex/utils/sanity_checker.rb +8 -48
  77. data/lib/stimulus_reflex/version.rb +1 -1
  78. data/lib/stimulus_reflex/version_checker.rb +54 -0
  79. data/lib/stimulus_reflex.rb +2 -0
  80. data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +250 -0
  81. data/package.json +36 -28
  82. data/{rollup.config.js → rollup.config.mjs} +6 -24
  83. data/stimulus_reflex.gemspec +16 -19
  84. data/yarn.lock +1331 -748
  85. metadata +129 -79
  86. data/LATEST +0 -1
  87. data/app/assets/javascripts/stimulus_reflex.min.js +0 -2
  88. data/app/assets/javascripts/stimulus_reflex.min.js.map +0 -1
  89. data/app/assets/javascripts/stimulus_reflex.umd.min.js +0 -905
  90. data/app/assets/javascripts/stimulus_reflex.umd.min.js.map +0 -1
  91. data/lib/generators/stimulus_reflex/initializer_generator.rb +0 -14
  92. data/test/broadcasters/broadcaster_test.rb +0 -11
  93. data/test/broadcasters/broadcaster_test_case.rb +0 -39
  94. data/test/broadcasters/nothing_broadcaster_test.rb +0 -31
  95. data/test/broadcasters/page_broadcaster_test.rb +0 -79
  96. data/test/broadcasters/selector_broadcaster_test.rb +0 -173
  97. data/test/callbacks_test.rb +0 -652
  98. data/test/concern_enhancer_test.rb +0 -54
  99. data/test/element_test.rb +0 -254
  100. data/test/generators/stimulus_reflex_generator_test.rb +0 -58
  101. data/test/reflex_test.rb +0 -43
  102. data/test/test_helper.rb +0 -71
  103. data/test/tmp/app/reflexes/application_reflex.rb +0 -12
  104. data/yarn-error.log +0 -4964
@@ -1 +0,0 @@
1
- {"version":3,"file":"stimulus_reflex.min.js","sources":["../../../javascript/schema.js","../../../javascript/debug.js","../../../javascript/reflex_store.js","../../../javascript/log.js","../../../javascript/deprecate.js","../../../javascript/utils.js","../../../javascript/attributes.js","../../../javascript/isolation_mode.js","../../../javascript/lifecycle.js","../../../javascript/controllers.js","../../../javascript/reflexes.js","../../../javascript/reflex_data.js","../../../javascript/transports/action_cable.js","../../../javascript/callbacks.js","../../../javascript/stimulus_reflex.js","../../../javascript/index.js"],"sourcesContent":["const defaultSchema = {\n reflexAttribute: 'data-reflex',\n reflexPermanentAttribute: 'data-reflex-permanent',\n reflexRootAttribute: 'data-reflex-root',\n reflexSuppressLoggingAttribute: 'data-reflex-suppress-logging',\n reflexDatasetAttribute: 'data-reflex-dataset',\n reflexDatasetAllAttribute: 'data-reflex-dataset-all',\n reflexSerializeFormAttribute: 'data-reflex-serialize-form',\n reflexFormSelectorAttribute: 'data-reflex-form-selector',\n reflexIncludeInnerHtmlAttribute: 'data-reflex-include-inner-html',\n reflexIncludeTextContentAttribute: 'data-reflex-include-text-content'\n}\n\nlet schema = {}\n\nexport { schema, defaultSchema }\n\nexport default {\n set (application) {\n schema = { ...defaultSchema, ...application.schema }\n for (const attribute in schema) {\n Object.defineProperty(this, attribute.slice(0, -9), {\n get: () => {\n return schema[attribute]\n }\n })\n }\n }\n}\n","let debugging = false\n\nexport default {\n get enabled () {\n return debugging\n },\n get disabled () {\n return !debugging\n },\n get value () {\n return debugging\n },\n set (value) {\n debugging = !!value\n },\n set debug (value) {\n debugging = !!value\n }\n}\n","const reflexes = {}\n\nexport { reflexes }\n","import Debug from './debug'\n\nimport { reflexes } from './reflex_store'\n\nconst request = (\n reflexId,\n target,\n args,\n controller,\n element,\n controllerElement\n) => {\n const reflex = reflexes[reflexId]\n if (Debug.disabled || reflex.promise.data.suppressLogging) return\n reflex.timestamp = new Date()\n console.log(`\\u2191 stimulus \\u2191 ${target}`, {\n reflexId,\n args,\n controller,\n element,\n controllerElement\n })\n}\n\nconst success = (event, halted) => {\n const { detail } = event || {}\n const { selector, payload } = detail || {}\n const { reflexId, target, morph } = detail.stimulusReflex || {}\n const reflex = reflexes[reflexId]\n if (Debug.disabled || reflex.promise.data.suppressLogging) return\n const progress =\n reflex.totalOperations > 1\n ? ` ${reflex.completedOperations}/${reflex.totalOperations}`\n : ''\n const duration = reflex.timestamp\n ? `in ${new Date() - reflex.timestamp}ms`\n : 'CLONED'\n const operation = event.type\n .split(':')[1]\n .split('-')\n .slice(1)\n .join('_')\n console.log(\n `\\u2193 reflex \\u2193 ${target} \\u2192 ${selector ||\n '\\u221E'}${progress} ${duration}`,\n { reflexId, morph, operation, halted, payload }\n )\n}\n\nconst error = event => {\n const { detail } = event || {}\n const { reflexId, target, payload } = detail.stimulusReflex || {}\n const reflex = reflexes[reflexId]\n if (Debug.disabled || reflex.promise.data.suppressLogging) return\n const duration = reflex.timestamp\n ? `in ${new Date() - reflex.timestamp}ms`\n : 'CLONED'\n console.log(\n `\\u2193 reflex \\u2193 ${target} ${duration} %cERROR: ${event.detail.body}`,\n 'color: #f00;',\n { reflexId, payload }\n )\n}\n\nexport default { request, success, error }\n","let deprecationWarnings = true\n\nexport default {\n get enabled () {\n return deprecationWarnings\n },\n get disabled () {\n return !deprecationWarnings\n },\n get value () {\n return deprecationWarnings\n },\n set (value) {\n deprecationWarnings = !!value\n },\n set deprecate (value) {\n deprecationWarnings = !!value\n }\n}\n","// uuid4 function taken from stackoverflow\n// https://stackoverflow.com/a/2117523/554903\n\nconst uuidv4 = () => {\n const crypto = window.crypto || window.msCrypto\n return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16)\n )\n}\n\nconst serializeForm = (form, options = {}) => {\n if (!form) return ''\n\n const w = options.w || window\n const { element } = options\n const formData = new w.FormData(form)\n const data = Array.from(formData, e => e.map(encodeURIComponent).join('='))\n const submitButton = form.querySelector('input[type=submit]')\n if (\n element &&\n element.name &&\n element.nodeName === 'INPUT' &&\n element.type === 'submit'\n ) {\n data.push(\n `${encodeURIComponent(element.name)}=${encodeURIComponent(element.value)}`\n )\n } else if (submitButton && submitButton.name) {\n data.push(\n `${encodeURIComponent(submitButton.name)}=${encodeURIComponent(\n submitButton.value\n )}`\n )\n }\n return Array.from(data).join('&')\n}\n\nconst camelize = (value, uppercaseFirstLetter = true) => {\n if (typeof value !== 'string') return ''\n value = value\n .replace(/[\\s_](.)/g, $1 => $1.toUpperCase())\n .replace(/[\\s_]/g, '')\n .replace(/^(.)/, $1 => $1.toLowerCase())\n\n if (uppercaseFirstLetter)\n value = value.substr(0, 1).toUpperCase() + value.substr(1)\n\n return value\n}\n\nconst debounce = (callback, delay = 250) => {\n let timeoutId\n return (...args) => {\n clearTimeout(timeoutId)\n timeoutId = setTimeout(() => {\n timeoutId = null\n callback(...args)\n }, delay)\n }\n}\n\nconst extractReflexName = reflexString => {\n const match = reflexString.match(/(?:.*->)?(.*?)(?:Reflex)?#/)\n\n return match ? match[1] : ''\n}\n\nconst emitEvent = (event, detail) => {\n document.dispatchEvent(\n new CustomEvent(event, {\n bubbles: true,\n cancelable: false,\n detail\n })\n )\n if (window.jQuery) window.jQuery(document).trigger(event, detail)\n}\n\n// construct a valid xPath for an element in the DOM\nconst elementToXPath = element => {\n if (element.id !== '') return \"//*[@id='\" + element.id + \"']\"\n if (element === document.body) return '/html/body'\n\n let ix = 0\n const siblings = element?.parentNode ? element.parentNode.childNodes : []\n\n for (var i = 0; i < siblings.length; i++) {\n const sibling = siblings[i]\n if (sibling === element) {\n const computedPath = elementToXPath(element.parentNode)\n const tagName = element.tagName.toLowerCase()\n const ixInc = ix + 1\n return `${computedPath}/${tagName}[${ixInc}]`\n }\n\n if (sibling.nodeType === 1 && sibling.tagName === element.tagName) {\n ix++\n }\n }\n}\n\nconst XPathToElement = xpath => {\n return document.evaluate(\n xpath,\n document,\n null,\n XPathResult.FIRST_ORDERED_NODE_TYPE,\n null\n ).singleNodeValue\n}\n\nconst XPathToArray = (xpath, reverse = false) => {\n const snapshotList = document.evaluate(\n xpath,\n document,\n null,\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,\n null\n )\n\n const snapshots = []\n\n for (let i = 0; i < snapshotList.snapshotLength; i++) {\n snapshots.push(snapshotList.snapshotItem(i))\n }\n\n return reverse ? snapshots.reverse() : snapshots\n}\n\nexport {\n uuidv4,\n serializeForm,\n camelize,\n debounce,\n extractReflexName,\n emitEvent,\n elementToXPath,\n XPathToElement,\n XPathToArray\n}\n","import Schema from './schema'\nimport Debug from './debug'\nimport Deprecate from './deprecate'\n\nimport { elementToXPath, XPathToArray } from './utils'\n\nconst multipleInstances = element => {\n if (['checkbox', 'radio'].includes(element.type)) {\n return (\n document.querySelectorAll(\n `input[type=\"${element.type}\"][name=\"${element.name}\"]`\n ).length > 1\n )\n }\n return false\n}\nconst collectCheckedOptions = element => {\n return Array.from(element.querySelectorAll('option:checked'))\n .concat(\n Array.from(\n document.querySelectorAll(\n `input[type=\"${element.type}\"][name=\"${element.name}\"]`\n )\n ).filter(elem => elem.checked)\n )\n .map(o => o.value)\n}\n\n// Returns a string value for the passed array.\n//\n// attributeValue(['', 'one', null, 'two', 'three ']) // 'one two three'\n//\nconst attributeValue = (values = []) => {\n const value = values\n .filter(v => v && String(v).length)\n .map(v => v.trim())\n .join(' ')\n .trim()\n return value.length ? value : null\n}\n\n// Returns an array for the passed string value by splitting on whitespace.\n//\n// attributeValues('one two three ') // ['one', 'two', 'three']\n//\nconst attributeValues = value => {\n if (!value) return []\n if (!value.length) return []\n return value.split(' ').filter(v => v.trim().length)\n}\n\n// Extracts attributes from a DOM element.\n//\nconst extractElementAttributes = element => {\n let attrs = Array.from(element.attributes).reduce((memo, attr) => {\n memo[attr.name] = attr.value\n return memo\n }, {})\n\n attrs.checked = !!element.checked\n attrs.selected = !!element.selected\n attrs.tag_name = element.tagName\n\n if (element.tagName.match(/select/i) || multipleInstances(element)) {\n const collectedOptions = collectCheckedOptions(element)\n attrs.values = collectedOptions\n attrs.value = collectedOptions.join(',')\n } else {\n attrs.value = element.value\n }\n return attrs\n}\n\n// Returns an array of elements for the provided tokens.\n// Tokens is an array of space separated string coming from the `data-reflex-dataset`\n// or `data-reflex-dataset-all` attribute.\n//\nconst getElementsFromTokens = (element, tokens) => {\n if (!tokens || tokens.length === 0) return []\n\n let elements = [element]\n\n const xPath = elementToXPath(element)\n\n tokens.forEach(token => {\n try {\n switch (token) {\n case 'combined':\n if (Deprecate.enabled)\n console.warn(\n \"In the next version of StimulusReflex, the 'combined' option to data-reflex-dataset will become 'ancestors'.\"\n )\n elements = [\n ...elements,\n ...XPathToArray(`${xPath}/ancestor::*`, true)\n ]\n break\n case 'ancestors':\n elements = [\n ...elements,\n ...XPathToArray(`${xPath}/ancestor::*`, true)\n ]\n break\n case 'parent':\n elements = [...elements, ...XPathToArray(`${xPath}/parent::*`)]\n break\n case 'siblings':\n elements = [\n ...elements,\n ...XPathToArray(\n `${xPath}/preceding-sibling::*|${xPath}/following-sibling::*`\n )\n ]\n break\n case 'children':\n elements = [...elements, ...XPathToArray(`${xPath}/child::*`)]\n break\n case 'descendants':\n elements = [...elements, ...XPathToArray(`${xPath}/descendant::*`)]\n break\n default:\n elements = [...elements, ...document.querySelectorAll(token)]\n }\n } catch (error) {\n if (Debug.enabled) console.error(error)\n }\n })\n\n return elements\n}\n\n// Extracts the dataset of an element and combines it with the data attributes from all specified tokens\n//\nconst extractElementDataset = element => {\n const dataset = element.attributes[Schema.reflexDataset]\n const allDataset = element.attributes[Schema.reflexDatasetAll]\n\n const tokens = (dataset && dataset.value.split(' ')) || []\n const allTokens = (allDataset && allDataset.value.split(' ')) || []\n\n const datasetElements = getElementsFromTokens(element, tokens)\n const datasetAllElements = getElementsFromTokens(element, allTokens)\n\n const datasetAttributes = datasetElements.reduce((acc, ele) => {\n return { ...extractDataAttributes(ele), ...acc }\n }, {})\n\n const reflexElementAttributes = extractDataAttributes(element)\n\n const elementDataset = {\n dataset: { ...reflexElementAttributes, ...datasetAttributes },\n datasetAll: {}\n }\n\n datasetAllElements.forEach(element => {\n const elementAttributes = extractDataAttributes(element)\n\n Object.keys(elementAttributes).forEach(key => {\n const value = elementAttributes[key]\n\n if (\n elementDataset.datasetAll[key] &&\n Array.isArray(elementDataset.datasetAll[key])\n ) {\n elementDataset.datasetAll[key].push(value)\n } else {\n elementDataset.datasetAll[key] = [value]\n }\n })\n })\n\n return elementDataset\n}\n\n// Extracts all data attributes from a DOM element.\n//\nconst extractDataAttributes = element => {\n let attrs = {}\n\n if (element && element.attributes) {\n Array.from(element.attributes).forEach(attr => {\n if (attr.name.startsWith('data-')) {\n attrs[attr.name] = attr.value\n }\n })\n }\n\n return attrs\n}\n\nexport {\n attributeValue,\n attributeValues,\n extractElementAttributes,\n extractElementDataset,\n extractDataAttributes\n}\n","let isolationMode = false\n\nexport default {\n get disabled () {\n return !isolationMode\n },\n set (value) {\n isolationMode = value\n }\n}\n","import Debug from './debug'\n\nimport { camelize } from './utils'\nimport { reflexes } from './reflex_store'\n\n// Invokes a lifecycle method on a StimulusReflex controller.\n//\n// - stage - the lifecycle stage\n// * before\n// * success\n// * error\n// * halted\n// * after\n// * finalize\n//\n// - reflexElement - the element that triggered the Reflex (not necessarily the StimulusReflex Controller Element)\n// - controllerElement - the element holding the StimulusReflex Controller\n// - reflexId - the UUIDv4 which uniquely identifies the Reflex\n// - payload - the optional \"return value\" from the Reflex method\n//\nconst invokeLifecycleMethod = (\n stage,\n reflexElement,\n controllerElement,\n reflexId,\n payload\n) => {\n if (!controllerElement || !controllerElement.reflexData[reflexId]) return\n\n const controller = controllerElement.reflexController[reflexId]\n const reflex = controllerElement.reflexData[reflexId].target\n const reflexMethodName = reflex.split('#')[1]\n\n const specificLifecycleMethodName = ['before', 'after', 'finalize'].includes(\n stage\n )\n ? `${stage}${camelize(reflexMethodName)}`\n : `${camelize(reflexMethodName, false)}${camelize(stage)}`\n const specificLifecycleMethod = controller[specificLifecycleMethodName]\n\n const genericLifecycleMethodName = ['before', 'after', 'finalize'].includes(\n stage\n )\n ? `${stage}Reflex`\n : `reflex${camelize(stage)}`\n const genericLifecycleMethod = controller[genericLifecycleMethodName]\n\n if (typeof specificLifecycleMethod === 'function') {\n specificLifecycleMethod.call(\n controller,\n reflexElement,\n reflex,\n controllerElement.reflexError[reflexId],\n reflexId,\n payload\n )\n }\n\n if (typeof genericLifecycleMethod === 'function') {\n genericLifecycleMethod.call(\n controller,\n reflexElement,\n reflex,\n controllerElement.reflexError[reflexId],\n reflexId,\n payload\n )\n }\n\n if (reflexes[reflexId] && stage === reflexes[reflexId].finalStage) {\n Reflect.deleteProperty(controllerElement.reflexController, reflexId)\n Reflect.deleteProperty(controllerElement.reflexData, reflexId)\n Reflect.deleteProperty(controllerElement.reflexError, reflexId)\n // Removing this on a trial basis\n // 1. Prevents race condition with CR broadcasts\n // 2. Planning to remove it for v4 as part of queueing refactor\n // 3. Removing reflexes shouldn't be the responsibility of the lifecycle subsystem\n // Reflect.deleteProperty(reflexes, reflexId)\n }\n}\n\ndocument.addEventListener(\n 'stimulus-reflex:before',\n event =>\n invokeLifecycleMethod(\n 'before',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n ),\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:success',\n event => {\n invokeLifecycleMethod(\n 'success',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n )\n dispatchLifecycleEvent(\n 'after',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n )\n },\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:nothing',\n event => {\n dispatchLifecycleEvent(\n 'success',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n )\n },\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:error',\n event => {\n invokeLifecycleMethod(\n 'error',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n )\n dispatchLifecycleEvent(\n 'after',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n )\n },\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:halted',\n event =>\n invokeLifecycleMethod(\n 'halted',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n ),\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:after',\n event =>\n invokeLifecycleMethod(\n 'after',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n ),\n true\n)\n\ndocument.addEventListener(\n 'stimulus-reflex:finalize',\n event =>\n invokeLifecycleMethod(\n 'finalize',\n event.detail.element,\n event.detail.controller.element,\n event.detail.reflexId,\n event.detail.payload\n ),\n true\n)\n\n// Dispatches a lifecycle event on document\n//\n// - stage - the lifecycle stage\n// * before\n// * success\n// * error\n// * halted\n// * after\n// * finalize\n//\n// - reflexElement - the element that triggered the Reflex (not necessarily the StimulusReflex Controller Element)\n//\n// - controllerElement - the element holding the StimulusReflex Controller\n//\n// - reflexId - the UUIDv4 which uniquely identifies the Reflex\n//\n// - payload - optional Reflex return value\n//\nconst dispatchLifecycleEvent = (\n stage,\n reflexElement,\n controllerElement,\n reflexId,\n payload\n) => {\n if (!controllerElement) {\n if (Debug.enabled && !reflexes[reflexId].warned) {\n console.warn(\n `StimulusReflex was not able execute callbacks or emit events for \"${stage}\" or later life-cycle stages for this Reflex. The StimulusReflex Controller Element is no longer present in the DOM. Could you move the StimulusReflex Controller to an element higher in your DOM?`\n )\n reflexes[reflexId].warned = true\n }\n return\n }\n\n if (\n !controllerElement.reflexController ||\n (controllerElement.reflexController &&\n !controllerElement.reflexController[reflexId])\n ) {\n if (Debug.enabled && !reflexes[reflexId].warned) {\n console.warn(\n `StimulusReflex detected that the StimulusReflex Controller responsible for this Reflex has been replaced with a new instance. Callbacks and events for \"${stage}\" or later life-cycle stages cannot be executed.`\n )\n reflexes[reflexId].warned = true\n }\n return\n }\n\n const { target } = controllerElement.reflexData[reflexId] || {}\n const controller = controllerElement.reflexController[reflexId] || {}\n const event = `stimulus-reflex:${stage}`\n const action = `${event}:${target.split('#')[1]}`\n const detail = {\n reflex: target,\n controller,\n reflexId,\n element: reflexElement,\n payload\n }\n const options = { bubbles: true, cancelable: false, detail }\n\n controllerElement.dispatchEvent(new CustomEvent(event, options))\n controllerElement.dispatchEvent(new CustomEvent(action, options))\n\n if (window.jQuery) {\n window.jQuery(controllerElement).trigger(event, detail)\n window.jQuery(controllerElement).trigger(action, detail)\n }\n}\n\nexport { dispatchLifecycleEvent }\n","import Schema from './schema'\n\nimport { attributeValues } from './attributes'\nimport { extractReflexName } from './utils'\n\n// Returns StimulusReflex controllers local to the passed element based on the data-controller attribute.\n//\nconst localReflexControllers = (app, element) => {\n return attributeValues(element.getAttribute(Schema.controller)).reduce(\n (memo, name) => {\n const controller = app.getControllerForElementAndIdentifier(element, name)\n if (controller && controller.StimulusReflex) memo.push(controller)\n return memo\n },\n []\n )\n}\n\n// Returns all StimulusReflex controllers for the passed element.\n// Traverses DOM ancestors starting with element.\n//\nconst allReflexControllers = (app, element) => {\n let controllers = []\n while (element) {\n controllers = controllers.concat(localReflexControllers(app, element))\n element = element.parentElement\n }\n return controllers\n}\n\n// Given a reflex string such as 'click->TestReflex#create' and a list of\n// controllers. It will find the matching controller based on the controller's\n// identifier. e.g. Given these controller identifiers ['foo', 'bar', 'test'],\n// it would select the 'test' controller.\nconst findControllerByReflexName = (reflexName, controllers) => {\n const controller = controllers.find(controller => {\n if (!controller.identifier) return\n\n return (\n extractReflexName(reflexName)\n .replace(/([a-z0–9])([A-Z])/g, '$1-$2')\n .replace(/(::)/g, '--')\n .toLowerCase() === controller.identifier\n )\n })\n\n return controller || controllers[0]\n}\n\nexport { allReflexControllers, findControllerByReflexName }\n","import CableReady from 'cable_ready'\n\nimport Debug from './debug'\nimport Schema from './schema'\nimport IsolationMode from './isolation_mode'\n\nimport { reflexes } from './reflex_store'\nimport { dispatchLifecycleEvent } from './lifecycle'\nimport { XPathToElement, debounce, emitEvent } from './utils'\nimport { allReflexControllers, findControllerByReflexName } from './controllers'\nimport { attributeValue, attributeValues } from './attributes'\n\nconst received = data => {\n if (!data.cableReady) return\n\n if (data.version.replace('.pre', '-pre') !== CableReady.version) {\n if (Debug.enabled)\n console.error(\n `Reflex failed due to cable_ready gem/NPM package version mismatch. Package versions must match exactly.\\nNote that if you are using pre-release builds, gems use the \"x.y.z.preN\" version format, while NPM packages use \"x.y.z-preN\".\\n\\ncable_ready gem: ${data.version}\\ncable_ready NPM: ${CableReady.version}`\n )\n return\n }\n\n let reflexOperations = []\n\n for (let i = data.operations.length - 1; i >= 0; i--) {\n if (data.operations[i].stimulusReflex) {\n reflexOperations.push(data.operations[i])\n data.operations.splice(i, 1)\n }\n }\n\n if (\n reflexOperations.some(\n operation => operation.stimulusReflex.url !== location.href\n )\n ) {\n return\n }\n\n let reflexData\n\n if (reflexOperations.length) {\n reflexData = reflexOperations[0].stimulusReflex\n reflexData.payload = reflexOperations[0].payload\n }\n\n if (reflexData) {\n const { reflexId, payload } = reflexData\n\n if (!reflexes[reflexId] && IsolationMode.disabled) {\n const controllerElement = XPathToElement(reflexData.xpathController)\n const reflexElement = XPathToElement(reflexData.xpathElement)\n\n controllerElement.reflexController =\n controllerElement.reflexController || {}\n controllerElement.reflexData = controllerElement.reflexData || {}\n controllerElement.reflexError = controllerElement.reflexError || {}\n\n controllerElement.reflexController[\n reflexId\n ] = reflexes.app.getControllerForElementAndIdentifier(\n controllerElement,\n reflexData.reflexController\n )\n\n controllerElement.reflexData[reflexId] = reflexData\n\n dispatchLifecycleEvent(\n 'before',\n reflexElement,\n controllerElement,\n reflexId,\n payload\n )\n\n registerReflex(reflexData)\n }\n\n if (reflexes[reflexId]) {\n reflexes[reflexId].totalOperations = reflexOperations.length\n reflexes[reflexId].pendingOperations = reflexOperations.length\n reflexes[reflexId].completedOperations = 0\n reflexes[reflexId].piggybackOperations = data.operations\n CableReady.perform(reflexOperations)\n }\n } else {\n if (data.operations.length && reflexes[data.operations[0].reflexId]) {\n CableReady.perform(data.operations)\n }\n }\n}\n\nconst registerReflex = data => {\n const { reflexId } = data\n reflexes[reflexId] = { finalStage: 'finalize' }\n\n const promise = new Promise((resolve, reject) => {\n reflexes[reflexId].promise = {\n resolve,\n reject,\n data\n }\n })\n\n promise.reflexId = reflexId\n\n if (Debug.enabled) promise.catch(() => {})\n\n return promise\n}\n\n// compute the DOM element(s) which will be the morph root\n// use the data-reflex-root attribute on the reflex or the controller\n// optional value is a CSS selector(s); comma-separated list\n// order of preference is data-reflex, data-controller, document body (default)\nconst getReflexRoots = element => {\n let list = []\n while (list.length === 0 && element) {\n let reflexRoot = element.getAttribute(Schema.reflexRoot)\n if (reflexRoot) {\n if (reflexRoot.length === 0 && element.id) reflexRoot = `#${element.id}`\n const selectors = reflexRoot.split(',').filter(s => s.trim().length)\n if (Debug.enabled && selectors.length === 0) {\n console.error(\n `No value found for ${Schema.reflexRoot}. Add an #id to the element or provide a value for ${Schema.reflexRoot}.`,\n element\n )\n }\n list = list.concat(selectors.filter(s => document.querySelector(s)))\n }\n element = element.parentElement\n ? element.parentElement.closest(`[${Schema.reflexRoot}]`)\n : null\n }\n return list\n}\n\n// Sets up declarative reflex behavior.\n// Any elements that define data-reflex will automatically be wired up with the default StimulusReflexController.\n//\nconst setupDeclarativeReflexes = debounce(() => {\n document.querySelectorAll(`[${Schema.reflex}]`).forEach(element => {\n const controllers = attributeValues(element.getAttribute(Schema.controller))\n const reflexAttributeNames = attributeValues(\n element.getAttribute(Schema.reflex)\n )\n const actions = attributeValues(element.getAttribute(Schema.action))\n reflexAttributeNames.forEach(reflexName => {\n const controller = findControllerByReflexName(\n reflexName,\n allReflexControllers(reflexes.app, element)\n )\n let action\n if (controller) {\n action = `${reflexName.split('->')[0]}->${\n controller.identifier\n }#__perform`\n if (!actions.includes(action)) actions.push(action)\n } else {\n action = `${reflexName.split('->')[0]}->stimulus-reflex#__perform`\n if (!controllers.includes('stimulus-reflex')) {\n controllers.push('stimulus-reflex')\n }\n if (!actions.includes(action)) actions.push(action)\n }\n })\n const controllerValue = attributeValue(controllers)\n const actionValue = attributeValue(actions)\n if (\n controllerValue &&\n element.getAttribute(Schema.controller) != controllerValue\n ) {\n element.setAttribute(Schema.controller, controllerValue)\n }\n if (actionValue && element.getAttribute(Schema.action) != actionValue)\n element.setAttribute(Schema.action, actionValue)\n })\n emitEvent('stimulus-reflex:ready')\n}, 20)\n\nexport { received, registerReflex, getReflexRoots, setupDeclarativeReflexes }\n","import Schema from './schema'\n\nimport { extractElementAttributes, extractElementDataset } from './attributes'\nimport { getReflexRoots } from './reflexes'\nimport { uuidv4 } from './utils'\nimport { elementToXPath } from './utils'\n\nimport { version } from '../package.json'\n\nexport default class ReflexData {\n constructor (\n options,\n reflexElement,\n controllerElement,\n reflexController,\n permanentAttributeName,\n target,\n args,\n url,\n tabId\n ) {\n this.options = options\n this.reflexElement = reflexElement\n this.controllerElement = controllerElement\n this.reflexController = reflexController\n this.permanentAttributeName = permanentAttributeName\n this.target = target\n this.args = args\n this.url = url\n this.tabId = tabId\n }\n\n get attrs () {\n this._attrs =\n this._attrs ||\n this.options['attrs'] ||\n extractElementAttributes(this.reflexElement)\n\n return this._attrs\n }\n\n get reflexId () {\n this._reflexId = this._reflexId || this.options['reflexId'] || uuidv4()\n return this._reflexId\n }\n\n get selectors () {\n this._selectors =\n this._selectors ||\n this.options['selectors'] ||\n getReflexRoots(this.reflexElement)\n\n return typeof this._selectors === 'string'\n ? [this._selectors]\n : this._selectors\n }\n\n get resolveLate () {\n return this.options['resolveLate'] || false\n }\n\n get dataset () {\n this._dataset = this._dataset || extractElementDataset(this.reflexElement)\n return this._dataset\n }\n\n get innerHTML () {\n return this.includeInnerHtml ? this.reflexElement.innerHTML : ''\n }\n\n get textContent () {\n return this.includeTextContent ? this.reflexElement.textContent : ''\n }\n\n get xpathController () {\n return elementToXPath(this.controllerElement)\n }\n\n get xpathElement () {\n return elementToXPath(this.reflexElement)\n }\n\n get formSelector () {\n const attr = this.reflexElement.attributes[Schema.reflexFormSelector]\n ? this.reflexElement.attributes[Schema.reflexFormSelector].value\n : undefined\n return this.options['formSelector'] || attr\n }\n\n get includeInnerHtml () {\n const attr =\n this.reflexElement.attributes[Schema.reflexIncludeInnerHtml] || false\n return this.options['includeInnerHTML'] || attr\n ? attr.value !== 'false'\n : false\n }\n\n get includeTextContent () {\n const attr =\n this.reflexElement.attributes[Schema.reflexIncludeTextContent] || false\n return this.options['includeTextContent'] || attr\n ? attr.value !== 'false'\n : false\n }\n\n get suppressLogging () {\n return (\n this.options['suppressLogging'] ||\n this.reflexElement.attributes[Schema.reflexSuppressLogging] ||\n false\n )\n }\n\n valueOf () {\n return {\n attrs: this.attrs,\n dataset: this.dataset,\n selectors: this.selectors,\n reflexId: this.reflexId,\n resolveLate: this.resolveLate,\n suppressLogging: this.suppressLogging,\n xpathController: this.xpathController,\n xpathElement: this.xpathElement,\n inner_html: this.innerHTML,\n text_content: this.textContent,\n formSelector: this.formSelector,\n reflexController: this.reflexController,\n permanentAttributeName: this.permanentAttributeName,\n target: this.target,\n args: this.args,\n url: this.url,\n tabId: this.tabId,\n version\n }\n }\n}\n","import { createConsumer } from '@rails/actioncable'\nimport { received } from '../reflexes'\nimport { emitEvent } from '../utils'\n\nlet consumer\nlet params\nlet subscriptionActive\n\nconst createSubscription = controller => {\n consumer = consumer || controller.application.consumer || createConsumer()\n const { channel } = controller.StimulusReflex\n const subscription = { channel, ...params }\n const identifier = JSON.stringify(subscription)\n\n controller.StimulusReflex.subscription =\n consumer.subscriptions.findAll(identifier)[0] ||\n consumer.subscriptions.create(subscription, {\n received,\n connected,\n rejected,\n disconnected\n })\n}\n\nconst connected = () => {\n subscriptionActive = true\n document.body.classList.replace(\n 'stimulus-reflex-disconnected',\n 'stimulus-reflex-connected'\n )\n emitEvent('stimulus-reflex:connected')\n emitEvent('stimulus-reflex:action-cable:connected')\n}\n\nconst rejected = () => {\n subscriptionActive = false\n document.body.classList.replace(\n 'stimulus-reflex-connected',\n 'stimulus-reflex-disconnected'\n )\n emitEvent('stimulus-reflex:rejected')\n emitEvent('stimulus-reflex:action-cable:rejected')\n if (Debug.enabled) console.warn('Channel subscription was rejected.')\n}\n\nconst disconnected = willAttemptReconnect => {\n subscriptionActive = false\n document.body.classList.replace(\n 'stimulus-reflex-connected',\n 'stimulus-reflex-disconnected'\n )\n emitEvent('stimulus-reflex:disconnected', willAttemptReconnect)\n emitEvent('stimulus-reflex:action-cable:disconnected', willAttemptReconnect)\n}\n\nexport default {\n consumer,\n params,\n get subscriptionActive () {\n return subscriptionActive\n },\n createSubscription,\n connected,\n rejected,\n disconnected,\n set (consumerValue, paramsValue) {\n consumer = consumerValue\n params = paramsValue\n }\n}\n","import CableReady from 'cable_ready'\n\nimport Log from './log'\n\nimport { reflexes } from './reflex_store'\nimport { dispatchLifecycleEvent } from './lifecycle'\nimport { XPathToElement } from './utils'\n\nconst beforeDOMUpdate = event => {\n const { stimulusReflex, payload } = event.detail || {}\n if (!stimulusReflex) return\n const { reflexId, xpathElement, xpathController } = stimulusReflex\n const controllerElement = XPathToElement(xpathController)\n const reflexElement = XPathToElement(xpathElement)\n const reflex = reflexes[reflexId]\n const { promise } = reflex\n\n reflex.pendingOperations--\n\n if (reflex.pendingOperations > 0) return\n\n if (!stimulusReflex.resolveLate)\n setTimeout(() =>\n promise.resolve({\n element: reflexElement,\n event,\n data: promise.data,\n payload,\n reflexId,\n toString: () => ''\n })\n )\n\n setTimeout(() =>\n dispatchLifecycleEvent(\n 'success',\n reflexElement,\n controllerElement,\n reflexId,\n payload\n )\n )\n}\n\nconst afterDOMUpdate = event => {\n const { stimulusReflex, payload } = event.detail || {}\n if (!stimulusReflex) return\n const { reflexId, xpathElement, xpathController } = stimulusReflex\n const controllerElement = XPathToElement(xpathController)\n const reflexElement = XPathToElement(xpathElement)\n const reflex = reflexes[reflexId]\n const { promise } = reflex\n\n reflex.completedOperations++\n\n Log.success(event, false)\n\n if (reflex.completedOperations < reflex.totalOperations) return\n\n if (stimulusReflex.resolveLate)\n setTimeout(() =>\n promise.resolve({\n element: reflexElement,\n event,\n data: promise.data,\n payload,\n reflexId,\n toString: () => ''\n })\n )\n\n setTimeout(() =>\n dispatchLifecycleEvent(\n 'finalize',\n reflexElement,\n controllerElement,\n reflexId,\n payload\n )\n )\n\n if (reflex.piggybackOperations.length)\n CableReady.perform(reflex.piggybackOperations)\n}\n\nconst routeReflexEvent = event => {\n const { stimulusReflex, payload, name, body } = event.detail || {}\n const eventType = name.split('-')[2]\n if (!stimulusReflex || !['nothing', 'halted', 'error'].includes(eventType))\n return\n\n const { reflexId, xpathElement, xpathController } = stimulusReflex\n const reflexElement = XPathToElement(xpathElement)\n const controllerElement = XPathToElement(xpathController)\n const reflex = reflexes[reflexId]\n const { promise } = reflex\n\n if (controllerElement) {\n controllerElement.reflexError = controllerElement.reflexError || {}\n if (eventType === 'error') controllerElement.reflexError[reflexId] = body\n }\n\n switch (eventType) {\n case 'nothing':\n nothing(event, payload, promise, reflex, reflexElement)\n break\n case 'error':\n error(event, payload, promise, reflex, reflexElement)\n break\n case 'halted':\n halted(event, payload, promise, reflex, reflexElement)\n break\n }\n\n setTimeout(() =>\n dispatchLifecycleEvent(\n eventType,\n reflexElement,\n controllerElement,\n reflexId,\n payload\n )\n )\n\n if (reflex.piggybackOperations.length)\n CableReady.perform(reflex.piggybackOperations)\n}\n\nconst nothing = (event, payload, promise, reflex, reflexElement) => {\n reflex.finalStage = 'after'\n\n Log.success(event, false)\n\n setTimeout(() =>\n promise.resolve({\n data: promise.data,\n element: reflexElement,\n event,\n payload,\n reflexId: promise.data.reflexId,\n toString: () => ''\n })\n )\n}\n\nconst halted = (event, payload, promise, reflex, reflexElement) => {\n reflex.finalStage = 'halted'\n\n Log.success(event, true)\n\n setTimeout(() =>\n promise.resolve({\n data: promise.data,\n element: reflexElement,\n event,\n payload,\n reflexId: promise.data.reflexId,\n toString: () => ''\n })\n )\n}\n\nconst error = (event, payload, promise, reflex, reflexElement) => {\n reflex.finalStage = 'after'\n\n Log.error(event)\n\n setTimeout(() =>\n promise.reject({\n data: promise.data,\n element: reflexElement,\n event,\n payload,\n reflexId: promise.data.reflexId,\n error: event.detail.body,\n toString: () => event.detail.body\n })\n )\n}\n\nexport { beforeDOMUpdate, afterDOMUpdate, routeReflexEvent }\n","import { Controller } from '@hotwired/stimulus'\n\nimport Schema from './schema'\nimport Log from './log'\nimport Debug from './debug'\nimport Deprecate from './deprecate'\nimport ReflexData from './reflex_data'\nimport IsolationMode from './isolation_mode'\nimport ActionCableTransport from './transports/action_cable'\n\nimport { dispatchLifecycleEvent } from './lifecycle'\nimport { uuidv4, serializeForm } from './utils'\nimport { beforeDOMUpdate, afterDOMUpdate, routeReflexEvent } from './callbacks'\nimport { registerReflex, setupDeclarativeReflexes } from './reflexes'\nimport { reflexes } from './reflex_store'\nimport { attributeValues } from './attributes'\n\n// Default StimulusReflexController that is implicitly wired up as data-controller for any DOM elements\n// that have configured data-reflex. Note that this default can be overridden when initializing the application.\n// i.e. StimulusReflex.initialize(myStimulusApplication, MyCustomDefaultController);\n//\nclass StimulusReflexController extends Controller {\n constructor (...args) {\n super(...args)\n register(this)\n }\n}\n\n// Initializes StimulusReflex by registering the default Stimulus controller with the passed Stimulus application.\n//\n// - application - the Stimulus application\n// - options\n// * controller - [optional] the default StimulusReflexController\n// * consumer - [optional] the ActionCable consumer\n// * debug - [false] log all Reflexes to the console\n// * params - [{}] key/value parameters to send during channel subscription\n// * isolate - [false] restrict Reflex playback to the tab which initiated it\n// * deprecate - [true] show warnings regarding upcoming changes to the library\n//\nconst initialize = (\n application,\n { controller, consumer, debug, params, isolate, deprecate } = {}\n) => {\n ActionCableTransport.set(consumer, params)\n document.addEventListener(\n 'DOMContentLoaded',\n () => {\n document.body.classList.remove('stimulus-reflex-connected')\n document.body.classList.add('stimulus-reflex-disconnected')\n if (Deprecate.enabled && consumer)\n console.warn(\n \"Deprecation warning: the next version of StimulusReflex will obtain a reference to consumer via the Stimulus application object.\\nPlease add 'application.consumer = consumer' to your index.js after your Stimulus application has been established, and remove the consumer key from your StimulusReflex initialize() options object.\"\n )\n if (Deprecate.enabled && IsolationMode.disabled)\n console.warn(\n 'Deprecation warning: the next version of StimulusReflex will standardize isolation mode, and the isolate option will be removed.\\nPlease update your applications to assume that every tab will be isolated.'\n )\n },\n { once: true }\n )\n IsolationMode.set(!!isolate)\n reflexes.app = application\n Schema.set(application)\n reflexes.app.register(\n 'stimulus-reflex',\n controller || StimulusReflexController\n )\n Debug.set(!!debug)\n if (typeof deprecate !== 'undefined') Deprecate.set(deprecate)\n const observer = new MutationObserver(setupDeclarativeReflexes)\n observer.observe(document.documentElement, {\n attributeFilter: [Schema.reflex, Schema.action],\n childList: true,\n subtree: true\n })\n}\n\n// Registers a Stimulus controller and extends it with StimulusReflex behavior\n//\n// controller - the Stimulus controller\n// options - [optional] configuration\n//\nconst register = (controller, options = {}) => {\n const channel = 'StimulusReflex::Channel'\n controller.StimulusReflex = { ...options, channel }\n ActionCableTransport.createSubscription(controller)\n Object.assign(controller, {\n // Indicates if the ActionCable web socket connection is open.\n // The connection must be open before calling stimulate.\n //\n isActionCableConnectionOpen () {\n return this.StimulusReflex.subscription.consumer.connection.isOpen()\n },\n\n // Invokes a server side reflex method.\n //\n // - target - the reflex target (full name of the server side reflex) i.e. 'ReflexClassName#method'\n // - reflexElement - [optional] the element that triggered the reflex, defaults to this.element\n // - options - [optional] an object that contains at least one of attrs, reflexId, selectors, resolveLate, serializeForm\n // - *args - remaining arguments are forwarded to the server side reflex method\n //\n stimulate () {\n const url = location.href\n const args = Array.from(arguments)\n const target = args.shift() || 'StimulusReflex::Reflex#default_reflex'\n const controllerElement = this.element\n const reflexElement =\n args[0] && args[0].nodeType === Node.ELEMENT_NODE\n ? args.shift()\n : controllerElement\n if (\n reflexElement.type === 'number' &&\n reflexElement.validity &&\n reflexElement.validity.badInput\n ) {\n if (Debug.enabled) console.warn('Reflex aborted: invalid numeric input')\n return\n }\n const options = {}\n if (\n args[0] &&\n typeof args[0] === 'object' &&\n Object.keys(args[0]).filter(key =>\n [\n 'attrs',\n 'selectors',\n 'reflexId',\n 'resolveLate',\n 'serializeForm',\n 'suppressLogging',\n 'includeInnerHTML',\n 'includeTextContent'\n ].includes(key)\n ).length\n ) {\n const opts = args.shift()\n Object.keys(opts).forEach(o => (options[o] = opts[o]))\n }\n\n const reflexData = new ReflexData(\n options,\n reflexElement,\n controllerElement,\n this.identifier,\n Schema.reflexPermanent,\n target,\n args,\n url,\n tabId\n )\n\n const reflexId = reflexData.reflexId\n\n if (!this.isActionCableConnectionOpen())\n throw 'The ActionCable connection is not open! `this.isActionCableConnectionOpen()` must return true before calling `this.stimulate()`'\n\n if (!ActionCableTransport.subscriptionActive)\n throw 'The ActionCable channel subscription for StimulusReflex was rejected.'\n\n // lifecycle setup\n controllerElement.reflexController =\n controllerElement.reflexController || {}\n controllerElement.reflexData = controllerElement.reflexData || {}\n controllerElement.reflexError = controllerElement.reflexError || {}\n\n controllerElement.reflexController[reflexId] = this\n controllerElement.reflexData[reflexId] = reflexData.valueOf()\n\n dispatchLifecycleEvent(\n 'before',\n reflexElement,\n controllerElement,\n reflexId\n )\n\n setTimeout(() => {\n const { params } = controllerElement.reflexData[reflexId] || {}\n const check = reflexElement.attributes[Schema.reflexSerializeForm]\n if (check) {\n // not needed after v4 because this is only here for the deprecation warning\n options['serializeForm'] = check.value !== 'false'\n }\n\n const form =\n reflexElement.closest(reflexData.formSelector) ||\n document.querySelector(reflexData.formSelector) ||\n reflexElement.closest('form')\n\n if (Deprecate.enabled && options['serializeForm'] === undefined && form)\n console.warn(\n `Deprecation warning: the next version of StimulusReflex will not serialize forms by default.\\nPlease set ${Schema.reflexSerializeForm}=\\\"true\\\" on your Reflex Controller Element or pass { serializeForm: true } as an option to stimulate.`\n )\n const formData =\n options['serializeForm'] === false\n ? ''\n : serializeForm(form, {\n element: reflexElement\n })\n\n controllerElement.reflexData[reflexId] = {\n ...reflexData.valueOf(),\n params,\n formData\n }\n\n this.StimulusReflex.subscription.send(\n controllerElement.reflexData[reflexId]\n )\n })\n\n const promise = registerReflex(reflexData.valueOf())\n\n Log.request(\n reflexId,\n target,\n args,\n this.context.scope.identifier,\n reflexElement,\n controllerElement\n )\n\n return promise\n },\n\n // Wraps the call to stimulate for any data-reflex elements.\n // This is internal and should not be invoked directly.\n __perform (event) {\n let element = event.target\n let reflex\n\n while (element && !reflex) {\n reflex = element.getAttribute(Schema.reflex)\n if (!reflex || !reflex.trim().length) element = element.parentElement\n }\n\n const match = attributeValues(reflex).find(\n reflex => reflex.split('->')[0] === event.type\n )\n\n if (match) {\n event.preventDefault()\n event.stopPropagation()\n this.stimulate(match.split('->')[1], element)\n }\n }\n })\n}\n\n// Uniquely identify this browser tab in each Reflex\nconst tabId = uuidv4()\n\nconst useReflex = (controller, options = {}) => {\n register(controller, options)\n}\n\ndocument.addEventListener('cable-ready:after-dispatch-event', routeReflexEvent)\ndocument.addEventListener('cable-ready:before-inner-html', beforeDOMUpdate)\ndocument.addEventListener('cable-ready:before-morph', beforeDOMUpdate)\ndocument.addEventListener('cable-ready:after-inner-html', afterDOMUpdate)\ndocument.addEventListener('cable-ready:after-morph', afterDOMUpdate)\nwindow.addEventListener('load', setupDeclarativeReflexes)\n\nexport {\n initialize,\n register,\n useReflex\n}\n","export * from './stimulus_reflex'\n\nimport * as StimulusReflex from './stimulus_reflex'\n\nimport Debug from './debug'\nimport Deprecate from './deprecate'\n\nconst global = {\n ...StimulusReflex,\n get debug () {\n return Debug.value\n },\n set debug (value) {\n Debug.set(!!value)\n },\n get deprecate () {\n return Deprecate.value\n },\n set deprecate (value) {\n Deprecate.set(!!value)\n }\n}\n\nwindow.StimulusReflex = global\n\nexport default global\n"],"names":["defaultSchema","reflexAttribute","reflexPermanentAttribute","reflexRootAttribute","reflexSuppressLoggingAttribute","reflexDatasetAttribute","reflexDatasetAllAttribute","reflexSerializeFormAttribute","reflexFormSelectorAttribute","reflexIncludeInnerHtmlAttribute","reflexIncludeTextContentAttribute","schema","Schema","set","application","attribute","Object","defineProperty","this","slice","get","debugging","Debug$1","enabled","disabled","value","debug","reflexes","Log","reflexId","target","args","controller","element","controllerElement","reflex","Debug","promise","data","suppressLogging","timestamp","Date","console","log","event","halted","detail","selector","payload","morph","stimulusReflex","progress","totalOperations","completedOperations","duration","operation","type","split","join","body","deprecationWarnings","Deprecate","deprecate","uuidv4","crypto","window","msCrypto","replace","c","getRandomValues","Uint8Array","toString","camelize","uppercaseFirstLetter","$1","toUpperCase","toLowerCase","substr","emitEvent","document","dispatchEvent","CustomEvent","bubbles","cancelable","jQuery","trigger","elementToXPath","id","ix","siblings","parentNode","childNodes","i","length","sibling","tagName","nodeType","XPathToElement","xpath","evaluate","XPathResult","FIRST_ORDERED_NODE_TYPE","singleNodeValue","XPathToArray","reverse","snapshotList","ORDERED_NODE_SNAPSHOT_TYPE","snapshots","snapshotLength","push","snapshotItem","attributeValue","values","filter","v","String","map","trim","attributeValues","extractElementAttributes","attrs","Array","from","attributes","reduce","memo","attr","name","checked","selected","tag_name","match","includes","querySelectorAll","multipleInstances","collectedOptions","concat","elem","o","collectCheckedOptions","getElementsFromTokens","tokens","elements","xPath","forEach","token","warn","error","extractDataAttributes","startsWith","isolationMode","IsolationMode","invokeLifecycleMethod","stage","reflexElement","reflexData","reflexController","reflexMethodName","specificLifecycleMethod","genericLifecycleMethod","call","reflexError","finalStage","Reflect","deleteProperty","addEventListener","dispatchLifecycleEvent","warned","action","options","localReflexControllers","app","getAttribute","getControllerForElementAndIdentifier","StimulusReflex","received","cableReady","version","CableReady","reflexOperations","operations","splice","some","url","location","href","xpathController","xpathElement","registerReflex","pendingOperations","piggybackOperations","perform","Promise","resolve","reject","catch","setupDeclarativeReflexes","callback","delay","timeoutId","clearTimeout","setTimeout","debounce","controllers","reflexAttributeNames","actions","reflexName","find","identifier","reflexString","extractReflexName","findControllerByReflexName","parentElement","allReflexControllers","controllerValue","actionValue","setAttribute","ReflexData","constructor","permanentAttributeName","tabId","_attrs","_reflexId","selectors","_selectors","list","reflexRoot","s","querySelector","closest","getReflexRoots","resolveLate","dataset","_dataset","reflexDataset","allDataset","reflexDatasetAll","allTokens","datasetElements","datasetAllElements","datasetAttributes","acc","ele","elementDataset","datasetAll","elementAttributes","keys","key","isArray","extractElementDataset","innerHTML","includeInnerHtml","textContent","includeTextContent","formSelector","reflexFormSelector","undefined","reflexIncludeInnerHtml","reflexIncludeTextContent","reflexSuppressLogging","valueOf","inner_html","text_content","consumer","params","subscriptionActive","connected","classList","rejected","disconnected","willAttemptReconnect","ActionCableTransport","createSubscription","createConsumer","channel","subscription","JSON","stringify","subscriptions","findAll","create","consumerValue","paramsValue","beforeDOMUpdate","afterDOMUpdate","nothing","StimulusReflexController","Controller","super","register","initialize","isolate","remove","add","once","MutationObserver","observe","documentElement","attributeFilter","childList","subtree","assign","isActionCableConnectionOpen","connection","isOpen","stimulate","arguments","shift","Node","ELEMENT_NODE","validity","badInput","opts","reflexPermanent","check","reflexSerializeForm","form","formData","w","FormData","e","encodeURIComponent","submitButton","nodeName","serializeForm","send","context","scope","__perform","preventDefault","stopPropagation","useReflex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,IAAa4H,IAAU9H,EAASE,GAAUqI,aACrDC,QAAQC,eAAelI,EAAkB0H,iBAAkB/H,GAC3DsI,QAAQC,eAAelI,EAAkByH,WAAY9H,GACrDsI,QAAQC,eAAelI,EAAkB+H,YAAapI,KAS1DkD,SAASsF,iBACP,0BACAzH,GACE4G,EACE,SACA5G,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,WAEjB,GAGF+B,SAASsF,iBACP,2BACAzH,IACE4G,EACE,UACA5G,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,SAEfsH,EACE,QACA1H,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,YAGjB,GAGF+B,SAASsF,iBACP,2BACAzH,IACE0H,EACE,UACA1H,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,YAGjB,GAGF+B,SAASsF,iBACP,yBACAzH,IACE4G,EACE,QACA5G,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,SAEfsH,EACE,QACA1H,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,YAGjB,GAGF+B,SAASsF,iBACP,0BACAzH,GACE4G,EACE,SACA5G,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,WAEjB,GAGF+B,SAASsF,iBACP,yBACAzH,GACE4G,EACE,QACA5G,EAAME,OAAOb,QACbW,EAAME,OAAOd,WAAWC,QACxBW,EAAME,OAAOjB,SACbe,EAAME,OAAOE,WAEjB,GAGF+B,SAASsF,iBACP,4BACAzH,GACE4G,EACE,WACA5G,E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