@gbti/ryker 0.2.1 → 0.2.3

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.
package/README.md CHANGED
@@ -78,7 +78,7 @@ it.
78
78
  Ryker requires Node.js 20 or newer for installation. The resulting HTML and
79
79
  classic browser script work offline and from `file://` without Node.js.
80
80
 
81
- This repository is at version `0.2.1`, and the npm `latest` tag serves it, so
81
+ This repository is at version `0.2.3`, and the npm `latest` tag serves it, so
82
82
  every `npx` command above installs this code.
83
83
 
84
84
  ## Privacy
package/bin/ryker.js CHANGED
@@ -4,7 +4,7 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, writeF
4
4
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
- const VERSION = '0.2.1';
7
+ const VERSION = '0.2.3';
8
8
  const BEGIN = '<!-- ryker:begin -->';
9
9
  const END = '<!-- ryker:end -->';
10
10
  const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * Ryker 0.2.1
2
+ * Ryker 0.2.3
3
3
  * A drop-in editing layer for authored HTML reports.
4
4
  *
5
5
  * Generated bundle. Do not edit. Sources, in load order:
6
6
  * utils/dom.js (51 lines)
7
- * config/config.js (131 lines)
7
+ * config/config.js (157 lines)
8
8
  * security/scan.js (86 lines)
9
9
  * editor/sanitize.js (218 lines)
10
10
  * editor/blocks.js (596 lines)
@@ -14,12 +14,13 @@
14
14
  * export/target.js (66 lines)
15
15
  * export/packager.js (277 lines)
16
16
  * ui/theme.js (61 lines)
17
- * ui/styles.js (405 lines)
17
+ * ui/styles.js (421 lines)
18
18
  * ui/shell.js (241 lines)
19
19
  * ui/icons.js (68 lines)
20
20
  * ui/tooltip.js (82 lines)
21
21
  * ui/dialog.js (138 lines)
22
22
  * ui/menu.js (104 lines)
23
+ * ui/about.js (77 lines)
23
24
  * export/dialog.js (213 lines)
24
25
  * editor/editable.js (596 lines)
25
26
  * editor/history.js (248 lines)
@@ -34,14 +35,14 @@
34
35
  * ui/rail.js (530 lines)
35
36
  * instructions/steps.js (592 lines)
36
37
  * instructions/moves.js (158 lines)
37
- * instructions/instructions.js (509 lines)
38
+ * instructions/instructions.js (517 lines)
38
39
  * instructions/merge.js (405 lines)
39
40
  * storage/fs.js (336 lines)
40
41
  * storage/logger.js (433 lines)
41
42
  * instructions/browser.js (296 lines)
42
43
  * ui/pane.js (292 lines)
43
44
  * storage/recover.js (335 lines)
44
- * bootstrap/boot.js (541 lines)
45
+ * bootstrap/boot.js (546 lines)
45
46
  *
46
47
  * Classic script by design: module scripts do not load from file:// URLs,
47
48
  * and a report handed over as a ZIP is opened from disk.
@@ -49,7 +50,7 @@
49
50
  (function () {
50
51
  'use strict';
51
52
  if (window.Ryker && window.Ryker.VERSION) return;
52
- var Ryker = { VERSION: "0.2.1", BUILD: "Ryker", SURFACE: "drop-in" };
53
+ var Ryker = { VERSION: "0.2.3", BUILD: "Ryker", SURFACE: "drop-in" };
53
54
  window.Ryker = Ryker;
54
55
 
55
56
  /* ---- utils/dom.js ---------------------------------------------- */
@@ -204,16 +205,41 @@
204
205
  ? extensionDocumentId()
205
206
  : slug(document.title || 'untitled');
206
207
  }
207
- if (!cfg.RYKER_DOCUMENT_PATH) {
208
- var last = location.pathname.split('/').pop();
209
- cfg.RYKER_DOCUMENT_PATH = last ? decodeURIComponent(last) : 'report.html';
210
- }
208
+ if (!cfg.RYKER_DOCUMENT_PATH) cfg.RYKER_DOCUMENT_PATH = documentPath();
211
209
 
212
210
  cfg._leaked = leaked;
213
211
  state = cfg;
214
212
  return state;
215
213
  }
216
214
 
