@phnx-labs/artifacts-cli 0.9.13 → 0.10.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +7 -9
  3. package/dist/cli.d.ts +1 -2
  4. package/dist/cli.js +34 -190
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/auth.d.ts +3 -1
  7. package/dist/commands/auth.js +17 -18
  8. package/dist/commands/auth.js.map +1 -1
  9. package/dist/commands/comments.js +2 -2
  10. package/dist/commands/comments.js.map +1 -1
  11. package/dist/commands/new.js +3 -3
  12. package/dist/commands/new.js.map +1 -1
  13. package/dist/commands/share.d.ts +44 -111
  14. package/dist/commands/share.js +225 -638
  15. package/dist/commands/share.js.map +1 -1
  16. package/dist/lib/collab.d.ts +3 -3
  17. package/dist/lib/collab.js +183 -13
  18. package/dist/lib/collab.js.map +1 -1
  19. package/dist/lib/components.js +0 -1
  20. package/dist/lib/components.js.map +1 -1
  21. package/dist/lib/config.d.ts +0 -17
  22. package/dist/lib/config.js.map +1 -1
  23. package/dist/lib/embedded-html.d.ts +1 -1
  24. package/dist/lib/embedded-html.js +0 -15
  25. package/dist/lib/embedded-html.js.map +1 -1
  26. package/dist/lib/freshness.d.ts +2 -6
  27. package/dist/lib/freshness.js +4 -33
  28. package/dist/lib/freshness.js.map +1 -1
  29. package/dist/lib/header-actions.d.ts +10 -37
  30. package/dist/lib/header-actions.js +19 -94
  31. package/dist/lib/header-actions.js.map +1 -1
  32. package/dist/lib/metadata-menu.d.ts +10 -33
  33. package/dist/lib/metadata-menu.js +12 -51
  34. package/dist/lib/metadata-menu.js.map +1 -1
  35. package/dist/lib/reader-anchors.d.ts +3 -3
  36. package/dist/lib/reader-anchors.js +7 -4
  37. package/dist/lib/reader-anchors.js.map +1 -1
  38. package/dist/lib/render.d.ts +2 -19
  39. package/dist/lib/render.js +37 -321
  40. package/dist/lib/render.js.map +1 -1
  41. package/dist/lib/section-collapse.d.ts +1 -2
  42. package/dist/lib/section-collapse.js +1 -2
  43. package/dist/lib/section-collapse.js.map +1 -1
  44. package/dist/lib/selection-toolbar.d.ts +9 -0
  45. package/dist/lib/selection-toolbar.js +49 -0
  46. package/dist/lib/selection-toolbar.js.map +1 -0
  47. package/dist/lib/share/backend.d.ts +8 -75
  48. package/dist/lib/share/backend.js +11 -123
  49. package/dist/lib/share/backend.js.map +1 -1
  50. package/dist/lib/share/config.d.ts +0 -79
  51. package/dist/lib/share/config.js +3 -175
  52. package/dist/lib/share/config.js.map +1 -1
  53. package/dist/lib/share/delete.d.ts +3 -14
  54. package/dist/lib/share/delete.js +8 -12
  55. package/dist/lib/share/delete.js.map +1 -1
  56. package/dist/lib/share/http-error.d.ts +12 -0
  57. package/dist/lib/share/http-error.js +32 -0
  58. package/dist/lib/share/http-error.js.map +1 -1
  59. package/dist/lib/share/media.d.ts +1 -6
  60. package/dist/lib/share/media.js +9 -17
  61. package/dist/lib/share/media.js.map +1 -1
  62. package/dist/lib/share/og.d.ts +0 -3
  63. package/dist/lib/share/og.js +2 -4
  64. package/dist/lib/share/og.js.map +1 -1
  65. package/dist/lib/share/provision.d.ts +7 -120
  66. package/dist/lib/share/provision.js +30 -290
  67. package/dist/lib/share/provision.js.map +1 -1
  68. package/dist/lib/share/publish.d.ts +10 -65
  69. package/dist/lib/share/publish.js +32 -131
  70. package/dist/lib/share/publish.js.map +1 -1
  71. package/dist/lib/share/visibility.d.ts +11 -35
  72. package/dist/lib/share/visibility.js +8 -35
  73. package/dist/lib/share/visibility.js.map +1 -1
  74. package/dist/lib/share/worker-media-template.js +1 -1
  75. package/dist/lib/share/worker-publish-template.d.ts +1 -1
  76. package/dist/lib/share/worker-publish-template.js +3 -0
  77. package/dist/lib/share/worker-publish-template.js.map +1 -1
  78. package/dist/lib/share/worker-template.d.ts +2 -14
  79. package/dist/lib/share/worker-template.js +207 -27
  80. package/dist/lib/share/worker-template.js.map +1 -1
  81. package/dist/lib/templates.d.ts +1 -2
  82. package/dist/lib/templates.js +1 -19
  83. package/dist/lib/templates.js.map +1 -1
  84. package/dist/lib/validate.js +1 -29
  85. package/dist/lib/validate.js.map +1 -1
  86. package/package.json +1 -4
  87. package/dist/commands/answers.d.ts +0 -6
  88. package/dist/commands/answers.js +0 -91
  89. package/dist/commands/answers.js.map +0 -1
  90. package/dist/commands/favorite.d.ts +0 -9
  91. package/dist/commands/favorite.js +0 -59
  92. package/dist/commands/favorite.js.map +0 -1
  93. package/dist/commands/history.d.ts +0 -4
  94. package/dist/commands/history.js +0 -29
  95. package/dist/commands/history.js.map +0 -1
  96. package/dist/commands/notes.d.ts +0 -5
  97. package/dist/commands/notes.js +0 -28
  98. package/dist/commands/notes.js.map +0 -1
  99. package/dist/lib/browser-detect.d.ts +0 -28
  100. package/dist/lib/browser-detect.js +0 -126
  101. package/dist/lib/browser-detect.js.map +0 -1
  102. package/dist/lib/favorites.d.ts +0 -73
  103. package/dist/lib/favorites.js +0 -180
  104. package/dist/lib/favorites.js.map +0 -1
  105. package/dist/lib/github.d.ts +0 -14
  106. package/dist/lib/github.js +0 -36
  107. package/dist/lib/github.js.map +0 -1
  108. package/dist/lib/highlights.d.ts +0 -11
  109. package/dist/lib/highlights.js +0 -116
  110. package/dist/lib/highlights.js.map +0 -1
  111. package/dist/lib/link-previews.d.ts +0 -67
  112. package/dist/lib/link-previews.js +0 -427
  113. package/dist/lib/link-previews.js.map +0 -1
  114. package/dist/lib/notes.d.ts +0 -22
  115. package/dist/lib/notes.js +0 -22
  116. package/dist/lib/notes.js.map +0 -1
  117. package/dist/lib/pdf.d.ts +0 -13
  118. package/dist/lib/pdf.js +0 -66
  119. package/dist/lib/pdf.js.map +0 -1
  120. package/dist/lib/revisions.d.ts +0 -102
  121. package/dist/lib/revisions.js +0 -445
  122. package/dist/lib/revisions.js.map +0 -1
  123. package/dist/lib/share/analytics.d.ts +0 -13
  124. package/dist/lib/share/analytics.js +0 -46
  125. package/dist/lib/share/analytics.js.map +0 -1
  126. package/dist/lib/share/capture.d.ts +0 -31
  127. package/dist/lib/share/capture.js +0 -175
  128. package/dist/lib/share/capture.js.map +0 -1
  129. package/dist/lib/tokens.d.ts +0 -12
  130. package/dist/lib/tokens.js +0 -28
  131. package/dist/lib/tokens.js.map +0 -1
  132. package/dist/lib/worksheet.d.ts +0 -94
  133. package/dist/lib/worksheet.js +0 -394
  134. package/dist/lib/worksheet.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export declare const EMBEDDED_ARTIFACT_CLASSES: readonly [...string[], "artifact-behavior", "artifact-behavior-panel", "artifact-callout", "artifact-callout-danger", "artifact-callout-warn", "artifact-diagram", "artifact-figure", "artifact-figure-diagram", "artifact-figure-tall", "artifact-figure-wide", "artifact-grid", "artifact-grid-2", "artifact-grid-3", "artifact-image", "artifact-legend", "artifact-panel", "artifact-stat", "artifact-stat-label", "artifact-stat-value", "artifact-tag", "artifact-tag-accent", "artifact-excerpt", "artifact-excerpt-file", "artifact-excerpt-range", "artifact-excerpt-pre", "artifact-excerpt-note", "artifact-excerpt-missing", "ex-line", "ex-hl", "ex-no", "ex-code", "code-diff", "code-diff-file", "code-diff-pre", "cd-line", "cd-sign", "cd-code", "cd-add", "cd-del", "cd-ctx", "cd-hunk", "cd-meta", "checklist", "checklist-head", "checklist-items", "cl-item", "cl-done", "cl-doing", "cl-todo", "cl-box", "cl-text", "status-list", "status-item", "status-done", "status-fail", "status-warn", "status-neutral", "status-icon", "status-body", "status-label", "status-desc", "status-text", "wq-card", "wq-head", "wq-label", "wq-hint", "wq-chip", "wq-chip-draft", "wq-chip-you", "wq-chip-answered", "wq-chip-edited", "wq-copy", "wq-textarea", "wq-input", "wq-group", "wq-row", "wq-row-label"];
