basedpl 0.1.77 → 0.1.78

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.
Binary file
package/bpl-editor.js CHANGED
@@ -90,7 +90,7 @@ const bar = // Based on Adám Brudzewsky's APL language bar: https://abrudz.gith
90
90
  }
91
91
 
92
92
  const host = d.createElement('div');
93
- host.innerHTML = `<div class="ngn_lb" aria-label="BPL symbols"></div>
93
+ host.innerHTML = `<div class="ngn_lb" aria-label="BPL symbols"><button type="button" class="ngn_x" style="float:right" title="Close symbol bar">×</button></div>
94
94
  <div class="bpl_choices" role="group" aria-label="BPL symbol completions" hidden></div>
95
95
  <style>
96
96
  .ngn_lb,.bpl_choices{background:var(--bpl-bar-background,#eee);color:var(--bpl-bar-color,#111);font:15px var(--bpl-font,SAX2B),monospace}
@@ -106,6 +106,7 @@ const bar = // Based on Adám Brudzewsky's APL language bar: https://abrudz.gith
106
106
  </style>`;
107
107
  container.append(host);
108
108
  const bar = host.querySelector('.ngn_lb'), tip = host.querySelector('.bpl_choices');
109
+ bar.querySelector('.ngn_x').onclick = () => { bar.hidden = true; };
109
110
  let active, lastEditor, choice, keyInput = false;
110
111
  const names = new Map(symbols.map(({glyph, name, monad, dyad}) =>
111
112
  [glyph, [name, monad, dyad].filter(Boolean).join(' ')]));
@@ -251,15 +252,14 @@ const bar = // Based on Adám Brudzewsky's APL language bar: https://abrudz.gith
251
252
  container.style.cssText = 'position:fixed;top:0;left:0;right:0;z-index:2147483647';
252
253
  d.body.append(container);
253
254
  const input = attach(monaco, container, true), bar = container.querySelector('.ngn_lb');
254
- bar.insertAdjacentHTML('afterbegin', '<button class="ngn_x" style="float:right" title="Close symbol bar">×</button><button class="ngn_o" style="float:right" title="Toggle overlay/push-down"></button>');
255
+ bar.insertAdjacentHTML('afterbegin', '<button class="ngn_o" style="float:right" title="Toggle overlay/push-down"></button>');
255
256
  let overlay = false;
256
257
  const padding = d.body.style.paddingTop, toggle = bar.querySelector('.ngn_o');
257
258
  try { overlay = localStorage.getItem('ngn_lb_overlay') === '1'; } catch {}
258
259
  function reflow() {
259
260
  toggle.textContent = overlay ? '▼' : '▲';
260
- d.body.style.paddingTop = overlay || container.hidden ? padding : `${bar.offsetHeight}px`;
261
+ d.body.style.paddingTop = overlay || bar.hidden ? padding : `${bar.offsetHeight}px`;
261
262
  }
262
- bar.querySelector('.ngn_x').onclick = () => { container.hidden = true; reflow(); };
263
263
  toggle.onclick = () => {
264
264
  overlay = !overlay;
265
265
  try { localStorage.setItem('ngn_lb_overlay', overlay ? '1' : '0'); } catch {}
@@ -463,9 +463,14 @@ const bar = // Based on Adám Brudzewsky's APL language bar: https://abrudz.gith
463
463
  }
464
464
  );
465
465
  const font = new URL("SAX2B.woff2", import.meta.url);
466
- export function attach(monaco, container) {
467
- const input = bar.attach(monaco, container), style = container.ownerDocument.createElement('style');
466
+ export function installFont(doc = document) {
467
+ if (doc.getElementById('bpl-font')) return;
468
+ const style = doc.createElement('style');
469
+ style.id = 'bpl-font';
468
470
  style.textContent = `@font-face{font-family:SAX2B;src:url("${font}") format("woff2")}`;
469
- container.append(style);
470
- return {dispose() { input.dispose(); style.remove(); }};
471
+ doc.head.append(style);
472
+ }
473
+ export function attach(monaco, container) {
474
+ installFont(container.ownerDocument);
475
+ return bar.attach(monaco, container);
471
476
  }
package/lb.js CHANGED
@@ -86,7 +86,7 @@
86
86
  }
87
87
 
88
88
  const host = d.createElement('div');
89
- host.innerHTML = `<div class="ngn_lb" aria-label="BPL symbols"></div>
89
+ host.innerHTML = `<div class="ngn_lb" aria-label="BPL symbols"><button type="button" class="ngn_x" style="float:right" title="Close symbol bar">×</button></div>
90
90
  <div class="bpl_choices" role="group" aria-label="BPL symbol completions" hidden></div>
91
91
  <style>
92
92
  .ngn_lb,.bpl_choices{background:var(--bpl-bar-background,#eee);color:var(--bpl-bar-color,#111);font:15px var(--bpl-font,SAX2B),monospace}
@@ -102,6 +102,7 @@
102
102
  </style>`;
103
103
  container.append(host);
104
104
  const bar = host.querySelector('.ngn_lb'), tip = host.querySelector('.bpl_choices');
105
+ bar.querySelector('.ngn_x').onclick = () => { bar.hidden = true; };
105
106
  let active, lastEditor, choice, keyInput = false;
106
107
  const names = new Map(symbols.map(({glyph, name, monad, dyad}) =>
107
108
  [glyph, [name, monad, dyad].filter(Boolean).join(' ')]));
@@ -247,15 +248,14 @@
247
248
  container.style.cssText = 'position:fixed;top:0;left:0;right:0;z-index:2147483647';
248
249
  d.body.append(container);
249
250
  const input = attach(monaco, container, true), bar = container.querySelector('.ngn_lb');
250
- bar.insertAdjacentHTML('afterbegin', '<button class="ngn_x" style="float:right" title="Close symbol bar">×</button><button class="ngn_o" style="float:right" title="Toggle overlay/push-down"></button>');
251
+ bar.insertAdjacentHTML('afterbegin', '<button class="ngn_o" style="float:right" title="Toggle overlay/push-down"></button>');
251
252
  let overlay = false;
252
253
  const padding = d.body.style.paddingTop, toggle = bar.querySelector('.ngn_o');
253
254
  try { overlay = localStorage.getItem('ngn_lb_overlay') === '1'; } catch {}
254
255
  function reflow() {
255
256
  toggle.textContent = overlay ? '▼' : '▲';
256
- d.body.style.paddingTop = overlay || container.hidden ? padding : `${bar.offsetHeight}px`;
257
+ d.body.style.paddingTop = overlay || bar.hidden ? padding : `${bar.offsetHeight}px`;
257
258
  }
258
- bar.querySelector('.ngn_x').onclick = () => { container.hidden = true; reflow(); };
259
259
  toggle.onclick = () => {
260
260
  overlay = !overlay;
261
261
  try { localStorage.setItem('ngn_lb_overlay', overlay ? '1' : '0'); } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basedpl",
3
- "version": "0.1.77",
3
+ "version": "0.1.78",
4
4
  "description": "BasedPL, the Based-array Programming Language, is an APL-derived array language, borrowing ideas from J and BQN, with an emphasis on simple, consistent notation.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {