hyperactiveform 0.4.0 → 0.5.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.
data/docs/js/full_list.js CHANGED
@@ -1,242 +1,334 @@
1
- (function() {
2
-
3
- var $clicked = $(null);
4
- var searchTimeout = null;
5
- var searchCache = [];
6
- var caseSensitiveMatch = false;
7
- var ignoreKeyCodeMin = 8;
8
- var ignoreKeyCodeMax = 46;
9
- var commandKey = 91;
10
-
11
- RegExp.escape = function(text) {
12
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13
- }
14
-
15
- function escapeShortcut() {
16
- $(document).keydown(function(evt) {
17
- if (evt.which == 27) {
18
- window.parent.postMessage('navEscape', '*');
19
- }
20
- });
21
- }
22
-
23
- function navResizer() {
24
- $(window).mousemove(function(e) {
25
- window.parent.postMessage({
26
- action: 'mousemove', event: {pageX: e.pageX, which: e.which}
27
- }, '*');
28
- }).mouseup(function(e) {
29
- window.parent.postMessage({action: 'mouseup'}, '*');
30
- });
31
- window.parent.postMessage("navReady", "*");
32
- }
33
-
34
- function clearSearchTimeout() {
35
- clearTimeout(searchTimeout);
36
- searchTimeout = null;
37
- }
38
-
39
- function enableLinks() {
40
- // load the target page in the parent window
41
- $('#full_list li').on('click', function(evt) {
42
- $('#full_list li').removeClass('clicked');
43
- $clicked = $(this);
44
- $clicked.addClass('clicked');
45
- evt.stopPropagation();
46
-
47
- if (evt.target.tagName === 'A') return true;
48
-
49
- var elem = $clicked.find('> .item .object_link a')[0];
50
- var e = evt.originalEvent;
51
- var newEvent = new MouseEvent(evt.originalEvent.type);
52
- newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
53
- elem.dispatchEvent(newEvent);
54
- evt.preventDefault();
55
- return false;
56
- });
57
- }
58
-
59
- function enableToggles() {
60
- // show/hide nested classes on toggle click
61
- $('#full_list a.toggle').on('click', function(evt) {
62
- evt.stopPropagation();
63
- evt.preventDefault();
64
- $(this).parent().parent().toggleClass('collapsed');
65
- $(this).attr('aria-expanded', function (i, attr) {
66
- return attr == 'true' ? 'false' : 'true'
67
- });
68
- highlight();
69
- });
70
-
71
- // navigation of nested classes using keyboard
72
- $('#full_list a.toggle').on('keypress',function(evt) {
73
- // enter key is pressed
74
- if (evt.which == 13) {
75
- evt.stopPropagation();
76
- evt.preventDefault();
77
- $(this).parent().parent().toggleClass('collapsed');
78
- $(this).attr('aria-expanded', function (i, attr) {
79
- return attr == 'true' ? 'false' : 'true'
80
- });
81
- highlight();
82
- }
83
- });
84
- }
85
-
86
- function populateSearchCache() {
87
- $('#full_list li .item').each(function() {
88
- var $node = $(this);
89
- var $link = $node.find('.object_link a');
90
- if ($link.length > 0) {
91
- searchCache.push({
92
- node: $node,
93
- link: $link,
94
- name: $link.text(),
95
- fullName: $link.attr('title').split(' ')[0]
96
- });
97
- }
98
- });
99
- }
100
-
101
- function enableSearch() {
102
- $('#search input').keyup(function(event) {
103
- if (ignoredKeyPress(event)) return;
104
- if (this.value === "") {
105
- clearSearch();
106
- } else {
107
- performSearch(this.value);
108
- }
109
- });
110
-
111
- $('#full_list').after("<div id='noresults' role='status' style='display: none'></div>");
112
- }
113
-
114
- function ignoredKeyPress(event) {
115
- if (
116
- (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
117
- (event.keyCode == commandKey)
118
- ) {
119
- return true;
120
- } else {
121
- return false;
122
- }
123
- }
124
-
125
- function clearSearch() {
126
- clearSearchTimeout();
127
- $('#full_list .found').removeClass('found').each(function() {
128
- var $link = $(this).find('.object_link a');
129
- $link.text($link.text());
130
- });
131
- $('#full_list, #content').removeClass('insearch');
132
- $clicked.parents().removeClass('collapsed');
133
- highlight();
134
- }
135
-
136
- function performSearch(searchString) {
137
- clearSearchTimeout();
138
- $('#full_list, #content').addClass('insearch');
139
- $('#noresults').text('').hide();
140
- partialSearch(searchString, 0);
141
- }
142
-
143
- function partialSearch(searchString, offset) {
144
- var lastRowClass = '';
145
- var i = null;
146
- for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
147
- var item = searchCache[i];
148
- var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
149
- var matchString = buildMatchString(searchString);
150
- var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
151
- if (searchName.match(matchRegexp) == null) {
152
- item.node.removeClass('found');
153
- item.link.text(item.link.text());
154
- }
155
- else {
156
- item.node.addClass('found');
157
- item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
158
- lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
159
- item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
160
- }
161
- }
162
- if(i == searchCache.length) {
163
- searchDone();
164
- } else {
165
- searchTimeout = setTimeout(function() {
166
- partialSearch(searchString, i);
167
- }, 0);
168
- }
169
- }
170
-
171
- function searchDone() {
172
- searchTimeout = null;
173
- highlight();
174
- var found = $('#full_list li:visible').size();
175
- if (found === 0) {
176
- $('#noresults').text('No results were found.');
177
- } else {
178
- // This is read out to screen readers
179
- $('#noresults').text('There are ' + found + ' results.');
180
- }
181
- $('#noresults').show();
182
- $('#content').removeClass('insearch');
183
- }
184
-
185
- function buildMatchString(searchString, event) {
186
- caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
187
- var regexSearchString = RegExp.escape(searchString);
188
- if (caseSensitiveMatch) {
189
- regexSearchString += "|" +
190
- $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
191
- join('.+?');
192
- }
193
- return regexSearchString;
194
- }
195
-
196
- function highlight() {
197
- $('#full_list li:visible').each(function(n) {
198
- $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
199
- });
200
- }
201
-
202
- /**
203
- * Expands the tree to the target element and its immediate
204
- * children.
205
- */
206
- function expandTo(path) {
207
- var $target = $(document.getElementById('object_' + path));
208
- $target.addClass('clicked');
209
- $target.removeClass('collapsed');
210
- $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
211
-
212
- $target.find('a.toggle').attr('aria-expanded', 'true')
213
- $target.parentsUntil('#full_list', 'li').each(function(i, el) {
214
- $(el).find('> div > a.toggle').attr('aria-expanded', 'true');
215
- });
216
-
217
- if($target[0]) {
218
- window.scrollTo(window.scrollX, $target.offset().top - 250);
219
- highlight();
220
- }
221
- }
222
-
223
- function windowEvents(event) {
224
- var msg = event.data;
225
- if (msg.action === "expand") {
226
- expandTo(msg.path);
227
- }
228
- return false;
229
- }
230
-
231
- window.addEventListener("message", windowEvents, false);
232
-
233
- $(document).ready(function() {
234
- escapeShortcut();
235
- navResizer();
236
- enableLinks();
237
- enableToggles();
238
- populateSearchCache();
239
- enableSearch();
240
- });
1
+ (() => {
2
+ let clicked = null;
3
+ let searchTimeout = null;
4
+ const searchCache = [];
5
+ let caseSensitiveMatch = false;
241
6
 
7
+ function query(selector, root) {
8
+ return (root || document).querySelector(selector);
9
+ }
10
+
11
+ function queryAll(selector, root) {
12
+ return Array.prototype.slice.call(
13
+ (root || document).querySelectorAll(selector),
14
+ );
15
+ }
16
+
17
+ function isVisible(element) {
18
+ if (!element) return false;
19
+ if (window.getComputedStyle(element).display === "none") return false;
20
+ if (element.parentElement && element.parentElement !== document.body) {
21
+ return isVisible(element.parentElement);
22
+ }
23
+ return true;
24
+ }
25
+
26
+ RegExp.escape = (text) => text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
27
+
28
+ function ready(callback) {
29
+ if (document.readyState === "loading") {
30
+ document.addEventListener("DOMContentLoaded", callback, { once: true });
31
+ } else {
32
+ callback();
33
+ }
34
+ }
35
+
36
+ function escapeShortcut() {
37
+ document.addEventListener("keydown", (event) => {
38
+ if (event.key === "Escape") {
39
+ window.parent.postMessage("navEscape", "*");
40
+ }
41
+ });
42
+ }
43
+
44
+ function clearSearchTimeout() {
45
+ clearTimeout(searchTimeout);
46
+ searchTimeout = null;
47
+ }
48
+
49
+ function setClicked(item) {
50
+ queryAll("#full_list li.clicked").forEach((node) => {
51
+ node.classList.remove("clicked");
52
+ });
53
+ clicked = item;
54
+ if (clicked) clicked.classList.add("clicked");
55
+ }
56
+
57
+ function pathForItem(item) {
58
+ if (!item?.id || item.id.indexOf("object_") !== 0) return null;
59
+ return item.id.substring("object_".length);
60
+ }
61
+
62
+ function enableLinks() {
63
+ queryAll("#full_list li").forEach((item) => {
64
+ const itemRow = item.querySelector(":scope > .item");
65
+
66
+ if (!itemRow) return;
67
+
68
+ itemRow.addEventListener("click", (event) => {
69
+ let targetLink;
70
+ let url;
71
+
72
+ if (
73
+ event.defaultPrevented ||
74
+ event.button !== 0 ||
75
+ event.metaKey ||
76
+ event.ctrlKey ||
77
+ event.shiftKey ||
78
+ event.altKey
79
+ ) {
80
+ return true;
81
+ }
82
+
83
+ setClicked(item);
84
+ event.stopPropagation();
85
+ targetLink = event.target.closest("a");
86
+ if (!targetLink?.matches(".object_link a")) {
87
+ targetLink = item.querySelector(":scope > .item .object_link a");
88
+ }
89
+ if (!targetLink) return false;
90
+
91
+ event.preventDefault();
92
+ url = targetLink.getAttribute("href");
93
+ try {
94
+ url = new URL(url, window.location.href).href;
95
+ } catch (_error) {}
96
+ window.top.postMessage(
97
+ { action: "navigate", url: url, path: pathForItem(item) },
98
+ "*",
99
+ );
100
+ return false;
101
+ });
102
+ });
103
+ }
104
+
105
+ function toggleItem(toggle) {
106
+ const item = toggle.parentElement.parentElement;
107
+ const expanded = item.classList.contains("collapsed");
108
+
109
+ item.classList.toggle("collapsed");
110
+ toggle.setAttribute("aria-expanded", expanded ? "true" : "false");
111
+ highlight();
112
+ }
113
+
114
+ function enableToggles() {
115
+ queryAll("#full_list a.toggle").forEach((toggle) => {
116
+ toggle.addEventListener("click", (event) => {
117
+ event.stopPropagation();
118
+ event.preventDefault();
119
+ toggleItem(toggle);
120
+ });
121
+
122
+ toggle.addEventListener("keypress", (event) => {
123
+ if (event.key !== "Enter") return;
124
+ event.stopPropagation();
125
+ event.preventDefault();
126
+ toggleItem(toggle);
127
+ });
128
+ });
129
+ }
130
+
131
+ function populateSearchCache() {
132
+ queryAll("#full_list li .item").forEach((node) => {
133
+ const link = query(".object_link a", node);
134
+ if (!link) return;
135
+
136
+ searchCache.push({
137
+ node: node,
138
+ link: link,
139
+ name: link.textContent,
140
+ fullName: link.getAttribute("title").split(" ")[0],
141
+ });
142
+ });
143
+ }
144
+
145
+ function enableSearch() {
146
+ const input = query("#search input");
147
+ const fullList = query("#full_list");
148
+
149
+ if (!input || !fullList) return;
150
+
151
+ function updateSearchResults() {
152
+ if (input.value === "") {
153
+ clearSearch();
154
+ } else {
155
+ performSearch(input.value);
156
+ }
157
+ }
158
+
159
+ input.addEventListener("input", updateSearchResults);
160
+ input.addEventListener("change", updateSearchResults);
161
+
162
+ fullList.insertAdjacentHTML(
163
+ "afterend",
164
+ "<div id='noresults' role='status' style='display: none'></div>",
165
+ );
166
+ }
167
+
168
+ function clearSearch() {
169
+ clearSearchTimeout();
170
+ queryAll("#full_list .found").forEach((node) => {
171
+ node.classList.remove("found");
172
+ });
173
+ query("#full_list").classList.remove("insearch");
174
+ query("#content").classList.remove("insearch");
175
+ if (clicked) {
176
+ let current = clicked.parentElement;
177
+ while (current) {
178
+ if (current.tagName === "LI") current.classList.remove("collapsed");
179
+ if (current.id === "full_list") break;
180
+ current = current.parentElement;
181
+ }
182
+ }
183
+ highlight();
184
+ }
185
+
186
+ function performSearch(searchString) {
187
+ clearSearchTimeout();
188
+ query("#full_list").classList.add("insearch");
189
+ query("#content").classList.add("insearch");
190
+ query("#noresults").textContent = "";
191
+ query("#noresults").style.display = "none";
192
+ partialSearch(searchString, 0);
193
+ }
194
+
195
+ function partialSearch(searchString, offset) {
196
+ let lastRowClass = "";
197
+ let i;
198
+
199
+ for (i = offset; i < Math.min(offset + 50, searchCache.length); i += 1) {
200
+ const item = searchCache[i];
201
+ const searchName =
202
+ searchString.indexOf("::") !== -1 ? item.fullName : item.name;
203
+ const matchRegexp = new RegExp(
204
+ buildMatchString(searchString),
205
+ caseSensitiveMatch ? "" : "i",
206
+ );
207
+
208
+ if (!searchName.match(matchRegexp)) {
209
+ item.node.classList.remove("found");
210
+ } else {
211
+ item.node.classList.add("found");
212
+ if (lastRowClass) item.node.classList.remove(lastRowClass);
213
+ item.node.classList.add(lastRowClass === "r1" ? "r2" : "r1");
214
+ lastRowClass = item.node.classList.contains("r1") ? "r1" : "r2";
215
+ item.link.innerHTML = item.name.replace(
216
+ matchRegexp,
217
+ "<strong>$&</strong>",
218
+ );
219
+ }
220
+ }
221
+
222
+ if (i === searchCache.length) {
223
+ searchDone();
224
+ } else {
225
+ searchTimeout = setTimeout(() => {
226
+ partialSearch(searchString, i);
227
+ }, 0);
228
+ }
229
+ }
230
+
231
+ function searchDone() {
232
+ const found = queryAll("#full_list li").filter(isVisible).length;
233
+
234
+ searchTimeout = null;
235
+ highlight();
236
+
237
+ if (found === 0) {
238
+ query("#noresults").textContent = "No results were found.";
239
+ } else {
240
+ query("#noresults").textContent = `There are ${found} results.`;
241
+ }
242
+ query("#noresults").style.display = "block";
243
+ query("#content").classList.remove("insearch");
244
+ }
245
+
246
+ function buildMatchString(searchString) {
247
+ let regexSearchString;
248
+
249
+ caseSensitiveMatch = /[A-Z]/.test(searchString);
250
+ regexSearchString = RegExp.escape(searchString);
251
+ if (caseSensitiveMatch) {
252
+ regexSearchString +=
253
+ "|" +
254
+ searchString
255
+ .split("")
256
+ .map((character) => RegExp.escape(character))
257
+ .join(".+?");
258
+ }
259
+ return regexSearchString;
260
+ }
261
+
262
+ function highlight() {
263
+ queryAll("#full_list li")
264
+ .filter(isVisible)
265
+ .forEach((item, index) => {
266
+ item.classList.remove("even");
267
+ item.classList.remove("odd");
268
+ item.classList.add(index % 2 === 0 ? "odd" : "even");
269
+ });
270
+ }
271
+
272
+ function isInView(element) {
273
+ const rect = element.getBoundingClientRect();
274
+ const windowHeight =
275
+ window.innerHeight || document.documentElement.clientHeight;
276
+ return rect.left >= 0 && rect.bottom <= windowHeight;
277
+ }
278
+
279
+ function expandTo(path) {
280
+ const target = document.getElementById(`object_${path}`);
281
+
282
+ if (!target) return;
283
+
284
+ setClicked(target);
285
+ target.classList.remove("collapsed");
286
+
287
+ let current = target.parentElement;
288
+ while (current && current.id !== "full_list") {
289
+ if (current.tagName === "LI") current.classList.remove("collapsed");
290
+ current = current.parentElement;
291
+ }
292
+
293
+ queryAll("a.toggle", target).forEach((toggle) => {
294
+ toggle.setAttribute("aria-expanded", "true");
295
+ });
296
+
297
+ current = target.parentElement;
298
+ while (current && current.id !== "full_list") {
299
+ if (current.tagName === "LI") {
300
+ const toggle = current.querySelector(":scope > div > a.toggle");
301
+ if (toggle) toggle.setAttribute("aria-expanded", "true");
302
+ }
303
+ current = current.parentElement;
304
+ }
305
+
306
+ highlight();
307
+
308
+ if (!isInView(target)) {
309
+ window.scrollTo(
310
+ window.scrollX,
311
+ target.getBoundingClientRect().top + window.scrollY - 250,
312
+ );
313
+ }
314
+ }
315
+
316
+ function windowEvents(event) {
317
+ const msg = event.data;
318
+ if (msg.action === "expand") {
319
+ expandTo(msg.path);
320
+ }
321
+ return false;
322
+ }
323
+
324
+ window.addEventListener("message", windowEvents, false);
325
+
326
+ ready(() => {
327
+ escapeShortcut();
328
+ enableLinks();
329
+ enableToggles();
330
+ populateSearchCache();
331
+ enableSearch();
332
+ highlight();
333
+ });
242
334
  })();
@@ -2,11 +2,11 @@
2
2
  <html >
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
- <meta charset="utf-8" />
5
+ <meta charset="utf-8">
6
6
 
7
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen">
8
8
 
9
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen">
10
10
 
11
11
 
12
12
 
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
  <title>Method List</title>
19
- <base id="base_target" target="_parent" />
19
+ <base id="base_target" target="_parent">
20
20
  </head>
21
21
  <body>
22
22
  <div id="content">
@@ -40,7 +40,7 @@
40
40
 
41
41
  <div id="search">
42
42
  <label for="search-class">Search:</label>
43
- <input id="search-class" type="text" />
43
+ <input id="search-class" type="text">
44
44
  </div>
45
45
  </div>
46
46
 
@@ -6,13 +6,13 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.9.37
9
+ &mdash; Documentation by YARD 0.9.45
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css">
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css">
16
16
 
17
17
  <script type="text/javascript">
18
18
  pathId = "";
@@ -27,6 +27,8 @@
27
27
 
28
28
  </head>
29
29
  <body>
30
+ <div id="main_progress" aria-hidden="true"></div>
31
+
30
32
  <div class="nav_wrap">
31
33
  <iframe id="nav" src="class_list.html?1"></iframe>
32
34
  <div id="resizer"></div>
@@ -82,7 +84,7 @@
82
84
  <p class="children">
83
85
 
84
86
 
85
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="HyperActiveForm.html" title="HyperActiveForm (module)">HyperActiveForm</a></span>, <span class='object_link'><a href="Rspec.html" title="Rspec (module)">Rspec</a></span>, <span class='object_link'><a href="TestUnit.html" title="TestUnit (module)">TestUnit</a></span>
87
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="HyperActiveForm.html" title="HyperActiveForm (module)">HyperActiveForm</a></span>, <span class='object_link'><a href="Hyperactiveform_.html" title="Hyperactiveform (module)">Hyperactiveform</a></span>, <span class='object_link'><a href="Rspec.html" title="Rspec (module)">Rspec</a></span>, <span class='object_link'><a href="TestUnit.html" title="TestUnit (module)">TestUnit</a></span>
86
88
 
87
89
 
88
90
 
@@ -102,11 +104,11 @@
102
104
  </div>
103
105
 
104
106
  <div id="footer">
105
- Generated on Mon Jan 13 17:26:04 2025 by
107
+ Generated on Tue Aug 25 18:22:24 2026 by
106
108
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
- 0.9.37 (ruby-3.3.1).
109
+ 0.9.45 (ruby-4.0.6).
108
110
  </div>
109
111
 
110
112
  </div>
111
113
  </body>
112
- </html>
114
+ </html>
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec :path => '..'
4
4
 
5
- gem 'rails', '~> 8.0'
5
+ gem 'rails', '~> 8.0.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem 'rails', '~> 8.1.0.beta1'