pict-docuserve 1.4.0 → 1.4.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.
@@ -227,6 +227,11 @@ class DocusserveSplashView extends libPictView
227
227
  this.renderFromCatalog(tmpDocuserve);
228
228
  }
229
229
 
230
+ // Conditionally append a "Playground" button to the action row when
231
+ // the current module ships a _playground.json. Async — the button
232
+ // pops in once the config resolves.
233
+ this.renderPlaygroundButton();
234
+
230
235
  // Render docs/README.md beneath the hero — the splash fills the
231
236
  // viewport above the fold, the README content follows on scroll.
232
237
  this.renderReadme();
@@ -234,6 +239,55 @@ class DocusserveSplashView extends libPictView
234
239
  return super.onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent);
235
240
  }
236
241
 
242
+ /**
243
+ * Append a "Playground" button to the splash action row when the
244
+ * current module declares a playground in `_playground.json`. The
245
+ * route depends on `Kind`:
246
+ * - Kind: "section" → full-page section playground
247
+ * - anything else → Fable JS REPL drawer
248
+ *
249
+ * When no `_playground.json` exists (loadPlaygroundConfig resolves
250
+ * to null), no button is added — the existing GitHub / Get Started
251
+ * buttons stand on their own.
252
+ */
253
+ renderPlaygroundButton()
254
+ {
255
+ let tmpDocProvider = this.pict.providers['Docuserve-Documentation'];
256
+ if (!tmpDocProvider || typeof tmpDocProvider.loadPlaygroundConfig !== 'function')
257
+ {
258
+ return;
259
+ }
260
+
261
+ let tmpAppData = this.pict.AppData.Docuserve || {};
262
+ let tmpGroup = tmpAppData.CurrentGroup || '';
263
+ let tmpModule = tmpAppData.CurrentModule || '';
264
+
265
+ tmpDocProvider.loadPlaygroundConfig(tmpGroup, tmpModule).then((pConfig) =>
266
+ {
267
+ if (!pConfig)
268
+ {
269
+ return;
270
+ }
271
+ let tmpRoute;
272
+ if (pConfig.Kind === 'section')
273
+ {
274
+ tmpRoute = (tmpGroup && tmpModule)
275
+ ? '#/playground/section/' + tmpGroup + '/' + tmpModule
276
+ : '#/playground/section';
277
+ }
278
+ else
279
+ {
280
+ tmpRoute = '#/playground/fable';
281
+ }
282
+ let tmpButtonHTML = '<a class="secondary" href="' + this.escapeHTML(tmpRoute) + '">Playground</a>';
283
+ this.pict.ContentAssignment.projectContent('append', '#Docuserve-Splash-Actions', tmpButtonHTML);
284
+ })
285
+ .catch(() =>
286
+ {
287
+ // Soft failure — no button is added when the config can't load.
288
+ });
289
+ }
290
+
237
291
  /**
238
292
  * Render the splash screen from parsed _cover.md data.
239
293
  *