@potch/html-bin 2.1.2 → 2.2.0

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": "@potch/html-bin",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -164,6 +164,8 @@ export const createBin = ({
164
164
  }
165
165
  });
166
166
 
167
+ const isFullScreen = signal(false);
168
+
167
169
  const isMiniMode = computed(() => {
168
170
  const w = actualWidth.value;
169
171
  return !splitMode || w <= 700;
@@ -337,7 +339,8 @@ export const createBin = ({
337
339
  () =>
338
340
  "bin" +
339
341
  maybe(isMiniMode.value, " bin--mini-mode") +
340
- maybe(resizing.value, " bin--resizing")
342
+ maybe(resizing.value, " bin--resizing") +
343
+ maybe(isFullScreen.value, " bin--fullscreen")
341
344
  ),
342
345
  },
343
346
  _(
@@ -360,6 +363,21 @@ export const createBin = ({
360
363
  _(
361
364
  "div",
362
365
  { className: "bin__menu" },
366
+ _(
367
+ "button",
368
+ {
369
+ className: "bin__preview__expand bin__iconbutton",
370
+ title: "show the code tabs",
371
+ "aria-label": "show the code tabs",
372
+ style: computed(() => ({
373
+ display: splitOverride.value === 0 ? "block" : "none",
374
+ })),
375
+ onclick: () => {
376
+ splitOverride.value = null;
377
+ },
378
+ },
379
+ "⏭️"
380
+ ),
363
381
  _(
364
382
  "div",
365
383
  { className: "bin__tab bin__preview_tab bin__tab--active" },
@@ -375,26 +393,21 @@ export const createBin = ({
375
393
  "🔁"
376
394
  )
377
395
  ),
378
- _("button", {
379
- className: "bin__preview__expand bin__iconbutton",
380
- title: computed(() =>
381
- splitOverride.value === 0
382
- ? "show the code tabs"
383
- : "show only the preview"
384
- ),
385
- "aria-label": computed(() =>
386
- splitOverride.value === 0
387
- ? "show the code tabs"
388
- : "show only the preview"
389
- ),
390
- innerText: computed(() => (splitOverride.value === 0 ? "⏭️" : "↔️")),
391
- style: computed(() => ({
392
- order: splitOverride.value === 0 ? -1 : "unset",
393
- })),
394
- onclick: () => {
395
- splitOverride.value = splitOverride.value === 0 ? null : 0;
396
+ _(
397
+ "button",
398
+ {
399
+ className: "bin__preview__expand bin__iconbutton",
400
+ title: "show only the preview",
401
+ "aria-label": "show only the preview",
402
+ style: computed(() => ({
403
+ display: splitOverride.value === 0 ? "none" : "block",
404
+ })),
405
+ onclick: () => {
406
+ splitOverride.value = 0;
407
+ },
396
408
  },
397
- })
409
+ "↔️"
410
+ )
398
411
  ),
399
412
  editorPanes.js,
400
413
  editorPanes.css,
@@ -410,7 +423,14 @@ export const createBin = ({
410
423
  src: previewURL,
411
424
  }),
412
425
  _("div", { className: "bin__controls" })
413
- )
426
+ ),
427
+ _("button", {
428
+ className: "bin__fullscreen bin__iconbutton",
429
+ title: "toggle fullscreen mode",
430
+ "aria-label": "toggle fullscreen mode",
431
+ innerText: computed(() => (isFullScreen.value ? "↖️" : "↘️")),
432
+ onclick: () => (isFullScreen.value = !isFullScreen.value),
433
+ })
414
434
  );
415
435
 
416
436
  if (width) binEl.style.setProperty("--bin-width", width);
package/src/style.css CHANGED
@@ -33,6 +33,15 @@
33
33
  --code-comment: #a3b0d9;
34
34
  }
35
35
 
36
+ .bin--fullscreen {
37
+ --bin-width: 100svw !important;
38
+ --bin-height: 100svh !important;
39
+ position: fixed;
40
+ inset: 0;
41
+ height: 100svh;
42
+ max-height: 100svh;
43
+ }
44
+
36
45
  .bin__widget {
37
46
  position: absolute;
38
47
  width: 100%;
@@ -102,6 +111,13 @@
102
111
  margin-inline: 0.5rem;
103
112
  }
104
113
 
114
+ .bin__fullscreen {
115
+ position: absolute;
116
+ bottom: 0.5rem;
117
+ right: 0.5rem;
118
+ padding: 0.25rem;
119
+ }
120
+
105
121
  .bin__resizer {
106
122
  user-select: none;
107
123
  grid-area: resizer;