1
+ export declare const EMBEDDED_ARTIFACT_CLASSES: readonly [...string[], "artifact-behavior", "artifact-behavior-panel", "artifact-callout", "artifact-callout-danger", "artifact-callout-warn", "artifact-diagram", "artifact-figure", "artifact-figure-diagram", "artifact-figure-tall", "artifact-figure-wide", "artifact-grid", "artifact-grid-2", "artifact-grid-3", "artifact-image", "artifact-legend", "artifact-panel", "artifact-stat", "artifact-stat-label", "artifact-stat-value", "artifact-tag", "artifact-tag-accent", "artifact-excerpt", "artifact-excerpt-file", "artifact-excerpt-range", "artifact-excerpt-pre", "artifact-excerpt-note", "artifact-excerpt-missing", "ex-line", "ex-hl", "ex-no", "ex-code", "code-diff", "code-diff-file", "code-diff-pre", "cd-line", "cd-sign", "cd-code", "cd-add", "cd-del", "cd-ctx", "cd-hunk", "cd-meta", "checklist", "checklist-head", "checklist-items", "cl-item", "cl-done", "cl-doing", "cl-todo", "cl-box", "cl-text", "status-list", "status-item", "status-done", "status-fail", "status-warn", "status-neutral", "status-icon", "status-body", "status-label", "status-desc", "status-text"];
2
2
  export interface EmbeddedHtmlIssue {
3
3
  index: number;
4
4
  message: string;
@@ -55,21 +55,6 @@ export const EMBEDDED_ARTIFACT_CLASSES = [
55
55
  'cl-box',
56
56
  'cl-text',
57
57
  ...STATUS_LIST_CLASSES,
58
- 'wq-card',
59
- 'wq-head',
60
- 'wq-label',
61
- 'wq-hint',
62
- 'wq-chip',
63
- 'wq-chip-draft',
64
- 'wq-chip-you',
65
- 'wq-chip-answered',
66
- 'wq-chip-edited',
67
- 'wq-copy',
68
- 'wq-textarea',
69
- 'wq-input',
70
- 'wq-group',
71
- 'wq-row',
72
- 'wq-row-label',
73
58
  ];
74
59
  export const EMBEDDED_BLOCK_TAGS = ['svg', 'figure', 'section', 'article', 'aside', 'div', 'details'];
75
60
  export const EMBEDDED_BLOCK_PATTERN = new RegExp(`<(?:${EMBEDDED_BLOCK_TAGS.join('|')})\\b`, 'i');
@@ -1 +1 @@
1
- {"version":3,"file":"embedded-html.js","sourceRoot":"","sources":["../../src/lib/embedded-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OA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CAAC;wBACV,KAAK;wBACL,OAAO,EAAE,oCAAoC,SAAS,uCAAuC;qBAC9F,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;KACF,EACD;QACE,uBAAuB,EAAE,KAAK;QAC9B,aAAa,EAAE,KAAK;QACpB,oBAAoB,EAAE,IAAI;KAC3B,CACF,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,EAAE,CAAC;IACb,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"embedded-html.js","sourceRoot":"","sources":["../../src/lib/embedded-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,GAAG,gBAAgB;IACnB,mBAAmB;IACnB,yBAAyB;IACzB,kBAAkB;IAClB,yBAAyB;IACzB,uBAAuB;IACvB,kBAAkB;IAClB,iBAAiB;IACjB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,eAAe;IACf,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;IAClB,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,uBAAuB;IACvB,0BAA0B;IAC1B,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,SAAS;IACT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C,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAC3F,IAAI,CAAC,UAAU;gBAAE,OAAO;YACxB,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACrC,MAAM,CAAC,IAAI,CAAC;wBACV,KAAK;wBACL,OAAO,EAAE,oCAAoC,SAAS,uCAAuC;qBAC9F,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;KACF,EACD;QACE,uBAAuB,EAAE,KAAK;QAC9B,aAAa,EAAE,KAAK;QACpB,oBAAoB,EAAE,IAAI;KAC3B,CACF,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,EAAE,CAAC;IACb,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,6 +1,2 @@
1
- /** Date-only values deliberately carry no invented time-of-day. */
2
- export declare function artifactTimestamp(value: unknown): {
3
- iso: string;
4
- relative: boolean;
5
- } | undefined;
6
- export declare const FRESHNESS_SCRIPT = "<script>\n(() => {\n const times = [...document.querySelectorAll('time[data-relative=\"true\"]')];\n const update = () => {\n const now = Date.now();\n for (const time of times) {\n const instant = new Date(time.dateTime);\n const seconds = Math.floor((now - instant.getTime()) / 1000);\n if (!Number.isFinite(seconds)) continue;\n const label = time.dataset.label;\n // Future dates are never called \"just now\".\n let value = seconds < 0 ? instant.toLocaleString() : instant.toISOString().slice(0, 10);\n if (seconds >= 0 && seconds < 60) value = 'just now';\n else if (seconds >= 60 && seconds < 3600) { const n = Math.floor(seconds / 60); value = n + (n === 1 ? ' min ago' : ' mins ago'); }\n else if (seconds >= 3600 && seconds < 86400) { const n = Math.floor(seconds / 3600); value = n + (n === 1 ? ' hour ago' : ' hours ago'); }\n else if (seconds >= 86400 && seconds < 604800) { const n = Math.floor(seconds / 86400); value = n + (n === 1 ? ' day ago' : ' days ago'); }\n time.textContent = label + ' ' + value;\n time.title = label + ' ' + instant.toLocaleString() + ' (' + time.dateTime + ')';\n }\n };\n update();\n if (times.length) setInterval(() => { if (!document.hidden) update(); }, 30000);\n document.addEventListener('visibilitychange', () => { if (!document.hidden) update(); });\n})();\n</script>";
1
+ /** An author timestamp as ISO 8601. Date-only values deliberately carry no invented time-of-day. */
2
+ export declare function artifactTimestamp(value: unknown): string | undefined;
@@ -1,11 +1,7 @@
1
- /** Date-only values deliberately carry no invented time-of-day. */
1
+ /** An author timestamp as ISO 8601. Date-only values deliberately carry no invented time-of-day. */
2
2
  export function artifactTimestamp(value) {
3
- if (value instanceof Date) {
4
- if (!Number.isFinite(value.getTime()))
5
- return undefined;
6
- // YAML's date scalar loses precision information. Midnight stays absolute.
7
- return { iso: value.toISOString(), relative: value.toISOString().slice(11) !== '00:00:00.000Z' };
8
- }
3
+ if (value instanceof Date)
4
+ return Number.isFinite(value.getTime()) ? value.toISOString() : undefined;
9
5
  if (typeof value !== 'string')
10
6
  return undefined;
11
7
  const input = value.trim();
@@ -22,31 +18,6 @@ export function artifactTimestamp(value) {
22
18
  return undefined;
23
19
  if (input.length === 10 && date.toISOString().slice(0, 10) !== input)
24
20
  return undefined;
25
- return { iso: input.length === 10 ? input : date.toISOString(), relative: input.length > 10 };
21
+ return input.length === 10 ? input : date.toISOString();
26
22
  }
27
- export const FRESHNESS_SCRIPT = `<script>
28
- (() => {
29
- const times = [...document.querySelectorAll('time[data-relative="true"]')];
30
- const update = () => {
31
- const now = Date.now();
32
- for (const time of times) {
33
- const instant = new Date(time.dateTime);
34
- const seconds = Math.floor((now - instant.getTime()) / 1000);
35
- if (!Number.isFinite(seconds)) continue;
36
- const label = time.dataset.label;
37
- // Future dates are never called "just now".
38
- let value = seconds < 0 ? instant.toLocaleString() : instant.toISOString().slice(0, 10);
39
- if (seconds >= 0 && seconds < 60) value = 'just now';
40
- else if (seconds >= 60 && seconds < 3600) { const n = Math.floor(seconds / 60); value = n + (n === 1 ? ' min ago' : ' mins ago'); }
41
- else if (seconds >= 3600 && seconds < 86400) { const n = Math.floor(seconds / 3600); value = n + (n === 1 ? ' hour ago' : ' hours ago'); }
42
- else if (seconds >= 86400 && seconds < 604800) { const n = Math.floor(seconds / 86400); value = n + (n === 1 ? ' day ago' : ' days ago'); }
43
- time.textContent = label + ' ' + value;
44
- time.title = label + ' ' + instant.toLocaleString() + ' (' + time.dateTime + ')';
45
- }
46
- };
47
- update();
48
- if (times.length) setInterval(() => { if (!document.hidden) update(); }, 30000);
49
- document.addEventListener('visibilitychange', () => { if (!document.hidden) update(); });
50
- })();
51
- </script>`;
52
23
  //# sourceMappingURL=freshness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"freshness.js","sourceRoot":"","sources":["../../src/lib/freshness.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAAE,OAAO,SAAS,CAAC;QACxD,2EAA2E;QAC3E,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,eAAe,EAAE,CAAC;IACnG,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,+EAA+E,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnH,MAAM,QAAQ,GAAG,KAAK,CA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AC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACvF,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AAC1D,CAAC"}
@@ -1,44 +1,17 @@
1
1
  /**
2
- * The document-header action buttons: Share and Favorite.
3
- *
4
- * One markup builder, one style block, one script. The renderer emits the
5
- * slot between {@link HEADER_ACTIONS_START}/{@link HEADER_ACTIONS_END} markers
6
- * with the buttons in their DEFAULT (unfavorited) state, so the render
7
- * fingerprint never flips on a favorite toggle; the decorate step (which runs
8
- * after fingerprinting) rewrites the slot with the favorite state actually
9
- * recorded in the store.
2
+ * The document-header Share button.
10
3
  *
11
4
  * Click behavior is decided at runtime by where the page is being viewed:
12
5
  * - served by `artifacts render --open` (loopback http): POST back to the
13
- * local server, which performs the owner-only share / favorite toggle for
14
- * real and reports the result;
15
- * - a plain file:// page: the copy-command idiom — the button copies the
16
- * exact CLI command (`artifacts share <id> --visibility me`,
17
- * `artifacts favorite <id>`) to run in a terminal;
6
+ * local server, which publishes owner-only for real and reports the URL;
7
+ * - a plain file:// page: the copy-command idiom — the button copies
8
+ * `artifacts share <this file> --visibility me` to run in a terminal;
18
9
  * - a hosted page (the managed share host, or any non-loopback origin): the
19
- * artifact is already published, so Share degrades to copying the page's
20
- * own URL rather than offering to re-share; Favorite still copies the
21
- * command (only meaningful on the author's machine, harmless elsewhere).
10
+ * artifact is already published, so Share copies the page's own URL.
22
11
  *
23
- * The copied commands address the artifact by its store ID, never by path —
24
- * reader-facing HTML must not carry local absolute paths (the revision store
25
- * has a standing test for that invariant), and `artifacts share` accepts an id
26
- * exactly like `artifacts history` does.
12
+ * The copied command names the page by its file name, read at click time, so
13
+ * reader-facing HTML never carries a local absolute path.
27
14
  */
28
- export declare const HEADER_ACTIONS_START = "<!--artifact-actions-start-->";
29
- export declare const HEADER_ACTIONS_END = "<!--artifact-actions-end-->";
30
- export interface HeaderActions {
31
- /** The artifact's store identity (SHA-256 of its canonical source path). */
32
- artifactId: string;
33
- /** Render-time favorite state; the decorate step replaces it with the store's. */
34
- favorited: boolean;
35
- }
36
- export declare function shareCommand(actions: HeaderActions): string;
37
- export declare function favoriteCommand(actions: HeaderActions): string;
38
- export declare function headerActions(actions: HeaderActions): string;
39
- /** The slot the renderer emits; `decorateHeaderActions` rewrites its content. */
40
- export declare function headerActionsSlot(actions: HeaderActions): string;
41
- /** Replace a rendered document's action slot with fresh state. No markers → unchanged. */
42
- export declare function decorateHeaderActions(html: string, actions: HeaderActions): string;
43
- export declare const HEADER_ACTIONS_CSS = "\n.header-actions{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto}\n.header-action{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--muted);font:500 12px/1 var(--font-mono);cursor:pointer}\n.header-action:hover{color:var(--accent);border-color:var(--accent)}\n.header-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px}\n.header-action:disabled{opacity:.6;cursor:default}\n.header-action svg{width:13px;height:13px;flex:0 0 auto}\n.favorite-action{padding:0 10px;border-color:color-mix(in srgb,var(--accent) 45%,var(--line));color:var(--accent)}\n.favorite-action.is-favorite{background:color-mix(in srgb,var(--accent) 16%,var(--surface));border-color:var(--accent)}\n.favorite-action.is-favorite svg{fill:currentColor}\n.header-action-feedback{color:var(--muted);font:11.5px/1.4 var(--font-mono);max-width:300px;overflow-wrap:anywhere}\n.header-action-feedback:empty{display:none}\n@media print{.header-actions{display:none}}\n";
44
- export declare const HEADER_ACTIONS_SCRIPT = "<script>\n(() => {\n const root = document.querySelector('[data-header-actions]');\n if (!root) return;\n const shareButton = root.querySelector('.share-action');\n const favoriteButton = root.querySelector('.favorite-action');\n const status = root.querySelector('.header-action-feedback');\n let timer;\n const say = (message) => {\n status.textContent = message;\n clearTimeout(timer);\n timer = setTimeout(() => { if (status.textContent === message) status.textContent = ''; }, 8000);\n };\n const copy = async (text) => {\n try {\n if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error('unavailable');\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n const area = document.createElement('textarea');\n area.value = text;\n area.style.position = 'fixed'; area.style.opacity = '0';\n document.body.appendChild(area);\n area.focus(); area.select();\n let ok = false;\n try { ok = document.execCommand('copy'); } catch {}\n area.remove();\n return ok;\n }\n };\n // Where is this page being viewed? The loopback dev server (artifacts render\n // --open) answers POSTs for real actions; any other http(s) origin is an\n // already-published page; file:// has no server at all.\n const hostname = location.hostname;\n const web = location.protocol === 'http:' || location.protocol === 'https:';\n const loopback = web && (hostname === '127.0.0.1' || hostname === 'localhost' || hostname === '[::1]' || hostname === '::1');\n const hosted = web && !loopback;\n const copyCommand = async (command, what) => {\n const ok = await copy(command);\n say(ok ? what + ' command copied \u2014 run it in your terminal' : 'Could not copy. ' + what + ' command: ' + command);\n };\n const paintFavorite = (on) => {\n favoriteButton.classList.toggle('is-favorite', on);\n favoriteButton.setAttribute('aria-pressed', String(on));\n const label = on ? 'Remove from favorites' : 'Add to favorites';\n favoriteButton.setAttribute('aria-label', label);\n favoriteButton.setAttribute('title', on ? 'Remove from favorites' : 'Favorite this artifact');\n };\n if (hosted) {\n // Already published: re-sharing makes no sense here, so Share becomes a\n // plain copy-link of this page's URL.\n shareButton.querySelector('.share-action-label').textContent = 'Copy link';\n shareButton.setAttribute('aria-label', 'Copy link to this page');\n shareButton.setAttribute('title', 'Copy the link to this page');\n shareButton.addEventListener('click', async () => {\n const ok = await copy(location.href);\n say(ok ? 'Link copied' : 'Could not copy the link \u2014 copy it from the address bar');\n });\n } else if (loopback) {\n shareButton.addEventListener('click', async () => {\n shareButton.disabled = true;\n say('Sharing owner-only\u2026');\n try {\n const response = await fetch('/artifacts/share', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });\n if (!response.ok) throw new Error(await response.text());\n const result = await response.json();\n const copied = await copy(result.url);\n say(copied ? 'Shared owner-only \u2014 link copied' : 'Shared owner-only: ' + result.url);\n } catch (error) {\n await copyCommand(shareButton.dataset.shareCommand, 'Share');\n } finally {\n shareButton.disabled = false;\n }\n });\n } else {\n shareButton.addEventListener('click', () => copyCommand(shareButton.dataset.shareCommand, 'Share'));\n }\n if (loopback) {\n favoriteButton.addEventListener('click', async () => {\n favoriteButton.disabled = true;\n try {\n const response = await fetch('/artifacts/favorite', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ title: document.title }),\n });\n if (!response.ok) throw new Error(await response.text());\n const result = await response.json();\n paintFavorite(Boolean(result.favorite));\n say(result.favorite ? 'Favorited' : 'Removed from favorites');\n } catch {\n await copyCommand(favoriteButton.dataset.favoriteCommand, 'Favorite');\n } finally {\n favoriteButton.disabled = false;\n }\n });\n } else {\n favoriteButton.addEventListener('click', () => copyCommand(favoriteButton.dataset.favoriteCommand, 'Favorite'));\n }\n})();\n</script>";
15
+ export declare const HEADER_ACTIONS: string;
16
+ export declare const HEADER_ACTIONS_CSS = "\n.header-actions{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto}\n.header-action{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--muted);font:500 12px/1 var(--font-mono);cursor:pointer}\n.header-action:hover{color:var(--accent);border-color:var(--accent)}\n.header-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px}\n.header-action:disabled{opacity:.6;cursor:default}\n.header-action svg{width:13px;height:13px;flex:0 0 auto}\n.header-action-feedback{color:var(--muted);font:11.5px/1.4 var(--font-mono);max-width:300px;overflow-wrap:anywhere}\n.header-action-feedback:empty{display:none}\n@media print{.header-actions{display:none}}\n";
17
+ export declare const HEADER_ACTIONS_SCRIPT = "<script>\n(() => {\n const root = document.querySelector('[data-header-actions]');\n if (!root) return;\n const shareButton = root.querySelector('.share-action');\n const status = root.querySelector('.header-action-feedback');\n let timer;\n const say = (message) => {\n status.textContent = message;\n clearTimeout(timer);\n timer = setTimeout(() => { if (status.textContent === message) status.textContent = ''; }, 8000);\n };\n const copy = async (text) => {\n try {\n if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error('unavailable');\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n const area = document.createElement('textarea');\n area.value = text;\n area.style.position = 'fixed'; area.style.opacity = '0';\n document.body.appendChild(area);\n area.focus(); area.select();\n let ok = false;\n try { ok = document.execCommand('copy'); } catch {}\n area.remove();\n return ok;\n }\n };\n // Where is this page being viewed? The loopback dev server (artifacts render\n // --open) answers POSTs for real actions; any other http(s) origin is an\n // already-published page; file:// has no server at all.\n const hostname = location.hostname;\n const web = location.protocol === 'http:' || location.protocol === 'https:';\n const loopback = web && (hostname === '127.0.0.1' || hostname === 'localhost' || hostname === '[::1]' || hostname === '::1');\n const hosted = web && !loopback;\n const copyShareCommand = async () => {\n const file = decodeURIComponent(location.pathname.split('/').pop() || '');\n const command = 'artifacts share ' + (/^[\\w.@+-]+$/.test(file) ? file : \"'\" + file.replace(/'/g, \"'\\\\''\") + \"'\") + ' --visibility me';\n const ok = await copy(command);\n say(ok ? 'Share command copied \u2014 run it in your terminal' : 'Could not copy. Share command: ' + command);\n };\n if (hosted) {\n // Already published: re-sharing makes no sense here, so Share becomes a\n // plain copy-link of this page's URL.\n shareButton.querySelector('.share-action-label').textContent = 'Copy link';\n shareButton.setAttribute('aria-label', 'Copy link to this page');\n shareButton.setAttribute('title', 'Copy the link to this page');\n shareButton.addEventListener('click', async () => {\n const ok = await copy(location.href);\n say(ok ? 'Link copied' : 'Could not copy the link \u2014 copy it from the address bar');\n });\n } else if (loopback) {\n shareButton.addEventListener('click', async () => {\n shareButton.disabled = true;\n say('Sharing owner-only\u2026');\n try {\n const response = await fetch('/artifacts/share', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });\n if (!response.ok) throw new Error(await response.text());\n const result = await response.json();\n const copied = await copy(result.url);\n say(copied ? 'Shared owner-only \u2014 link copied' : 'Shared owner-only: ' + result.url);\n } catch (error) {\n await copyShareCommand();\n } finally {\n shareButton.disabled = false;\n }\n });\n } else {\n shareButton.addEventListener('click', copyShareCommand);\n }\n})();\n</script>";
@@ -1,68 +1,24 @@
1
1
  /**
2
- * The document-header action buttons: Share and Favorite.
3
- *
4
- * One markup builder, one style block, one script. The renderer emits the
5
- * slot between {@link HEADER_ACTIONS_START}/{@link HEADER_ACTIONS_END} markers
6
- * with the buttons in their DEFAULT (unfavorited) state, so the render
7
- * fingerprint never flips on a favorite toggle; the decorate step (which runs
8
- * after fingerprinting) rewrites the slot with the favorite state actually
9
- * recorded in the store.
2
+ * The document-header Share button.
10
3
  *
11
4
  * Click behavior is decided at runtime by where the page is being viewed:
12
5
  * - served by `artifacts render --open` (loopback http): POST back to the
13
- * local server, which performs the owner-only share / favorite toggle for
14
- * real and reports the result;
15
- * - a plain file:// page: the copy-command idiom — the button copies the
16
- * exact CLI command (`artifacts share <id> --visibility me`,
17
- * `artifacts favorite <id>`) to run in a terminal;
6
+ * local server, which publishes owner-only for real and reports the URL;
7
+ * - a plain file:// page: the copy-command idiom — the button copies
8
+ * `artifacts share <this file> --visibility me` to run in a terminal;
18
9
  * - a hosted page (the managed share host, or any non-loopback origin): the
19
- * artifact is already published, so Share degrades to copying the page's
20
- * own URL rather than offering to re-share; Favorite still copies the
21
- * command (only meaningful on the author's machine, harmless elsewhere).
10
+ * artifact is already published, so Share copies the page's own URL.
22
11
  *
23
- * The copied commands address the artifact by its store ID, never by path —
24
- * reader-facing HTML must not carry local absolute paths (the revision store
25
- * has a standing test for that invariant), and `artifacts share` accepts an id
26
- * exactly like `artifacts history` does.
12
+ * The copied command names the page by its file name, read at click time, so
13
+ * reader-facing HTML never carries a local absolute path.
27
14
  */
28
- import { escapeHtml } from './html.js';
29
- export const HEADER_ACTIONS_START = '<!--artifact-actions-start-->';
30
- export const HEADER_ACTIONS_END = '<!--artifact-actions-end-->';
31
- export function shareCommand(actions) {
32
- // The id is a fixed-shape [0-9a-f]{64} digest — safe unquoted.
33
- return `artifacts share ${actions.artifactId} --visibility me`;
34
- }
35
- export function favoriteCommand(actions) {
36
- return `artifacts favorite ${actions.artifactId}`;
37
- }
38
- const STAR_PATH = 'M12 2.6l2.9 6.28 6.9.68-5.19 4.6 1.44 6.8L12 17.77l-6.05 3.19 1.44-6.8-5.19-4.6 6.9-.68z';
39
15
  const SHARE_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M12 15V3.5"/><path d="M7.5 7.5L12 3l4.5 4.5"/><path d="M4.5 13.5v5a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-5"/></svg>';
40
- export function headerActions(actions) {
41
- const share = shareCommand(actions);
42
- const favorite = favoriteCommand(actions);
43
- const on = actions.favorited;
44
- return (`<span class="header-actions" data-header-actions>` +
45
- `<button type="button" class="header-action share-action" data-share-command="${escapeHtml(share)}" ` +
46
- `aria-label="Share owner-only (only you can open the link)" title="Share owner-only — only you can open the link. Copies the share command; shares directly when served by artifacts render --open.">` +
47
- `${SHARE_ICON}<span class="share-action-label">Share</span></button>` +
48
- `<button type="button" class="header-action favorite-action${on ? ' is-favorite' : ''}" data-favorite-command="${escapeHtml(favorite)}" ` +
49
- `aria-pressed="${on}" aria-label="${on ? 'Remove from favorites' : 'Add to favorites'}" title="${on ? 'Remove from favorites' : 'Favorite this artifact'}">` +
50
- `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="${STAR_PATH}"/></svg></button>` +
51
- `<span class="header-action-feedback" role="status" aria-live="polite"></span>` +
52
- `</span>`);
53
- }
54
- /** The slot the renderer emits; `decorateHeaderActions` rewrites its content. */
55
- export function headerActionsSlot(actions) {
56
- return `${HEADER_ACTIONS_START}${headerActions(actions)}${HEADER_ACTIONS_END}`;
57
- }
58
- /** Replace a rendered document's action slot with fresh state. No markers → unchanged. */
59
- export function decorateHeaderActions(html, actions) {
60
- const start = html.indexOf(HEADER_ACTIONS_START);
61
- const end = html.indexOf(HEADER_ACTIONS_END, start);
62
- if (start < 0 || end < 0)
63
- return html;
64
- return html.slice(0, start) + headerActionsSlot(actions) + html.slice(end + HEADER_ACTIONS_END.length);
65
- }
16
+ export const HEADER_ACTIONS = `<span class="header-actions" data-header-actions>` +
17
+ `<button type="button" class="header-action share-action" ` +
18
+ `aria-label="Share owner-only (only you can open the link)" title="Share owner-only — only you can open the link. Copies the share command; shares directly when served by artifacts render --open.">` +
19
+ `${SHARE_ICON}<span class="share-action-label">Share</span></button>` +
20
+ `<span class="header-action-feedback" role="status" aria-live="polite"></span>` +
21
+ `</span>`;
66
22
  export const HEADER_ACTIONS_CSS = `
67
23
  .header-actions{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto}
68
24
  .header-action{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--muted);font:500 12px/1 var(--font-mono);cursor:pointer}
@@ -70,9 +26,6 @@ export const HEADER_ACTIONS_CSS = `
70
26
  .header-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
71
27
  .header-action:disabled{opacity:.6;cursor:default}
72
28
  .header-action svg{width:13px;height:13px;flex:0 0 auto}
73
- .favorite-action{padding:0 10px;border-color:color-mix(in srgb,var(--accent) 45%,var(--line));color:var(--accent)}
74
- .favorite-action.is-favorite{background:color-mix(in srgb,var(--accent) 16%,var(--surface));border-color:var(--accent)}
75
- .favorite-action.is-favorite svg{fill:currentColor}
76
29
  .header-action-feedback{color:var(--muted);font:11.5px/1.4 var(--font-mono);max-width:300px;overflow-wrap:anywhere}
77
30
  .header-action-feedback:empty{display:none}
78
31
  @media print{.header-actions{display:none}}
@@ -82,7 +35,6 @@ export const HEADER_ACTIONS_SCRIPT = `<script>
82
35
  const root = document.querySelector('[data-header-actions]');
83
36
  if (!root) return;
84
37
  const shareButton = root.querySelector('.share-action');
85
- const favoriteButton = root.querySelector('.favorite-action');
86
38
  const status = root.querySelector('.header-action-feedback');
87
39
  let timer;
88
40
  const say = (message) => {
@@ -114,16 +66,11 @@ export const HEADER_ACTIONS_SCRIPT = `<script>
114
66
  const web = location.protocol === 'http:' || location.protocol === 'https:';
115
67
  const loopback = web && (hostname === '127.0.0.1' || hostname === 'localhost' || hostname === '[::1]' || hostname === '::1');
116
68
  const hosted = web && !loopback;
117
- const copyCommand = async (command, what) => {
69
+ const copyShareCommand = async () => {
70
+ const file = decodeURIComponent(location.pathname.split('/').pop() || '');
71
+ const command = 'artifacts share ' + (/^[\\w.@+-]+$/.test(file) ? file : "'" + file.replace(/'/g, "'\\\\''") + "'") + ' --visibility me';
118
72
  const ok = await copy(command);
119
- say(ok ? what + ' command copied — run it in your terminal' : 'Could not copy. ' + what + ' command: ' + command);
120
- };
121
- const paintFavorite = (on) => {
122
- favoriteButton.classList.toggle('is-favorite', on);
123
- favoriteButton.setAttribute('aria-pressed', String(on));
124
- const label = on ? 'Remove from favorites' : 'Add to favorites';
125
- favoriteButton.setAttribute('aria-label', label);
126
- favoriteButton.setAttribute('title', on ? 'Remove from favorites' : 'Favorite this artifact');
73
+ say(ok ? 'Share command copied — run it in your terminal' : 'Could not copy. Share command: ' + command);
127
74
  };
128
75
  if (hosted) {
129
76
  // Already published: re-sharing makes no sense here, so Share becomes a
@@ -146,35 +93,13 @@ export const HEADER_ACTIONS_SCRIPT = `<script>
146
93
  const copied = await copy(result.url);
147
94
  say(copied ? 'Shared owner-only — link copied' : 'Shared owner-only: ' + result.url);
148
95
  } catch (error) {
149
- await copyCommand(shareButton.dataset.shareCommand, 'Share');
96
+ await copyShareCommand();
150
97
  } finally {
151
98
  shareButton.disabled = false;
152
99
  }
153
100
  });
154
101
  } else {
155
- shareButton.addEventListener('click', () => copyCommand(shareButton.dataset.shareCommand, 'Share'));
156
- }
157
- if (loopback) {
158
- favoriteButton.addEventListener('click', async () => {
159
- favoriteButton.disabled = true;
160
- try {
161
- const response = await fetch('/artifacts/favorite', {
162
- method: 'POST',
163
- headers: { 'content-type': 'application/json' },
164
- body: JSON.stringify({ title: document.title }),
165
- });
166
- if (!response.ok) throw new Error(await response.text());
167
- const result = await response.json();
168
- paintFavorite(Boolean(result.favorite));
169
- say(result.favorite ? 'Favorited' : 'Removed from favorites');
170
- } catch {
171
- await copyCommand(favoriteButton.dataset.favoriteCommand, 'Favorite');
172
- } finally {
173
- favoriteButton.disabled = false;
174
- }
175
- });
176
- } else {
177
- favoriteButton.addEventListener('click', () => copyCommand(favoriteButton.dataset.favoriteCommand, 'Favorite'));
102
+ shareButton.addEventListener('click', copyShareCommand);
178
103
  }
179
104
  })();
180
105
  </script>`;
@@ -1 +1 @@
1
- {"version":3,"file":"header-actions.js","sourceRoot":"","sources":["../../src/lib/header-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAShE,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,+DAA+D;IAC/D,OAAO,mBAAmB,OAAO,CAAC,UAAU,kBAAkB,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,OAAO,sBAAsB,OAAO,CAAC,UAAU,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,SAAS,GAAG,0FAA0F,CAAC;AAC7G,MAAM,UAAU,GAAG,0RAA0R,CAAC;AAE9S,MAAM,UAAU,aAAa,CAAC,OAAsB;IACl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AAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;CAajC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoG3B,CAAC"}
1
+ {"version":3,"file":"header-actions.js","sourceRoot":"","sources":["../../src/lib/header-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,UAAU,GAAG,0RAA0R,CAAC;AAE9S,MAAM,CAAC,MAAM,cAAc,GACzB,mDAAmD;IACnD,2DAA2D;IAC3D,sMAAsM;IACtM,GAAG,UAAU,wDAAwD;IACrE,+EAA+E;IAC/E,SAAS,CAAC;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;CAUjC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAwE3B,CAAC"}
@@ -9,25 +9,14 @@ export interface OriginMetadata {
9
9
  session: string;
10
10
  sessionId: string;
11
11
  }
12
- export interface ReaderRevision {
13
- id: string;
14
- revisions: {
15
- number: number;
16
- createdAt: string;
17
- }[];
18
- }
19
- /** A page timestamp the reader can fall back on when no saved history exists yet. */
12
+ /** A page timestamp: an explicit author date or the source file's mtime. */
20
13
  export interface ReaderTimestamp {
21
14
  /** "Created", "Updated", or "Source updated" - the honest provenance of the time. */
22
15
  label: string;
23
16
  iso: string;
24
- /** True when the instant carries a real time of day and may be shown as "10 minutes ago". */
25
- relative: boolean;
26
- /** Absolute, date-only display (YYYY-MM-DD) used before the freshness script runs. */
17
+ /** Absolute, date-only display (YYYY-MM-DD). */
27
18
  display: string;
28
19
  }
29
- export declare const REVISION_START = "<!--artifact-revision-start-->";
30
- export declare const REVISION_END = "<!--artifact-revision-end-->";
31
20
  export declare const CREATED_START = "<!--artifact-created-start-->";
32
21
  export declare const CREATED_END = "<!--artifact-created-end-->";
33
22
  /** "yosemite-m4" reads as "Yosemite M4". The canonical id is what gets copied. */
@@ -44,25 +33,13 @@ export declare function deviceDetails(origin: OriginMetadata): string;
44
33
  * the session. Controls for values that were not recorded are omitted.
45
34
  */
46
35
  export declare function originMenu(origin: OriginMetadata): string;
36
+ /** The header's stamp: the latest page timestamp, under its own label. */
37
+ export declare function latestStamp(timestamps: ReaderTimestamp[]): string;
47
38
  /**
48
- * The page footer's created stamp. Saved history wins — revision 1's stored
49
- * instant stays honest even after later updates rewrite the header's stamp;
50
- * without history, the page's own "Created" timestamp is used. Empty when
51
- * nothing created-like was recorded: a created instant is never invented.
52
- */
53
- export declare function createdStamp(history?: ReaderRevision, timestamps?: ReaderTimestamp[]): string;
54
- /**
55
- * The created stamp wrapped in the CREATED markers, so the revision-decorate
56
- * path can rewrite the slot once history exists — and so publish-time footer
57
- * edits (the share QR) can locate it in an already-rendered page.
58
- */
59
- export declare function createdSlot(history?: ReaderRevision, timestamps?: ReaderTimestamp[]): string;
60
- /**
61
- * The history control. With saved history the trigger reads "Created just now"
62
- * or "Updated 10 minutes ago" from the stored snapshot timestamp; without it,
63
- * the latest page timestamp keeps its own label (for example "Source updated").
64
- * The copied commands keep their numeric revisions.
39
+ * The page footer's created stamp, wrapped in the CREATED markers so
40
+ * publish-time footer edits (the share QR) can locate it in a rendered page.
41
+ * Empty when no created instant was recorded: one is never invented.
65
42
  */
66
- export declare function revisionMenu(history?: ReaderRevision, timestamps?: ReaderTimestamp[]): string;
67
- export declare const METADATA_CSS = "\n.metadata-link{text-decoration:none}.metadata-link>.link-affordance{flex:0 0 auto}.metadata-chip>.copy-affordance{opacity:0}.metadata-chip:hover>.copy-affordance,.metadata-chip:focus-visible>.copy-affordance{opacity:1}\n.document-header{position:relative;flex-wrap:wrap;gap:8px;padding-bottom:10px}.artifact-menu,.origin-inline{font:12px/1.5 var(--font-body);color:var(--muted)}.artifact-menu>summary{display:flex;align-items:center;gap:7px;cursor:pointer;list-style:none;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;max-width:270px;overflow-wrap:anywhere}.artifact-menu>summary::-webkit-details-marker{display:none}.artifact-menu>summary:hover{color:var(--accent);border-color:var(--accent)}.artifact-menu>summary:focus-visible,.metadata-copy:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.metadata-popover{position:absolute;z-index:80;right:0;top:calc(100% + 6px);width:min(370px,100%);max-height:70vh;overflow:auto;padding:20px;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-popover h2{font:650 17px/1.4 var(--font-body);margin:0 0 16px;padding:0;border:0}.metadata-copy{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:34px;width:100%;border:0;border-radius:6px;padding:7px 8px;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere}.metadata-copy:hover{background:var(--surface-alt)}.metadata-copy>.copy-affordance{font-size:10px;color:var(--muted);flex:0 0 auto}.origin-inline{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;max-width:100%}.metadata-chip{width:auto;max-width:220px;min-height:0;gap:6px;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;color:var(--muted);white-space:nowrap}.metadata-chip .metadata-value{min-width:0;overflow:hidden;text-overflow:ellipsis}.header-label{text-transform:capitalize}.metadata-chip:hover{color:var(--accent);border-color:var(--accent);background:var(--surface)}.origin-inline>.metadata-feedback{margin:0;flex:0 0 auto}.origin-inline>.metadata-fallback{position:absolute;right:0;top:calc(100% + 6px);z-index:80;width:min(370px,100%);margin:0;padding:10px;border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-note{color:var(--muted);font-size:12px}.metadata-feedback:empty{display:none}.metadata-feedback{color:var(--accent);font-size:12px;margin:8px 0 0}.metadata-fallback{width:100%;min-height:110px;color:var(--text);background:var(--bg);border:1px solid var(--line);font:12px/1.5 var(--font-mono);margin-top:8px;resize:vertical}.revision-list{list-style:none;padding:0;margin:0}.revision-list li{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:4px 12px;padding:9px 0;border-bottom:1px solid var(--line)}.revision-list time{color:var(--muted);font-size:12px}.revision-list .metadata-copy{width:auto;font-size:12px;padding:4px 8px;min-height:0}.metadata-popover [hidden],.origin-inline [hidden]{display:none!important}@media(max-width:480px){.artifact-menu>summary{max-width:220px}.metadata-chip{max-width:160px}.metadata-popover{padding:16px}}@media print{.artifact-menu,.origin-inline{display:none}}\n";
68
- export declare const METADATA_SCRIPT = "<script>\n(() => {\n const menus = [...document.querySelectorAll('.artifact-menu')];\n const scopes = [...document.querySelectorAll('[data-copy-scope]')];\n const reset = scope => {\n const status = scope.querySelector('.metadata-feedback');\n const fallback = scope.querySelector('.metadata-fallback');\n if (status) status.textContent = '';\n if (fallback) fallback.hidden = true;\n };\n for (const menu of menus) menu.querySelector('summary').addEventListener('click', () => menus.forEach(other => { if (other !== menu) other.open = false; }));\n for (const scope of scopes) {\n const status = scope.querySelector('.metadata-feedback');\n const fallback = scope.querySelector('.metadata-fallback');\n let timer;\n scope.querySelectorAll('[data-copy-value]').forEach(button => button.addEventListener('click', async () => {\n const value = button.dataset.copyValue;\n clearTimeout(timer); reset(scope);\n try {\n if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error('Clipboard unavailable');\n await navigator.clipboard.writeText(value);\n status.textContent = 'Copied';\n timer = setTimeout(() => { if (status.textContent === 'Copied') status.textContent = ''; }, 4000);\n } catch {\n status.textContent = 'Could not copy. Select and copy the full value below.';\n fallback.value = value; fallback.hidden = false;\n fallback.focus(); fallback.select();\n }\n }));\n }\n document.addEventListener('click', event => {\n menus.forEach(menu => { if (!menu.contains(event.target)) menu.open = false; });\n scopes.forEach(scope => { if (!scope.contains(event.target)) reset(scope); });\n });\n document.addEventListener('keydown', event => {\n if (event.key !== 'Escape') return;\n scopes.forEach(reset);\n menus.forEach(menu => { if (menu.open) { menu.open = false; menu.querySelector('summary').focus(); } });\n });\n})();\n</script>";
43
+ export declare function createdSlot(timestamps: ReaderTimestamp[]): string;
44
+ export declare const METADATA_CSS = "\n.metadata-link{text-decoration:none}.metadata-link>.link-affordance{flex:0 0 auto}.metadata-chip>.copy-affordance{opacity:0}.metadata-chip:hover>.copy-affordance,.metadata-chip:focus-visible>.copy-affordance{opacity:1}\n.document-header{position:relative;flex-wrap:wrap;gap:8px;padding-bottom:10px}.origin-inline{font:12px/1.5 var(--font-body);color:var(--muted)}.metadata-copy:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.metadata-copy{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:34px;width:100%;border:0;border-radius:6px;padding:7px 8px;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere}.metadata-copy:hover{background:var(--surface-alt)}.metadata-copy>.copy-affordance{font-size:10px;color:var(--muted);flex:0 0 auto}.origin-inline{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;max-width:100%}.metadata-chip{width:auto;max-width:220px;min-height:0;gap:6px;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;color:var(--muted);white-space:nowrap}.metadata-chip .metadata-value{min-width:0;overflow:hidden;text-overflow:ellipsis}.header-label{text-transform:capitalize}.header-time{white-space:nowrap}.metadata-chip:hover{color:var(--accent);border-color:var(--accent);background:var(--surface)}.origin-inline>.metadata-feedback{margin:0;flex:0 0 auto}.origin-inline>.metadata-fallback{position:absolute;right:0;top:calc(100% + 6px);z-index:80;width:min(370px,100%);margin:0;padding:10px;border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-feedback:empty{display:none}.metadata-feedback{color:var(--accent);font-size:12px;margin:8px 0 0}.metadata-fallback{width:100%;min-height:110px;color:var(--text);background:var(--bg);border:1px solid var(--line);font:12px/1.5 var(--font-mono);margin-top:8px;resize:vertical}.origin-inline [hidden]{display:none!important}@media(max-width:480px){.metadata-chip{max-width:160px}}@media print{.origin-inline{display:none}}\n";
45
+ export declare const METADATA_SCRIPT = "<script>\n(() => {\n const scopes = [...document.querySelectorAll('[data-copy-scope]')];\n const reset = scope => {\n const status = scope.querySelector('.metadata-feedback');\n const fallback = scope.querySelector('.metadata-fallback');\n if (status) status.textContent = '';\n if (fallback) fallback.hidden = true;\n };\n for (const scope of scopes) {\n const status = scope.querySelector('.metadata-feedback');\n const fallback = scope.querySelector('.metadata-fallback');\n let timer;\n scope.querySelectorAll('[data-copy-value]').forEach(button => button.addEventListener('click', async () => {\n const value = button.dataset.copyValue;\n clearTimeout(timer); reset(scope);\n try {\n if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error('Clipboard unavailable');\n await navigator.clipboard.writeText(value);\n status.textContent = 'Copied';\n timer = setTimeout(() => { if (status.textContent === 'Copied') status.textContent = ''; }, 4000);\n } catch {\n status.textContent = 'Could not copy. Select and copy the full value below.';\n fallback.value = value; fallback.hidden = false;\n fallback.focus(); fallback.select();\n }\n }));\n }\n document.addEventListener('click', event => {\n scopes.forEach(scope => { if (!scope.contains(event.target)) reset(scope); });\n });\n document.addEventListener('keydown', event => {\n if (event.key !== 'Escape') return;\n scopes.forEach(reset);\n });\n})();\n</script>";
@@ -1,7 +1,5 @@
1
1
  import { escapeHtml } from './html.js';
2
2
  import { shortHost } from './templates.js';
3
- export const REVISION_START = '<!--artifact-revision-start-->';
4
- export const REVISION_END = '<!--artifact-revision-end-->';
5
3
  export const CREATED_START = '<!--artifact-created-start-->';
6
4
  export const CREATED_END = '<!--artifact-created-end-->';
7
5
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -69,61 +67,27 @@ export function originMenu(origin) {
69
67
  ].join('');
70
68
  return controls ? `<div class="origin-inline" data-copy-scope>${controls}${fallback}</div>` : '';
71
69
  }
72
- const stamp = (label, iso, display, relative = true) => `<time${relative ? ' data-relative="true"' : ''} data-label="${escapeHtml(label)}" datetime="${escapeHtml(iso)}" title="${escapeHtml(iso)}">${escapeHtml(label)} ${escapeHtml(display)}</time>`;
73
- const revisionLabel = (number) => (number === 1 ? 'Created' : 'Updated');
74
- const latestTimestamp = (stamps) => stamps.reduce((best, next) => (!best || Date.parse(next.iso) >= Date.parse(best.iso) ? next : best), undefined);
75
- /**
76
- * The page footer's created stamp. Saved history wins — revision 1's stored
77
- * instant stays honest even after later updates rewrite the header's stamp;
78
- * without history, the page's own "Created" timestamp is used. Empty when
79
- * nothing created-like was recorded: a created instant is never invented.
80
- */
81
- export function createdStamp(history, timestamps = []) {
82
- const first = history?.revisions[0];
83
- const created = first
84
- ? { iso: first.createdAt, display: first.createdAt.slice(0, 10), relative: true }
85
- : timestamps.find((time) => time.label === 'Created');
86
- return created ? stamp('Created', created.iso, created.display, created.relative) : '';
87
- }
88
- /**
89
- * The created stamp wrapped in the CREATED markers, so the revision-decorate
90
- * path can rewrite the slot once history exists — and so publish-time footer
91
- * edits (the share QR) can locate it in an already-rendered page.
92
- */
93
- export function createdSlot(history, timestamps = []) {
94
- return `${CREATED_START}${createdStamp(history, timestamps)}${CREATED_END}`;
70
+ const stamp = (label, time, className = '') => `<time${className ? ` class="${className}"` : ''} datetime="${escapeHtml(time.iso)}" title="${escapeHtml(time.iso)}">${escapeHtml(label)} ${escapeHtml(time.display)}</time>`;
71
+ /** The header's stamp: the latest page timestamp, under its own label. */
72
+ export function latestStamp(timestamps) {
73
+ const latest = timestamps.reduce((best, next) => (!best || Date.parse(next.iso) >= Date.parse(best.iso) ? next : best), undefined);
74
+ return latest ? stamp(latest.label, latest, 'header-time') : '';
95
75
  }
96
76
  /**
97
- * The history control. With saved history the trigger reads "Created just now"
98
- * or "Updated 10 minutes ago" from the stored snapshot timestamp; without it,
99
- * the latest page timestamp keeps its own label (for example "Source updated").
100
- * The copied commands keep their numeric revisions.
77
+ * The page footer's created stamp, wrapped in the CREATED markers so
78
+ * publish-time footer edits (the share QR) can locate it in a rendered page.
79
+ * Empty when no created instant was recorded: one is never invented.
101
80
  */
102
- export function revisionMenu(history, timestamps = []) {
103
- const latest = history?.revisions.at(-1);
104
- let summary;
105
- let content;
106
- if (history && latest) {
107
- const count = history.revisions.length;
108
- summary = stamp(revisionLabel(latest.number), latest.createdAt, latest.createdAt.slice(0, 10));
109
- const entries = history.revisions.slice(-10).reverse().map((revision) => `<li>${stamp(revisionLabel(revision.number), revision.createdAt, revision.createdAt.slice(0, 10))}${copy(`Copy command to open revision ${revision.number}`, `artifacts history ${history.id} --open ${revision.number}`, revision === latest ? 'This version' : 'Copy open command')}</li>`);
110
- content = `<p class="metadata-note">${count === 1 ? '1 version' : `${count} versions`}, saved on the rendering device. Copy an open command to run it there; it never overwrites the source.</p><ol class="revision-list">${entries.join('')}</ol>${count > 10 ? copy('Copy complete history command', `artifacts history ${history.id}`, 'All versions') : ''}`;
111
- }
112
- else {
113
- const newest = latestTimestamp(timestamps);
114
- summary = newest ? stamp(newest.label, newest.iso, newest.display, newest.relative) : 'History';
115
- const known = timestamps.length ? `<ul class="revision-list">${timestamps.map((time) => `<li>${stamp(time.label, time.iso, time.display, time.relative)}</li>`).join('')}</ul>` : '';
116
- content = `${known}<p class="metadata-note">No saved versions yet. Render a Markdown file to an output path to start tracking versions.</p>`;
117
- }
118
- return `${REVISION_START}<details class="artifact-menu revision-menu"><summary aria-label="Revision history">${summary} <span aria-hidden="true">&#9662;</span></summary><div class="metadata-popover" data-copy-scope><h2>History</h2>${content}${fallback}</div></details>${REVISION_END}`;
81
+ export function createdSlot(timestamps) {
82
+ const created = timestamps.find((time) => time.label === 'Created');
83
+ return `${CREATED_START}${created ? stamp('Created', created) : ''}${CREATED_END}`;
119
84
  }
120
85
  export const METADATA_CSS = `
121
86
  .metadata-link{text-decoration:none}.metadata-link>.link-affordance{flex:0 0 auto}.metadata-chip>.copy-affordance{opacity:0}.metadata-chip:hover>.copy-affordance,.metadata-chip:focus-visible>.copy-affordance{opacity:1}
122
- .document-header{position:relative;flex-wrap:wrap;gap:8px;padding-bottom:10px}.artifact-menu,.origin-inline{font:12px/1.5 var(--font-body);color:var(--muted)}.artifact-menu>summary{display:flex;align-items:center;gap:7px;cursor:pointer;list-style:none;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;max-width:270px;overflow-wrap:anywhere}.artifact-menu>summary::-webkit-details-marker{display:none}.artifact-menu>summary:hover{color:var(--accent);border-color:var(--accent)}.artifact-menu>summary:focus-visible,.metadata-copy:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.metadata-popover{position:absolute;z-index:80;right:0;top:calc(100% + 6px);width:min(370px,100%);max-height:70vh;overflow:auto;padding:20px;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-popover h2{font:650 17px/1.4 var(--font-body);margin:0 0 16px;padding:0;border:0}.metadata-copy{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:34px;width:100%;border:0;border-radius:6px;padding:7px 8px;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere}.metadata-copy:hover{background:var(--surface-alt)}.metadata-copy>.copy-affordance{font-size:10px;color:var(--muted);flex:0 0 auto}.origin-inline{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;max-width:100%}.metadata-chip{width:auto;max-width:220px;min-height:0;gap:6px;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;color:var(--muted);white-space:nowrap}.metadata-chip .metadata-value{min-width:0;overflow:hidden;text-overflow:ellipsis}.header-label{text-transform:capitalize}.metadata-chip:hover{color:var(--accent);border-color:var(--accent);background:var(--surface)}.origin-inline>.metadata-feedback{margin:0;flex:0 0 auto}.origin-inline>.metadata-fallback{position:absolute;right:0;top:calc(100% + 6px);z-index:80;width:min(370px,100%);margin:0;padding:10px;border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-note{color:var(--muted);font-size:12px}.metadata-feedback:empty{display:none}.metadata-feedback{color:var(--accent);font-size:12px;margin:8px 0 0}.metadata-fallback{width:100%;min-height:110px;color:var(--text);background:var(--bg);border:1px solid var(--line);font:12px/1.5 var(--font-mono);margin-top:8px;resize:vertical}.revision-list{list-style:none;padding:0;margin:0}.revision-list li{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:4px 12px;padding:9px 0;border-bottom:1px solid var(--line)}.revision-list time{color:var(--muted);font-size:12px}.revision-list .metadata-copy{width:auto;font-size:12px;padding:4px 8px;min-height:0}.metadata-popover [hidden],.origin-inline [hidden]{display:none!important}@media(max-width:480px){.artifact-menu>summary{max-width:220px}.metadata-chip{max-width:160px}.metadata-popover{padding:16px}}@media print{.artifact-menu,.origin-inline{display:none}}
87
+ .document-header{position:relative;flex-wrap:wrap;gap:8px;padding-bottom:10px}.origin-inline{font:12px/1.5 var(--font-body);color:var(--muted)}.metadata-copy:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.metadata-copy{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:34px;width:100%;border:0;border-radius:6px;padding:7px 8px;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere}.metadata-copy:hover{background:var(--surface-alt)}.metadata-copy>.copy-affordance{font-size:10px;color:var(--muted);flex:0 0 auto}.origin-inline{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;max-width:100%}.metadata-chip{width:auto;max-width:220px;min-height:0;gap:6px;border:1px solid var(--line);border-radius:999px;background:var(--surface);padding:5px 11px;color:var(--muted);white-space:nowrap}.metadata-chip .metadata-value{min-width:0;overflow:hidden;text-overflow:ellipsis}.header-label{text-transform:capitalize}.header-time{white-space:nowrap}.metadata-chip:hover{color:var(--accent);border-color:var(--accent);background:var(--surface)}.origin-inline>.metadata-feedback{margin:0;flex:0 0 auto}.origin-inline>.metadata-fallback{position:absolute;right:0;top:calc(100% + 6px);z-index:80;width:min(370px,100%);margin:0;padding:10px;border-radius:14px;box-shadow:0 12px 34px #0002}.metadata-feedback:empty{display:none}.metadata-feedback{color:var(--accent);font-size:12px;margin:8px 0 0}.metadata-fallback{width:100%;min-height:110px;color:var(--text);background:var(--bg);border:1px solid var(--line);font:12px/1.5 var(--font-mono);margin-top:8px;resize:vertical}.origin-inline [hidden]{display:none!important}@media(max-width:480px){.metadata-chip{max-width:160px}}@media print{.origin-inline{display:none}}
123
88
  `;
124
89
  export const METADATA_SCRIPT = `<script>
125
90
  (() => {
126
- const menus = [...document.querySelectorAll('.artifact-menu')];
127
91
  const scopes = [...document.querySelectorAll('[data-copy-scope]')];
128
92
  const reset = scope => {
129
93
  const status = scope.querySelector('.metadata-feedback');
@@ -131,7 +95,6 @@ export const METADATA_SCRIPT = `<script>
131
95
  if (status) status.textContent = '';
132
96
  if (fallback) fallback.hidden = true;
133
97
  };
134
- for (const menu of menus) menu.querySelector('summary').addEventListener('click', () => menus.forEach(other => { if (other !== menu) other.open = false; }));
135
98
  for (const scope of scopes) {
136
99
  const status = scope.querySelector('.metadata-feedback');
137
100
  const fallback = scope.querySelector('.metadata-fallback');
@@ -152,13 +115,11 @@ export const METADATA_SCRIPT = `<script>
152
115
  }));
153
116
  }
154
117
  document.addEventListener('click', event => {
155
- menus.forEach(menu => { if (!menu.contains(event.target)) menu.open = false; });
156
118
  scopes.forEach(scope => { if (!scope.contains(event.target)) reset(scope); });
157
119
  });
158
120
  document.addEventListener('keydown', event => {
159
121
  if (event.key !== 'Escape') return;
160
122
  scopes.forEach(reset);
161
- menus.forEach(menu => { if (menu.open) { menu.open = false; menu.querySelector('summary').focus(); } });
162
123
  });
163
124
  })();
164
125
  </script>`;