copy_tuner_client 0.14.2 → 0.15.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26adaa006e804e9c509487d5b7828552870c6009b99d7aee76a3762458d2395e
4
- data.tar.gz: 37e7dc18874e645182753e0901ffc66290c6900beeb40901c3517b46592ec8de
3
+ metadata.gz: 375dbe69369421e9f764466f5b92f63b3eacda2235ddc0a42892620ae6474342
4
+ data.tar.gz: '07638a3f438bee6a23fa8fa3109cd620585821f417c15693bfcac4589ca053d0'
5
5
  SHA512:
6
- metadata.gz: fee3134bfc9dedd074a545d91f3ace4d0edb4e5d299a5c33cd055a77249c769e2dc0bb3fa67091c843c62a13f54100a61cb9753cf18b95c330335f513617a26d
7
- data.tar.gz: a39cd58e37c7c062916a27044c9aba40d1f0dc82c5acfe3404ac4e2961e41de91dc94a7e8ab829a91e6b6b8c07cde211f99669c5306d6be1de187637d09973ab
6
+ metadata.gz: bc8bee8ccf7f8668e3d7abb146fe568692a0e765d9fad2bc9137185d34115703a342e2bdd79a5db3a3a0a45e5fabeedd1d70cffa7fc70fc9bd5d81c28cddd3e0
7
+ data.tar.gz: 15f30baf267916980605c002524e07818e66aa7dcec62173c9c907acf54e849302862b05cf245bd3cb065668b67dcf39bb0636b62a499af709d99d2c58fdada8
@@ -22,11 +22,13 @@ jobs:
22
22
  strategy:
23
23
  fail-fast: false
24
24
  matrix:
25
- ruby: [2.7, "3.0", 3.1]
25
+ ruby: ["3.0", 3.1, 3.2]
26
26
  gemfile: ["6.1", "7.0", "main"]
27
27
  exclude:
28
28
  - ruby: "3.1"
29
29
  gemfile: "6.1"
30
+ - ruby: "3.2"
31
+ gemfile: "6.1"
30
32
  steps:
31
33
  - name: Install packages
32
34
  run: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.15.0
2
+
3
+ - Drop support for ruby 2.7
4
+
1
5
  ## 0.14.1
2
6
 
3
7
  - Fix super call in define_method
