@total_onion/onion-library 2.0.201 → 2.0.203
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/assembleAssetList.js +21 -2
- package/components/fields-core-css-sizing-vars-v3/core-css-sizing-vars-v3.scss +102 -74
- package/components/fields-core-root-variables-v3/core-root-variables-v3.scss +39 -37
- package/components/webc-loadmore-trigger/index.html +30 -0
- package/components/webc-loadmore-trigger/loadmore-trigger.css +20 -0
- package/components/webc-loadmore-trigger/loadmore-trigger.html +3 -0
- package/components/webc-loadmore-trigger/loadmore-trigger.js +23 -0
- package/components/webc-post-filter-module/dev-content/dev-content.js +68 -0
- package/components/webc-post-filter-module/index.html +30 -0
- package/components/webc-post-filter-module/post-filter-module.css +10 -0
- package/components/webc-post-filter-module/post-filter-module.html +14 -0
- package/components/webc-post-filter-module/post-filter-module.js +197 -0
- package/components/webc-post-grid-display-module/index.html +30 -0
- package/components/webc-post-grid-display-module/post-grid-display-module.css +20 -0
- package/components/webc-post-grid-display-module/post-grid-display-module.html +7 -0
- package/components/webc-post-grid-display-module/post-grid-display-module.js +37 -0
- package/components/webc-ptfg-9000/index.html +50 -0
- package/components/webc-ptfg-9000/ptfg-9000.css +8 -0
- package/components/webc-ptfg-9000/ptfg-9000.html +5 -0
- package/components/webc-ptfg-9000/ptfg-9000.js +39 -0
- package/createJsAssets-v3.js +1 -1
- package/esbuild.mjs +39 -6
- package/onion-loader-local.js +1 -1
- package/package.json +1 -1
- package/public/assetList.mjs +78 -2
- package/public/block-group-container-v3/group-container-v3.css +26 -26
- package/public/block-post-info-v3/post-info-v3.css +429 -429
- package/public/block-post-type-filter-grid-v4/dev-content/dev-content.js +38 -0
- package/public/block-post-type-filter-grid-v4/post-type-filter-grid-v4.css +42 -0
- package/public/block-post-type-filter-grid-v4/post-type-filter-grid-v4.js +181 -0
- package/public/block-product-info-v3/product-info-v3.css +257 -257
- package/public/block-sub-group-container-v3/sub-group-container-v3.css +23 -23
- package/public/jsAssets.mjs +41 -3
- package/public/publicBundleBase.css +4800 -0
- package/public/{publicBundle.scss → publicBundleBase.scss} +6 -2
- package/public/publicBundle.css +0 -6392
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const devContentDogz = [
|
|
2
|
+
{
|
|
3
|
+
postname: 'Dogz-1',
|
|
4
|
+
'post-link': '#',
|
|
5
|
+
'image-src': 'https://place-puppy.com/puppy/y:100/x:100',
|
|
6
|
+
categories: new Set([1, 5])
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
postname: 'Dogz-2',
|
|
10
|
+
'post-link': '#',
|
|
11
|
+
'image-src': 'https://place-puppy.com/puppy/y:100/x:100',
|
|
12
|
+
|
|
13
|
+
categories: new Set([2])
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
postname: 'Dogz-3',
|
|
17
|
+
'post-link': '#',
|
|
18
|
+
'image-src': 'https://place-puppy.com/puppy/y:100/x:100',
|
|
19
|
+
|
|
20
|
+
categories: new Set([1, 3])
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
postname: 'Dogz-4',
|
|
24
|
+
'post-link': '#',
|
|
25
|
+
'image-src': 'https://place-puppy.com/puppy/y:100/x:100',
|
|
26
|
+
|
|
27
|
+
categories: new Set([4])
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const devContentCategories = [
|
|
32
|
+
{name: 'grumpy', id: '1', parentid: '6'},
|
|
33
|
+
{name: 'fluffy', id: '2', parentid: '6'},
|
|
34
|
+
{name: 'happy', id: '3', parentid: '6'},
|
|
35
|
+
{name: 'sleepy', id: '4', parentid: '6'},
|
|
36
|
+
{name: 'sweet', id: '5', parentid: '6'},
|
|
37
|
+
{name: 'hounds', id: '6', parentid: null}
|
|
38
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
post-type-filter-grid-v4 {
|
|
2
|
+
display: block;
|
|
3
|
+
background-color: hotpink;
|
|
4
|
+
--padding-block-multiplier-mobile-top: 1;
|
|
5
|
+
--padding-inline-multiplier-mobile-right: 1;
|
|
6
|
+
--padding-block-multiplier-mobile-bottom: 1;
|
|
7
|
+
--padding-inline-multiplier-mobile-left: 1;
|
|
8
|
+
}
|
|
9
|
+
post-filter-module-v4 {
|
|
10
|
+
display: block;
|
|
11
|
+
background-color: aquamarine;
|
|
12
|
+
}
|
|
13
|
+
post-grid-display-module-v4 {
|
|
14
|
+
--padding-block-multiplier-mobile-top: 1;
|
|
15
|
+
--padding-inline-multiplier-mobile-right: 1;
|
|
16
|
+
--padding-block-multiplier-mobile-bottom: 1;
|
|
17
|
+
--padding-inline-multiplier-mobile-left: 1;
|
|
18
|
+
display: grid;
|
|
19
|
+
background-color: hotpink;
|
|
20
|
+
}
|
|
21
|
+
post-grid-display-module-v4 .post-grid-display-module-v4__grid-container {
|
|
22
|
+
align-self: stretch;
|
|
23
|
+
justify-self: stretch;
|
|
24
|
+
place-self: stretch;
|
|
25
|
+
display: grid;
|
|
26
|
+
padding: 10px;
|
|
27
|
+
grid-gap: 10px;
|
|
28
|
+
gap: 10px;
|
|
29
|
+
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
30
|
+
}
|
|
31
|
+
post-grid-display-module-v4 .post-grid-display-module-v4__post-image {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: auto;
|
|
34
|
+
}
|
|
35
|
+
load-more-posts-trigger-v4 {
|
|
36
|
+
display: block;
|
|
37
|
+
padding: 10px;
|
|
38
|
+
background-color: #639;
|
|
39
|
+
}
|
|
40
|
+
load-more-posts-trigger-v4 .load-more-posts-trigger-v4__button-trigger {
|
|
41
|
+
color: antiquewhite;
|
|
42
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export default function posttypefiltergridv4Js(options = {}) {
|
|
2
|
+
try {
|
|
3
|
+
const { block } = options;
|
|
4
|
+
customElements.define(
|
|
5
|
+
"post-filter-module-v4",
|
|
6
|
+
class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.filterState = {
|
|
10
|
+
allposts: /* @__PURE__ */ new Set(),
|
|
11
|
+
filteredposts: /* @__PURE__ */ new Set(),
|
|
12
|
+
activefilters: /* @__PURE__ */ new Set(),
|
|
13
|
+
setActiveFilters: function(newState) {
|
|
14
|
+
Object.assign(this.filterState, newState);
|
|
15
|
+
this.dispatchEvent(
|
|
16
|
+
new CustomEvent("activefilters-updated")
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
setFilteredPosts: function(newState) {
|
|
20
|
+
Object.assign(this.filterState, newState);
|
|
21
|
+
this.dispatchEvent(
|
|
22
|
+
new CustomEvent("filteredposts-updated")
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.filterCategoriesDisplay = this.querySelector(
|
|
27
|
+
".post-filter-module-v4__filter-categories-display"
|
|
28
|
+
);
|
|
29
|
+
this.clearFiltersButton = this.querySelector(
|
|
30
|
+
".post-filter-module-v4__clear-filters-button"
|
|
31
|
+
);
|
|
32
|
+
this.setStateButton = this.querySelector(
|
|
33
|
+
".post-filter-module-v4__set-state-button"
|
|
34
|
+
);
|
|
35
|
+
this.clearFiltersButton.addEventListener(
|
|
36
|
+
"click",
|
|
37
|
+
this.clearFilters.bind(this)
|
|
38
|
+
);
|
|
39
|
+
this.addEventListener(
|
|
40
|
+
"activefilters-updated",
|
|
41
|
+
this.filterPosts.bind(this)
|
|
42
|
+
);
|
|
43
|
+
this.devMode = this.dataset.dev;
|
|
44
|
+
this.devModeContent = this.dataset.devcontent;
|
|
45
|
+
}
|
|
46
|
+
async connectedCallback() {
|
|
47
|
+
console.log("Filter Module element added to page.");
|
|
48
|
+
let data;
|
|
49
|
+
if (this.devMode) {
|
|
50
|
+
data = await import("./dev-content/dev-content.js");
|
|
51
|
+
}
|
|
52
|
+
this.filterState.allposts = data[`devContent${this.devModeContent}`];
|
|
53
|
+
this.filterState.categories = data[`devContentCategories`];
|
|
54
|
+
this.filterState.categories.forEach((category) => {
|
|
55
|
+
if (category.parentid) {
|
|
56
|
+
this.filterCategoriesDisplay.insertAdjacentHTML(
|
|
57
|
+
"beforeend",
|
|
58
|
+
`<button class="post-filter-module-v4__category-button" data-categoryid="${category.id}">${category.name}</button>`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
this.categorybuttons = this.querySelectorAll(
|
|
63
|
+
".post-filter-module-v4__category-button"
|
|
64
|
+
);
|
|
65
|
+
this.categorybuttons.forEach((button) => {
|
|
66
|
+
button.addEventListener("click", () => {
|
|
67
|
+
if (this.filterState.activefilters.has(
|
|
68
|
+
Number(button.dataset.categoryid)
|
|
69
|
+
)) {
|
|
70
|
+
const newActiveFilters = new Set(
|
|
71
|
+
this.filterState.activefilters
|
|
72
|
+
);
|
|
73
|
+
newActiveFilters.delete(
|
|
74
|
+
Number(button.dataset.categoryid)
|
|
75
|
+
);
|
|
76
|
+
this.filterState.setActiveFilters.bind(this)({
|
|
77
|
+
activefilters: newActiveFilters
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
const newActiveFilters = new Set(
|
|
81
|
+
this.filterState.activefilters
|
|
82
|
+
);
|
|
83
|
+
newActiveFilters.add(
|
|
84
|
+
Number(button.dataset.categoryid)
|
|
85
|
+
);
|
|
86
|
+
this.filterState.setActiveFilters.bind(this)({
|
|
87
|
+
activefilters: newActiveFilters
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
93
|
+
filteredposts: this.filterState.allposts
|
|
94
|
+
});
|
|
95
|
+
this.classList.add("loaded");
|
|
96
|
+
}
|
|
97
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
98
|
+
}
|
|
99
|
+
filterPosts(event) {
|
|
100
|
+
if (this.filterState.activefilters.size === 0) {
|
|
101
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
102
|
+
filteredposts: this.filterState.allposts
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const newFilteredPosts = this.filterState.allposts.filter(
|
|
107
|
+
(post) => {
|
|
108
|
+
return this.filterState.activefilters.intersection(
|
|
109
|
+
post.categories
|
|
110
|
+
).size > 0;
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
this.filterState.setFilteredPosts.bind(this)({
|
|
114
|
+
filteredposts: newFilteredPosts
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
clearFilters(event) {
|
|
118
|
+
this.filterState.setActiveFilters.bind(this)({
|
|
119
|
+
activefilters: /* @__PURE__ */ new Set()
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
customElements.define(
|
|
125
|
+
"post-type-filter-grid-v4",
|
|
126
|
+
class extends HTMLElement {
|
|
127
|
+
constructor() {
|
|
128
|
+
super();
|
|
129
|
+
this.data = this.dataset;
|
|
130
|
+
this.filterModule = this.querySelector("#filter-module");
|
|
131
|
+
this.displayModule = this.querySelector("#display-module");
|
|
132
|
+
}
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
console.log("PTFG v4 element added to page.");
|
|
135
|
+
this.filterModule.addEventListener(
|
|
136
|
+
"filteredposts-updated",
|
|
137
|
+
() => {
|
|
138
|
+
this.displayModule.dataset.posts = JSON.stringify(
|
|
139
|
+
this.filterModule.filterState.filteredposts
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
this.classList.add("loaded");
|
|
144
|
+
}
|
|
145
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
customElements.define(
|
|
150
|
+
"post-grid-display-module-v4",
|
|
151
|
+
class extends HTMLElement {
|
|
152
|
+
static observedAttributes = ["data-posts"];
|
|
153
|
+
constructor() {
|
|
154
|
+
super();
|
|
155
|
+
this.gridContainer = this.querySelector(
|
|
156
|
+
".post-grid-display-module-v4__grid-container"
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
connectedCallback() {
|
|
160
|
+
console.log("Display module added to page.");
|
|
161
|
+
this.classList.add("loaded");
|
|
162
|
+
}
|
|
163
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
164
|
+
this.gridContainer.innerHTML = "";
|
|
165
|
+
if (newValue) {
|
|
166
|
+
const posts = JSON.parse(newValue);
|
|
167
|
+
posts.forEach((post) => {
|
|
168
|
+
const postContent = `<div class="post-grid-display-module-v4__post-container"><h2>${post.postname}</h2><img class="post-grid-display-module-v4__post-image" src="${post["image-src"]}" alt="${post.postname}"></div>`;
|
|
169
|
+
this.gridContainer.insertAdjacentHTML(
|
|
170
|
+
"beforeend",
|
|
171
|
+
postContent
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.error(error);
|
|
180
|
+
}
|
|
181
|
+
}
|