hdoc-tools 0.41.5 → 0.41.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.41.5",
3
+ "version": "0.41.7",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {
@@ -36,6 +36,8 @@ main {
36
36
  display: block;
37
37
  }
38
38
 
39
+
40
+ /* NWJ - comment out while test gerrys chatgpt styles
39
41
  h1,
40
42
  h2,
41
43
  h3,
@@ -44,9 +46,10 @@ h5,
44
46
  h6 {
45
47
  margin: 0;
46
48
  line-height: normal;
47
- font-size: revert; /* let browser handle it */
49
+ font-size: revert;
48
50
  font-weight: 400;
49
51
  }
52
+ */
50
53
 
51
54
  p {
52
55
  margin: 0;
@@ -229,3 +232,59 @@ p {
229
232
  overflow-wrap: break-word;
230
233
  }
231
234
 
235
+ /* billythefish */
236
+ /* styles from gerrys chatgpt recommendation */
237
+ /* Base (adjust if your body size differs) */
238
+ html { font-size: 16px; }
239
+ :root{
240
+ /* Tweak the min/max to taste; ratio ≈ 1.25 across levels */
241
+ --h1-min: 2.0rem; --h1-max: 3.0rem; /* 32–48 */
242
+ --h2-min: 1.6rem; --h2-max: 2.25rem; /* 25.6–36 */
243
+ --h3-min: 1.35rem; --h3-max: 1.8rem; /* 21.6–28.8 */
244
+ --h4-min: 1.15rem; --h4-max: 1.45rem; /* 18.4–23.2 */
245
+ --h5-min: 1.05rem; --h5-max: 1.2rem; /* 16.8–19.2 */
246
+ --h6-min: 0.95rem; --h6-max: 1.05rem; /* 15.2–16.8 */
247
+ }
248
+ h1,h2,h3,h4,h5,h6{
249
+ font-family: var(--hb-heading, inherit);
250
+ line-height: 1.15;
251
+ margin-top: 2.2em; /* consistent vertical rhythm */
252
+ margin-bottom: 0.6em;
253
+ letter-spacing: 0;
254
+ }
255
+ h1{
256
+ font-size: clamp(var(--h1-min), 2vw + 1rem, var(--h1-max));
257
+ font-weight: 750; /* strong but not shouty */
258
+ line-height: 1.1;
259
+ margin-top: 0; /* article title at top */
260
+ }
261
+ h2{
262
+ font-size: clamp(var(--h2-min), 1.5vw + 0.9rem, var(--h2-max));
263
+ font-weight: 700;
264
+ border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
265
+ padding-bottom: 0.2em;
266
+ }
267
+ h3{
268
+ font-size: clamp(var(--h3-min), 1.2vw + 0.7rem, var(--h3-max));
269
+ font-weight: 650;
270
+ }
271
+ h4{
272
+ font-size: clamp(var(--h4-min), 0.8vw + 0.65rem, var(--h4-max));
273
+ font-weight: 600;
274
+ }
275
+ h5{
276
+ font-size: clamp(var(--h5-min), 0.6vw + 0.6rem, var(--h5-max));
277
+ font-weight: 550;
278
+ color: color-mix(in srgb, currentColor 85%, #000 15%);
279
+ }
280
+ h6{
281
+ font-size: clamp(var(--h6-min), 0.4vw + 0.55rem, var(--h6-max));
282
+ font-weight: 600;
283
+ text-transform: uppercase; /* differentiate without shrinking */
284
+ letter-spacing: 0.06em;
285
+ color: color-mix(in srgb, currentColor 70%, #000 30%);
286
+ }
287
+ /* Better anchor linking with fixed headers/ToC */
288
+ :where(h1,h2,h3,h4,h5,h6){ scroll-margin-top: 96px; }
289
+ /* Tighten multi-line large headings */
290
+ h1, h2 { hyphens: auto; }
@@ -51,16 +51,27 @@ api-param-name {
51
51
  font-style: italic;
52
52
  font-weight: 600;
53
53
  }
54
+
54
55
  api-param-optional:before {
55
56
  content: "Optional [default=";
56
57
  font-style: normal;
57
58
  font-weight: 400;
58
59
  }
60
+
59
61
  api-param-optional:after {
60
- font-style: normal;
61
62
  content: "]";
63
+ font-style: normal;
62
64
  font-weight: 400;
63
65
  }
66
+
67
+ /* If no default provided */
68
+ api-param-optional[no-default-value]:before {
69
+ content: "Optional";
70
+ }
71
+
72
+ api-param-optional[no-default-value]:after {
73
+ content: "";
74
+ }
64
75
 
65
76
  /* API parameter description block */
66
77
  api-param-desc {
@@ -2,6 +2,7 @@
2
2
  * Headings
3
3
  * -------------------------------------------------------------------------- */
4
4
 
5
+ /* NWJ - comment out while test gerrys chatgpt styles
5
6
  .HTL-doc h1,
6
7
  .HTL-doc h2,
7
8
  .HTL-doc h3,
@@ -39,10 +40,8 @@
39
40
  font-size: 18px;
40
41
  left: -25px;
41
42
  top: 52%;
42
- width: 32px;
43
- /*so will over lap headre slightly - stops flicker when hover out of header into anchor */
43
+ width: 32px;
44
44
  opacity: 0;
45
- /*hidden */
46
45
  }
47
46
 
48
47
  .HTL-doc h3 .header-anchor {
@@ -51,10 +50,9 @@
51
50
  left: -25px;
52
51
  top: 5px;
53
52
  width: 32px;
54
- /*so will over lap headre slightly - stops flicker when hover out of header into anchor */
55
53
  opacity: 0;
56
- /*hidden */
57
54
  }
55
+ */
58
56
 
59
57
 
60
58
  .HTL-doc h1:hover .header-anchor,
@@ -66,6 +64,7 @@
66
64
  opacity: 1;
67
65
  }
68
66
 
67
+ /* NWJ - comment out while test gerrys chatgpt styles
69
68
  @media (min-width: 768px) {
70
69
  .HTL-doc h1 {
71
70
  letter-spacing: -0.02em;
@@ -73,6 +72,7 @@
73
72
  font-size: 32px;
74
73
  }
75
74
  }
75
+ */
76
76
 
77
77
  /**
78
78
  * Paragraph and inline elements
package/ui/index.html CHANGED
@@ -47,6 +47,16 @@
47
47
  }
48
48
  customElements.define("api-param-name", APIParamName);
49
49
 
50
+ class ApiParamOptional extends HTMLElement {
51
+ connectedCallback() {
52
+ const text = (this.textContent || '').trim();
53
+ if (!text) {
54
+ this.innerHTML = ''; // remove content
55
+ this.setAttribute('no-default-value', '');
56
+ }
57
+ }
58
+ }
59
+ customElements.define('api-param-optional', ApiParamOptional);
50
60
 
51
61
  var ThemePreference = localStorage.getItem('hdocbook-theme-appearance') || '';
52
62
  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
@@ -258,8 +258,12 @@ function loadContentUrl(
258
258
  fromPopState,
259
259
  fromBook = true,
260
260
  ) {
261
-
262
-
261
+ let downloadFile = false;
262
+ if (linkRef.includes('_books/')) {
263
+ downloadFile = linkRef.split('').length > 1;
264
+ console.log('downloadFile', downloadFile);
265
+ }
266
+
263
267
  //-- clear table of contents
264
268
  view.docApp.tableOfContents = [];
265
269
  let clean_linkRef = linkRef;
@@ -271,23 +275,30 @@ function loadContentUrl(
271
275
  clean_linkRef = removeTrailingSlash(clean_linkRef);
272
276
  //-- remove starting / if link starts with it
273
277
  clean_linkRef = removeStartingSlash(clean_linkRef);
274
-
275
- //-- update url in browser
276
- if (fromBook)
277
- setBrowserViewUrl(clean_linkRef, {}, fromPageRefresh, fromPopState);
278
- //-- destroy any existing content children and events properly
279
- jqContentContainer.empty();
280
- jqDocumentHeader.find(".document-title").empty();
281
-
282
- //-- for now just load whatever the href prop is (we can add actions to perform specific processing and then load content based on element atts etc)
283
- let frontmatterData = {};
278
+
284
279
  let booksLinkRef = clean_linkRef;
285
280
  if (fromBook) {
286
281
  booksLinkRef = clean_linkRef.includes("_books/")
287
282
  ? clean_linkRef
288
283
  : `_books/${clean_linkRef}`;
289
284
  }
290
- fetch(booksLinkRef)
285
+
286
+ if (downloadFile) {
287
+ //-- open in new tab to download
288
+ window.open(booksLinkRef, '_blank');
289
+ } else {
290
+ //-- update url in browser
291
+ if (fromBook) {
292
+ setBrowserViewUrl(clean_linkRef, {}, fromPageRefresh, fromPopState);
293
+ }
294
+
295
+ //-- destroy any existing content children and events properly
296
+ jqContentContainer.empty();
297
+ jqDocumentHeader.find(".document-title").empty();
298
+
299
+ //-- for now just load whatever the href prop is (we can add actions to perform specific processing and then load content based on element atts etc)
300
+ let frontmatterData = {};
301
+ fetch(booksLinkRef)
291
302
  .then((response) => {
292
303
  if (response.headers.has("X-frontmatter")) {
293
304
  frontmatterData = response.headers.get("X-frontmatter");
@@ -417,6 +428,8 @@ function loadContentUrl(
417
428
 
418
429
  listenForHrefClicks();
419
430
  });
431
+ }
432
+
420
433
  }
421
434
 
422
435
  function setGitHubBookUrl(linkRef) {
@@ -625,6 +638,7 @@ Vue.component("nav-section-component", {
625
638
  },
626
639
  });
627
640
 
641
+
628
642
  const hslDocLog = {
629
643
  _entry: [],
630
644
  log: function (strMessage, varData) {