cable_ready 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -3
- data/app/assets/javascripts/cable_ready.js +134 -18
- data/app/assets/javascripts/cable_ready.min.js +2 -0
- data/app/assets/javascripts/cable_ready.min.js.map +1 -0
- data/app/assets/javascripts/cable_ready.umd.js +132 -18
- data/app/assets/javascripts/cable_ready.umd.min.js +2 -0
- data/app/assets/javascripts/cable_ready.umd.min.js.map +1 -0
- data/app/helpers/cable_ready/view_helper.rb +2 -1
- data/app/models/concerns/cable_ready/updatable.rb +3 -4
- data/cable_ready.gemspec~ +40 -0
- data/lib/cable_ready/channels.rb +2 -0
- data/lib/cable_ready/config.rb +3 -1
- data/lib/cable_ready/engine.rb +4 -0
- data/lib/cable_ready/operation_builder.rb +6 -2
- data/lib/cable_ready/version.rb +1 -1
- data/package.json +2 -2
- data/yarn.lock +433 -71
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 740e012630c79e657256a99d309e96704f2dfc7080d056edcd68c23ab18aebb2
|
4
|
+
data.tar.gz: 356b0038be58993b208f1128465d46a0ed4bf0cf858038e2a44b86275b8447f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea5efc0262818516332c01f9e6ef98fc935c0f56e0f0a73f7ccf43c88f8774d7ccc9fd6fef4acf2f83ca77a446735a836f55a23d1391fbcc5c8811b667c5d3c
|
7
|
+
data.tar.gz: 0b199e3a2950c6103e2099a194973db49ac89f53a8698693ef12767665f20497bec903336a9f197f93b006120e35e14645ad37c18b9b2ecedb87d2eee8aae7d8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (5.0.
|
4
|
+
cable_ready (5.0.1)
|
5
5
|
actionpack (>= 5.2)
|
6
6
|
actionview (>= 5.2)
|
7
7
|
activesupport (>= 5.2)
|
@@ -108,9 +108,11 @@ GEM
|
|
108
108
|
net-smtp (0.3.3)
|
109
109
|
net-protocol
|
110
110
|
nio4r (2.5.8)
|
111
|
-
nokogiri (1.14.
|
111
|
+
nokogiri (1.14.3-arm64-darwin)
|
112
112
|
racc (~> 1.4)
|
113
|
-
nokogiri (1.14.
|
113
|
+
nokogiri (1.14.3-x86_64-darwin)
|
114
|
+
racc (~> 1.4)
|
115
|
+
nokogiri (1.14.3-x86_64-linux)
|
114
116
|
racc (~> 1.4)
|
115
117
|
parallel (1.22.1)
|
116
118
|
parser (3.2.1.0)
|
@@ -178,6 +180,7 @@ GEM
|
|
178
180
|
actionpack (>= 5.2)
|
179
181
|
activesupport (>= 5.2)
|
180
182
|
sprockets (>= 3.0.0)
|
183
|
+
sqlite3 (1.6.0-arm64-darwin)
|
181
184
|
sqlite3 (1.6.0-x86_64-darwin)
|
182
185
|
sqlite3 (1.6.0-x86_64-linux)
|
183
186
|
standard (1.19.1)
|
@@ -198,7 +201,9 @@ GEM
|
|
198
201
|
zeitwerk (2.6.7)
|
199
202
|
|
200
203
|
PLATFORMS
|
204
|
+
arm64-darwin-22
|
201
205
|
x86_64-darwin-19
|
206
|
+
x86_64-darwin-22
|
202
207
|
x86_64-linux
|
203
208
|
|
204
209
|
DEPENDENCIES
|
@@ -2,7 +2,7 @@ import morphdom from "morphdom";
|
|
2
2
|
|
3
3
|
var name = "cable_ready";
|
4
4
|
|
5
|
-
var version = "5.0.
|
5
|
+
var version = "5.0.1";
|
6
6
|
|
7
7
|
var description = "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.";
|
8
8
|
|
@@ -59,7 +59,7 @@ var devDependencies = {
|
|
59
59
|
rollup: "^3.19.1",
|
60
60
|
sinon: "^15.0.2",
|
61
61
|
vite: "^4.1.4",
|
62
|
-
vitepress: "^1.0.0-
|
62
|
+
vitepress: "^1.0.0-beta.1",
|
63
63
|
"vitepress-plugin-search": "^1.0.4-alpha.19"
|
64
64
|
};
|
65
65
|
|
@@ -292,8 +292,29 @@ async function graciouslyFetch(url, additionalHeaders) {
|
|
292
292
|
}
|
293
293
|
}
|
294
294
|
|
295
|
+
class BoundedQueue {
|
296
|
+
constructor(maxSize) {
|
297
|
+
this.maxSize = maxSize;
|
298
|
+
this.queue = [];
|
299
|
+
}
|
300
|
+
push(item) {
|
301
|
+
if (this.isFull()) {
|
302
|
+
// Remove the oldest item to make space for the new one
|
303
|
+
this.shift();
|
304
|
+
}
|
305
|
+
this.queue.push(item);
|
306
|
+
}
|
307
|
+
shift() {
|
308
|
+
return this.queue.shift();
|
309
|
+
}
|
310
|
+
isFull() {
|
311
|
+
return this.queue.length === this.maxSize;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
295
315
|
var utils = Object.freeze({
|
296
316
|
__proto__: null,
|
317
|
+
BoundedQueue: BoundedQueue,
|
297
318
|
after: after,
|
298
319
|
assignFocus: assignFocus,
|
299
320
|
before: before,
|
@@ -984,42 +1005,52 @@ var Debug = {
|
|
984
1005
|
|
985
1006
|
const request = (data, blocks) => {
|
986
1007
|
if (Debug.disabled) return;
|
987
|
-
|
1008
|
+
const message = `↑ Updatable request affecting ${blocks.length} element(s): `;
|
1009
|
+
console.log(message, {
|
988
1010
|
elements: blocks.map((b => b.element)),
|
989
1011
|
identifiers: blocks.map((b => b.element.getAttribute("identifier"))),
|
990
1012
|
data: data
|
991
1013
|
});
|
1014
|
+
return message;
|
992
1015
|
};
|
993
1016
|
|
994
1017
|
const cancel = (timestamp, reason) => {
|
995
1018
|
if (Debug.disabled) return;
|
996
1019
|
const duration = new Date - timestamp;
|
997
|
-
|
1020
|
+
const message = `❌ Updatable request canceled after ${duration}ms: ${reason}`;
|
1021
|
+
console.log(message);
|
1022
|
+
return message;
|
998
1023
|
};
|
999
1024
|
|
1000
1025
|
const response = (timestamp, element, urls) => {
|
1001
1026
|
if (Debug.disabled) return;
|
1002
1027
|
const duration = new Date - timestamp;
|
1003
|
-
|
1028
|
+
const message = `↓ Updatable response: All URLs fetched in ${duration}ms`;
|
1029
|
+
console.log(message, {
|
1004
1030
|
element: element,
|
1005
1031
|
urls: urls
|
1006
1032
|
});
|
1033
|
+
return message;
|
1007
1034
|
};
|
1008
1035
|
|
1009
1036
|
const morphStart = (timestamp, element) => {
|
1010
1037
|
if (Debug.disabled) return;
|
1011
1038
|
const duration = new Date - timestamp;
|
1012
|
-
|
1039
|
+
const message = `↻ Updatable morph: starting after ${duration}ms`;
|
1040
|
+
console.log(message, {
|
1013
1041
|
element: element
|
1014
1042
|
});
|
1043
|
+
return message;
|
1015
1044
|
};
|
1016
1045
|
|
1017
1046
|
const morphEnd = (timestamp, element) => {
|
1018
1047
|
if (Debug.disabled) return;
|
1019
1048
|
const duration = new Date - timestamp;
|
1020
|
-
|
1049
|
+
const message = `↺ Updatable morph: completed after ${duration}ms`;
|
1050
|
+
console.log(message, {
|
1021
1051
|
element: element
|
1022
1052
|
});
|
1053
|
+
return message;
|
1023
1054
|
};
|
1024
1055
|
|
1025
1056
|
var Log = {
|
@@ -1030,6 +1061,56 @@ var Log = {
|
|
1030
1061
|
morphEnd: morphEnd
|
1031
1062
|
};
|
1032
1063
|
|
1064
|
+
class AppearanceObserver {
|
1065
|
+
constructor(delegate, element = null) {
|
1066
|
+
this.delegate = delegate;
|
1067
|
+
this.element = element || delegate;
|
1068
|
+
this.started = false;
|
1069
|
+
this.intersecting = false;
|
1070
|
+
this.intersectionObserver = new IntersectionObserver(this.intersect);
|
1071
|
+
}
|
1072
|
+
start() {
|
1073
|
+
if (!this.started) {
|
1074
|
+
this.started = true;
|
1075
|
+
this.intersectionObserver.observe(this.element);
|
1076
|
+
this.observeVisibility();
|
1077
|
+
}
|
1078
|
+
}
|
1079
|
+
stop() {
|
1080
|
+
if (this.started) {
|
1081
|
+
this.started = false;
|
1082
|
+
this.intersectionObserver.unobserve(this.element);
|
1083
|
+
this.unobserveVisibility();
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
observeVisibility=() => {
|
1087
|
+
document.addEventListener("visibilitychange", this.handleVisibilityChange);
|
1088
|
+
};
|
1089
|
+
unobserveVisibility=() => {
|
1090
|
+
document.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
1091
|
+
};
|
1092
|
+
intersect=entries => {
|
1093
|
+
entries.forEach((entry => {
|
1094
|
+
if (entry.target === this.element) {
|
1095
|
+
if (entry.isIntersecting && document.visibilityState === "visible") {
|
1096
|
+
this.intersecting = true;
|
1097
|
+
this.delegate.appearedInViewport();
|
1098
|
+
} else {
|
1099
|
+
this.intersecting = false;
|
1100
|
+
this.delegate.disappearedFromViewport();
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
}));
|
1104
|
+
};
|
1105
|
+
handleVisibilityChange=event => {
|
1106
|
+
if (document.visibilityState === "visible" && this.intersecting) {
|
1107
|
+
this.delegate.appearedInViewport();
|
1108
|
+
} else {
|
1109
|
+
this.delegate.disappearedFromViewport();
|
1110
|
+
}
|
1111
|
+
};
|
1112
|
+
}
|
1113
|
+
|
1033
1114
|
const template = `\n<style>\n :host {\n display: block;\n }\n</style>\n<slot></slot>\n`;
|
1034
1115
|
|
1035
1116
|
class UpdatesForElement extends SubscribingElement {
|
@@ -1042,6 +1123,11 @@ class UpdatesForElement extends SubscribingElement {
|
|
1042
1123
|
mode: "open"
|
1043
1124
|
});
|
1044
1125
|
shadowRoot.innerHTML = template;
|
1126
|
+
this.triggerElementLog = new BoundedQueue(10);
|
1127
|
+
this.targetElementLog = new BoundedQueue(10);
|
1128
|
+
this.appearanceObserver = new AppearanceObserver(this);
|
1129
|
+
this.visible = false;
|
1130
|
+
this.didTransitionToVisible = false;
|
1045
1131
|
}
|
1046
1132
|
async connectedCallback() {
|
1047
1133
|
if (this.preview) return;
|
@@ -1052,18 +1138,27 @@ class UpdatesForElement extends SubscribingElement {
|
|
1052
1138
|
} else {
|
1053
1139
|
console.error("The `cable_ready_updates_for` helper cannot connect. You must initialize CableReady with an Action Cable consumer.");
|
1054
1140
|
}
|
1141
|
+
if (this.observeAppearance) {
|
1142
|
+
this.appearanceObserver.start();
|
1143
|
+
}
|
1144
|
+
}
|
1145
|
+
disconnectedCallback() {
|
1146
|
+
if (this.observeAppearance) {
|
1147
|
+
this.appearanceObserver.stop();
|
1148
|
+
}
|
1055
1149
|
}
|
1056
1150
|
async update(data) {
|
1057
1151
|
this.lastUpdateTimestamp = new Date;
|
1058
1152
|
const blocks = Array.from(document.querySelectorAll(this.query), (element => new Block(element))).filter((block => block.shouldUpdate(data)));
|
1059
|
-
Log.request(data, blocks);
|
1153
|
+
this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.request(data, blocks)}`);
|
1060
1154
|
if (blocks.length === 0) {
|
1061
|
-
Log.cancel(this.lastUpdateTimestamp, "All elements filtered out");
|
1155
|
+
this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.cancel(this.lastUpdateTimestamp, "All elements filtered out")}`);
|
1062
1156
|
return;
|
1063
1157
|
}
|
1064
1158
|
// first <cable-ready-updates-for> element in the DOM *at any given moment* updates all of the others
|
1065
|
-
|
1066
|
-
|
1159
|
+
// if the element becomes visible though, we have to overrule and load it
|
1160
|
+
if (blocks[0].element !== this && !this.didTransitionToVisible) {
|
1161
|
+
this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.cancel(this.lastUpdateTimestamp, "Update already requested")}`);
|
1067
1162
|
return;
|
1068
1163
|
}
|
1069
1164
|
// hold a reference to the active element so that it can be restored after the morph
|
@@ -1079,7 +1174,7 @@ class UpdatesForElement extends SubscribingElement {
|
|
1079
1174
|
this.html[url] = await response.text();
|
1080
1175
|
}
|
1081
1176
|
})));
|
1082
|
-
Log.response(this.lastUpdateTimestamp, this, uniqueUrls);
|
1177
|
+
this.triggerElementLog.push(`${(new Date).toLocaleString()}: ${Log.response(this.lastUpdateTimestamp, this, uniqueUrls)}`);
|
1083
1178
|
// track current block index for each URL; referred to as fragments
|
1084
1179
|
this.index = {};
|
1085
1180
|
blocks.forEach((block => {
|
@@ -1088,6 +1183,17 @@ class UpdatesForElement extends SubscribingElement {
|
|
1088
1183
|
block.process(data, this.html, this.index, this.lastUpdateTimestamp);
|
1089
1184
|
}));
|
1090
1185
|
}
|
1186
|
+
appearedInViewport() {
|
1187
|
+
if (!this.visible) {
|
1188
|
+
// transition from invisible to visible forces update
|
1189
|
+
this.didTransitionToVisible = true;
|
1190
|
+
this.update({});
|
1191
|
+
}
|
1192
|
+
this.visible = true;
|
1193
|
+
}
|
1194
|
+
disappearedFromViewport() {
|
1195
|
+
this.visible = false;
|
1196
|
+
}
|
1091
1197
|
get query() {
|
1092
1198
|
return `${this.tagName}[identifier="${this.identifier}"]`;
|
1093
1199
|
}
|
@@ -1097,21 +1203,24 @@ class UpdatesForElement extends SubscribingElement {
|
|
1097
1203
|
get debounce() {
|
1098
1204
|
return this.hasAttribute("debounce") ? parseInt(this.getAttribute("debounce")) : 20;
|
1099
1205
|
}
|
1206
|
+
get observeAppearance() {
|
1207
|
+
return this.hasAttribute("observe-appearance");
|
1208
|
+
}
|
1100
1209
|
}
|
1101
1210
|
|
1102
1211
|
class Block {
|
1103
1212
|
constructor(element) {
|
1104
1213
|
this.element = element;
|
1105
1214
|
}
|
1106
|
-
async process(data, html,
|
1107
|
-
const blockIndex =
|
1215
|
+
async process(data, html, fragmentsIndex, startTimestamp) {
|
1216
|
+
const blockIndex = fragmentsIndex[this.url];
|
1108
1217
|
const template = document.createElement("template");
|
1109
1218
|
this.element.setAttribute("updating", "updating");
|
1110
1219
|
template.innerHTML = String(html[this.url]).trim();
|
1111
1220
|
await this.resolveTurboFrames(template.content);
|
1112
1221
|
const fragments = template.content.querySelectorAll(this.query);
|
1113
1222
|
if (fragments.length <= blockIndex) {
|
1114
|
-
console.warn(`Update aborted due to insufficient number of elements. The offending url is ${this.url}
|
1223
|
+
console.warn(`Update aborted due to insufficient number of elements. The offending url is ${this.url}, the offending element is:`, this.element);
|
1115
1224
|
return;
|
1116
1225
|
}
|
1117
1226
|
const operation = {
|
@@ -1120,17 +1229,18 @@ class Block {
|
|
1120
1229
|
permanentAttributeName: "data-ignore-updates"
|
1121
1230
|
};
|
1122
1231
|
dispatch(this.element, "cable-ready:before-update", operation);
|
1123
|
-
Log.morphStart(startTimestamp, this.element);
|
1232
|
+
this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${Log.morphStart(startTimestamp, this.element)}`);
|
1124
1233
|
morphdom(this.element, fragments[blockIndex], {
|
1125
1234
|
childrenOnly: true,
|
1126
1235
|
onBeforeElUpdated: shouldMorph(operation),
|
1127
1236
|
onElUpdated: _ => {
|
1128
1237
|
this.element.removeAttribute("updating");
|
1238
|
+
this.element.didTransitionToVisible = false;
|
1129
1239
|
dispatch(this.element, "cable-ready:after-update", operation);
|
1130
1240
|
assignFocus(operation.focusSelector);
|
1131
1241
|
}
|
1132
1242
|
});
|
1133
|
-
Log.morphEnd(startTimestamp, this.element);
|
1243
|
+
this.element.targetElementLog.push(`${(new Date).toLocaleString()}: ${Log.morphEnd(startTimestamp, this.element)}`);
|
1134
1244
|
}
|
1135
1245
|
async resolveTurboFrames(documentFragment) {
|
1136
1246
|
const reloadingTurboFrames = [ ...documentFragment.querySelectorAll('turbo-frame[src]:not([loading="lazy"])') ];
|
@@ -1152,7 +1262,7 @@ class Block {
|
|
1152
1262
|
}
|
1153
1263
|
shouldUpdate(data) {
|
1154
1264
|
// if everything that could prevent an update is false, update this block
|
1155
|
-
return !this.ignoresInnerUpdates && this.hasChangesSelectedForUpdate(data);
|
1265
|
+
return !this.ignoresInnerUpdates && this.hasChangesSelectedForUpdate(data) && (!this.observeAppearance || this.visible);
|
1156
1266
|
}
|
1157
1267
|
hasChangesSelectedForUpdate(data) {
|
1158
1268
|
// if there's an only attribute, only update if at least one of the attributes changed is in the allow list
|
@@ -1172,6 +1282,12 @@ class Block {
|
|
1172
1282
|
get query() {
|
1173
1283
|
return this.element.query;
|
1174
1284
|
}
|
1285
|
+
get visible() {
|
1286
|
+
return this.element.visible;
|
1287
|
+
}
|
1288
|
+
get observeAppearance() {
|
1289
|
+
return this.element.observeAppearance;
|
1290
|
+
}
|
1175
1291
|
}
|
1176
1292
|
|
1177
1293
|
const registerInnerUpdates = () => {
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import e from"morphdom";var t="5.0.0-pre9";const n={INPUT:!0,TEXTAREA:!0,SELECT:!0},o={INPUT:!0,TEXTAREA:!0,OPTION:!0},r={"datetime-local":!0,"select-multiple":!0,"select-one":!0,color:!0,date:!0,datetime:!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,textarea:!0,time:!0,url:!0,week:!0};let s;var a={get element(){return s},set(e){s=e}};const i=e=>n[e.tagName]&&r[e.type],l=e=>{const t=(e&&e.nodeType===Node.ELEMENT_NODE?e:document.querySelector(e))||a.element;t&&t.focus&&t.focus()},c=(e,t,n={})=>{const o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o),window.jQuery&&window.jQuery(e).trigger(t,n)},u=e=>document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,d=(e,t=!1)=>{const n=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let e=0;e<n.snapshotLength;e++)o.push(n.snapshotItem(e));return t?o.reverse():o},m=e=>Array.from(e).flat(),h=(e,t)=>{Array.from(e.selectAll?e.element:[e.element]).forEach(t)},p=(f=function(e,t,n){return e+(n?"-":"")+t.toLowerCase()},function(e){return b(e).reduce(f,"")});var f;const b=e=>(e=null==e?"":e).match(/([A-Z]{2,}|[0-9]+|[A-Z]?[a-z]+|[A-Z])/g)||[],g=(e,t)=>!e.cancel&&(e.delay?setTimeout(t,e.delay):t(),!0),y=(e,t)=>c(e,`cable-ready:before-${p(t.operation)}`,t),w=(e,t)=>c(e,`cable-ready:after-${p(t.operation)}`,t);function E(e,t=250){let n;return(...o)=>{n&&clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}}function v(e){if(!e.ok)throw Error(e.statusText);return e}function A(e){return void 0===e||["string","number","boolean"].includes(typeof e)||console.warn(`Operation expects a string, number or boolean, but got ${e} (${typeof e})`),null!=e?e:""}function T(e){return void 0!==e&&"string"!=typeof e&&console.warn(`Operation expects a string, but got ${e} (${typeof e})`),null!=e?String(e):""}function S(e){return void 0===e||Array.isArray(e)||console.warn(`Operation expects an array, but got ${e} (${typeof e})`),null!=e?Array.from(e):[]}function C(e){return void 0!==e&&"object"!=typeof e&&console.warn(`Operation expects an object, but got ${e} (${typeof e})`),null!=e?Object(e):{}}function M(e){return void 0===e||Array.isArray(e)||"string"==typeof e||console.warn(`Operation expects an Array or a String, but got ${e} (${typeof e})`),null==e?"":Array.isArray(e)?Array.from(e):String(e)}async function x(e,t){try{const n=await fetch(e,{headers:{"X-REQUESTED-WITH":"XmlHttpRequest",...t}});if(null==n)return;return v(n),n}catch(t){console.error(`Could not fetch ${e}`)}}var O=Object.freeze({__proto__:null,after:w,assignFocus:l,before:y,debounce:E,dispatch:c,fragmentToString:function(e){return(new XMLSerializer).serializeToString(e)},getClassNames:m,graciouslyFetch:x,handleErrors:v,isTextInput:i,kebabize:p,operate:g,processElements:h,safeArray:S,safeObject:C,safeScalar:A,safeString:T,safeStringOrArray:M,xpathToElement:u,xpathToElementArray:d});const L=e=>(t,n)=>!q.map((o=>"function"!=typeof o||o(e,t,n))).includes(!1),R=e=>t=>{D.forEach((n=>{"function"==typeof n&&n(e,t)}))},$=(e,t,n)=>!(!o[t.tagName]&&t.isEqualNode(n)),U=(e,t,n)=>t!==a.element||!t.isContentEditable,k=(e,t,n)=>{const{permanentAttributeName:o}=e;if(!o)return!0;const r=t.closest(`[${o}]`);if(!r&&t===a.element&&i(t)){const e={value:!0};return Array.from(n.attributes).forEach((n=>{e[n.name]||t.setAttribute(n.name,n.value)})),!1}return!r},q=[$,k,U],D=[];var N=Object.freeze({__proto__:null,didMorph:R,didMorphCallbacks:D,shouldMorph:L,shouldMorphCallbacks:q,verifyNotContentEditable:U,verifyNotMutable:$,verifyNotPermanent:k}),P={append:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{html:n,focusSelector:o}=e;t.insertAdjacentHTML("beforeend",A(n)),l(o)})),w(t,e)}))},graft:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{parent:n,focusSelector:o}=e,r=document.querySelector(n);r&&(r.appendChild(t),l(o))})),w(t,e)}))},innerHtml:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{html:n,focusSelector:o}=e;t.innerHTML=A(n),l(o)})),w(t,e)}))},insertAdjacentHtml:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{html:n,position:o,focusSelector:r}=e;t.insertAdjacentHTML(o||"beforeend",A(n)),l(r)})),w(t,e)}))},insertAdjacentText:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{text:n,position:o,focusSelector:r}=e;t.insertAdjacentText(o||"beforeend",A(n)),l(r)})),w(t,e)}))},outerHtml:e=>{h(e,(t=>{const n=t.parentElement,o=n&&Array.from(n.children).indexOf(t);y(t,e),g(e,(()=>{const{html:n,focusSelector:o}=e;t.outerHTML=A(n),l(o)})),w(n?n.children[o]:document.documentElement,e)}))},prepend:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{html:n,focusSelector:o}=e;t.insertAdjacentHTML("afterbegin",A(n)),l(o)})),w(t,e)}))},remove:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{focusSelector:n}=e;t.remove(),l(n)})),w(document,e)}))},replace:e=>{h(e,(t=>{const n=t.parentElement,o=n&&Array.from(n.children).indexOf(t);y(t,e),g(e,(()=>{const{html:n,focusSelector:o}=e;t.outerHTML=A(n),l(o)})),w(n?n.children[o]:document.documentElement,e)}))},textContent:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{text:n,focusSelector:o}=e;t.textContent=A(n),l(o)})),w(t,e)}))},addCssClass:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n}=e;t.classList.add(...m([M(n)]))})),w(t,e)}))},removeAttribute:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n}=e;t.removeAttribute(T(n))})),w(t,e)}))},removeCssClass:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n}=e;t.classList.remove(...m([M(n)])),0===t.classList.length&&t.removeAttribute("class")})),w(t,e)}))},setAttribute:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n,value:o}=e;t.setAttribute(T(n),A(o))})),w(t,e)}))},setDatasetProperty:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n,value:o}=e;t.dataset[T(n)]=A(o)})),w(t,e)}))},setProperty:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n,value:o}=e;n in t&&(t[T(n)]=A(o))})),w(t,e)}))},setStyle:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n,value:o}=e;t.style[T(n)]=A(o)})),w(t,e)}))},setStyles:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{styles:n}=e;for(let[e,o]of Object.entries(n))t.style[T(e)]=A(o)})),w(t,e)}))},setValue:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{value:n}=e;t.value=A(n)})),w(t,e)}))},dispatchEvent:e=>{h(e,(t=>{y(t,e),g(e,(()=>{const{name:n,detail:o}=e;c(t,T(n),C(o))})),w(t,e)}))},setMeta:e=>{y(document,e),g(e,(()=>{const{name:t,content:n}=e;let o=document.head.querySelector(`meta[name='${t}']`);o||(o=document.createElement("meta"),o.name=T(t),document.head.appendChild(o)),o.content=A(n)})),w(document,e)},setTitle:e=>{y(document,e),g(e,(()=>{const{title:t}=e;document.title=A(t)})),w(document,e)},clearStorage:e=>{y(document,e),g(e,(()=>{const{type:t}=e;("session"===t?sessionStorage:localStorage).clear()})),w(document,e)},go:e=>{y(window,e),g(e,(()=>{const{delta:t}=e;history.go(t)})),w(window,e)},pushState:e=>{y(window,e),g(e,(()=>{const{state:t,title:n,url:o}=e;history.pushState(C(t),T(n),T(o))})),w(window,e)},redirectTo:e=>{y(window,e),g(e,(()=>{let{url:t,action:n,turbo:o}=e;n=n||"advance",t=T(t),void 0===o&&(o=!0),o?(window.Turbo&&window.Turbo.visit(t,{action:n}),window.Turbolinks&&window.Turbolinks.visit(t,{action:n}),window.Turbo||window.Turbolinks||(window.location.href=t)):window.location.href=t})),w(window,e)},reload:e=>{y(window,e),g(e,(()=>{window.location.reload()})),w(window,e)},removeStorageItem:e=>{y(document,e),g(e,(()=>{const{key:t,type:n}=e;("session"===n?sessionStorage:localStorage).removeItem(T(t))})),w(document,e)},replaceState:e=>{y(window,e),g(e,(()=>{const{state:t,title:n,url:o}=e;history.replaceState(C(t),T(n),T(o))})),w(window,e)},scrollIntoView:e=>{const{element:t}=e;y(t,e),g(e,(()=>{t.scrollIntoView(e)})),w(t,e)},setCookie:e=>{y(document,e),g(e,(()=>{const{cookie:t}=e;document.cookie=A(t)})),w(document,e)},setFocus:e=>{const{element:t}=e;y(t,e),g(e,(()=>{l(t)})),w(t,e)},setStorageItem:e=>{y(document,e),g(e,(()=>{const{key:t,value:n,type:o}=e;("session"===o?sessionStorage:localStorage).setItem(T(t),A(n))})),w(document,e)},consoleLog:e=>{y(document,e),g(e,(()=>{const{message:t,level:n}=e;n&&["warn","info","error"].includes(n)?console[n](t):console.log(t)})),w(document,e)},consoleTable:e=>{y(document,e),g(e,(()=>{const{data:t,columns:n}=e;console.table(t,S(n))})),w(document,e)},notification:e=>{y(document,e),g(e,(()=>{const{title:t,options:n}=e;Notification.requestPermission().then((o=>{e.permission=o,"granted"===o&&new Notification(T(t),C(n))}))})),w(document,e)},morph:t=>{h(t,(n=>{const{html:o}=t,r=document.createElement("template");r.innerHTML=String(A(o)).trim(),t.content=r.content;const s=n.parentElement,a=s&&Array.from(s.children).indexOf(n);y(n,t),g(t,(()=>{const{childrenOnly:o,focusSelector:s}=t;e(n,o?r.content:r.innerHTML,{childrenOnly:!!o,onBeforeElUpdated:L(t),onElUpdated:R(t)}),l(s)})),w(s?s.children[a]:document.documentElement,t)}))}};let H=P;const I=e=>{H={...H,...e}};var _={get all(){return H}};let j="warn";var z={get behavior(){return j},set(e){["warn","ignore","event","exception"].includes(e)?j=e:console.warn("Invalid 'onMissingElement' option. Defaulting to 'warn'.")}};const F=(e,t={onMissingElement:z.behavior})=>{const n={};e.forEach((e=>{e.batch&&(n[e.batch]=n[e.batch]?++n[e.batch]:1)})),e.forEach((e=>{const o=e.operation;try{if(e.selector?e.xpath?e.element=e.selectAll?d(e.selector):u(e.selector):e.element=e.selectAll?document.querySelectorAll(e.selector):document.querySelector(e.selector):e.element=document,e.element||"ignore"!==t.onMissingElement){a.set(document.activeElement);const t=_.all[o];t?(t(e),e.batch&&0==--n[e.batch]&&c(document,"cable-ready:batch-complete",{batch:e.batch})):console.error(`CableReady couldn't find the "${o}" operation. Make sure you use the camelized form when calling an operation method.`)}}catch(n){if(e.element)console.error(`CableReady detected an error in ${o||"operation"}: ${n.message}. If you need to support older browsers make sure you've included the corresponding polyfills. https://docs.stimulusreflex.com/setup#polyfills-for-ie11.`),console.error(n);else{const n=`CableReady ${o||""} operation failed due to missing DOM element for selector: '${e.selector}'`;switch(t.onMissingElement){case"ignore":break;case"event":c(document,"cable-ready:missing-element",{warning:n,operation:e});break;case"exception":throw n;default:console.warn(n)}}}}))};class X extends HTMLElement{disconnectedCallback(){this.channel&&this.channel.unsubscribe()}createSubscription(e,t,n){this.channel=e.subscriptions.create({channel:t,identifier:this.identifier},{received:n})}get preview(){return document.documentElement.hasAttribute("data-turbolinks-preview")||document.documentElement.hasAttribute("data-turbo-preview")}get identifier(){return this.getAttribute("identifier")}}let V;const Y=[25,50,75,100,200,250,500,800,1e3,2e3],Q=async(e=0)=>{if(V)return V;if(e>=Y.length)throw new Error("Couldn't obtain a Action Cable consumer within 5s");var t;return await(t=Y[e],new Promise((e=>setTimeout(e,t)))),await Q(e+1)};var Z={setConsumer(e){V=e},get consumer(){return V},getConsumer:async()=>await Q()};class B extends X{static define(){customElements.get("stream-from")||customElements.define("stream-from",this)}async connectedCallback(){if(this.preview)return;const e=await Z.getConsumer();e?this.createSubscription(e,"CableReady::Stream",this.performOperations.bind(this)):console.error("The `stream_from` helper cannot connect. You must initialize CableReady with an Action Cable consumer.")}performOperations(e){e.cableReady&&F(e.operations,{onMissingElement:this.onMissingElement})}get onMissingElement(){const e=this.getAttribute("missing")||z.behavior;return["warn","ignore","event"].includes(e)?e:(console.warn("Invalid 'missing' attribute. Defaulting to 'warn'."),"warn")}}let W=!1;var G={get enabled(){return W},get disabled(){return!W},get value(){return W},set(e){W=!!e},set debug(e){W=!!e}};var J=(e,t)=>{G.disabled||console.log(`↑ Updatable request affecting ${t.length} element(s): `,{elements:t.map((e=>e.element)),identifiers:t.map((e=>e.element.getAttribute("identifier"))),data:e})},K=(e,t)=>{if(G.disabled)return;const n=new Date-e;console.log(`❌ Updatable request canceled after ${n}ms: ${t}`)},ee=(e,t,n)=>{if(G.disabled)return;const o=new Date-e;console.log(`↓ Updatable response: All URLs fetched in ${o}ms`,{element:t,urls:n})},te=(e,t)=>{if(G.disabled)return;const n=new Date-e;console.log(`↻ Updatable morph: starting after ${n}ms`,{element:t})},ne=(e,t)=>{if(G.disabled)return;const n=new Date-e;console.log(`↺ Updatable morph: completed after ${n}ms`,{element:t})};class oe extends X{static define(){customElements.get("updates-for")||customElements.define("updates-for",this)}constructor(){super();this.attachShadow({mode:"open"}).innerHTML="\n<style>\n :host {\n display: block;\n }\n</style>\n<slot></slot>\n"}async connectedCallback(){if(this.preview)return;this.update=E(this.update.bind(this),this.debounce);const e=await Z.getConsumer();e?this.createSubscription(e,"CableReady::Stream",this.update):console.error("The `updates-for` helper cannot connect. You must initialize CableReady with an Action Cable consumer.")}async update(e){this.lastUpdateTimestamp=new Date;const t=Array.from(document.querySelectorAll(this.query),(e=>new re(e))).filter((t=>t.shouldUpdate(e)));if(J(e,t),0===t.length)return void K(this.lastUpdateTimestamp,"All elements filtered out");if(t[0].element!==this)return void K(this.lastUpdateTimestamp,"Update already requested");a.set(document.activeElement),this.html={};const n=[...new Set(t.map((e=>e.url)))];await Promise.all(n.map((async e=>{if(!this.html.hasOwnProperty(e)){const t=await x(e,{"X-Cable-Ready":"update"});this.html[e]=await t.text()}}))),ee(this.lastUpdateTimestamp,this,n),this.index={},t.forEach((t=>{this.index.hasOwnProperty(t.url)?this.index[t.url]++:this.index[t.url]=0,t.process(e,this.html,this.index,this.lastUpdateTimestamp)}))}get query(){return`updates-for[identifier="${this.identifier}"]`}get identifier(){return this.getAttribute("identifier")}get debounce(){return this.hasAttribute("debounce")?parseInt(this.getAttribute("debounce")):20}}class re{constructor(e){this.element=e}async process(t,n,o,r){const s=o[this.url],a=document.createElement("template");this.element.setAttribute("updating","updating"),a.innerHTML=String(n[this.url]).trim(),await this.resolveTurboFrames(a.content);const i=a.content.querySelectorAll(this.query);if(i.length<=s)return void console.warn(`Update aborted due to insufficient number of elements. The offending url is ${this.url}.`);const u={element:this.element,html:i[s],permanentAttributeName:"data-ignore-updates"};c(this.element,"cable-ready:before-update",u),te(r,this.element),e(this.element,i[s],{childrenOnly:!0,onBeforeElUpdated:L(u),onElUpdated:e=>{this.element.removeAttribute("updating"),c(this.element,"cable-ready:after-update",u),l(u.focusSelector)}}),ne(r,this.element)}async resolveTurboFrames(e){const t=[...e.querySelectorAll('turbo-frame[src]:not([loading="lazy"])')];return Promise.all(t.map((e=>new Promise((async t=>{const n=await x(e.getAttribute("src"),{"Turbo-Frame":e.id,"X-Cable-Ready":"update"}),o=document.createElement("template");o.innerHTML=await n.text(),await this.resolveTurboFrames(o.content);const r=`turbo-frame#${e.id}`,s=o.content.querySelector(r),a=s?s.innerHTML.trim():"";docFragment.querySelector(r).innerHTML=a,t()})))))}shouldUpdate(e){return!this.ignoresInnerUpdates&&this.hasChangesSelectedForUpdate(e)}hasChangesSelectedForUpdate(e){const t=this.element.getAttribute("only");return!(t&&e.changed&&!t.split(" ").some((t=>e.changed.includes(t))))}get ignoresInnerUpdates(){return this.element.hasAttribute("ignore-inner-updates")&&this.element.hasAttribute("performing-inner-update")}get url(){return this.element.hasAttribute("url")?this.element.getAttribute("url"):location.href}get identifier(){return this.element.identifier}get query(){return this.element.query}}const se=e=>{const t=e&&e.parentElement&&e.parentElement.closest("updates-for");t&&(t.setAttribute("performing-inner-update",""),se(t))},ae=e=>{const t=e&&e.parentElement&&e.parentElement.closest("updates-for");t&&(t.removeAttribute("performing-inner-update"),ae(t))},ie=()=>{document.addEventListener("stimulus-reflex:before",(e=>{se(e.detail.element)})),document.addEventListener("stimulus-reflex:after",(e=>{setTimeout((()=>{ae(e.detail.element)}))})),document.addEventListener("turbo:submit-start",(e=>{se(e.target)})),document.addEventListener("turbo:submit-end",(e=>{setTimeout((()=>{ae(e.target)}))})),document.addEventListener("turbo-boost:command:start",(e=>{se(e.target)})),document.addEventListener("turbo-boost:command:finish",(e=>{setTimeout((()=>{ae(e.target)}))})),document.addEventListener("turbo-boost:command:error",(e=>{setTimeout((()=>{ae(e.target)}))})),B.define(),oe.define()},le={perform:F,performAsync:(e,t={onMissingElement:z.behavior})=>new Promise(((n,o)=>{try{n(F(e,t))}catch(e){o(e)}})),shouldMorphCallbacks:q,didMorphCallbacks:D,initialize:(e={})=>{const{consumer:t,onMissingElement:n,debug:o}=e;G.set(!!o),t?Z.setConsumer(t):console.error("CableReady requires a reference to your Action Cable `consumer` for its helpers to function.\nEnsure that you have imported the `CableReady` package as well as `consumer` from your `channels` folder, then call `CableReady.initialize({ consumer })`."),n&&MissingElement.set(n),ie()},addOperation:(e,t)=>{const n={};n[e]=t,I(n)},addOperations:e=>{I(e)},version:t,cable:Z,get DOMOperations(){return console.warn("DEPRECATED: Please use `CableReady.operations` instead of `CableReady.DOMOperations`"),_.all},get operations(){return _.all},get consumer(){return Z.consumer}};window.CableReady=le;export{N as MorphCallbacks,B as StreamFromElement,X as SubscribingElement,oe as UpdatesForElement,O as Utils,le as default};
|
2
|
+
//# sourceMappingURL=cable_ready.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cable_ready.min.js","sources":["../../../javascript/enums.js","../../../javascript/active_element.js","../../../javascript/utils.js","../../../javascript/morph_callbacks.js","../../../javascript/operations.js","../../../javascript/operation_store.js","../../../javascript/missing_element.js","../../../javascript/cable_ready.js","../../../javascript/elements/subscribing_element.js","../../../javascript/cable_consumer.js","../../../javascript/elements/stream_from_element.js","../../../javascript/debug.js","../../../javascript/updatable/log.js","../../../javascript/elements/updates_for_element.js","../../../javascript/updatable/inner_updates_compat.js","../../../javascript/elements/index.js","../../../javascript/index.js"],"sourcesContent":["export const inputTags = {\n INPUT: true,\n TEXTAREA: true,\n SELECT: true\n}\n\nexport const mutableTags = {\n INPUT: true,\n TEXTAREA: true,\n OPTION: true\n}\n\nexport const textInputTypes = {\n 'datetime-local': true,\n 'select-multiple': true,\n 'select-one': true,\n color: true,\n date: true,\n datetime: true,\n email: true,\n month: true,\n number: true,\n password: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n textarea: true,\n time: true,\n url: true,\n week: true\n}\n","let activeElement\n\nexport default {\n get element () {\n return activeElement\n },\n set (element) {\n activeElement = element\n }\n}\n","import { inputTags, textInputTypes } from './enums'\nimport ActiveElement from './active_element'\n\n// Indicates if the passed element is considered a text input.\n//\nconst isTextInput = element => {\n return inputTags[element.tagName] && textInputTypes[element.type]\n}\n\n// Assigns focus to the appropriate element... preferring the explicitly passed selector\n//\n// * selector - a CSS selector for the element that should have focus\n//\nconst assignFocus = selector => {\n const element =\n selector && selector.nodeType === Node.ELEMENT_NODE\n ? selector\n : document.querySelector(selector)\n const focusElement = element || ActiveElement.element\n if (focusElement && focusElement.focus) focusElement.focus()\n}\n\n// Dispatches an event on the passed element\n//\n// * element - the element\n// * name - the name of the event\n// * detail - the event detail\n//\nconst dispatch = (element, name, detail = {}) => {\n const init = { bubbles: true, cancelable: true, detail }\n const event = new CustomEvent(name, init)\n element.dispatchEvent(event)\n if (window.jQuery) window.jQuery(element).trigger(name, detail)\n}\n\n// Accepts an xPath query and returns the element found at that position in the DOM\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\n// Accepts an xPath query and returns all matching elements in the DOM\n//\nconst xpathToElementArray = (xpath, reverse = false) => {\n const snapshotList = document.evaluate(\n xpath,\n document,\n null,\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,\n null\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\n// Return an array with the class names to be used\n//\n// * names - could be a string or an array of strings for multiple classes.\n//\nconst getClassNames = names => Array.from(names).flat()\n\n// Perform operation for either the first or all of the elements returned by CSS selector\n//\n// * operation - the instruction payload from perform\n// * callback - the operation function to run for each element\n//\nconst processElements = (operation, callback) => {\n Array.from(\n operation.selectAll ? operation.element : [operation.element]\n ).forEach(callback)\n}\n\n// convert string to kebab-case\n// most other implementations (lodash) are focused on camelCase to kebab-case\n// instead, this uses word token boundaries to produce readable URL slugs and keys\n// this implementation will not support Emoji or other non-ASCII characters\n//\nconst kebabize = createCompounder(function (result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase()\n})\n\nfunction createCompounder (callback) {\n return function (str) {\n return words(str).reduce(callback, '')\n }\n}\n\nconst words = str => {\n str = str == null ? '' : str\n return str.match(/([A-Z]{2,}|[0-9]+|[A-Z]?[a-z]+|[A-Z])/g) || []\n}\n\n// Provide a standardized pipeline of checks and modifications to all operations based on provided options\n// Currently skips execution if cancelled and implements an optional delay\n//\nconst operate = (operation, callback) => {\n if (!operation.cancel) {\n operation.delay ? setTimeout(callback, operation.delay) : callback()\n return true\n }\n return false\n}\n\n// Dispatch life-cycle events with standardized naming\nconst before = (target, operation) =>\n dispatch(\n target,\n `cable-ready:before-${kebabize(operation.operation)}`,\n operation\n )\n\nconst after = (target, operation) =>\n dispatch(\n target,\n `cable-ready:after-${kebabize(operation.operation)}`,\n operation\n )\n\nfunction debounce (fn, delay = 250) {\n let timer\n return (...args) => {\n const callback = () => fn.apply(this, args)\n if (timer) clearTimeout(timer)\n timer = setTimeout(callback, delay)\n }\n}\n\nfunction handleErrors (response) {\n if (!response.ok) throw Error(response.statusText)\n return response\n}\n\nfunction safeScalar (val) {\n if (\n val !== undefined &&\n !['string', 'number', 'boolean'].includes(typeof val)\n )\n console.warn(\n `Operation expects a string, number or boolean, but got ${val} (${typeof val})`\n )\n return val != null ? val : ''\n}\n\nfunction safeString (str) {\n if (str !== undefined && typeof str !== 'string')\n console.warn(`Operation expects a string, but got ${str} (${typeof str})`)\n\n return str != null ? String(str) : ''\n}\n\nfunction safeArray (arr) {\n if (arr !== undefined && !Array.isArray(arr))\n console.warn(`Operation expects an array, but got ${arr} (${typeof arr})`)\n return arr != null ? Array.from(arr) : []\n}\n\nfunction safeObject (obj) {\n if (obj !== undefined && typeof obj !== 'object')\n console.warn(`Operation expects an object, but got ${obj} (${typeof obj})`)\n return obj != null ? Object(obj) : {}\n}\n\nfunction safeStringOrArray (elem) {\n if (elem !== undefined && !Array.isArray(elem) && typeof elem !== 'string')\n console.warn(`Operation expects an Array or a String, but got ${elem} (${typeof elem})`)\n\n return elem == null ? '' : Array.isArray(elem) ? Array.from(elem) : String(elem)\n}\n\nfunction fragmentToString (fragment) {\n return new XMLSerializer().serializeToString(fragment)\n}\n\n// A proxy method to wrap a fetch call in error handling\n//\n// * url - the URL to fetch\n// * additionalHeaders - an object of additional headers passed to fetch\n//\nasync function graciouslyFetch (url, additionalHeaders) {\n try {\n const response = await fetch(url, {\n headers: {\n 'X-REQUESTED-WITH': 'XmlHttpRequest',\n ...additionalHeaders\n }\n })\n if (response == undefined) return\n\n handleErrors(response)\n\n return response\n } catch (e) {\n console.error(`Could not fetch ${url}`)\n }\n}\n\nexport {\n isTextInput,\n assignFocus,\n dispatch,\n xpathToElement,\n xpathToElementArray,\n getClassNames,\n processElements,\n operate,\n before,\n after,\n debounce,\n handleErrors,\n graciouslyFetch,\n kebabize,\n safeScalar,\n safeString,\n safeArray,\n safeObject,\n safeStringOrArray,\n fragmentToString\n}\n","import { mutableTags } from './enums'\nimport { isTextInput } from './utils'\nimport ActiveElement from './active_element'\n\n// Indicates whether or not we should morph an element via onBeforeElUpdated callback\n// SEE: https://github.com/patrick-steele-idem/morphdom#morphdomfromnode-tonode-options--node\n//\nconst shouldMorph = operation => (fromEl, toEl) => {\n return !shouldMorphCallbacks\n .map(callback => {\n return typeof callback === 'function'\n ? callback(operation, fromEl, toEl)\n : true\n })\n .includes(false)\n}\n\n// Execute any pluggable functions that modify elements after morphing via onElUpdated callback\n//\nconst didMorph = operation => el => {\n didMorphCallbacks.forEach(callback => {\n if (typeof callback === 'function') callback(operation, el)\n })\n}\n\nconst verifyNotMutable = (detail, fromEl, toEl) => {\n // Skip nodes that are equal:\n // https://github.com/patrick-steele-idem/morphdom#can-i-make-morphdom-blaze-through-the-dom-tree-even-faster-yes\n if (!mutableTags[fromEl.tagName] && fromEl.isEqualNode(toEl)) return false\n return true\n}\n\nconst verifyNotContentEditable = (detail, fromEl, toEl) => {\n if (fromEl === ActiveElement.element && fromEl.isContentEditable) return false\n return true\n}\n\nconst verifyNotPermanent = (detail, fromEl, toEl) => {\n const { permanentAttributeName } = detail\n if (!permanentAttributeName) return true\n\n const permanent = fromEl.closest(`[${permanentAttributeName}]`)\n\n // only morph attributes on the active non-permanent text input\n if (!permanent && fromEl === ActiveElement.element && isTextInput(fromEl)) {\n const ignore = { value: true }\n Array.from(toEl.attributes).forEach(attribute => {\n if (!ignore[attribute.name])\n fromEl.setAttribute(attribute.name, attribute.value)\n })\n return false\n }\n\n return !permanent\n}\n\nconst shouldMorphCallbacks = [\n verifyNotMutable,\n verifyNotPermanent,\n verifyNotContentEditable\n]\nconst didMorphCallbacks = []\n\nexport {\n shouldMorphCallbacks,\n didMorphCallbacks,\n shouldMorph,\n didMorph,\n verifyNotMutable,\n verifyNotContentEditable,\n verifyNotPermanent\n}\n","import morphdom from 'morphdom'\n\nimport { shouldMorph, didMorph } from './morph_callbacks'\nimport {\n assignFocus,\n dispatch,\n getClassNames,\n processElements,\n before,\n after,\n operate,\n safeScalar,\n safeString,\n safeArray,\n safeObject,\n safeStringOrArray\n} from './utils'\n\nexport default {\n // DOM Mutations\n\n append: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.insertAdjacentHTML('beforeend', safeScalar(html))\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n graft: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { parent, focusSelector } = operation\n const parentElement = document.querySelector(parent)\n if (parentElement) {\n parentElement.appendChild(element)\n assignFocus(focusSelector)\n }\n })\n after(element, operation)\n })\n },\n\n innerHtml: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.innerHTML = safeScalar(html)\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n insertAdjacentHtml: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, position, focusSelector } = operation\n element.insertAdjacentHTML(position || 'beforeend', safeScalar(html))\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n insertAdjacentText: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { text, position, focusSelector } = operation\n element.insertAdjacentText(position || 'beforeend', safeScalar(text))\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n outerHtml: operation => {\n processElements(operation, element => {\n const parent = element.parentElement\n const idx = parent && Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.outerHTML = safeScalar(html)\n assignFocus(focusSelector)\n })\n after(parent ? parent.children[idx] : document.documentElement, operation)\n })\n },\n\n prepend: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.insertAdjacentHTML('afterbegin', safeScalar(html))\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n remove: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { focusSelector } = operation\n element.remove()\n assignFocus(focusSelector)\n })\n after(document, operation)\n })\n },\n\n replace: operation => {\n processElements(operation, element => {\n const parent = element.parentElement\n const idx = parent && Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.outerHTML = safeScalar(html)\n assignFocus(focusSelector)\n })\n after(parent ? parent.children[idx] : document.documentElement, operation)\n })\n },\n\n textContent: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { text, focusSelector } = operation\n element.textContent = safeScalar(text)\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n // Element Property Mutations\n\n addCssClass: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.classList.add(...getClassNames([safeStringOrArray(name)]))\n })\n after(element, operation)\n })\n },\n\n removeAttribute: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.removeAttribute(safeString(name))\n })\n after(element, operation)\n })\n },\n\n removeCssClass: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.classList.remove(...getClassNames([safeStringOrArray(name)]))\n if (element.classList.length === 0) element.removeAttribute('class')\n })\n after(element, operation)\n })\n },\n\n setAttribute: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.setAttribute(safeString(name), safeScalar(value))\n })\n after(element, operation)\n })\n },\n\n setDatasetProperty: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.dataset[safeString(name)] = safeScalar(value)\n })\n after(element, operation)\n })\n },\n\n setProperty: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n if (name in element) element[safeString(name)] = safeScalar(value)\n })\n after(element, operation)\n })\n },\n\n setStyle: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.style[safeString(name)] = safeScalar(value)\n })\n after(element, operation)\n })\n },\n\n setStyles: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { styles } = operation\n for (let [name, value] of Object.entries(styles))\n element.style[safeString(name)] = safeScalar(value)\n })\n after(element, operation)\n })\n },\n\n setValue: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { value } = operation\n element.value = safeScalar(value)\n })\n after(element, operation)\n })\n },\n\n // DOM Events and Meta-Operations\n\n dispatchEvent: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, detail } = operation\n dispatch(element, safeString(name), safeObject(detail))\n })\n after(element, operation)\n })\n },\n\n setMeta: operation => {\n before(document, operation)\n operate(operation, () => {\n const { name, content } = operation\n let meta = document.head.querySelector(`meta[name='${name}']`)\n if (!meta) {\n meta = document.createElement('meta')\n meta.name = safeString(name)\n document.head.appendChild(meta)\n }\n meta.content = safeScalar(content)\n })\n after(document, operation)\n },\n\n setTitle: operation => {\n before(document, operation)\n operate(operation, () => {\n const { title } = operation\n document.title = safeScalar(title)\n })\n after(document, operation)\n },\n\n // Browser Manipulations\n\n clearStorage: operation => {\n before(document, operation)\n operate(operation, () => {\n const { type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.clear()\n })\n after(document, operation)\n },\n\n go: operation => {\n before(window, operation)\n operate(operation, () => {\n const { delta } = operation\n history.go(delta)\n })\n after(window, operation)\n },\n\n pushState: operation => {\n before(window, operation)\n operate(operation, () => {\n const { state, title, url } = operation\n history.pushState(safeObject(state), safeString(title), safeString(url))\n })\n after(window, operation)\n },\n\n redirectTo: operation => {\n before(window, operation)\n operate(operation, () => {\n let { url, action, turbo } = operation\n action = action || 'advance'\n url = safeString(url)\n if (turbo === undefined) turbo = true\n\n if (turbo) {\n if (window.Turbo) window.Turbo.visit(url, { action })\n if (window.Turbolinks) window.Turbolinks.visit(url, { action })\n if (!window.Turbo && !window.Turbolinks) window.location.href = url\n } else {\n window.location.href = url\n }\n })\n after(window, operation)\n },\n\n reload: operation => {\n before(window, operation)\n operate(operation, () => {\n window.location.reload()\n })\n after(window, operation)\n },\n\n removeStorageItem: operation => {\n before(document, operation)\n operate(operation, () => {\n const { key, type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.removeItem(safeString(key))\n })\n after(document, operation)\n },\n\n replaceState: operation => {\n before(window, operation)\n operate(operation, () => {\n const { state, title, url } = operation\n history.replaceState(\n safeObject(state),\n safeString(title),\n safeString(url)\n )\n })\n after(window, operation)\n },\n\n scrollIntoView: operation => {\n const { element } = operation\n before(element, operation)\n operate(operation, () => {\n element.scrollIntoView(operation)\n })\n after(element, operation)\n },\n\n setCookie: operation => {\n before(document, operation)\n operate(operation, () => {\n const { cookie } = operation\n document.cookie = safeScalar(cookie)\n })\n after(document, operation)\n },\n\n setFocus: operation => {\n const { element } = operation\n before(element, operation)\n operate(operation, () => {\n assignFocus(element)\n })\n after(element, operation)\n },\n\n setStorageItem: operation => {\n before(document, operation)\n operate(operation, () => {\n const { key, value, type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.setItem(safeString(key), safeScalar(value))\n })\n after(document, operation)\n },\n\n // Notifications\n\n consoleLog: operation => {\n before(document, operation)\n operate(operation, () => {\n const { message, level } = operation\n level && ['warn', 'info', 'error'].includes(level)\n ? console[level](message)\n : console.log(message)\n })\n after(document, operation)\n },\n\n consoleTable: operation => {\n before(document, operation)\n operate(operation, () => {\n const { data, columns } = operation\n console.table(data, safeArray(columns))\n })\n after(document, operation)\n },\n\n notification: operation => {\n before(document, operation)\n operate(operation, () => {\n const { title, options } = operation\n Notification.requestPermission().then(result => {\n operation.permission = result\n if (result === 'granted')\n new Notification(safeString(title), safeObject(options))\n })\n })\n after(document, operation)\n },\n\n // Morph operations\n\n morph: operation => {\n processElements(operation, element => {\n const { html } = operation\n const template = document.createElement('template')\n template.innerHTML = String(safeScalar(html)).trim()\n operation.content = template.content\n const parent = element.parentElement\n const idx = parent && Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { childrenOnly, focusSelector } = operation\n morphdom(\n element,\n childrenOnly ? template.content : template.innerHTML,\n {\n childrenOnly: !!childrenOnly,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: didMorph(operation)\n }\n )\n assignFocus(focusSelector)\n })\n after(parent ? parent.children[idx] : document.documentElement, operation)\n })\n }\n}\n","import Operations from './operations'\n\nlet operations = Operations\n\nconst add = newOperations => {\n operations = { ...operations, ...newOperations }\n}\n\nconst addOperations = operations => {\n add(operations)\n}\n\nconst addOperation = (name, operation) => {\n const operations = {}\n operations[name] = operation\n\n add(operations)\n}\n\nexport { addOperation, addOperations }\n\nexport default {\n get all () {\n return operations\n }\n}\n","let missingElement = 'warn'\n\nexport default {\n get behavior () {\n return missingElement\n },\n set (value) {\n if (['warn', 'ignore', 'event', 'exception'].includes(value))\n missingElement = value\n else\n console.warn(\"Invalid 'onMissingElement' option. Defaulting to 'warn'.\")\n }\n}\n","import { xpathToElement, xpathToElementArray, dispatch } from './utils'\nimport ActiveElement from './active_element'\nimport OperationStore from './operation_store'\nimport MissingElement from './missing_element'\n\nconst perform = (\n operations,\n options = { onMissingElement: MissingElement.behavior }\n) => {\n const batches = {}\n operations.forEach(operation => {\n if (!!operation.batch)\n batches[operation.batch] = batches[operation.batch]\n ? ++batches[operation.batch]\n : 1\n })\n operations.forEach(operation => {\n const name = operation.operation\n try {\n if (operation.selector) {\n if (operation.xpath) {\n operation.element = operation.selectAll\n ? xpathToElementArray(operation.selector)\n : xpathToElement(operation.selector)\n } else {\n operation.element = operation.selectAll\n ? document.querySelectorAll(operation.selector)\n : document.querySelector(operation.selector)\n }\n } else {\n operation.element = document\n }\n if (operation.element || options.onMissingElement !== 'ignore') {\n ActiveElement.set(document.activeElement)\n const cableReadyOperation = OperationStore.all[name]\n\n if (cableReadyOperation) {\n cableReadyOperation(operation)\n if (!!operation.batch && --batches[operation.batch] === 0)\n dispatch(document, 'cable-ready:batch-complete', {\n batch: operation.batch\n })\n } else {\n console.error(\n `CableReady couldn't find the \"${name}\" operation. Make sure you use the camelized form when calling an operation method.`\n )\n }\n }\n } catch (e) {\n if (operation.element) {\n console.error(\n `CableReady detected an error in ${name || 'operation'}: ${\n e.message\n }. If you need to support older browsers make sure you've included the corresponding polyfills. https://docs.stimulusreflex.com/setup#polyfills-for-ie11.`\n )\n console.error(e)\n } else {\n const warning = `CableReady ${name ||\n ''} operation failed due to missing DOM element for selector: '${\n operation.selector\n }'`\n switch (options.onMissingElement) {\n case 'ignore':\n break\n case 'event':\n dispatch(document, 'cable-ready:missing-element', {\n warning,\n operation\n })\n break\n case 'exception':\n throw warning\n default:\n console.warn(warning)\n }\n }\n }\n })\n}\n\nconst performAsync = (\n operations,\n options = { onMissingElement: MissingElement.behavior }\n) => {\n return new Promise((resolve, reject) => {\n try {\n resolve(perform(operations, options))\n } catch (err) {\n reject(err)\n }\n })\n}\n\nexport { perform, performAsync }\n","export default class SubscribingElement extends HTMLElement {\n disconnectedCallback () {\n if (this.channel) this.channel.unsubscribe()\n }\n\n createSubscription (consumer, channel, receivedCallback) {\n this.channel = consumer.subscriptions.create(\n {\n channel,\n identifier: this.identifier\n },\n {\n received: receivedCallback\n }\n )\n }\n\n get preview () {\n return (\n document.documentElement.hasAttribute('data-turbolinks-preview') ||\n document.documentElement.hasAttribute('data-turbo-preview')\n )\n }\n\n get identifier () {\n return this.getAttribute('identifier')\n }\n}\n","let consumer\n\nconst BACKOFF = [25, 50, 75, 100, 200, 250, 500, 800, 1000, 2000]\n\nconst wait = (ms) => new Promise(resolve => setTimeout(resolve, ms))\n\nconst getConsumerWithRetry = async (retry = 0) => {\n if (consumer) return consumer\n\n if (retry >= BACKOFF.length) {\n throw new Error(\"Couldn't obtain a Action Cable consumer within 5s\")\n }\n\n await wait(BACKOFF[retry])\n\n return await getConsumerWithRetry(retry + 1)\n}\n\nexport default {\n setConsumer (value) {\n consumer = value\n },\n\n get consumer () {\n return consumer\n },\n\n async getConsumer () {\n return await getConsumerWithRetry()\n }\n}\n","import { perform } from '../cable_ready'\nimport SubscribingElement from './subscribing_element'\nimport CableConsumer from '../cable_consumer'\nimport MissingElement from '../missing_element'\n\nexport default class StreamFromElement extends SubscribingElement {\n static define () {\n if (!customElements.get('stream-from')) {\n customElements.define('stream-from', this)\n }\n }\n\n async connectedCallback () {\n if (this.preview) return\n\n const consumer = await CableConsumer.getConsumer()\n\n if (consumer) {\n this.createSubscription(\n consumer,\n 'CableReady::Stream',\n this.performOperations.bind(this)\n )\n } else {\n console.error(\n 'The `stream_from` helper cannot connect. You must initialize CableReady with an Action Cable consumer.'\n )\n }\n }\n\n performOperations (data) {\n if (data.cableReady)\n perform(data.operations, { onMissingElement: this.onMissingElement })\n }\n\n get onMissingElement () {\n const value = this.getAttribute('missing') || MissingElement.behavior\n\n // stream_from does not support raising exceptions on missing elements because there's no way to catch them\n if (['warn', 'ignore', 'event'].includes(value)) return value\n else {\n console.warn(\"Invalid 'missing' attribute. Defaulting to 'warn'.\")\n return 'warn'\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","import Debug from '../debug'\n\nconst request = (data, blocks) => {\n if (Debug.disabled) return\n\n console.log(\n `\\u2191 Updatable request affecting ${blocks.length} element(s): `,\n {\n elements: blocks.map(b => b.element),\n identifiers: blocks.map(b => b.element.getAttribute('identifier')),\n data\n }\n )\n}\n\nconst cancel = (timestamp, reason) => {\n if (Debug.disabled) return\n\n const duration = new Date() - timestamp\n console.log(\n `\\u274C Updatable request canceled after ${duration}ms: ${reason}`\n )\n}\n\nconst response = (timestamp, element, urls) => {\n if (Debug.disabled) return\n\n const duration = new Date() - timestamp\n console.log(`\\u2193 Updatable response: All URLs fetched in ${duration}ms`, {\n element,\n urls\n })\n}\n\nconst morphStart = (timestamp, element) => {\n if (Debug.disabled) return\n\n const duration = new Date() - timestamp\n console.log(`\\u21BB Updatable morph: starting after ${duration}ms`, {\n element\n })\n}\n\nconst morphEnd = (timestamp, element) => {\n if (Debug.disabled) return\n\n const duration = new Date() - timestamp\n console.log(`\\u21BA Updatable morph: completed after ${duration}ms`, {\n element\n })\n}\n\nexport default { request, cancel, response, morphStart, morphEnd }\n","import morphdom from 'morphdom'\nimport SubscribingElement from './subscribing_element'\n\nimport { shouldMorph } from '../morph_callbacks'\nimport { debounce, assignFocus, dispatch, graciouslyFetch } from '../utils'\n\nimport ActiveElement from '../active_element'\nimport CableConsumer from '../cable_consumer'\nimport Log from '../updatable/log'\n\nconst template = `\n<style>\n :host {\n display: block;\n }\n</style>\n<slot></slot>\n`\n\nfunction url (element) {\n return element.hasAttribute('url')\n ? element.getAttribute('url')\n : location.href\n}\n\nexport default class UpdatesForElement extends SubscribingElement {\n static define () {\n if (!customElements.get('updates-for')) {\n customElements.define('updates-for', this)\n }\n }\n\n constructor () {\n super()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n shadowRoot.innerHTML = template\n }\n\n async connectedCallback () {\n if (this.preview) return\n this.update = debounce(this.update.bind(this), this.debounce)\n\n const consumer = await CableConsumer.getConsumer()\n\n if (consumer) {\n this.createSubscription(consumer, 'CableReady::Stream', this.update)\n } else {\n console.error(\n 'The `updates-for` helper cannot connect. You must initialize CableReady with an Action Cable consumer.'\n )\n }\n }\n\n async update (data) {\n this.lastUpdateTimestamp = new Date()\n\n const blocks = Array.from(\n document.querySelectorAll(this.query),\n element => new Block(element)\n ).filter(block => block.shouldUpdate(data))\n\n Log.request(data, blocks)\n\n if (blocks.length === 0) {\n Log.cancel(this.lastUpdateTimestamp, 'All elements filtered out')\n\n return\n }\n\n // first updates-for element in the DOM *at any given moment* updates all of the others\n if (blocks[0].element !== this) {\n Log.cancel(this.lastUpdateTimestamp, 'Update already requested')\n\n return\n }\n\n // hold a reference to the active element so that it can be restored after the morph\n ActiveElement.set(document.activeElement)\n\n // store all retrieved HTML in an object keyed by URL to minimize fetch calls\n this.html = {}\n\n const uniqueUrls = [...new Set(blocks.map(block => block.url))]\n\n await Promise.all(\n uniqueUrls.map(async url => {\n if (!this.html.hasOwnProperty(url)) {\n const response = await graciouslyFetch(url, {\n 'X-Cable-Ready': 'update'\n })\n this.html[url] = await response.text()\n }\n })\n )\n\n Log.response(this.lastUpdateTimestamp, this, uniqueUrls)\n\n // track current block index for each URL; referred to as fragments\n this.index = {}\n\n blocks.forEach(block => {\n // if the block's URL is not in the index, initialize it to 0; otherwise, increment it\n this.index.hasOwnProperty(block.url)\n ? this.index[block.url]++\n : (this.index[block.url] = 0)\n\n block.process(data, this.html, this.index, this.lastUpdateTimestamp)\n })\n }\n\n get query () {\n return `updates-for[identifier=\"${this.identifier}\"]`\n }\n\n get identifier () {\n return this.getAttribute('identifier')\n }\n\n get debounce () {\n return this.hasAttribute('debounce')\n ? parseInt(this.getAttribute('debounce'))\n : 20\n }\n}\n\nclass Block {\n constructor (element) {\n this.element = element\n }\n\n async process (data, html, index, startTimestamp) {\n const blockIndex = index[this.url]\n const template = document.createElement('template')\n this.element.setAttribute('updating', 'updating')\n\n template.innerHTML = String(html[this.url]).trim()\n\n await this.resolveTurboFrames(template.content)\n\n const fragments = template.content.querySelectorAll(this.query)\n\n if (fragments.length <= blockIndex) {\n console.warn(\n `Update aborted due to insufficient number of elements. The offending url is ${this.url}.`\n )\n return\n }\n\n const operation = {\n element: this.element,\n html: fragments[blockIndex],\n permanentAttributeName: 'data-ignore-updates'\n }\n\n dispatch(this.element, 'cable-ready:before-update', operation)\n Log.morphStart(startTimestamp, this.element)\n\n morphdom(this.element, fragments[blockIndex], {\n childrenOnly: true,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: _ => {\n this.element.removeAttribute('updating')\n dispatch(this.element, 'cable-ready:after-update', operation)\n assignFocus(operation.focusSelector)\n }\n })\n Log.morphEnd(startTimestamp, this.element)\n }\n\n async resolveTurboFrames (documentFragment) {\n const reloadingTurboFrames = [\n ...documentFragment.querySelectorAll(\n 'turbo-frame[src]:not([loading=\"lazy\"])'\n )\n ]\n\n return Promise.all(\n reloadingTurboFrames.map(frame => {\n return new Promise(async resolve => {\n const frameResponse = await graciouslyFetch(\n frame.getAttribute('src'),\n {\n 'Turbo-Frame': frame.id,\n 'X-Cable-Ready': 'update'\n }\n )\n\n const frameTemplate = document.createElement('template')\n frameTemplate.innerHTML = await frameResponse.text()\n\n // recurse here to get all nested eager loaded frames\n await this.resolveTurboFrames(frameTemplate.content)\n\n const selector = `turbo-frame#${frame.id}`\n const frameContent = frameTemplate.content.querySelector(selector)\n const content = frameContent ? frameContent.innerHTML.trim() : ''\n\n docFragment.querySelector(selector).innerHTML = content\n\n resolve()\n })\n })\n )\n }\n\n shouldUpdate (data) {\n // if everything that could prevent an update is false, update this block\n return !this.ignoresInnerUpdates && this.hasChangesSelectedForUpdate(data)\n }\n\n hasChangesSelectedForUpdate (data) {\n // if there's an only attribute, only update if at least one of the attributes changed is in the allow list\n const only = this.element.getAttribute('only')\n\n return !(\n only &&\n data.changed &&\n !only.split(' ').some(attribute => data.changed.includes(attribute))\n )\n }\n\n get ignoresInnerUpdates () {\n // don't update during a Reflex or Turbolinks redraw\n return (\n this.element.hasAttribute('ignore-inner-updates') &&\n this.element.hasAttribute('performing-inner-update')\n )\n }\n\n get url () {\n return this.element.hasAttribute('url')\n ? this.element.getAttribute('url')\n : location.href\n }\n\n get identifier () {\n return this.element.identifier\n }\n\n get query () {\n return this.element.query\n }\n}\n","export const registerInnerUpdates = () => {\n document.addEventListener('stimulus-reflex:before', event => {\n recursiveMarkUpdatesForElements(event.detail.element)\n })\n\n document.addEventListener('stimulus-reflex:after', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.detail.element)\n })\n })\n\n document.addEventListener('turbo:submit-start', event => {\n recursiveMarkUpdatesForElements(event.target)\n })\n\n document.addEventListener('turbo:submit-end', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.target)\n })\n })\n\n document.addEventListener('turbo-boost:command:start', event => {\n recursiveMarkUpdatesForElements(event.target)\n })\n\n document.addEventListener('turbo-boost:command:finish', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.target)\n })\n })\n\n document.addEventListener('turbo-boost:command:error', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.target)\n })\n })\n}\n\nconst recursiveMarkUpdatesForElements = leaf => {\n const closestUpdatesFor =\n leaf && leaf.parentElement && leaf.parentElement.closest('updates-for')\n if (closestUpdatesFor) {\n closestUpdatesFor.setAttribute('performing-inner-update', '')\n recursiveMarkUpdatesForElements(closestUpdatesFor)\n }\n}\n\nconst recursiveUnmarkUpdatesForElements = leaf => {\n const closestUpdatesFor =\n leaf && leaf.parentElement && leaf.parentElement.closest('updates-for')\n if (closestUpdatesFor) {\n closestUpdatesFor.removeAttribute('performing-inner-update')\n recursiveUnmarkUpdatesForElements(closestUpdatesFor)\n }\n}\n","import StreamFromElement from './stream_from_element'\nimport UpdatesForElement from './updates_for_element'\n\nimport { registerInnerUpdates } from '../updatable/inner_updates_compat'\n\nexport const defineElements = () => {\n registerInnerUpdates()\n\n StreamFromElement.define()\n UpdatesForElement.define()\n}\n","import morphdom from 'morphdom'\n\nimport packageInfo from '../package.json'\nimport { perform, performAsync } from './cable_ready'\nimport { defineElements } from './elements'\nimport { shouldMorphCallbacks, didMorphCallbacks } from './morph_callbacks'\n\nimport * as MorphCallbacks from './morph_callbacks'\nimport * as Utils from './utils'\n\nimport OperationStore, { addOperation, addOperations } from './operation_store'\nimport StreamFromElement from './elements/stream_from_element'\nimport UpdatesForElement from './elements/updates_for_element'\nimport SubscribingElement from './elements/subscribing_element'\nimport CableConsumer from './cable_consumer'\nimport Debug from './debug'\n\nconst initialize = (initializeOptions = {}) => {\n const { consumer, onMissingElement, debug } = initializeOptions\n\n Debug.set(!!debug)\n\n if (consumer) {\n CableConsumer.setConsumer(consumer)\n } else {\n console.error(\n 'CableReady requires a reference to your Action Cable `consumer` for its helpers to function.\\nEnsure that you have imported the `CableReady` package as well as `consumer` from your `channels` folder, then call `CableReady.initialize({ consumer })`.'\n )\n }\n\n if (onMissingElement) {\n MissingElement.set(onMissingElement)\n }\n\n defineElements()\n}\n\nexport {\n Utils,\n MorphCallbacks,\n StreamFromElement,\n UpdatesForElement,\n SubscribingElement\n}\n\nconst global = {\n perform,\n performAsync,\n shouldMorphCallbacks,\n didMorphCallbacks,\n initialize,\n addOperation,\n addOperations,\n version: packageInfo.version,\n cable: CableConsumer,\n get DOMOperations () {\n console.warn(\n 'DEPRECATED: Please use `CableReady.operations` instead of `CableReady.DOMOperations`'\n )\n return OperationStore.all\n },\n get operations () {\n return OperationStore.all\n },\n get consumer () {\n return CableConsumer.consumer\n }\n}\n\nwindow.CableReady = global\n\nexport default global\n"],"names":["inputTags","INPUT","TEXTAREA","SELECT","mutableTags","OPTION","textInputTypes","color","date","datetime","email","month","number","password","range","search","tel","text","textarea","time","url","week","activeElement","ActiveElement","element","set","isTextInput","tagName","type","assignFocus","selector","focusElement","nodeType","Node","ELEMENT_NODE","document","querySelector","focus","dispatch","name","detail","event","CustomEvent","bubbles","cancelable","dispatchEvent","window","jQuery","trigger","xpathToElement","xpath","evaluate","XPathResult","FIRST_ORDERED_NODE_TYPE","singleNodeValue","xpathToElementArray","reverse","snapshotList","ORDERED_NODE_SNAPSHOT_TYPE","snapshots","i","snapshotLength","push","snapshotItem","getClassNames","names","Array","from","flat","processElements","operation","callback","selectAll","forEach","kebabize","result","word","index","toLowerCase","str","words","reduce","match","operate","cancel","delay","setTimeout","before","target","after","debounce","fn","timer","args","clearTimeout","apply","this","handleErrors","response","ok","Error","statusText","safeScalar","val","undefined","includes","console","warn","safeString","String","safeArray","arr","isArray","safeObject","obj","Object","safeStringOrArray","elem","async","graciouslyFetch","additionalHeaders","fetch","headers","e","error","fragment","XMLSerializer","serializeToString","shouldMorph","fromEl","toEl","shouldMorphCallbacks","map","didMorph","el","didMorphCallbacks","verifyNotMutable","isEqualNode","verifyNotContentEditable","isContentEditable","verifyNotPermanent","permanentAttributeName","permanent","closest","ignore","value","attributes","attribute","setAttribute","Operations","append","html","focusSelector","insertAdjacentHTML","graft","parent","parentElement","appendChild","innerHtml","innerHTML","insertAdjacentHtml","position","insertAdjacentText","outerHtml","idx","children","indexOf","outerHTML","documentElement","prepend","remove","replace","textContent","addCssClass","classList","add","removeAttribute","removeCssClass","length","setDatasetProperty","dataset","setProperty","setStyle","style","setStyles","styles","entries","setValue","setMeta","content","meta","head","createElement","setTitle","title","clearStorage","sessionStorage","localStorage","clear","go","delta","history","pushState","state","redirectTo","action","turbo","Turbo","visit","Turbolinks","location","href","reload","removeStorageItem","key","removeItem","replaceState","scrollIntoView","setCookie","cookie","setFocus","setStorageItem","setItem","consoleLog","message","level","log","consoleTable","data","columns","table","notification","options","Notification","requestPermission","then","permission","morph","template","trim","childrenOnly","morphdom","onBeforeElUpdated","onElUpdated","operations","newOperations","OperationStore","all","missingElement","MissingElement$1","behavior","perform","onMissingElement","MissingElement","batches","batch","querySelectorAll","cableReadyOperation","warning","SubscribingElement","HTMLElement","disconnectedCallback","channel","unsubscribe","createSubscription","consumer","receivedCallback","subscriptions","create","identifier","received","preview","hasAttribute","getAttribute","BACKOFF","getConsumerWithRetry","retry","ms","Promise","resolve","CableConsumer","setConsumer","StreamFromElement","static","customElements","get","define","getConsumer","performOperations","bind","cableReady","debugging","Debug","enabled","disabled","debug","Log","blocks","elements","b","identifiers","timestamp","reason","duration","Date","urls","UpdatesForElement","constructor","super","attachShadow","mode","update","lastUpdateTimestamp","query","Block","filter","block","shouldUpdate","uniqueUrls","Set","hasOwnProperty","process","parseInt","startTimestamp","blockIndex","resolveTurboFrames","fragments","_","documentFragment","reloadingTurboFrames","frame","frameResponse","id","frameTemplate","frameContent","docFragment","ignoresInnerUpdates","hasChangesSelectedForUpdate","only","changed","split","some","recursiveMarkUpdatesForElements","leaf","closestUpdatesFor","recursiveUnmarkUpdatesForElements","defineElements","addEventListener","global","performAsync","reject","err","initialize","initializeOptions","addOperation","addOperations","version","packageInfo","cable","DOMOperations","CableReady"],"mappings":"2CAAO,MAAMA,EAAY,CACvBC,OAAO,EACPC,UAAU,EACVC,QAAQ,GAGGC,EAAc,CACzBH,OAAO,EACPC,UAAU,EACVG,QAAQ,GAGGC,EAAiB,CAC5B,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,MAAM,EACNC,KAAK,EACLC,MAAM,GC9BR,IAAIC,EAEJ,IAAeC,EAAA,CACTC,cACF,OAAOF,CACR,EACDG,IAAKD,GACHF,EAAgBE,CACjB,GCHH,MAAME,EAAcF,GACXxB,EAAUwB,EAAQG,UAAYrB,EAAekB,EAAQI,MAOxDC,EAAcC,IAClB,MAIMC,GAHJD,GAAYA,EAASE,WAAaC,KAAKC,aACnCJ,EACAK,SAASC,cAAcN,KACGP,EAAcC,QAC1CO,GAAgBA,EAAaM,OAAON,EAAaM,OAAO,EASxDC,EAAW,CAACd,EAASe,EAAMC,EAAS,CAAA,KACxC,MACMC,EAAQ,IAAIC,YAAYH,EADjB,CAAEI,SAAS,EAAMC,YAAY,EAAMJ,WAEhDhB,EAAQqB,cAAcJ,GAClBK,OAAOC,QAAQD,OAAOC,OAAOvB,GAASwB,QAAQT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