boomack 0.13.0 → 0.13.2

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.
@@ -199,11 +199,13 @@ header.home-header {
199
199
  .slot, .slot.ui.segment {
200
200
  margin: 0;
201
201
  padding: 0;
202
- display: flex;
203
- flex-direction: column;
204
202
  overflow: hidden;
205
203
  position: relative;
206
204
  }
205
+ .layout-grid .slot {
206
+ display: flex;
207
+ flex-direction: column;
208
+ }
207
209
  .slot.ui.segment.without-border {
208
210
  border: none;
209
211
  background: transparent;
@@ -49,11 +49,11 @@ function replaceThemePropsInStr(s) {
49
49
  %><%= slot.zoom !== 1.0 && !contentScale ? ' zoom' : '' %><%
50
50
  %>"
51
51
  style="<%
52
- if (!singled && panel.layout.grid) {
52
+ if (!singled && panel.layout.type === 'grid') {
53
53
  %>grid-column: <%= slot.column + 1 %> / span <%= slot.columnSpan %>;<%
54
54
  %>grid-row: <%= slot.row + 1 %> / span <%= slot.rowSpan %><%
55
55
  }
56
- if (panel.layout.document && commandSrc) {
56
+ if (panel.layout.type === 'document' && commandSrc) {
57
57
  %>height: calc(100vh - 2em);<%
58
58
  }
59
59
  %>"
@@ -185,6 +185,9 @@ function replaceThemePropsInStr(s) {
185
185
  if (slot.minHeight) {
186
186
  %>min-height: <%= slot.minHeight %>;<%
187
187
  }
188
+ if (slot.height) {
189
+ %>height: <%= slot.height %>;<%
190
+ }
188
191
  %>">
189
192
  <% if (slot.showId) { %><div class="slot-id"><%= slot.id %></div><% } %>
190
193
  </div>
@@ -192,6 +195,9 @@ function replaceThemePropsInStr(s) {
192
195
  if (slot.minHeight) {
193
196
  %>min-height: <%= slot.minHeight %>;<%
194
197
  }
198
+ if (slot.height) {
199
+ %>height: <%= slot.height %>;<%
200
+ }
195
201
  if (commandBackground) {
196
202
  %>background: <%= replaceThemePropsInStr(commandBackground) %>;<%
197
203
  }
@@ -200,6 +206,12 @@ function replaceThemePropsInStr(s) {
200
206
  if (!commandContent) {
201
207
  %>display:none;<%
202
208
  }
209
+ if (slot.height) {
210
+ %>height: <%= slot.height %>;<%
211
+ }
212
+ if (slot.maxHeight) {
213
+ %>max-height:<%= slot.maxHeight %>;overflow-y:scroll;<%
214
+ }
203
215
  if (slot.colorFilter) {
204
216
  if (_.isString(slot.colorFilter) && slot.colorFilter !== 'theme') {
205
217
  %>filter: <%= slot.colorFilter %>;<%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boomack",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
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",
@@ -39,6 +39,7 @@ function sanitizeOptions(options) {
39
39
  options.debug = utils.enforceBoolean(options.debug, false);
40
40
  options.transformation = utils.enforceString(options.transformation);
41
41
  options.syntax = utils.enforceString(options.syntax);
42
+ options.renderer = utils.enforceString(options.renderer);
42
43
  options.cache = utils.enforceEnum(optionsCacheEnum, options.cache, 'auto');
43
44
  options.iframe = utils.enforceBoolean(options.iframe, null);
44
45
  if (options.extend === 'beginning' ||
@@ -43,6 +43,7 @@ describe('model/display-request', function () {
43
43
  debug: false,
44
44
  transformation: null,
45
45
  syntax: null,
46
+ renderer: null,
46
47
  iframe: null,
47
48
  cache: 'auto',
48
49
  extend: 'no',
@@ -54,6 +55,7 @@ describe('model/display-request', function () {
54
55
  'debug',
55
56
  'transformation',
56
57
  'syntax',
58
+ 'renderer',
57
59
  'iframe',
58
60
  'cache',
59
61
  'extend',
@@ -82,6 +84,7 @@ describe('model/display-request', function () {
82
84
  debug: false,
83
85
  transformation: null,
84
86
  syntax: null,
87
+ renderer: null,
85
88
  iframe: null,
86
89
  cache: 'auto',
87
90
  extend: 'no',
@@ -104,6 +107,7 @@ describe('model/display-request', function () {
104
107
  options: {
105
108
  transformation: 'highlight',
106
109
  syntax: 'xml',
110
+ renderer: 'custom',
107
111
  iframe: 'off',
108
112
  cache: 'memory',
109
113
  scale: 'invalid',
@@ -126,6 +130,7 @@ describe('model/display-request', function () {
126
130
  debug: false,
127
131
  transformation: 'highlight',
128
132
  syntax: 'xml',
133
+ renderer: 'custom',
129
134
  iframe: false,
130
135
  cache: 'memory',
131
136
  extend: 'end',
@@ -29,6 +29,8 @@ const gridSlotDefaults = _.defaults({
29
29
  }, slotDefaults);
30
30
  const documentSlotDefaults = _.defaults({
31
31
  minHeight: '0',
32
+ height: null,
33
+ maxHeight: null,
32
34
  }, slotDefaults);
33
35
  const slotTemplateDefaults = {
34
36
  history: 0,
@@ -43,6 +45,8 @@ const slotTemplateDefaults = {
43
45
  border: true,
44
46
  zoom: 1.0,
45
47
  minHeight: '0',
48
+ height: null,
49
+ maxHeight: null,
46
50
  };
47
51
  const gridLayoutDefaults = {
48
52
  columns: 1,
@@ -105,6 +105,8 @@ describe('model/layout', function () {
105
105
  border: true,
106
106
  zoom: 1.0,
107
107
  minHeight: '0',
108
+ height: null,
109
+ maxHeight: null,
108
110
  },
109
111
  autoSlots: 0,
110
112
  nextIndex: 1,
@@ -228,6 +230,8 @@ describe('model/layout', function () {
228
230
  noMaximize: true,
229
231
  zoom: 1.25,
230
232
  minHeight: '20px',
233
+ height: '200px',
234
+ maxHeight: '50vh',
231
235
  },
232
236
  autoSlots: 0,
233
237
  nextIndex: 1,
@@ -250,6 +254,8 @@ describe('model/layout', function () {
250
254
  zoom: 1.5,
251
255
  colorFilter: 'saturate(130%)',
252
256
  minHeight: '25vh',
257
+ height: '20rem',
258
+ maxHeight: '100vh',
253
259
  },
254
260
  stash: {
255
261
  id: 'stash',
@@ -270,7 +276,9 @@ describe('model/layout', function () {
270
276
  0.0, -1.0, 0.0, 1.0,
271
277
  0.0, 0.0, 1.0, 0.0,
272
278
  ],
273
- minHeight: '10em',
279
+ minHeight: '2rem',
280
+ height: '5em',
281
+ maxHeight: '100px',
274
282
  },
275
283
  },
276
284
  title: 'Panel Title',
@@ -66,7 +66,7 @@ function applyDisplayRequestDefaults(displayRequest, cb) {
66
66
  if (!r.slot) {
67
67
  r.slot = defaultSlotForPanel(r.panel);
68
68
  }
69
- if (!r.slot) {
69
+ if (panel.layout.type !== 'document' && !r.slot) {
70
70
  cb(error("Slot not found"));
71
71
  return;
72
72
  }
@@ -98,6 +98,9 @@ function applyDisplayRequestDefaults(displayRequest, cb) {
98
98
  o.transformation = null;
99
99
  }
100
100
  }
101
+ if (o.transformation === 'none') {
102
+ o.transformation = null;
103
+ }
101
104
  if (o.transformation !== 'highlight') {
102
105
  o.syntax = null;
103
106
  }
@@ -120,6 +123,9 @@ function applyDisplayRequestDefaults(displayRequest, cb) {
120
123
  o.renderer = null;
121
124
  }
122
125
  }
126
+ if (o.renderer === 'none') {
127
+ o.renderer = null;
128
+ }
123
129
  const fixedRenderer = o.renderer;
124
130
  // read configuration values
125
131
  const autoMemoryCacheThreshold = parseDataAmount(cfg.get('cache.memory.autoThreshold.global', 1 * 1024 * 1024)); // 1MB
@@ -170,19 +170,17 @@ exports.setup = function (app, io) {
170
170
  return null;
171
171
  }
172
172
  }
173
- let data;
174
173
  try {
175
174
  if (cfg.getBoolean('api.request.yaml')) {
176
- data = YAML.parse(s, { schema: 'yaml-1.1' });
175
+ return YAML.parse(s, { schema: 'yaml-1.1' });
177
176
  }
178
177
  else {
179
- data = JSON.parse(s);
178
+ return JSON.parse(s);
180
179
  }
181
180
  }
182
181
  catch (e) {
183
182
  return null;
184
183
  }
185
- return _.isArray(data) ? data : [data];
186
184
  }
187
185
  function titleFromHttpHeader(req) {
188
186
  const titleHeader = req.get('X-Boomack-Title');
@@ -191,16 +189,12 @@ exports.setup = function (app, io) {
191
189
  null;
192
190
  }
193
191
  function optionsFromHttpHeader(req) {
194
- let result = [];
195
- const presetHeader = req.get('X-Boomack-Presets');
196
- const presets = decodePresets(presetHeader);
197
- if (presets)
198
- result = presets;
199
192
  const optionsHeader = req.get('X-Boomack-Options');
200
- const options = decodeOptions(optionsHeader);
201
- if (options)
202
- result = result.concat(options);
203
- return result;
193
+ return decodeOptions(optionsHeader);
194
+ }
195
+ function presetsFromHttpHeader(req) {
196
+ const presetHeader = req.get('X-Boomack-Presets');
197
+ return decodePresets(presetHeader);
204
198
  }
205
199
  function handleStreamingDisplayRequest(req, res, panelId, slotId) {
206
200
  const type = req.get('Content-Type');
@@ -213,6 +207,7 @@ exports.setup = function (app, io) {
213
207
  return;
214
208
  }
215
209
  const title = titleFromHttpHeader(req);
210
+ const presets = presetsFromHttpHeader(req);
216
211
  const options = optionsFromHttpHeader(req);
217
212
  const displayRequest = {
218
213
  panel: panelId,
@@ -222,6 +217,8 @@ exports.setup = function (app, io) {
222
217
  };
223
218
  if (title)
224
219
  displayRequest.title = title;
220
+ if (presets)
221
+ displayRequest.presets = presets;
225
222
  if (options)
226
223
  displayRequest.options = options;
227
224
  handleDisplayRequest([displayRequest], req.authorization, res);
@@ -236,8 +233,7 @@ exports.setup = function (app, io) {
236
233
  message: `The target panel "${panelId}" does not exist.`,
237
234
  });
238
235
  }
239
- const slotId = panel.layout.defaultSlot;
240
- handleStreamingDisplayRequest(req, res, panelId, slotId);
236
+ handleStreamingDisplayRequest(req, res, panelId, null);
241
237
  });
242
238
  app.post('/v1/panels/:panelId/slots/:slotId/display', apiAuth('content.display'), (req, res) => {
243
239
  const panelId = req.params.panelId;
@@ -252,7 +248,7 @@ exports.setup = function (app, io) {
252
248
  }
253
249
  const slotId = req.params.slotId;
254
250
  const slot = panel.layout.slots[slotId];
255
- if (!slot) {
251
+ if (panel.layout.type != 'document' && !slot) {
256
252
  error(res, {
257
253
  status: 404,
258
254
  title: 'Target Not Found',
@@ -203,7 +203,7 @@ exports.pushDisplayCommand = function (displayCommand, cb) {
203
203
  return;
204
204
  }
205
205
  const slotId = displayCommand.slot;
206
- if (!panel.content.has(slotId)) {
206
+ if (panel.layout.type !== 'document' && !panel.content.has(slotId)) {
207
207
  cb(new BadRequestError(`Panel '${panelId}' has no slot '${slotId}'`));
208
208
  return;
209
209
  }
@@ -98,6 +98,8 @@
98
98
  *
99
99
  * @typedef {Slot} DocumentSlot
100
100
  * @property {string} minHeight - The CSS length for the minimal height of the slot.
101
+ * @property {string} height - The CSS length for the height of the slot.
102
+ * @property {string} maxHeight - The CSS length for the maximal height of the slot.
101
103
  */
102
104
  /**
103
105
  * The structure to describe a general panel layout.