boomack 0.15.0-preview6 → 0.15.0-preview7

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.
@@ -214,12 +214,13 @@ window.boomack = window.boomack || {};
214
214
  }
215
215
 
216
216
  function getSlotInnerSize(slotE) {
217
+ var slotBackgroundE = slotE.find('.slot-background');
217
218
  var contentWrapperE = slotE.find('.slot-content-wrapper');
218
219
  return {
219
- width: contentWrapperE.innerWidth() -
220
+ width: slotBackgroundE.innerWidth() -
220
221
  parseFloat(contentWrapperE.css('padding-left')) -
221
222
  parseFloat(contentWrapperE.css('padding-right')),
222
- height: contentWrapperE.innerHeight() -
223
+ height: slotBackgroundE.innerHeight() -
223
224
  parseFloat(contentWrapperE.css('padding-top')) -
224
225
  parseFloat(contentWrapperE.css('padding-bottom')),
225
226
  };
@@ -71,8 +71,11 @@
71
71
  themeOverride,
72
72
  themeProperties,
73
73
  panel,
74
+ forceMargin,
74
75
  tools,
75
76
  toolbars,
77
+ borders,
78
+ showSlotIds,
76
79
  offline,
77
80
  }); %><%
78
81
  } else {
@@ -82,8 +85,11 @@
82
85
  themeOverride,
83
86
  themeProperties,
84
87
  panel,
88
+ forceMargin,
85
89
  tools,
86
90
  toolbars,
91
+ borders,
92
+ showSlotIds,
87
93
  offline,
88
94
  }); %><%
89
95
  }
@@ -9,10 +9,15 @@ expects context:
9
9
  - panel {Panel}
10
10
  - tools {boolean}
11
11
  - toolbars {boolean}
12
+ - borders {boolean}
13
+ - showSlotIds {boolean}
14
+ - forceMargin {boolean|null}
12
15
  - offline {boolean}
13
16
 
14
- */%>
15
- <div class="layout layout-document<%= panel.layout.document.noGap ? ' no-gap' : '' %><%= panel.layout.document.noMargin ? ' no-margin' : '' %>" style="<%
17
+ */%><%
18
+ var noMargin = typeof forceMargin === 'boolean' ? !forceMargin : panel.layout.document.noMargin;
19
+ %>
20
+ <div class="layout layout-document<%= panel.layout.document.noGap ? ' no-gap' : '' %><%= noMargin ? ' no-margin' : '' %>" style="<%
16
21
  %>transform:scale(<%= panel.layout.document.zoom %>);<%
17
22
  %>max-width:calc(<%= panel.layout.document.maxWidth %> / <%= panel.layout.document.zoom %>);<%
18
23
  %>">
@@ -30,6 +35,8 @@ expects context:
30
35
  slot,
31
36
  tools,
32
37
  toolbar: toolbars,
38
+ border: borders,
39
+ showSlotId: showSlotIds,
33
40
  offline,
34
41
  singled: false,
35
42
  }) %>
@@ -9,10 +9,15 @@ expects context:
9
9
  - panel {Panel}
10
10
  - tools {boolean}
11
11
  - toolbars {boolean}
12
+ - borders {boolean}
13
+ - showSlotIds {boolean}
14
+ - forceMargin {boolean|null}
12
15
  - offline {boolean}
13
16
 
14
- */%>
15
- <div class="layout layout-grid<%= panel.layout.grid.noGap ? ' no-gap' : '' %><%= panel.layout.grid.noMargin ? ' no-margin' : '' %>" style="<%
17
+ */%><%
18
+ var noMargin = typeof forceMargin === 'boolean' ? !forceMargin : panel.layout.grid.noMargin;
19
+ %>
20
+ <div class="layout layout-grid<%= panel.layout.grid.noGap ? ' no-gap' : '' %><%= noMargin ? ' no-margin' : '' %>" style="<%
16
21
  %>grid-template-columns:repeat(<%= panel.layout.grid.columns %>, 1fr);<%
17
22
  %>grid-template-rows:repeat(<%= panel.layout.grid.rows %>, 1fr);<%
18
23
  %>transform:scale(<%= panel.layout.grid.zoom %>);<%
@@ -32,6 +37,8 @@ expects context:
32
37
  slot,
33
38
  tools,
34
39
  toolbar: toolbars,
40
+ border: borders,
41
+ showSlotId: showSlotIds,
35
42
  offline,
36
43
  singled: false,
37
44
  }) %>
@@ -10,6 +10,8 @@ expects context:
10
10
  - themeProperties {Object}
11
11
  - tools {boolean}
12
12
  - toolbar {boolean}
13
+ - border {boolean}
14
+ - showSlotId {boolean}
13
15
  - offline {boolean}
14
16
  - singled {boolean}
15
17
 
@@ -22,6 +24,8 @@ var contentScale = command ? command.scale : null;
22
24
  var contentAlign = command ? command.align : null;
23
25
  var commandBackground = command ? command.background : null;
24
26
 
