@potch/html-bin 2.0.1 → 2.1.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/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 +18 -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,13 @@ export const createBin = ({
|
|
|
162
164
|
}
|
|
163
165
|
});
|
|
164
166
|
|
|
165
|
-
const isMiniMode = computed(() => actualWidth.value <= 700);
|
|
167
|
+
const isMiniMode = computed(() => !splitMode || actualWidth.value <= 700);
|
|
166
168
|
const resizing = signal(false);
|
|
167
|
-
const splitOverride = signal(
|
|
169
|
+
const splitOverride = signal(
|
|
170
|
+
splitMode && initialTab === "preview" ? 0 : null
|
|
171
|
+
);
|
|
168
172
|
|
|
169
|
-
const activeTab = signal(
|
|
173
|
+
const activeTab = signal(initialTab);
|
|
170
174
|
|
|
171
175
|
const sources = {
|
|
172
176
|
js: signal(rawSources.js ?? "// js goes here"),
|
|
@@ -370,8 +374,16 @@ export const createBin = ({
|
|
|
370
374
|
),
|
|
371
375
|
_("button", {
|
|
372
376
|
className: "bin__preview__expand bin__iconbutton",
|
|
373
|
-
title:
|
|
374
|
-
|
|
377
|
+
title: computed(() =>
|
|
378
|
+
splitOverride.value === 0
|
|
379
|
+
? "show the code tabs"
|
|
380
|
+
: "show only the preview"
|
|
381
|
+
),
|
|
382
|
+
"aria-label": computed(() =>
|
|
383
|
+
splitOverride.value === 0
|
|
384
|
+
? "show the code tabs"
|
|
385
|
+
: "show only the preview"
|
|
386
|
+
),
|
|
375
387
|
innerText: computed(() => (splitOverride.value === 0 ? "⏭️" : "↔️")),
|
|
376
388
|
style: computed(() => ({
|
|
377
389
|
order: splitOverride.value === 0 ? -1 : "unset",
|
|
@@ -488,6 +500,7 @@ export const createBin = ({
|
|
|
488
500
|
el: binEl,
|
|
489
501
|
editors,
|
|
490
502
|
activeTab,
|
|
503
|
+
splitMode,
|
|
491
504
|
start,
|
|
492
505
|
teardown,
|
|
493
506
|
};
|