215
+ /** The filename this document was loaded from, or null when there is not one.
216
+ *
217
+ * The drop-in is copied next to the file it edits, so the last path segment
218
+ * IS the filename and always has been. The extension is a different case: it
219
+ * runs on whatever page is open, and most pages are application routes with
220
+ * no file behind them. Reporting one anyway is not a cosmetic slip. The
221
+ * export header hands an agent a filename to apply edits to, so a LinkedIn
222
+ * post used to arrive as `File: "report.html"`, naming a file that does not
223
+ * exist, and a route like /app/dashboard used to arrive as
224
+ * `File: "dashboard"`, naming one that never did.
225
+ *
226
+ * Null here is honest rather than lossy: the download name falls back on its
227
+ * own in export/html.js, and instructions.js prints the page address instead
228
+ * of a filename when there is none. */
229
+ function documentPath() {
230
+ return pathFrom(location.pathname, Ryker.SURFACE);
231
+ }
232
+
233
+ /** Pure, so every URL shape can be checked without faking window.location. */
234
+ function pathFrom(pathname, surface) {
235
+ var last = String(pathname || '').split('/').pop();
236
+ last = last ? decodeURIComponent(last) : '';
237
+ if (surface !== 'extension') return last || 'report.html';
238
+ // A filename has an extension. Anything else is a route segment, and a
239
+ // route segment is not a file no matter how much it looks like a word.
240
+ return /\.[a-z0-9]{1,8}$/i.test(last) ? last : null;
241
+ }
242
+
217
243
  function slug(s) {
218
244
  return String(s).toLowerCase().replace(/[^a-z0-9]+/g, '-')
219
245
  .replace(/^-+|-+$/g, '').slice(0, 80) || 'untitled';
@@ -234,7 +260,8 @@
234
260
 
235
261
  function isMarkdown() { return format() === 'markdown'; }
236
262
 
237
- return { load: load, slug: slug, format: format, isMarkdown: isMarkdown };
263
+ return { load: load, slug: slug, format: format, isMarkdown: isMarkdown,
264
+ pathFrom: pathFrom };
238
265
  })();
239
266
 
240
267
 
@@ -2659,6 +2686,22 @@
2659
2686
  '.filerow .sz{margin-left:auto;color:var(--rk-muted);font-size:11px;flex:none}',
2660
2687
  '.filerow .nm{overflow-wrap:anywhere}',
2661
2688
 
2689
+ // A label/value table, as a definition list rather than a <table>: these are
2690
+ // pairs and not a grid of data, and a dl says so to a screen reader. The
2691
+ // label column is sized to its longest label so every value starts on the
2692
+ // same edge, which is the whole point of reading it as a table.
2693
+ '.kv{display:grid;grid-template-columns:minmax(0,142px) minmax(0,1fr);',
2694
+ ' margin:0;border:1px solid var(--rk-line);border-radius:var(--rk-r-md);overflow:hidden}',
2695
+ '.kv dt{padding:8px 11px;font-size:10.5px;font-weight:600;color:var(--rk-muted);',
2696
+ ' text-transform:uppercase;letter-spacing:.06em;background:var(--rk-bg2);',
2697
+ ' border-bottom:1px solid var(--rk-line)}',
2698
+ '.kv dd{margin:0;padding:8px 11px;font-size:12px;line-height:1.5;color:var(--rk-fg2);',
2699
+ ' border-bottom:1px solid var(--rk-line);overflow-wrap:anywhere}',
2700
+ '.kv dt:last-of-type,.kv dd:last-of-type{border-bottom:none}',
2701
+ // The one row that asks for something rather than stating a fact.
2702
+ '.kv dt.cta,.kv dd.cta{background:var(--rk-accent-soft)}',
2703
+ '.kv dt.cta{color:var(--rk-accent)}',
2704
+
2662
2705
  '.muted{color:var(--rk-muted)}',
2663
2706
  '.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}',
2664
2707
 
@@ -3317,6 +3360,85 @@
3317
3360
  })();
3318
3361
 
3319
3362
 