27
+ var showBorder = slot.border && border;
28
+
25
29
  var tbPause = !offline && tools && !slot.noPause;
26
30
  var tbZoom = !offline && tools && !slot.noZoom;
27
31
  var tbClear = !offline && tools&& !slot.noClear;
@@ -45,7 +49,7 @@ function replaceThemePropsInStr(s) {
45
49
  class="slot<%
46
50
  %><%= theme !== 'none' ? ' ui segment' : '' %><%
47
51
  %><%= command ? '' : ' empty' %><%
48
- %><%= slot.border ? ' with-border' : ' without-border' %><%
52
+ %><%= showBorder ? ' with-border' : ' without-border' %><%
49
53
  %><%= slot.toolbar && toolbar ? ' with-toolbar' : ' without-toolbar' %><%
50
54
  %><%= contentScale ? ' content-scale ' + contentScale : '' %><%
51
55
  %><%= contentAlign ? ' content-align ' + contentAlign : '' %><%
@@ -76,7 +80,7 @@ function replaceThemePropsInStr(s) {
76
80
  data-align="<%= contentAlign %>"
77
81
  >
78
82
  <% if (slot.toolbar && toolbar) { %>
79
- <div class="slot-toolbar ui <%= slot.border ? ' attached' : '' %> mini icon menu">
83
+ <div class="slot-toolbar ui <%= showBorder ? ' attached' : '' %> mini icon menu">
80
84
  <% if (slot.history && !offline && tools) { %>
81
85
  <a class="cmd-history-backward item<%= command && command.no > 1 ? '' : ' disabled' %>" onclick="boomack.cmdHistoryBackward('<%= slot.id %>')" style="display: none;"><i class="icon arrow circle left"></i></a>
82
86
  <span class="txt-history item" style="display: none;"><%- command ? '1' : '&ndash;' %>&nbsp;/&nbsp;<%- command ? Math.min(command.no, slot.history + 1) : '&ndash;' %></span>
@@ -194,7 +198,7 @@ function replaceThemePropsInStr(s) {
194
198
  %>height: <%= slot.height %>;<%
195
199
  }
196
200
  %>">
197
- <% if (slot.showId) { %><div class="slot-id"><%= slot.id %></div><% } %>
201
+ <% if (slot.showId && showSlotId) { %><div class="slot-id"><%= slot.id %></div><% } %>
198
202
  </div>
199
203
  <div class="slot-content-box" style="<%
200
204
  if (slot.minHeight) {
@@ -15,7 +15,7 @@
15
15
  <body class="slot-panel">
16
16
  <%
17
17
  const layoutSpec = panel.layout[panel.layout.type];
18
- const noMargin = layoutSpec && layoutSpec.noMargin;
18
+ const noMargin = typeof forceMargin === 'boolean' ? !forceMargin : layoutSpec && layoutSpec.noMargin;
19
19
  %>
20
20
  <div class="panel-wrapper layout-grid<%= noMargin ? ' no-margin' : '' %>" style="<%
21
21
  if (zoom !== 1.0) {
@@ -33,6 +33,8 @@
33
33
  slot,
34
34
  tools,
35
35
  toolbar,
36
+ border,
37
+ showSlotId,
36
38
  offline,
37
39
  singled: true,
38
40
  }); %></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boomack",
3
- "version": "0.15.0-preview6",
3
+ "version": "0.15.0-preview7",
4
4
  "description": "web app for displaying hyper-media items in concert with e.g. an IDE",
5
5
  "author": "Tobias Kiertscher <dev@mastersign.de>",
6
6
  "license": "MIT",
@@ -74,7 +74,6 @@
74
74
  "@types/lodash": "^4.17.5",
75
75
  "@types/markdown-it": "^14.1.1",
76
76
  "@types/node": "^18.0.0",
77
- "@types/rimraf": "^3.0.0",
78
77
  "chai": "^6.2.0",
79
78
  "css-element-queries": "1.2.3",
80
79
  "jquery": "^3.7.1",
@@ -88,11 +88,14 @@ export function setup(app) {
88
88
  themeOverride: options.themeOverride,
89
89
  themeVariation: options.themeVariation,
90
90
  zoom: options.zoom || 1.0,
91
+ forceMargin: options.forceMargin,
91
92
  header: options.header,
92
93
  headerTools: false,
93
94
  showLogo: options.showLogo,
94
95
  toolbars: options.toolbars,
95
96
  tools: options.tools,
97
+ borders: options.borders,
98
+ showSlotIds: options.showSlotIds,
96
99
  update: 'never',
97
100
  clientResGroups: plugins.getClientResourceGroupMap(),
98
101
  modules: plugins.getESModuleResourceMap(),
@@ -231,10 +234,13 @@ export function setup(app) {
231
234
  themeOverride: !!req.query.theme,
232
235
  themeVariation: layout.themeVariation,
233
236
  zoom: req.query.zoom,
237
+ forceMargin: enforceBoolean(req.query.margin),
234
238
  header: layout.header ? enforceBoolean(req.query.header, true) : false,
235
239
  showLogo: layout.showLogo ? enforceBoolean(req.query.logo, true) : false,
236
240
  toolbars: enforceBoolean(req.query.toolbars, true),
237
241
  tools: enforceBoolean(req.query.tools, true),
242
+ borders: enforceBoolean(req.query.borders, true),
243
+ showSlotIds: enforceBoolean(req.query['slot-ids'], true),
238
244
  update: 'never',
239
245
  compression: enforceInteger(req.query.comp),
240
246
  name: req.query.name,
@@ -109,8 +109,11 @@ export function setup(app, io) {
109
109
  themeOverride: false,
110
110
  themeVariation: panel.layout.themeVariation,
111
111
  themeProperties,
112
+ forceMargin: null,
112
113
  tools: true,
113
114
  toolbars: true,
115
+ borders: true,
116
+ showSlotIds: true,
114
117
  panel: { ...panel, layout },
115
118
  offline: true,
116
119
  });
@@ -6,7 +6,7 @@ import express from 'express';
6
6
  import ms from 'ms';
7
7
  import cookieParser from 'cookie-parser';
8
8
  import bodyParser from 'body-parser';
9
- import { enforceEnum, logError, moduleDirname, parseBoolean, timestamp, } from '../utils.js';
9
+ import { enforceBoolean, enforceEnum, logError, moduleDirname, parseBoolean, timestamp, } from '../utils.js';
10
10
  import { log } from '../service/logging.js';
11
11
  import cfg from '../service/config.js';
12
12
  import plugins from '../service/plugins.js';
@@ -279,8 +279,11 @@ export function setup(app, io) {
279
279
  themeProperties,
280
280
  themeOverride: !!req.query.theme,
281
281
  themeVariation: layout.themeVariation,
282
+ forceMargin: null,
282
283
  tools: true,
283
284
  toolbars: true,
285
+ borders: true,
286
+ showSlotIds: true,
284
287
  panel: { ...panel, layout },
285
288
  offline: false,
286
289
  });
@@ -338,11 +341,14 @@ export function setup(app, io) {
338
341
  themeVariation: panel.layout.themeVariation,
339
342
  panel: { ...panel, layout },
340
343
  zoom: req.query.zoom || 1.0,
344
+ forceMargin: enforceBoolean(req.query.margin),
341
345
  header: layout.header ? parseBoolean(req.query.header, true) : false,
342
346
  showLogo: layout.showLogo ? parseBoolean(req.query.logo, true) : false,
343
347
  headerTools: layout.headerTools ? parseBoolean(req.query['header-tools'], true) : false,
344
348
  toolbars: parseBoolean(req.query.toolbars, true),
345
349
  tools: parseBoolean(req.query.tools, true),
350
+ borders: parseBoolean(req.query.borders, true),
351
+ showSlotIds: parseBoolean(req.query['slot-ids'], true),
346
352
  clientResGroups: plugins.getClientResourceGroupMap(),
347
353
  modules: plugins.getESModuleResourceMap(),
348
354
  update: update,
@@ -434,8 +440,11 @@ export function setup(app, io) {
434
440
  zoom: req.query.zoom || 1.0,
435
441
  clientResGroups: plugins.getClientResourceGroupMap(),
436
442
  modules: plugins.getESModuleResourceMap(),
437
- tools: parseBoolean(req.query.tools, true),
443
+ forceMargin: enforceBoolean(req.query.margin),
438
444
  toolbar: parseBoolean(req.query.toolbar, true),
445
+ tools: parseBoolean(req.query.tools, true),
446
+ border: parseBoolean(req.query.border, true),
447
+ showSlotId: parseBoolean(req.query['slot-id'], true),
439
448
  offline: parseBoolean(req.query.offline),
440
449
  update: update,
441
450
  auth: req.auth,
@@ -46,8 +46,8 @@ export function enforceString(value, defaultValue) {
46
46
  }
47
47
  /**
48
48
  * Makes sure the return value is a boolean or null.
49
- * The following values are treated truthy: true, 1, case insensitive strings "true", "yes", "on".
50
- * The following values are treated falsy: false, 0, case insensitive strings "false", "no", "off".
49
+ * The following values are treated truthy: true, 1, "1", case insensitive strings "true", "yes", "on".
50
+ * The following values are treated falsy: false, 0, "0", case insensitive strings "false", "no", "off".
51
51
  * Everything else is treated invalid and replaced by defaultValue.
52
52
  *
53
53
  * @param {*} value - A boolean or any other value.
@@ -60,9 +60,9 @@ export function enforceBoolean(value, defaultValue) {
60
60
  if (defaultValue !== null && !_.isBoolean(defaultValue)) {
61
61
  throw new Error("Invalid argument for defaultValue. Must be boolean or null.");
62
62
  }
63
- if (value === true || value === 1)
63
+ if (value === true || value === 1 || value === '1')
64
64
  return true;
65
- if (value === false || value === 0)
65
+ if (value === false || value === 0 || value === '0')
66
66
  return false;
67
67
  if (_.isString(value)) {
68
68
  value = value.toLowerCase();