wiki-plugin-hitchhiker 0.5.0 → 0.5.1

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 (2) hide show
  1. package/client/wiki-ux.js +1 -1
  2. package/package.json +67 -2
package/client/wiki-ux.js CHANGED
@@ -1,4 +1,4 @@
1
- /* wiki-plugin-hitchhiker 0.5.0 */
1
+ /* wiki-plugin-hitchhiker 0.5.1 */
2
2
  (()=>{(function(){"use strict";var P=!1,S=0,j=setInterval(function(){S++;var e=window.wiki&&window.plugins&&window.plugins.factory&&window.plugins.factory.bind&&window.$&&typeof window.wiki.pageHandler<"u";if(e&&!P){P=!0,clearInterval(j);try{_()}catch(t){console.error("[wiki-ux] install failed",t)}}else S>100&&clearInterval(j)},200),p="font-size:1.05em;min-height:44px;padding:10px 18px;cursor:pointer;",z='<svg viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="vertical-align:-0.15em;margin-right:.4em" aria-hidden="true"><path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>',k=!1,dt={"*":{recommend:["paragraph","markdown","image","html","reference"],hide:[]}};function _(){st(),B(),X(),M(),U(),G(),console.log("[wiki-ux] installed")}function F(e){if(e.hasClass("hearth-page")||e.find(".item.hearth").length)return!0;try{var t=window.wiki.lineup.atKey(e.data("key")),a=t&&t.getRawPage&&t.getRawPage().story;return!!(a&&a.some(function(i){return i.type==="hearth"}))}catch{return!1}}function H(e,t){var a=/^https?:/.test(e)?e:location.protocol+"//"+e;return fetch(a+"/"+t+".json").then(function(i){return i.ok?i.json():null}).then(function(i){return!!(i&&i.story&&i.story.some(function(r){return r.type==="hearth"}))}).catch(function(){return!1})}function A(e){window.wiki&&window.wiki.showResult;var t=document.createElement("div");t.textContent="\u{1F3E0} "+e,t.style.cssText="position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:99999;background:rgba(200,120,40,0.95);color:#fff;padding:10px 16px;border-radius:8px;font:14px/1.4 -apple-system,sans-serif;box-shadow:0 4px 16px rgba(0,0,0,.3);max-width:80vw;",document.body.appendChild(t),setTimeout(function(){t.remove()},4200)}function U(){document.addEventListener("dragstart",function(e){var t=e.target&&e.target.closest?e.target.closest(".page h1 a"):null;t&&F(window.$(t).closest(".page"))&&(e.preventDefault(),e.stopImmediatePropagation(),A("This page keeps to its hearth \u2014 it will not be dragged out."))},!0)}function B(){document.addEventListener("click",function(e){var t=e.target,a=t&&t.closest?t.closest(".page h1 a"):null;if(a&&(e.preventDefault(),e.stopImmediatePropagation(),!a.closest(".page.wiki-ux-tools"))){if(e.shiftKey){try{W(a)}catch{R(a)}return}try{ot(a)}catch(i){console.error("[wiki-ux] flag page failed, opening origin site instead",i),R(a)}}},!0)}function C(e,t,a){var i=window.wiki,r=t==="welcome-visitors"?"view/welcome-visitors":"view/welcome-visitors/view/"+t;if(e.hasClass("remote")){var n=a;if(!n)try{var o=i.lineup.atKey(e.data("key"));n=o&&o.getRemoteSite&&o.getRemoteSite()}catch{}if(n)return i.site(n).getDirectURL(r)}return"/"+r}function W(e){var t=window.$(e).closest(".page"),a=t.attr("id");window.location.assign(C(t,a,h(t)))}function h(e){if(!e.hasClass("remote"))return"";try{var t=window.wiki.lineup.atKey(e.data("key"));return t&&t.getRemoteSite&&t.getRemoteSite()||e.data("site")||""}catch{return e.data("site")||""}}function m(e,t,a){a=a||{};var i=window.$,r=window.wiki,n=e.prevAll(".page").length;r.showResult(t);var o=i(".main > .page").last();o.insertAfter(e);try{r.lineup.changePageIndex(o.data("key"),n+1)}catch{}o.addClass("wiki-ux-tools"),a.ghost||o.removeClass("ghost");try{o[0].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}catch{}return o}function M(){document.addEventListener("click",function(e){var t=e.target;if(!(!t||!t.closest)){var a=t.closest(".wiki-ux-tool-fork")?"fork":t.closest(".wiki-ux-tool-sim")?"sim":t.closest(".wiki-ux-tool-trash")?"trash":t.closest(".wiki-ux-tool-clean")?"clean":t.closest(".wiki-ux-tool-flag")?"flag":t.closest(".wiki-ux-tool-toolpage")?"toolpage":null;if(a){e.preventDefault();var i=window.$,r=t.closest(".wiki-ux-tool-"+a),n=i(r).closest(".page"),o=n.prev(".page");try{a==="fork"?N(o,n):a==="sim"?q(o,n):a==="trash"?V(o,n):a==="clean"?Z(o,n):a==="flag"?window.plugins.fishPicker&&window.plugins.fishPicker.open(o,n):a==="toolpage"&&K(o,n,r.getAttribute("data-slug"))}catch(s){console.error('[wiki-ux] tool "'+a+'" failed',s)}}}},!0)}var D="demo.localhost";function K(e,t,a){if(a){var i=function(r){return fetch("//"+r+"/"+a+".json").then(function(n){if(!n.ok)throw new Error(""+n.status);return n.json()})};i(location.host).catch(function(){return i(D)}).then(function(r){m(e,window.wiki.newPage(r),{ghost:!0}),t.remove()}).catch(function(){window.alert('Tool page "'+a+'" not found on '+location.host+" or "+D+".")})}}function N(e,t){var a=e.find(".fork-page");if(a.length){a.trigger("click"),t.remove();return}if(window.isAuthenticated!==!0||/_rev\d+$/.test(e.attr("id")||"")){console.warn("[wiki-ux] fork: no .fork-page control on the source page");return}var i={type:"fork"};if(e.hasClass("local"))e.removeClass("local");else{var r=h(e);r&&(i.site=r)}e.removeClass("ghost"),window.wiki.pageHandler.put(e,i),t.remove()}function V(e,t){var a=window.wiki,i=e.data("data")||{},r=i.title||e.attr("id")||"this page";if(window.confirm('Trash "'+r+`"?
3
3
 
4
4
  It moves to the recycler and can be recovered from Recycled Pages.`)){var n;try{n=a.lineup.atKey(e.data("key"))}catch{}if(!n){window.alert("Could not identify the page to trash.");return}a.pageHandler.delete(n,e,function(o){if(o){window.alert("Trash failed: "+o);return}t.remove(),e.remove()})}}function Z(e,t){var a=window.wiki,i=e.data("data")||{},r=i.title||e.attr("id")||"this page",n=i.story||[],o={title:r,story:n,journal:[{type:"create",item:{title:r,story:n},date:Date.now(),certificate:"from marvin"}]};a.showResult(a.newPage(o),{$page:t})}function G(){fetch("/system/factories.json").then(function(e){return e.ok?e.json():[]}).then(function(e){window.catalog||(window.catalog=e),k=(e||[]).some(function(t){return t&&t.name==="Similarity"})}).catch(function(){})}function q(e,t){var a=e.data("data")||{},i=a.title||e.attr("id")||"this page",r=(e.attr("id")||"").split("_rev")[0],n=h(e)||location.hostname,o=t.find(".wiki-ux-tool-sim");o.prop("disabled",!0).text("\u{1F50D} Searching\u2026");var s=[i].concat((a.story||[]).filter(function(u){return u.type==="markdown"||u.type==="paragraph"}).map(function(u){return(u.text||"").trim()}).filter(Boolean)).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-hitchhiker",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "House pages + page-flag UX for the hitchhiker farms: bundled Tools/Changes/Login pages, the flag-click Tools page, drop-to-preview via an Outpost, and the hearth guard. The factory chooser is wiki-plugin-chooser; the fish picker is wiki-plugin-fish-picker. No dependencies.",
5
5
  "type": "module",
6
6
  "files": [
@@ -24,6 +24,71 @@
24
24
  "api": {
25
25
  "version": 1,
26
26
  "spec": "api/openapi.json"
27
+ },
28
+ "requires": {
29
+ "node": ">=22.12",
30
+ "security": {
31
+ "module": "wiki-security-hitchhiker-passport",
32
+ "range": ">=0.14.0-hitchhiker.2",
33
+ "tag": "hitchhiker",
34
+ "config": {
35
+ "security_type": "hitchhiker-passport"
36
+ },
37
+ "why": "the only farm-wide client injection point; without it this client is served and referenced by nothing"
38
+ },
39
+ "plugins": [
40
+ {
41
+ "package": "wiki-plugin-chooser",
42
+ "seat": "chooser",
43
+ "range": "^0.1.0",
44
+ "level": "required",
45
+ "why": "the factory chooser, split out of hitchhiker at 0.5.0"
46
+ },
47
+ {
48
+ "package": "wiki-plugin-fish-picker",
49
+ "seat": "fish-picker",
50
+ "range": "^0.1.0",
51
+ "level": "required",
52
+ "why": "the site identity flag editor, split out of hitchhiker at 0.5.0"
53
+ },
54
+ {
55
+ "package": "wiki-plugin-hearth",
56
+ "seat": "hearth",
57
+ "range": "^0.2.0",
58
+ "level": "recommended",
59
+ "why": "renders the hearth item that hitchhiker supplies the drag/fork guard for"
60
+ },
61
+ {
62
+ "package": "wiki-plugin-similarity",
63
+ "seat": "similarity",
64
+ "range": "^0.13.0",
65
+ "level": "optional",
66
+ "why": "the Similarity tool on the flag-click Tools page; gated on factory detection, hides if absent"
67
+ },
68
+ {
69
+ "package": "wiki-plugin-terms",
70
+ "seat": "terms",
71
+ "range": "*",
72
+ "level": "optional",
73
+ "source": "github:Hitchhikers-Guide-to-the-Galaxy/wiki-plugin-terms",
74
+ "why": "the terms fork interceptor - NOT PUBLISHED on npm; the bootstrap tolerates its absence"
75
+ }
76
+ ],
77
+ "services": [
78
+ {
79
+ "name": "unfurl",
80
+ "level": "optional",
81
+ "provider": "wiki-plugin-unfurl",
82
+ "siteConfig": "status/outpost.json",
83
+ "why": "link previews on flag-drop; the browser calls the Outpost directly, so no Outpost = no card, silently. MUST be https:// wherever the farm is served over https — an http:// Outpost is blocked as mixed content and fails with no visible error (verified 2026-08-20: http fetch from an https wiki page = TypeError: Failed to fetch)",
84
+ "scheme": "must match or exceed the scheme the wiki sites are served on"
85
+ }
86
+ ]
87
+ },
88
+ "provides": {
89
+ "seats": [
90
+ "hitchhiker"
91
+ ]
27
92
  }
28
93
  },
29
94
  "scripts": {
@@ -34,4 +99,4 @@
34
99
  "devDependencies": {
35
100
  "esbuild": "^0.25.0"
36
101
  }
37
- }
102
+ }