@potch/html-bin 2.0.1 → 2.1.1
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/README.md +9 -1
- package/build/index.js +2 -0
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -0
- package/build/index.min.js +1 -1
- package/build/index.min.js.map +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/src/index.js +21 -5
package/index.html
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -135,6 +135,8 @@ export const createBin = ({
|
|
|
135
135
|
container,
|
|
136
136
|
sources: rawSources,
|
|
137
137
|
split,
|
|
138
|
+
initialTab = "js",
|
|
139
|
+
splitMode = true,
|
|
138
140
|
width,
|
|
139
141
|
height,
|
|
140
142
|
}) => {
|
|
@@ -162,11 +164,16 @@ export const createBin = ({
|
|
|
162
164
|
}
|
|
163
165
|
});
|
|
164
166
|
|
|
165
|
-
const isMiniMode = computed(() =>
|
|
167
|
+
const isMiniMode = computed(() => {
|
|
168
|
+
const w = actualWidth.value;
|
|
169
|
+
return !splitMode || w <= 700;
|
|
170
|
+
});
|
|
166
171
|
const resizing = signal(false);
|
|
167
|
-
const splitOverride = signal(
|
|
172
|
+
const splitOverride = signal(
|
|
173
|
+
splitMode && initialTab === "preview" ? 0 : null
|
|
174
|
+
);
|
|
168
175
|
|
|
169
|
-
const activeTab = signal(
|
|
176
|
+
const activeTab = signal(initialTab);
|
|
170
177
|
|
|
171
178
|
const sources = {
|
|
172
179
|
js: signal(rawSources.js ?? "// js goes here"),
|
|
@@ -370,8 +377,16 @@ export const createBin = ({
|
|
|
370
377
|
),
|
|
371
378
|
_("button", {
|
|
372
379
|
className: "bin__preview__expand bin__iconbutton",
|
|
373
|
-
title:
|
|
374
|
-
|
|
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
|
+
),
|
|
375
390
|
innerText: computed(() => (splitOverride.value === 0 ? "⏭️" : "↔️")),
|
|
376
391
|
style: computed(() => ({
|
|
377
392
|
order: splitOverride.value === 0 ? -1 : "unset",
|
|
@@ -488,6 +503,7 @@ export const createBin = ({
|
|
|
488
503
|
el: binEl,
|
|
489
504
|
editors,
|
|
490
505
|
activeTab,
|
|
506
|
+
splitMode,
|
|
491
507
|
start,
|
|
492
508
|
teardown,
|
|
493
509
|
};
|