jedison 1.17.0 → 1.18.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/CHANGELOG.md +5 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +68 -18
- package/dist/esm/jedison.js.map +1 -1
- package/dist/umd/jedison.umd.js +1 -1
- package/dist/umd/jedison.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/jedison.js
CHANGED
|
@@ -4542,7 +4542,7 @@ class EditorObjectGrid extends EditorObject {
|
|
|
4542
4542
|
class EditorObjectCategories extends EditorObject {
|
|
4543
4543
|
static resolves(schema) {
|
|
4544
4544
|
const format2 = getSchemaXOption(schema, "format");
|
|
4545
|
-
const regex = /^categories-(horizontal|vertical
|
|
4545
|
+
const regex = /^categories-(horizontal|vertical)$/;
|
|
4546
4546
|
return getSchemaType(schema) === "object" && regex.test(format2);
|
|
4547
4547
|
}
|
|
4548
4548
|
init() {
|
|
@@ -4581,11 +4581,9 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4581
4581
|
const format2 = getSchemaXOption(this.instance.schema, "format");
|
|
4582
4582
|
const formatParts = format2.split("-");
|
|
4583
4583
|
const variant = formatParts[1];
|
|
4584
|
-
const
|
|
4585
|
-
const
|
|
4586
|
-
const row = this.theme.
|
|
4587
|
-
const tabListCol = this.theme.getCol(12, 12, navColumns, navColumns);
|
|
4588
|
-
const tabContentCol = this.theme.getCol(12, 12, 12 - navColumns, 12 - navColumns);
|
|
4584
|
+
const navMinWidth = getSchemaXOption(this.instance.schema, "navMinWidth");
|
|
4585
|
+
const navMaxWidth = getSchemaXOption(this.instance.schema, "navMaxWidth");
|
|
4586
|
+
const { row, tabListCol, tabContentCol } = this.theme.getNavRow(variant, { minWidth: navMinWidth, maxWidth: navMaxWidth });
|
|
4589
4587
|
const tabContent = this.theme.getTabContent();
|
|
4590
4588
|
const tabList = this.theme.getTabList({
|
|
4591
4589
|
variant
|
|
@@ -4664,7 +4662,7 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4664
4662
|
class EditorObjectNav extends EditorObject {
|
|
4665
4663
|
static resolves(schema) {
|
|
4666
4664
|
const format2 = getSchemaXOption(schema, "format");
|
|
4667
|
-
const regex = /^nav-(horizontal|vertical
|
|
4665
|
+
const regex = /^nav-(horizontal|vertical)$/;
|
|
4668
4666
|
const hasNavFormat = regex.test(format2);
|
|
4669
4667
|
return getSchemaType(schema) === "object" && hasNavFormat;
|
|
4670
4668
|
}
|
|
@@ -4712,11 +4710,9 @@ class EditorObjectNav extends EditorObject {
|
|
|
4712
4710
|
const format2 = getSchemaXOption(this.instance.schema, "format");
|
|
4713
4711
|
const formatParts = format2.split("-");
|
|
4714
4712
|
const variant = formatParts[1];
|
|
4715
|
-
const
|
|
4716
|
-
const
|
|
4717
|
-
const row = this.theme.
|
|
4718
|
-
const tabListCol = this.theme.getCol(12, 12, navColumns, navColumns);
|
|
4719
|
-
const tabContentCol = this.theme.getCol(12, 12, 12 - navColumns, 12 - navColumns);
|
|
4713
|
+
const navMinWidth = getSchemaXOption(this.instance.schema, "navMinWidth");
|
|
4714
|
+
const navMaxWidth = getSchemaXOption(this.instance.schema, "navMaxWidth");
|
|
4715
|
+
const { row, tabListCol, tabContentCol } = this.theme.getNavRow(variant, { minWidth: navMinWidth, maxWidth: navMaxWidth });
|
|
4720
4716
|
this.navTabContent = this.theme.getTabContent();
|
|
4721
4717
|
this.navTabList = this.theme.getTabList({ variant });
|
|
4722
4718
|
row.appendChild(tabListCol);
|
|
@@ -5679,7 +5675,7 @@ class EditorArrayChoices extends Editor {
|
|
|
5679
5675
|
class EditorArrayNav extends EditorArray {
|
|
5680
5676
|
static resolves(schema) {
|
|
5681
5677
|
const format2 = getSchemaXOption(schema, "format");
|
|
5682
|
-
const regex = /^nav-(horizontal|vertical
|
|
5678
|
+
const regex = /^nav-(horizontal|vertical)$/;
|
|
5683
5679
|
const hasNavFormat = regex.test(format2);
|
|
5684
5680
|
return getSchemaType(schema) === "array" && hasNavFormat;
|
|
5685
5681
|
}
|
|
@@ -5731,11 +5727,9 @@ class EditorArrayNav extends EditorArray {
|
|
|
5731
5727
|
const format2 = getSchemaXOption(this.instance.schema, "format");
|
|
5732
5728
|
const formatParts = format2.split("-");
|
|
5733
5729
|
const variant = formatParts[1];
|
|
5734
|
-
const
|
|
5735
|
-
const
|
|
5736
|
-
const row = this.theme.
|
|
5737
|
-
const tabListCol = this.theme.getCol(12, 12, navColumns, navColumns);
|
|
5738
|
-
const tabContentCol = this.theme.getCol(12, 12, 12 - navColumns, 12 - navColumns);
|
|
5730
|
+
const navMinWidth = getSchemaXOption(this.instance.schema, "navMinWidth");
|
|
5731
|
+
const navMaxWidth = getSchemaXOption(this.instance.schema, "navMaxWidth");
|
|
5732
|
+
const { row, tabListCol, tabContentCol } = this.theme.getNavRow(variant, { minWidth: navMinWidth, maxWidth: navMaxWidth });
|
|
5739
5733
|
const tabContent = this.theme.getTabContent();
|
|
5740
5734
|
const tabList = this.theme.getTabList({
|
|
5741
5735
|
variant
|
|
@@ -9863,6 +9857,62 @@ class Theme {
|
|
|
9863
9857
|
}
|
|
9864
9858
|
return col;
|
|
9865
9859
|
}
|
|
9860
|
+
/**
|
|
9861
|
+
* Row + two columns for nav-style editors (object-nav, array-nav,
|
|
9862
|
+
* object-categories). Horizontal keeps the fixed full-width split (the
|
|
9863
|
+
* zero-width content col intentionally forces it onto a new flex line
|
|
9864
|
+
* below the full-width tab list) built on the regular getRow()/getCol()
|
|
9865
|
+
* grid. Vertical uses a plain (non-grid) flex row instead: Bootstrap's
|
|
9866
|
+
* `.row > *` rule forces `width: 100%` on grid columns, which would
|
|
9867
|
+
* fight flex-basis:auto's content-based sizing, so the shrink-to-fit nav
|
|
9868
|
+
* column can't share that grid. It hugs its widest pill on wider
|
|
9869
|
+
* containers (constrained by widthOptions.minWidth/maxWidth) and stacks
|
|
9870
|
+
* full-width below the container-query breakpoint in ensureNavStyles().
|
|
9871
|
+
*/
|
|
9872
|
+
getNavRow(variant, widthOptions = {}) {
|
|
9873
|
+
if (variant === "horizontal") {
|
|
9874
|
+
const row2 = this.getRow();
|
|
9875
|
+
const tabListCol2 = this.getCol(12, 12, 12, 12);
|
|
9876
|
+
const tabContentCol2 = this.getCol(12, 12, 0, 0);
|
|
9877
|
+
return { row: row2, tabListCol: tabListCol2, tabContentCol: tabContentCol2 };
|
|
9878
|
+
}
|
|
9879
|
+
this.ensureNavStyles();
|
|
9880
|
+
const row = document.createElement("div");
|
|
9881
|
+
row.classList.add("jedi-nav-row");
|
|
9882
|
+
const tabListCol = document.createElement("div");
|
|
9883
|
+
tabListCol.classList.add("jedi-col");
|
|
9884
|
+
tabListCol.classList.add("jedi-nav-list-col");
|
|
9885
|
+
tabListCol.style.setProperty("--jedi-nav-max-width", widthOptions.maxWidth ?? "40%");
|
|
9886
|
+
if (widthOptions.minWidth) tabListCol.style.setProperty("--jedi-nav-min-width", widthOptions.minWidth);
|
|
9887
|
+
const tabContentCol = document.createElement("div");
|
|
9888
|
+
tabContentCol.classList.add("jedi-col");
|
|
9889
|
+
tabContentCol.classList.add("jedi-nav-content-col");
|
|
9890
|
+
return { row, tabListCol, tabContentCol };
|
|
9891
|
+
}
|
|
9892
|
+
/**
|
|
9893
|
+
* Mobile-first: the nav row stacks at 100% width by default; a container
|
|
9894
|
+
* query (not a viewport media query) switches to shrink-to-fit once the
|
|
9895
|
+
* row itself has >= 576px to work with, so a narrow embed (a modal, a
|
|
9896
|
+
* sidebar) gets the same treatment as a narrow viewport regardless of
|
|
9897
|
+
* how wide the page around it is. Injected once, same pattern as
|
|
9898
|
+
* bootstrap5.js's jedi-accordion-button-style, since inline styles can't
|
|
9899
|
+
* express @container.
|
|
9900
|
+
*/
|
|
9901
|
+
ensureNavStyles() {
|
|
9902
|
+
if (document.getElementById("jedi-nav-styles")) return;
|
|
9903
|
+
const style = document.createElement("style");
|
|
9904
|
+
style.id = "jedi-nav-styles";
|
|
9905
|
+
style.textContent = `
|
|
9906
|
+
.jedi-nav-row { display: flex; flex-wrap: wrap; gap: 1rem; container-type: inline-size; }
|
|
9907
|
+
.jedi-nav-list-col { flex: 1 1 100%; width: 100%; max-width: 100%; }
|
|
9908
|
+
.jedi-nav-content-col { flex: 1 1 100%; width: 100%; min-width: 0; }
|
|
9909
|
+
@container (min-width: 576px) {
|
|
9910
|
+
.jedi-nav-list-col { flex: 0 1 auto; width: auto; max-width: var(--jedi-nav-max-width, 40%); min-width: var(--jedi-nav-min-width, auto); }
|
|
9911
|
+
.jedi-nav-content-col { flex: 1 1 0%; width: auto; }
|
|
9912
|
+
}
|
|
9913
|
+
`;
|
|
9914
|
+
document.head.appendChild(style);
|
|
9915
|
+
}
|
|
9866
9916
|
/**
|
|
9867
9917
|
* Clearfix fixes layout issues in some libraries like bootstrap 3
|
|
9868
9918
|
*/
|