Skip to content

Commit 63083c4

Browse files
committedDec 13, 2023
Bump patch version
1 parent c8c06cc commit 63083c4

File tree

5 files changed

+278
-224
lines changed

5 files changed

+278
-224
lines changed
 

‎Reflect.js

-1
Original file line numberDiff line numberDiff line change
@@ -1129,4 +1129,3 @@ var Reflect;
11291129
}
11301130
});
11311131
})(Reflect || (Reflect = {}));
1132-
//# sourceMappingURL=Reflect.js.map

‎docs/ecmarkup.css

+50-14
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,43 @@ emu-const {
7878
emu-val {
7979
font-weight: bold;
8080
}
81-
emu-alg ol, emu-alg ol ol ol ol {
82-
list-style-type: decimal;
83-
}
84-
85-
emu-alg ol ol, emu-alg ol ol ol ol ol {
86-
list-style-type: lower-alpha;
87-
}
8881

89-
emu-alg ol ol ol, ol ol ol ol ol ol {
90-
list-style-type: lower-roman;
82+
/* depth 1 */
83+
emu-alg ol,
84+
/* depth 4 */
85+
emu-alg ol ol ol ol,
86+
emu-alg ol.nested-thrice,
87+
emu-alg ol.nested-twice ol,
88+
emu-alg ol.nested-once ol ol {
89+
list-style-type: decimal;
90+
}
91+
92+
/* depth 2 */
93+
emu-alg ol ol,
94+
emu-alg ol.nested-once,
95+
/* depth 5 */
96+
emu-alg ol ol ol ol ol,
97+
emu-alg ol.nested-four-times,
98+
emu-alg ol.nested-thrice ol,
99+
emu-alg ol.nested-twice ol ol,
100+
emu-alg ol.nested-once ol ol ol {
101+
list-style-type: lower-alpha;
102+
}
103+
104+
/* depth 3 */
105+
emu-alg ol ol ol,
106+
emu-alg ol.nested-twice,
107+
emu-alg ol.nested-once ol,
108+
/* depth 6 */
109+
emu-alg ol ol ol ol ol ol,
110+
emu-alg ol.nested-lots,
111+
emu-alg ol.nested-four-times ol,
112+
emu-alg ol.nested-thrice ol ol,
113+
emu-alg ol.nested-twice ol ol ol,
114+
emu-alg ol.nested-once ol ol ol ol,
115+
/* depth 7+ */
116+
emu-alg ol.nested-lots ol {
117+
list-style-type: lower-roman;
91118
}
92119

93120
emu-eqn {
@@ -138,6 +165,10 @@ emu-note > div.note-contents > p:last-of-type {
138165
margin-bottom: 0;
139166
}
140167

168+
emu-table td code {
169+
white-space: normal;
170+
}
171+
141172
emu-figure {
142173
display: block;
143174
}
@@ -162,6 +193,10 @@ emu-table figure {
162193

163194
emu-production {
164195
display: block;
196+
}
197+
198+
emu-grammar[type="example"] emu-production,
199+
emu-grammar[type="definition"] emu-production {
165200
margin-top: 1em;
166201
margin-bottom: 1em;
167202
margin-left: 5ex;
@@ -189,6 +224,7 @@ emu-gann {
189224
}
190225

191226
emu-gann emu-t:last-child,
227+
emu-gann emu-gprose:last-child,
192228
emu-gann emu-nt:last-child {
193229
margin-right: 0;
194230
}
@@ -243,10 +279,6 @@ emu-mods {
243279
font-weight: normal;
244280
}
245281

246-
emu-production[collapsed] emu-mods {
247-
display: none;
248-
}
249-
250282
emu-params, emu-opt {
251283
margin-right: 1ex;
252284
font-family: monospace;
@@ -265,6 +297,10 @@ emu-gprose {
265297
font-family: Helvetica, Arial, sans-serif;
266298
}
267299

300+
emu-production emu-gprose {
301+
margin-right: 1ex;
302+
}
303+
268304
h1.shortname {
269305
color: #f60;
270306
font-size: 1.5em;
@@ -292,7 +328,7 @@ h1, h2, h3, h4, h5, h6 {
292328

293329
h1 .secnum {
294330
text-decoration: none;
295-
margin-right: 10px;
331+
margin-right: 5px;
296332
}
297333

298334
h1 span.title {

‎docs/ecmarkup.js

+51-47
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ function Search(menu) {
55
this.$search = document.getElementById('menu-search');
66
this.$searchBox = document.getElementById('menu-search-box');
77
this.$searchResults = document.getElementById('menu-search-results');
8-
8+
99
this.loadBiblio();
10-
10+
1111
document.addEventListener('keydown', this.documentKeydown.bind(this));
12-
12+
1313
this.$searchBox.addEventListener('keydown', debounce(this.searchBoxKeydown.bind(this), { stopPropagation: true }));
1414
this.$searchBox.addEventListener('keyup', debounce(this.searchBoxKeyup.bind(this), { stopPropagation: true }));
15+
16+
// Perform an initial search if the box is not empty.
17+
if (this.$searchBox.value) {
18+
this.search(this.$searchBox.value);
19+
}
1520
}
1621

1722
Search.prototype.loadBiblio = function () {
@@ -51,7 +56,7 @@ Search.prototype.searchBoxKeyup = function (e) {
5156
if (e.keyCode === 13 || e.keyCode === 9) {
5257
return;
5358
}
54-
59+
5560
this.search(e.target.value);
5661
}
5762

@@ -74,38 +79,36 @@ Search.prototype.triggerSearch = function (e) {
7479
// prefer shorter matches.
7580
function relevance(result, searchString) {
7681
var relevance = 0;
77-
82+
7883
relevance = Math.max(0, 8 - result.match.chunks) << 7;
79-
84+
8085
if (result.match.caseMatch) {
8186
relevance *= 2;
8287
}
83-
88+
8489
if (result.match.prefix) {
8590
relevance += 2048
8691
}
87-
92+
8893
relevance += Math.max(0, 255 - result.entry.key.length);
89-
94+
9095
return relevance;
9196
}
9297

9398
Search.prototype.search = function (searchString) {
94-
var s = Date.now();
95-
9699
if (searchString === '') {
97100
this.displayResults([]);
98101
this.hideSearch();
99102
return;
100103
} else {
101104
this.showSearch();
102105
}
103-
106+
104107
if (searchString.length === 1) {
105108
this.displayResults([]);
106109
return;
107110
}
108-
111+
109112
var results;
110113

111114
if (/^[\d\.]*$/.test(searchString)) {
@@ -116,7 +119,7 @@ Search.prototype.search = function (searchString) {
116119
});
117120
} else {
118121
results = [];
119-
122+
120123
for (var i = 0; i < this.biblio.length; i++) {
121124
var entry = this.biblio[i];
122125
if (!entry.key) {
@@ -129,19 +132,19 @@ Search.prototype.search = function (searchString) {
129132
results.push({ entry: entry, match: match });
130133
}
131134
}
132-
135+
133136
results.forEach(function (result) {
134137
result.relevance = relevance(result, searchString);
135138
});
136-
139+
137140
results = results.sort(function (a, b) { return b.relevance - a.relevance });
138141

139142
}
140143

141144
if (results.length > 50) {
142145
results = results.slice(0, 50);
143146
}
144-
147+
145148
this.displayResults(results);
146149
}
147150
Search.prototype.hideSearch = function () {
@@ -158,7 +161,7 @@ Search.prototype.selectResult = function () {
158161
if ($first) {
159162
document.location = $first.getAttribute('href');
160163
}
161-
164+
162165
this.$searchBox.value = '';
163166
this.$searchBox.blur();
164167
this.displayResults([]);
@@ -172,7 +175,7 @@ Search.prototype.selectResult = function () {
172175
Search.prototype.displayResults = function (results) {
173176
if (results.length > 0) {
174177
this.$searchResults.classList.remove('no-results');
175-
178+
176179
var html = '<ul>';
177180

178181
results.forEach(function (result) {
@@ -189,7 +192,7 @@ Search.prototype.displayResults = function (results) {
189192
} else if (entry.type === 'production') {
190193
text = entry.key;
191194
cssClass = 'prod';
192-
id = entry.id;
195+
id = entry.id;
193196
} else if (entry.type === 'op') {
194197
text = entry.key;
195198
cssClass = 'op';
@@ -201,7 +204,7 @@ Search.prototype.displayResults = function (results) {
201204
}
202205

203206
if (text) {
204-
html += '<li class=menu-search-result-' + cssClass + '><a href="#' + id + '">' + text + '</a></li>'
207+
html += '<li class=menu-search-result-' + cssClass + '><a href="#' + id + '">' + text + '</a></li>';
205208
}
206209
});
207210

@@ -224,7 +227,7 @@ function Menu() {
224227
this.$toc = document.querySelector('#menu-toc > ol');
225228
this.$specContainer = document.getElementById('spec-container');
226229
this.search = new Search(this);
227-
230+
228231
this._pinnedIds = {};
229232
this.loadPinEntries();
230233

@@ -269,9 +272,9 @@ function Menu() {
269272
&& target.offsetHeight + target.scrollTop >= target.scrollHeight;
270273

271274
if (offBottom) {
272-
e.preventDefault();
273-
}
274-
})
275+
e.preventDefault();
276+
}
277+
});
275278
}
276279

277280
Menu.prototype.documentKeydown = function (e) {
@@ -298,7 +301,7 @@ Menu.prototype.revealInToc = function (path) {
298301
current[i].classList.remove('revealed');
299302
current[i].classList.remove('revealed-leaf');
300303
}
301-
304+
302305
var current = this.$toc;
303306
var index = 0;
304307
while (index < path.length) {
@@ -309,7 +312,7 @@ Menu.prototype.revealInToc = function (path) {
309312
if (index === path.length - 1) {
310313
children[i].classList.add('revealed-leaf');
311314
var rect = children[i].getBoundingClientRect();
312-
this.$toc.getBoundingClientRect().top
315+
// this.$toc.getBoundingClientRect().top;
313316
var tocRect = this.$toc.getBoundingClientRect();
314317
if (rect.top + 10 > tocRect.bottom) {
315318
this.$toc.scrollTop = this.$toc.scrollTop + (rect.top - tocRect.bottom) + (rect.bottom - rect.top);
@@ -320,29 +323,27 @@ Menu.prototype.revealInToc = function (path) {
320323
current = children[i].querySelector('ol');
321324
index++;
322325
break;
323-
}
326+
}
324327
}
325-
328+
326329
}
327330
}
328331

329332
function findActiveClause(root, path) {
330333
var clauses = new ClauseWalker(root);
331334
var $clause;
332-
var found = false;
333335
var path = path || [];
334-
336+
335337
while ($clause = clauses.nextNode()) {
336338
var rect = $clause.getBoundingClientRect();
337-
var $header = $clause.children[0];
339+
var $header = $clause.querySelector("h1");
338340
var marginTop = parseInt(getComputedStyle($header)["margin-top"]);
339-
341+
340342
if ((rect.top - marginTop) <= 0 && rect.bottom > 0) {
341-
found = true;
342343
return findActiveClause($clause, path.concat($clause)) || path;
343344
}
344345
}
345-
346+
346347
return path;
347348
}
348349

@@ -367,7 +368,7 @@ function ClauseWalker(root) {
367368
},
368369
false
369370
);
370-
371+
371372
return treeWalker;
372373
}
373374

@@ -450,7 +451,7 @@ Menu.prototype.loadPinEntries = function () {
450451
} catch (e) {
451452
return;
452453
}
453-
454+
454455
var pinsString = window.localStorage.pinEntries;
455456
if (!pinsString) return;
456457
var pins = JSON.parse(pinsString);
@@ -482,6 +483,11 @@ function init() {
482483
$container.addEventListener('mouseover', debounce(function (e) {
483484
Toolbox.activateIfMouseOver(e);
484485
}));
486+
document.addEventListener('keydown', debounce(function (e) {
487+
if (e.code === "Escape" && Toolbox.active) {
488+
Toolbox.deactivate();
489+
}
490+
}));
485491
}
486492

487493
document.addEventListener('DOMContentLoaded', init);
@@ -580,12 +586,11 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
580586
var qlen = searchString.length;
581587
var chunks = 1;
582588
var finding = false;
583-
var prefix = true;
584-
589+
585590
if (qlen > tlen) {
586591
return false;
587592
}
588-
593+
589594
if (qlen === tlen) {
590595
if (searchString === haystack) {
591596
return { caseMatch: true, chunks: 1, prefix: true };
@@ -595,7 +600,7 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
595600
return false;
596601
}
597602
}
598-
603+
599604
outer: for (var i = 0, j = 0; i < qlen; i++) {
600605
var nch = searchString[i];
601606
while (j < tlen) {
@@ -609,12 +614,12 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
609614
finding = false;
610615
}
611616
}
612-
613-
if (caseInsensitive) { return false }
614-
617+
618+
if (caseInsensitive) { return false; }
619+
615620
return fuzzysearch(searchString.toLowerCase(), haystack.toLowerCase(), true);
616621
}
617-
622+
618623
return { caseMatch: !caseInsensitive, chunks: chunks, prefix: j <= qlen };
619624
}
620625

@@ -771,7 +776,6 @@ var referencePane = {
771776
var target = document.getElementById(id);
772777
var cid = findParentClauseId(target);
773778
var clause = menu.search.biblio.byId[cid];
774-
var dupCount = 0;
775779
return { id: id, clause: clause }
776780
}).sort(function (a, b) {
777781
return sortByClauseNumber(a.clause, b.clause);
@@ -811,7 +815,7 @@ function sortByClauseNumber(c1, c2) {
811815
if (i >= c2c.length) {
812816
return 1;
813817
}
814-
818+
815819
var c1 = c1c[i];
816820
var c2 = c2c[i];
817821
var c1cn = Number(c1);

‎docs/index.html

+176-161
Large diffs are not rendered by default.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reflect-metadata",
3-
"version": "0.1.13",
3+
"version": "0.1.14",
44
"description": "Polyfill for Metadata Reflection API",
55
"main": "Reflect.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)
Please sign in to comment.