@eastgatesystems/tbx-reader 0.1.6 → 0.1.8

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.
@@ -164,7 +164,7 @@ var TbxDocument=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
164
164
  #tbx-gaudi-pane.tbx-gaudi-dragging,
165
165
  #tbx-gaudi-pane.tbx-gaudi-dragging path { cursor: grabbing; }
166
166
  #tbx-gaudi-pane .tbx-gaudi-sel { stroke: var(--tbx-accent, #2266cc); stroke-width: 4; animation: tbx-svg-pulse 500ms ease-in-out infinite alternate; }
167
- `,Rr=/[ \t\r\n\f\v.,;:!?()\[\]{}"]/;function zr(e){return!Rr.test(e)}function Br(e,t){if(t<0||t>e.length)return null;let n=Math.min(t,e.length-1);if(!zr(e[n]))return null;let r=n;for(;r>0&&zr(e[r-1]);)r--;let i=n+1;for(;i<e.length&&zr(e[i]);)i++;return e.slice(r,i)||null}function Vr(e,t,n){if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r?.startContainer.nodeType===Node.TEXT_NODE)return{node:r.startContainer,offset:r.startOffset}}if(e.caretPositionFromPoint){let r=e.caretPositionFromPoint(t,n);if(r?.offsetNode?.nodeType===Node.TEXT_NODE)return{node:r.offsetNode,offset:r.offset}}return null}function Hr(e,t,n){let r=Vr(n.ownerDocument,e,t);if(r&&n.contains(r.node))return Br(r.node.textContent??``,r.offset);let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),a;for(;a=i.nextNode();){let n=a.textContent??``;if(!n)continue;let r=document.createRange();r.selectNodeContents(a);let i=[...r.getClientRects()];if(i.length>0){for(let r of i)if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom){(r.top+r.bottom)/2;let t=0,i=n.length-1;for(;t<i;){let n=t+i>>1,o=document.createRange();o.setStart(a,n),o.setEnd(a,n+1);let s=o.getBoundingClientRect(),c=(s.top+s.bottom)/2;c<r.top?t=n+1:c>=r.bottom?i=n:s.right<=e?t=n+1:i=n}return Br(n,t)}continue}let o=a.parentElement;if(!o)continue;let s=o.getBoundingClientRect();if(!(t<s.top||t>s.bottom))return Br(n,Ur(o,n,e-s.left))}return null}function Ur(e,t,n){let r=window.getComputedStyle(e),i=document.createElement(`canvas`).getContext(`2d`);if(!i)return 0;i.font=`${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`;for(let e=1;e<=t.length;e++)if(i.measureText(t.slice(0,e)).width>=n)return e-1;return t.length-1}function Wr(e){return[`map`,`outline`,`treemap`,`gaudi`,`hyperbolic`].includes(e)}var Gr=class{constructor(e,t,n,r,i){this.panes=e,this._mode=t,this.leftColEl=n,this.outlineEl=r,this.getToolbarLeft=i}connectBreadcrumbs(e){this.updateBreadcrumbsFn=e;for(let{view:t}of this.panes.values())t.onViewRootChange=e}updateBreadcrumbs(){this.updateBreadcrumbsFn?.()}get mode(){return this._mode}get activeView(){return this.panes.get(this._mode).view}switchTo(e){this._mode=e}updateVisibility(){let{wide:e,fillHeight:t}=this.panes.get(this._mode);this.leftColEl.style.width=e?`50%`:``,this.outlineEl.style.overflowX=e?`auto`:`hidden`,this.outlineEl.style.paddingRight=e?`0`:``,this.outlineEl.style.height=t?`100%`:``;let n=this.getToolbarLeft();n&&(n.style.width=e?`${this.leftColEl.offsetWidth}px`:``);for(let[e,{view:t}]of this.panes)t.el.style.display=e===this._mode?``:`none`}renderCurrent(e){this.activeView.render(e)}scrollToSelected(){this.activeView.scrollToSelected()}onArrow(e){return this.activeView.onArrow(e)}getViewRoot(){return this.activeView.getViewRoot()}hoistTo(e,t){this.activeView.hoistTo(e,t)}renderOnSwitch(e){this.activeView.willRender(e),this.activeView.render(e)}switchView(e,t){this.activeView.suspend(),this.switchTo(e),this.updateVisibility(),this.updateBreadcrumbs(),t&&(this.renderOnSwitch(t),this.scrollToSelected())}},Kr=`
167
+ `,Rr=/[ \t\r\n\f\v.,;:!?()\[\]{}"]/;function zr(e){return!Rr.test(e)}function Br(e,t){if(t<0||t>e.length)return null;let n=Math.min(t,e.length-1);if(!zr(e[n]))return null;let r=n;for(;r>0&&zr(e[r-1]);)r--;let i=n+1;for(;i<e.length&&zr(e[i]);)i++;return e.slice(r,i)||null}function Vr(e,t,n){if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r?.startContainer.nodeType===Node.TEXT_NODE)return{node:r.startContainer,offset:r.startOffset}}if(e.caretPositionFromPoint){let r=e.caretPositionFromPoint(t,n);if(r?.offsetNode?.nodeType===Node.TEXT_NODE)return{node:r.offsetNode,offset:r.offset}}return null}function Hr(e,t,n){let r=Vr(n.ownerDocument,e,t);if(r&&n.contains(r.node))return Br(r.node.textContent??``,r.offset);let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),a;for(;a=i.nextNode();){let n=a.textContent??``;if(!n)continue;let r=document.createRange();r.selectNodeContents(a);let i=[...r.getClientRects()];if(i.length>0){for(let r of i)if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom){(r.top+r.bottom)/2;let t=0,i=n.length-1;for(;t<i;){let n=t+i>>1,o=document.createRange();o.setStart(a,n),o.setEnd(a,n+1);let s=o.getBoundingClientRect(),c=(s.top+s.bottom)/2;c<r.top?t=n+1:c>=r.bottom?i=n:s.right<=e?t=n+1:i=n}return Br(n,t)}continue}let o=a.parentElement;if(!o)continue;let s=o.getBoundingClientRect();if(!(t<s.top||t>s.bottom))return Br(n,Ur(o,n,e-s.left))}return null}function Ur(e,t,n){let r=window.getComputedStyle(e),i=document.createElement(`canvas`).getContext(`2d`);if(!i)return 0;i.font=`${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`;for(let e=1;e<=t.length;e++)if(i.measureText(t.slice(0,e)).width>=n)return e-1;return t.length-1}function Wr(e){return[`map`,`outline`,`treemap`,`gaudi`,`hyperbolic`].includes(e)}var Gr=class{constructor(e,t,n,r,i){this.panes=e,this._mode=t,this.leftColEl=n,this.outlineEl=r,this.getToolbarLeft=i}connectBreadcrumbs(e){this.updateBreadcrumbsFn=e;for(let{view:t}of this.panes.values())t.onViewRootChange=e}updateBreadcrumbs(){this.updateBreadcrumbsFn?.()}get mode(){return this._mode}get activeView(){return this.panes.get(this._mode).view}switchTo(e){this._mode=e}updateVisibility(){let{wide:e,fillHeight:t}=this.panes.get(this._mode);this.leftColEl.style.width=e?`var(--tbx-map-width, 50%)`:``,this.outlineEl.style.overflowX=e?`auto`:`hidden`,this.outlineEl.style.paddingRight=e?`0`:``,this.outlineEl.style.height=t?`100%`:``;let n=this.getToolbarLeft();n&&(n.style.width=e?`${this.leftColEl.offsetWidth}px`:``);for(let[e,{view:t}]of this.panes)t.el.style.display=e===this._mode?``:`none`}renderCurrent(e){this.activeView.render(e)}scrollToSelected(){this.activeView.scrollToSelected()}onArrow(e){return this.activeView.onArrow(e)}getViewRoot(){return this.activeView.getViewRoot()}hoistTo(e,t){this.activeView.hoistTo(e,t)}renderOnSwitch(e){this.activeView.willRender(e),this.activeView.render(e)}switchView(e,t){this.activeView.suspend(),this.switchTo(e),this.updateVisibility(),this.updateBreadcrumbs(),t&&(this.renderOnSwitch(t),this.scrollToSelected())}},Kr=`
168
168
  #tbx-breadcrumbs {
169
169
  flex-shrink: 0;
170
170
  height: 26px;
@@ -471,7 +471,7 @@ var TbxDocument=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`
471
471
  font-size: 0.75em;
472
472
  color: #666;
473
473
  }
474
- `,li=class{constructor(e){this.el=document.createElement(`div`),this.el.id=`tbx-about-overlay`,this.el.classList.add(`tbx-hidden`),this.el.innerHTML=`<div id="tbx-about"><div class="tbx-about-header"><div class="tbx-about-appname">Tinderbox Reader</div><div class="tbx-about-version">Version ${e}</div></div><div class="tbx-about-body"><div class="tbx-about-section"><strong>By:</strong><a href="https://www.eastgate.com" target="_blank">Eastgate Systems, Inc.</a><br>134 Main Street, Watertown MA 02472 USA<br>(800) 562-1638 &nbsp;+1 (617) 924-9044<br>info@eastgate.com</div><div class="tbx-about-section"><strong>Designer:</strong>Mark Bernstein</div></div><div class="tbx-about-footer">© 2002–2026 Eastgate Systems Inc. Released under the MIT License.</div></div>`}get isOpen(){return!this.el.classList.contains(`tbx-hidden`)}open(){this.el.classList.remove(`tbx-hidden`)}close(){this.el.classList.add(`tbx-hidden`)}},ui=`0.1.1`,di=[[`map`,`Map`,`⌘⌥M`],[`outline`,`Outline`,`⌘⌥O`],[`treemap`,`Treemap`,`⌘⌥P`],[`gaudi`,`Gaudí`,`⌘⌥G`],[`hyperbolic`,`Hyperbolic`,`⌃⌘H`]],fi=ai+si+ci+`
474
+ `,li=class{constructor(e){this.el=document.createElement(`div`),this.el.id=`tbx-about-overlay`,this.el.classList.add(`tbx-hidden`),this.el.innerHTML=`<div id="tbx-about"><div class="tbx-about-header"><div class="tbx-about-appname">Tinderbox Reader</div><div class="tbx-about-version">Version ${e}</div></div><div class="tbx-about-body"><div class="tbx-about-section"><strong>By:</strong><a href="https://www.eastgate.com" target="_blank">Eastgate Systems, Inc.</a><br>134 Main Street, Watertown MA 02472 USA<br>(800) 562-1638 &nbsp;+1 (617) 924-9044<br>info@eastgate.com</div><div class="tbx-about-section"><strong>Designer:</strong>Mark Bernstein</div></div><div class="tbx-about-footer">© 2002–2026 Eastgate Systems Inc. Released under the MIT License.</div></div>`}get isOpen(){return!this.el.classList.contains(`tbx-hidden`)}open(){this.el.classList.remove(`tbx-hidden`)}close(){this.el.classList.add(`tbx-hidden`)}},ui=`0.1.8`,di=[[`map`,`Map`,`⌘⌥M`],[`outline`,`Outline`,`⌘⌥O`],[`treemap`,`Treemap`,`⌘⌥P`],[`gaudi`,`Gaudí`,`⌘⌥G`],[`hyperbolic`,`Hyperbolic`,`⌃⌘H`]],fi=ai+si+ci+`
475
475
  #tbx-toolbar {
476
476
  display: flex;
477
477
  flex-shrink: 0;
@@ -5102,7 +5102,7 @@ var Wr = class {
5102
5102
  }
5103
5103
  updateVisibility() {
5104
5104
  let { wide: e, fillHeight: t } = this.panes.get(this._mode);
5105
- this.leftColEl.style.width = e ? "50%" : "", this.outlineEl.style.overflowX = e ? "auto" : "hidden", this.outlineEl.style.paddingRight = e ? "0" : "", this.outlineEl.style.height = t ? "100%" : "";
5105
+ this.leftColEl.style.width = e ? "var(--tbx-map-width, 50%)" : "", this.outlineEl.style.overflowX = e ? "auto" : "hidden", this.outlineEl.style.paddingRight = e ? "0" : "", this.outlineEl.style.height = t ? "100%" : "";
5106
5106
  let n = this.getToolbarLeft();
5107
5107
  n && (n.style.width = e ? `${this.leftColEl.offsetWidth}px` : "");
5108
5108
  for (let [e, { view: t }] of this.panes) t.el.style.display = e === this._mode ? "" : "none";
@@ -5371,7 +5371,7 @@ var ri = class {
5371
5371
  close() {
5372
5372
  this.el.classList.add("tbx-hidden");
5373
5373
  }
5374
- }, li = "0.1.1", ui = [
5374
+ }, li = "0.1.8", ui = [
5375
5375
  [
5376
5376
  "map",
5377
5377
  "Map",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eastgatesystems/tbx-reader",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Web component reader for Tinderbox and Storyspace .tbx hypertext documents",
5
5
  "main": "dist/tbx-document.iife.js",
6
6
  "module": "dist/tbx-document.mjs",