3363
+ /* ---- ui/about.js ----------------------------------------------- */
3364
+ // About Ryker: what this build is, who maintains it, and the one thing we ask.
3365
+ //
3366
+ // LAST in the menu, after the divider that follows Clear document. An About
3367
+ // entry is conventionally last, and putting it below the one destructive action
3368
+ // means a mis-click at the very bottom of the menu opens a dialog rather than
3369
+ // emptying somebody's document.
3370
+ //
3371
+ // Its own module rather than another block in boot.js, which is at 540 of its
3372
+ // 600 line cap and is about starting Ryker rather than describing it. That cap
3373
+ // already forced the export dialog out once.
3374
+ Ryker.about = (function () {
3375
+ 'use strict';
3376
+
3377
+ // Named rather than inlined, so a link that moves is changed in one place.
3378
+ var LINKS = {
3379
+ home: 'https://gbti.network',
3380
+ membership: 'https://gbti.network/membership/',
3381
+ source: 'https://github.com/gbti-network/ryker',
3382
+ issues: 'https://github.com/gbti-network/ryker/issues',
3383
+ license: 'https://github.com/gbti-network/ryker/blob/main/LICENSE',
3384
+ privacy: 'https://github.com/gbti-network/ryker/blob/main/privacy.md'
3385
+ };
3386
+
3387
+ // rel is not decoration. target=_blank without noopener hands the opened page
3388
+ // a live window.opener back into the document being edited, and on the drop-in
3389
+ // surface that document is somebody's report on their own disk.
3390
+ function link(href, text) {
3391
+ return '<a href="' + href + '" target="_blank" rel="noopener noreferrer">' +
3392
+ text + '</a>';
3393
+ }
3394
+
3395
+ /** Which build this is, in the form a bug report needs. The surface matters
3396
+ * more than it looks: the same version behaves differently as an extension
3397
+ * and as a drop-in, and "Save Document is missing" is expected on one and a
3398
+ * defect on the other. */
3399
+ function build() {
3400
+ var version = String(Ryker.VERSION || 'unversioned');
3401
+ var surface = Ryker.SURFACE === 'extension' ? 'extension' : 'drop-in';
3402
+ return Ryker.dom.escapeHtml(version + ' (' + surface + ' build)');
3403
+ }
3404
+
3405
+ function row(label, value, cls) {
3406
+ var c = cls ? ' class="' + cls + '"' : '';
3407
+ return '<dt' + c + '>' + label + '</dt><dd' + c + '>' + value + '</dd>';
3408
+ }
3409
+
3410
+ function open() {
3411
+ Ryker.dialog.open({
3412
+ title: 'About Ryker',
3413
+ // A label/value table rather than prose. Somebody opens About to look one
3414
+ // fact up, usually the version, and a paragraph makes them read for it.
3415
+ body: '<dl class="kv">' +
3416
+ row('Version', build()) +
3417
+ row('Maintainer', link(LINKS.home, 'GBTI Network')) +
3418
+ // The link and nothing else. Summarising a licence in a table cell
3419
+ // invites somebody to rely on the summary, and the terms that actually
3420
+ // bind them are the ones in the file.
3421
+ row('License', link(LINKS.license, 'Source-available')) +
3422
+ row('Source', link(LINKS.source, 'github.com/gbti-network/ryker')) +
3423
+ row('Report a bug', link(LINKS.issues, 'Open an issue')) +
3424
+ row('Privacy', link(LINKS.privacy, 'Nothing is tracked')) +
3425
+ // The ask, and the only one. Last row on purpose: a tool that promises
3426
+ // no telemetry and then leads with a pitch has spent the promise.
3427
+ // The only break point is before the ampersand, so the label reads
3428
+ // "Contributions" then "& Gratuity" rather than stranding the & at the
3429
+ // end of the first line.
3430
+ row('Contributions &amp;\u00a0Gratuity',
3431
+ 'Join ' + link(LINKS.membership, 'our professional network') +
3432
+ ' to support Ryker and other projects developed and maintained by ' +
3433
+ 'GBTI Network.', 'cta') +
3434
+ '</dl>'
3435
+ });
3436
+ }
3437
+
3438
+ return { open: open, LINKS: LINKS, build: build };
3439
+ })();
3440
+
3441
+
3320
3442
  /* ---- export/dialog.js ------------------------------------------ */
3321
3443
  // The two ways a document leaves Ryker: over the top of itself, or beside it.
3322
3444
  //
@@ -8348,7 +8470,15 @@
8348
8470
  out.push('# Document edit instructions');
8349
8471
  out.push('');
8350
8472
  out.push('Document: ' + quoted(document.title || cfg.RYKER_DOCUMENT_ID));
8351
- out.push('File: ' + quoted(cfg.RYKER_DOCUMENT_PATH));
8473
+ // A filename when there is one, the page address when there is not. The
8474
+ // query string and fragment are dropped: they routinely carry signed-preview
8475
+ // and SSO secrets, and this header gets copied into a prompt.
8476
+ if (cfg.RYKER_DOCUMENT_PATH) {
8477
+ out.push('File: ' + quoted(cfg.RYKER_DOCUMENT_PATH));
8478
+ } else {
8479
+ out.push('Page: ' + quoted(String(location.origin || '') +
8480
+ String(location.pathname || '/')));
8481
+ }
8352
8482
  out.push('Edits: ' + list.length + ' change(s)' +
8353
8483
  (mv.length ? ' and ' + mv.length + ' move(s)' : '') +
8354
8484
  ' across ' + saves + ' save(s) this session');
@@ -10734,7 +10864,12 @@
10734
10864
  icon: 'note', run: function () { setSaveNotesEnabled(!saveNotesEnabled()); } },
10735
10865
  null,
10736
10866
  { label: 'Clear document', icon: 'trash', danger: true,
10737
- run: function () { Ryker.pane.confirmClear(); } }
10867
+ run: function () { Ryker.pane.confirmClear(); } },
10868
+ null,
10869
+ // Below the destructive entry on purpose. About is conventionally last,
10870
+ // and a mis-click at the very bottom of the menu should open a dialog
10871
+ // rather than empty the document.
10872
+ { label: 'About Ryker', icon: 'note', run: function () { Ryker.about.open(); } }
10738
10873
  ]);
10739
10874
  }
10740
10875
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbti/ryker",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Add Ryker inline editing and prompt-ready change requests to authored HTML documents.",
5
5
  "type": "module",
6
6
  "bin": {