@@ -1,389 +1,252 @@
1
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2
- var FUNC_ERROR_TEXT = "Expected a function";
3
- var NAN = 0 / 0;
4
- var symbolTag = "[object Symbol]";
5
- var reTrim = /^\s+|\s+$/g;
6
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
7
- var reIsBinary = /^0b[01]+$/i;
8
- var reIsOctal = /^0o[0-7]+$/i;
9
- var freeParseInt = parseInt;
10
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
11
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
12
- var root = freeGlobal || freeSelf || Function("return this")();
13
- var objectProto = Object.prototype;
14
- var objectToString = objectProto.toString;
15
- var nativeMax = Math.max, nativeMin = Math.min;
16
- var now = function() {
17
- return root.Date.now();
1
+ var y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, A = "Expected a function", C = 0 / 0, _ = "[object Symbol]", $ = /^\s+|\s+$/g, R = /^[-+]0x[0-9a-f]+$/i, H = /^0b[01]+$/i, W = /^0o[0-7]+$/i, F = parseInt, D = typeof y == "object" && y && y.Object === Object && y, P = typeof self == "object" && self && self.Object === Object && self, q = D || P || Function("return this")(), K = Object.prototype, U = K.toString, Y = Math.max, V = Math.min, v = function() {
2
+ return q.Date.now();
18
3
  };
19
- function debounce(func, wait, options) {
20
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
21
- if (typeof func != "function") {
22
- throw new TypeError(FUNC_ERROR_TEXT);
23
- }
24
- wait = toNumber(wait) || 0;
25
- if (isObject(options)) {
26
- leading = !!options.leading;
27
- maxing = "maxWait" in options;
28
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
29
- trailing = "trailing" in options ? !!options.trailing : trailing;
30
- }
31
- function invokeFunc(time) {
32
- var args = lastArgs, thisArg = lastThis;
33
- lastArgs = lastThis = void 0;
34
- lastInvokeTime = time;
35
- result = func.apply(thisArg, args);
36
- return result;
37
- }
38
- function leadingEdge(time) {
39
- lastInvokeTime = time;
40
- timerId = setTimeout(timerExpired, wait);
41
- return leading ? invokeFunc(time) : result;
42
- }
43
- function remainingWait(time) {
44
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
45
- return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
46
- }
47
- function shouldInvoke(time) {
48
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
49
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
50
- }
51
- function timerExpired() {
52
- var time = now();
53
- if (shouldInvoke(time)) {
54
- return trailingEdge(time);
55
- }
56
- timerId = setTimeout(timerExpired, remainingWait(time));
57
- }
58
- function trailingEdge(time) {
59
- timerId = void 0;
60
- if (trailing && lastArgs) {
61
- return invokeFunc(time);
62
- }
63
- lastArgs = lastThis = void 0;
64
- return result;
65
- }
66
- function cancel() {
67
- if (timerId !== void 0) {
68
- clearTimeout(timerId);
69
- }
70
- lastInvokeTime = 0;
71
- lastArgs = lastCallTime = lastThis = timerId = void 0;
72
- }
73
- function flush() {
74
- return timerId === void 0 ? result : trailingEdge(now());
75
- }
76
- function debounced() {
77
- var time = now(), isInvoking = shouldInvoke(time);
78
- lastArgs = arguments;
79
- lastThis = this;
80
- lastCallTime = time;
81
- if (isInvoking) {
82
- if (timerId === void 0) {
83
- return leadingEdge(lastCallTime);
84
- }
85
- if (maxing) {
86
- timerId = setTimeout(timerExpired, wait);
87
- return invokeFunc(lastCallTime);
88
- }
89
- }
90
- if (timerId === void 0) {
91
- timerId = setTimeout(timerExpired, wait);
92
- }
93
- return result;
94
- }
95
- debounced.cancel = cancel;
96
- debounced.flush = flush;
97
- return debounced;
4
+ function X(t, e, n) {
5
+ var o, s, d, r, a, c, u = 0, x = !1, f = !1, b = !0;
6
+ if (typeof t != "function")
7
+ throw new TypeError(A);
8
+ e = O(e) || 0, E(n) && (x = !!n.leading, f = "maxWait" in n, d = f ? Y(O(n.maxWait) || 0, e) : d, b = "trailing" in n ? !!n.trailing : b);
9
+ function g(i) {
10
+ var l = o, p = s;
11
+ return o = s = void 0, u = i, r = t.apply(p, l), r;
12
+ }
13
+ function B(i) {
14
+ return u = i, a = setTimeout(m, e), x ? g(i) : r;
15
+ }
16
+ function M(i) {
17
+ var l = i - c, p = i - u, T = e - l;
18
+ return f ? V(T, d - p) : T;
19
+ }
20
+ function w(i) {
21
+ var l = i - c, p = i - u;
22
+ return c === void 0 || l >= e || l < 0 || f && p >= d;
23
+ }
24
+ function m() {
25
+ var i = v();
26
+ if (w(i))
27
+ return S(i);
28
+ a = setTimeout(m, M(i));
29
+ }
30
+ function S(i) {
31
+ return a = void 0, b && o ? g(i) : (o = s = void 0, r);
32
+ }
33
+ function I() {
34
+ a !== void 0 && clearTimeout(a), u = 0, o = c = s = a = void 0;
35
+ }
36
+ function N() {
37
+ return a === void 0 ? r : S(v());
38
+ }
39
+ function k() {
40
+ var i = v(), l = w(i);
41
+ if (o = arguments, s = this, c = i, l) {
42
+ if (a === void 0)
43
+ return B(c);
44
+ if (f)
45
+ return a = setTimeout(m, e), g(c);
46
+ }
47
+ return a === void 0 && (a = setTimeout(m, e)), r;
48
+ }
49
+ return k.cancel = I, k.flush = N, k;
98
50
  }
99
- function isObject(value) {
100
- var type = typeof value;
101
- return !!value && (type == "object" || type == "function");
51
+ function E(t) {
52
+ var e = typeof t;
53
+ return !!t && (e == "object" || e == "function");
102
54
  }
103
- function isObjectLike(value) {
104
- return !!value && typeof value == "object";
55
+ function z(t) {
56
+ return !!t && typeof t == "object";
105
57
  }
106
- function isSymbol(value) {
107
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
58
+ function G(t) {
59
+ return typeof t == "symbol" || z(t) && U.call(t) == _;
108
60
  }
109
- function toNumber(value) {
110
- if (typeof value == "number") {
111
- return value;
112
- }
113
- if (isSymbol(value)) {
114
- return NAN;
115
- }
116
- if (isObject(value)) {
117
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
118
- value = isObject(other) ? other + "" : other;
119
- }
120
- if (typeof value != "string") {
121
- return value === 0 ? value : +value;
122
- }
123
- value = value.replace(reTrim, "");
124
- var isBinary = reIsBinary.test(value);
125
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
61
+ function O(t) {
62
+ if (typeof t == "number")
63
+ return t;
64
+ if (G(t))
65
+ return C;
66
+ if (E(t)) {
67
+ var e = typeof t.valueOf == "function" ? t.valueOf() : t;
68
+ t = E(e) ? e + "" : e;
69
+ }
70
+ if (typeof t != "string")
71
+ return t === 0 ? t : +t;
72
+ t = t.replace($, "");
73
+ var n = H.test(t);
74
+ return n || W.test(t) ? F(t.slice(2), n ? 2 : 8) : R.test(t) ? C : +t;
126
75
  }
127
- var lodash_debounce = debounce;
128
- const HIDDEN_CLASS = "copy-tuner-hidden";
129
- class CopytunerBar {
130
- constructor(element, data, callback) {
131
- this.element = element;
132
- this.data = data;
133
- this.callback = callback;
134
- this.searchBoxElement = element.querySelector(".js-copy-tuner-bar-search");
135
- this.logMenuElement = this.makeLogMenu();
136
- this.element.append(this.logMenuElement);
137
- this.addHandler();
76
+ var Z = X;
77
+ const h = "copy-tuner-hidden";
78
+ class J {
79
+ // @ts-expect-error TS7006
80
+ constructor(e, n, o) {
81
+ this.element = e, this.data = n, this.callback = o, this.searchBoxElement = e.querySelector(".js-copy-tuner-bar-search"), this.logMenuElement = this.makeLogMenu(), this.element.append(this.logMenuElement), this.addHandler();
138
82
  }
139
83
  addHandler() {
140
- const openLogButton = this.element.querySelector(".js-copy-tuner-bar-open-log");
141
- openLogButton.addEventListener("click", (event) => {
142
- event.preventDefault();
143
- this.toggleLogMenu();
144
- });
145
- this.searchBoxElement.addEventListener("input", lodash_debounce(this.onKeyup.bind(this), 250));
84
+ this.element.querySelector(".js-copy-tuner-bar-open-log").addEventListener("click", (n) => {
85
+ n.preventDefault(), this.toggleLogMenu();
86
+ }), this.searchBoxElement.addEventListener("input", Z(this.onKeyup.bind(this), 250));
146
87
  }
147
88
  show() {
148
- this.element.classList.remove(HIDDEN_CLASS);
149
- this.searchBoxElement.focus();
89
+ this.element.classList.remove(h), this.searchBoxElement.focus();
150
90
  }
151
91
  hide() {
152
- this.element.classList.add(HIDDEN_CLASS);
92
+ this.element.classList.add(h);
153
93
  }
154
94
  showLogMenu() {
155
- this.logMenuElement.classList.remove(HIDDEN_CLASS);
95
+ this.logMenuElement.classList.remove(h);
156
96
  }
157
97
  toggleLogMenu() {
158
- this.logMenuElement.classList.toggle(HIDDEN_CLASS);
98
+ this.logMenuElement.classList.toggle(h);
159
99
  }
160
100
  makeLogMenu() {
161
- const div = document.createElement("div");
162
- div.setAttribute("id", "copy-tuner-bar-log-menu");
163
- div.classList.add(HIDDEN_CLASS);
164
- const table = document.createElement("table");
165
- const tbody = document.createElement("tbody");
166
- tbody.classList.remove("is-not-initialized");
167
- for (const key of Object.keys(this.data).sort()) {
168
- const value = this.data[key];
169
- if (value === "") {
101
+ const e = document.createElement("div");
102
+ e.setAttribute("id", "copy-tuner-bar-log-menu"), e.classList.add(h);
103
+ const n = document.createElement("table"), o = document.createElement("tbody");
104
+ o.classList.remove("is-not-initialized");
105
+ for (const s of Object.keys(this.data).sort()) {
106
+ const d = this.data[s];
107
+ if (d === "")
170
108
  continue;
171
- }
172
- const td1 = document.createElement("td");
173
- td1.textContent = key;
174
- const td2 = document.createElement("td");
175
- td2.textContent = value;
176
- const tr = document.createElement("tr");
177
- tr.classList.add("copy-tuner-bar-log-menu__row");
178
- tr.dataset.key = key;
179
- tr.addEventListener("click", ({ currentTarget }) => {
180
- this.callback(currentTarget.dataset.key);
181
- });
182
- tr.append(td1);
183
- tr.append(td2);
184
- tbody.append(tr);
185
- }
186
- table.append(tbody);
187
- div.append(table);
188
- return div;
189
- }
190
- onKeyup({ target }) {
191
- const keyword = target.value.trim();
109
+ const r = document.createElement("td");
110
+ r.textContent = s;
111
+ const a = document.createElement("td");
112
+ a.textContent = d;
113
+ const c = document.createElement("tr");
114
+ c.classList.add("copy-tuner-bar-log-menu__row"), c.dataset.key = s, c.addEventListener("click", ({ currentTarget: u }) => {
115
+ this.callback(u.dataset.key);
116
+ }), c.append(r), c.append(a), o.append(c);
117
+ }
118
+ return n.append(o), e.append(n), e;
119
+ }
120
+ // @ts-expect-error TS7031
121
+ onKeyup({ target: e }) {
122
+ const n = e.value.trim();
192
123
  this.showLogMenu();
193
- const rows = [...this.logMenuElement.querySelectorAll("tr")];
194
- for (const row of rows) {
195
- const isShow = keyword === "" || [...row.querySelectorAll("td")].some((td) => td.textContent.includes(keyword));
196
- row.classList.toggle(HIDDEN_CLASS, !isShow);
124
+ const o = [...this.logMenuElement.querySelectorAll("tr")];
125
+ for (const s of o) {
126
+ const d = n === "" || [...s.querySelectorAll("td")].some((r) => r.textContent.includes(n));
127
+ s.classList.toggle(h, !d);
197
128
  }
198
129
  }
199
130
  }
200
- const isMac = navigator.platform.toUpperCase().includes("MAC");
201
- const isVisible = (element) => !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length > 0);
202
- const getOffset = (elment) => {
203
- const box = elment.getBoundingClientRect();
131
+ const L = navigator.platform.toUpperCase().includes("MAC"), Q = (t) => !!(t.offsetWidth || t.offsetHeight || t.getClientRects().length > 0), ee = (t) => {
132
+ const e = t.getBoundingClientRect();
204
133
  return {
205
- top: box.top + (window.pageYOffset - document.documentElement.clientTop),
206
- left: box.left + (window.pageXOffset - document.documentElement.clientLeft)
134
+ top: e.top + (window.pageYOffset - document.documentElement.clientTop),
135
+ left: e.left + (window.pageXOffset - document.documentElement.clientLeft)
207
136
  };
208
- };
209
- const computeBoundingBox = (element) => {
210
- if (!isVisible(element)) {
137
+ }, te = (t) => {
138
+ if (!Q(t))
211
139
  return null;
212
- }
213
- const boxFrame = getOffset(element);
214
- boxFrame.right = boxFrame.left + element.offsetWidth;
215
- boxFrame.bottom = boxFrame.top + element.offsetHeight;
216
- return {
217
- left: boxFrame.left,
218
- top: boxFrame.top,
219
- width: boxFrame.right - boxFrame.left,
220
- height: boxFrame.bottom - boxFrame.top
140
+ const e = ee(t);
141
+ return e.right = e.left + t.offsetWidth, e.bottom = e.top + t.offsetHeight, {
142
+ left: e.left,
143
+ top: e.top,
144
+ // @ts-expect-error TS2339
145
+ width: e.right - e.left,
146
+ // @ts-expect-error TS2339
147
+ height: e.bottom - e.top
221
148
  };
222
- };
223
- const ZINDEX = 2e9;
224
- class Specimen {
225
- constructor(element, key, callback) {
226
- this.element = element;
227
- this.key = key;
228
- this.callback = callback;
149
+ }, ne = 2e9;
150
+ class oe {
151
+ // @ts-expect-error TS7006
152
+ constructor(e, n, o) {
153
+ this.element = e, this.key = n, this.callback = o;
229
154
  }
230
155
  show() {
231
- this.box = this.makeBox();
232
- if (this.box === null)
233
- return;
234
- this.box.addEventListener("click", () => {
156
+ this.box = this.makeBox(), this.box !== null && (this.box.addEventListener("click", () => {
235
157
  this.callback(this.key);
236
- });
237
- document.body.append(this.box);
158
+ }), document.body.append(this.box));
238
159
  }
239
160
  remove() {
240
- if (!this.box) {
241
- return;
242
- }
243
- this.box.remove();
244
- this.box = null;
161
+ this.box && (this.box.remove(), this.box = null);
245
162
  }
246
163
  makeBox() {
247
- const box = document.createElement("div");
248
- box.classList.add("copyray-specimen");
249
- box.classList.add("Specimen");
250
- const bounds = computeBoundingBox(this.element);
251
- if (bounds === null)
164
+ const e = document.createElement("div");
165
+ e.classList.add("copyray-specimen"), e.classList.add("Specimen");
166
+ const n = te(this.element);
167
+ if (n === null)
252
168
  return null;
253
- for (const key of Object.keys(bounds)) {
254
- const value = bounds[key];
255
- box.style[key] = `${value}px`;
256
- }
257
- box.style.zIndex = ZINDEX;
258
- const { position, top, left } = getComputedStyle(this.element);
259
- if (position === "fixed") {
260
- this.box.style.position = "fixed";
261
- this.box.style.top = `${top}px`;
262
- this.box.style.left = `${left}px`;
169
+ for (const r of Object.keys(n)) {
170
+ const a = n[r];
171
+ e.style[r] = `${a}px`;
263
172
  }
264
- box.append(this.makeLabel());
265
- return box;
173
+ e.style.zIndex = ne;
174
+ const { position: o, top: s, left: d } = getComputedStyle(this.element);
175
+ return o === "fixed" && (this.box.style.position = "fixed", this.box.style.top = `${s}px`, this.box.style.left = `${d}px`), e.append(this.makeLabel()), e;
266
176
  }
267
177
  makeLabel() {
268
- const div = document.createElement("div");
269
- div.classList.add("copyray-specimen-handle");
270
- div.classList.add("Specimen");
271
- div.textContent = this.key;
272
- return div;
178
+ const e = document.createElement("div");
179
+ return e.classList.add("copyray-specimen-handle"), e.classList.add("Specimen"), e.textContent = this.key, e;
273
180
  }
274
181
  }
275
- const findBlurbs = () => {
276
- const filterNone = () => NodeFilter.FILTER_ACCEPT;
277
- const iterator = document.createNodeIterator(document.body, NodeFilter.SHOW_COMMENT, filterNone, false);
278
- const comments = [];
279
- let curNode;
280
- while (curNode = iterator.nextNode()) {
281
- comments.push(curNode);
282
- }
283
- return comments.filter((comment) => comment.nodeValue.startsWith("COPYRAY")).map((comment) => {
284
- const [, key] = comment.nodeValue.match(/^COPYRAY (\S*)$/);
285
- const element = comment.parentNode;
286
- return { key, element };
182
+ const se = () => {
183
+ const t = () => NodeFilter.FILTER_ACCEPT, e = document.createNodeIterator(document.body, NodeFilter.SHOW_COMMENT, t, !1), n = [];
184
+ let o;
185
+ for (; o = e.nextNode(); )
186
+ n.push(o);
187
+ return n.filter((s) => s.nodeValue.startsWith("COPYRAY")).map((s) => {
188
+ const [, d] = s.nodeValue.match(/^COPYRAY (\S*)$/), r = s.parentNode;
189
+ return { key: d, element: r };
287
190
  });
288
191
  };
289
- class Copyray {
290
- constructor(baseUrl, data) {
291
- this.baseUrl = baseUrl;
292
- this.data = data;
293
- this.isShowing = false;
294
- this.specimens = [];
295
- this.overlay = this.makeOverlay();
296
- this.toggleButton = this.makeToggleButton();
297
- this.boundOpen = this.open.bind(this);
298
- this.copyTunerBar = new CopytunerBar(document.querySelector("#copy-tuner-bar"), this.data, this.boundOpen);
192
+ class ie {
193
+ // @ts-expect-error TS7006
194
+ constructor(e, n) {
195
+ this.baseUrl = e, this.data = n, this.isShowing = !1, this.specimens = [], this.overlay = this.makeOverlay(), this.toggleButton = this.makeToggleButton(), this.boundOpen = this.open.bind(this), this.copyTunerBar = new J(document.querySelector("#copy-tuner-bar"), this.data, this.boundOpen);
299
196
  }
300
197
  show() {
301
- this.reset();
302
- document.body.append(this.overlay);
303
- this.makeSpecimens();
304
- for (const specimen of this.specimens) {
305
- specimen.show();
306
- }
307
- this.copyTunerBar.show();
308
- this.isShowing = true;
198
+ this.reset(), document.body.append(this.overlay), this.makeSpecimens();
199
+ for (const e of this.specimens)
200
+ e.show();
201
+ this.copyTunerBar.show(), this.isShowing = !0;
309
202
  }
310
203
  hide() {
311
- this.overlay.remove();
312
- this.reset();
313
- this.copyTunerBar.hide();
314
- this.isShowing = false;
204
+ this.overlay.remove(), this.reset(), this.copyTunerBar.hide(), this.isShowing = !1;
315
205
  }
316
206
  toggle() {
317
- if (this.isShowing) {
318
- this.hide();
319
- } else {
320
- this.show();
321
- }
207
+ this.isShowing ? this.hide() : this.show();
322
208
  }
323
- open(key) {
324
- window.open(`${this.baseUrl}/blurbs/${key}/edit`);
209
+ // @ts-expect-error TS7006
210
+ open(e) {
211
+ window.open(`${this.baseUrl}/blurbs/${e}/edit`);
325
212
  }
326
213
  makeSpecimens() {
327
- for (const { element, key } of findBlurbs()) {
328
- this.specimens.push(new Specimen(element, key, this.boundOpen));
329
- }
214
+ for (const { element: e, key: n } of se())
215
+ this.specimens.push(new oe(e, n, this.boundOpen));
330
216
  }
331
217
  makeToggleButton() {
332
- const element = document.createElement("a");
333
- element.addEventListener("click", () => {
218
+ const e = document.createElement("a");
219
+ return e.addEventListener("click", () => {
334
220
  this.show();
335
- });
336
- element.classList.add("copyray-toggle-button");
337
- element.classList.add("hidden-on-mobile");
338
- element.textContent = "Open CopyTuner";
339
- document.body.append(element);
340
- return element;
221
+ }), e.classList.add("copyray-toggle-button"), e.classList.add("hidden-on-mobile"), e.textContent = "Open CopyTuner", document.body.append(e), e;
341
222
  }
342
223
  makeOverlay() {
343
- const div = document.createElement("div");
344
- div.setAttribute("id", "copyray-overlay");
345
- div.addEventListener("click", () => this.hide());
346
- return div;
224
+ const e = document.createElement("div");
225
+ return e.setAttribute("id", "copyray-overlay"), e.addEventListener("click", () => this.hide()), e;
347
226
  }
348
227
  reset() {
349
- for (const specimen of this.specimens) {
350
- specimen.remove();
351
- }
228
+ for (const e of this.specimens)
229
+ e.remove();
352
230
  }
353
231
  }
354
- var copyray = "";
355
- const appendCopyTunerBar = (url) => {
356
- const bar = document.createElement("div");
357
- bar.id = "copy-tuner-bar";
358
- bar.classList.add("copy-tuner-hidden");
359
- bar.innerHTML = `
360
- <a class="copy-tuner-bar-button" target="_blank" href="${url}">CopyTuner</a>
232
+ const re = (t) => {
233
+ const e = document.createElement("div");
234
+ e.id = "copy-tuner-bar", e.classList.add("copy-tuner-hidden"), e.innerHTML = `
235
+ <a class="copy-tuner-bar-button" target="_blank" href="${t}">CopyTuner</a>
361
236
  <a href="/copytuner" target="_blank" class="copy-tuner-bar-button">Sync</a>
362
237
  <a href="javascript:void(0)" class="copy-tuner-bar-open-log copy-tuner-bar-button js-copy-tuner-bar-open-log">Translations in this page</a>
363
238
  <input type="text" class="copy-tuner-bar__search js-copy-tuner-bar-search" placeholder="search">
364
- `;
365
- document.body.append(bar);
366
- };
367
- const start = () => {
368
- const { url, data } = window.CopyTuner;
369
- appendCopyTunerBar(url);
370
- const copyray2 = new Copyray(url, data);
371
- window.CopyTuner.toggle = () => copyray2.toggle();
372
- document.addEventListener("keydown", (event) => {
373
- if (copyray2.isShowing && ["Escape", "Esc"].includes(event.key)) {
374
- copyray2.hide();
239
+ `, document.body.append(e);
240
+ }, j = () => {
241
+ const { url: t, data: e } = window.CopyTuner;
242
+ re(t);
243
+ const n = new ie(t, e);
244
+ window.CopyTuner.toggle = () => n.toggle(), document.addEventListener("keydown", (o) => {
245
+ if (n.isShowing && ["Escape", "Esc"].includes(o.key)) {
246
+ n.hide();
375
247
  return;
376
248
  }
377
- if ((isMac && event.metaKey || !isMac && event.ctrlKey) && event.shiftKey && event.key.toLowerCase() === "k") {
378
- copyray2.toggle();
379
- }
380
- });
381
- if (console) {
382
- console.log(`Ready to Copyray. Press ${isMac ? "cmd+shift+k" : "ctrl+shift+k"} to scan your UI.`);
383
- }
249
+ (L && o.metaKey || !L && o.ctrlKey) && o.shiftKey && o.key.toLowerCase() === "k" && n.toggle();
250
+ }), console && console.log(`Ready to Copyray. Press ${L ? "cmd+shift+k" : "ctrl+shift+k"} to scan your UI.`);
384
251
  };
385
- if (document.readyState === "complete" || document.readyState !== "loading") {
386
- start();
387
- } else {
388
- document.addEventListener("DOMContentLoaded", () => start());
389
- }
252
+ document.readyState === "complete" || document.readyState !== "loading" ? j() : document.addEventListener("DOMContentLoaded", () => j());
@@ -3,7 +3,7 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
3
  require 'copy_tuner_client/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.required_ruby_version = '>= 2.7.0'
6
+ s.required_ruby_version = '>= 3.0.0'
7
7
  s.add_dependency 'i18n', '>= 0.5.0'
8
8
  s.add_dependency 'json'
9
9
  s.add_dependency 'nokogiri'
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.14.2'.freeze
3
+ VERSION = '0.15.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze