@total_onion/onion-library 2.0.232 → 2.0.235

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.
@@ -3,153 +3,154 @@
3
3
  @use '../component-element-positioning-v3/element-positioning-v3';
4
4
  @use '../../breakpoints';
5
5
  // @use 'NodeModules/swiper/swiper-bundle.min.css';
6
-
7
- .carousel-multi-layout-v3 {
8
- display: grid;
9
- grid-template: 'main' / 1fr;
10
- overflow-x: var(--block-overflow, hidden);
11
- width: 100%;
12
- position: relative;
13
- background-color: var(--carousel-bg-colour);
14
-
15
- &__inner-container {
16
- width: 100%;
17
- height: 100%;
18
- position: relative;
6
+ @layer base-styles {
7
+ .carousel-multi-layout-v3 {
19
8
  display: grid;
20
- grid-area: main;
21
- grid-template: 'main'/1fr;
22
- }
23
- &__swiper-carousel-container {
9
+ grid-template: 'main' / 1fr;
10
+ overflow-x: var(--block-overflow, hidden);
24
11
  width: 100%;
25
- height: 100%;
26
- grid-area: main;
27
- inset: 0;
28
- .swiper-wrapper {
29
- height: 100%;
30
- }
31
- }
32
-
33
- .swiper-button-disabled {
34
- pointer-events: none;
35
- opacity: 0;
36
- }
12
+ position: relative;
13
+ background-color: var(--carousel-bg-colour);
37
14
 
38
- .swiper-button-prev {
39
- left: var(--left-arrow-horizontally-mobile);
40
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
41
- left: var(--left-arrow-horizontally-portrait);
42
- }
43
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
44
- left: var(--left-arrow-horizontally-desktop);
15
+ &__inner-container {
16
+ width: 100%;
17
+ height: 100%;
18
+ position: relative;
19
+ display: grid;
20
+ grid-area: main;
21
+ grid-template: 'main'/1fr;
45
22
  }
46
- }
47
- .swiper-button-next {
48
- right: var(--right-arrow-horizontally-mobile);
49
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
50
- right: var(--right-arrow-horizontally-portrait);
23
+ &__swiper-carousel-container {
24
+ width: 100%;
25
+ height: 100%;
26
+ grid-area: main;
27
+ inset: 0;
28
+ .swiper-wrapper {
29
+ height: 100%;
30
+ }
51
31
  }
52
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
53
- right: var(--right-arrow-horizontally-desktop);
32
+
33
+ .swiper-button-disabled {
34
+ pointer-events: none;
35
+ opacity: 0;
54
36
  }
55
- }
56
37
 
57
- .swiper-button-next,
58
- .swiper-button-prev {
59
- top: var(--arrows-position-vertically-mobile);
60
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
61
- top: var(--arrows-position-vertically-portrait);
38
+ .swiper-button-prev {
39
+ left: var(--left-arrow-horizontally-mobile);
40
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
41
+ left: var(--left-arrow-horizontally-portrait);
42
+ }
43
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
44
+ left: var(--left-arrow-horizontally-desktop);
45
+ }
62
46
  }
63
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
64
- top: var(--arrows-position-vertically-desktop);
47
+ .swiper-button-next {
48
+ right: var(--right-arrow-horizontally-mobile);
49
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
50
+ right: var(--right-arrow-horizontally-portrait);
51
+ }
52
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
53
+ right: var(--right-arrow-horizontally-desktop);
54
+ }
65
55
  }
66
- &::after {
67
- --swiper-navigation-size: #{core-functions-v3.fluidSize(
68
- var(--arrows-size-mobile),
69
- 'mobile'
70
- )};
56
+
57
+ .swiper-button-next,
58
+ .swiper-button-prev {
59
+ top: var(--arrows-position-vertically-mobile);
71
60
  @include core-mixins-v3.device(breakpoints.$tabPortrait) {
72
- --swiper-navigation-size: #{core-functions-v3.fluidSize(
73
- var(--arrows-size-portrait),
74
- 'portrait'
75
- )};
61
+ top: var(--arrows-position-vertically-portrait);
76
62
  }
77
63
  @include core-mixins-v3.device(breakpoints.$tabLandscape) {
64
+ top: var(--arrows-position-vertically-desktop);
65
+ }
66
+ &::after {
78
67
  --swiper-navigation-size: #{core-functions-v3.fluidSize(
79
- var(--arrows-size-desktop),
80
- 'desktop'
68
+ var(--arrows-size-mobile),
69
+ 'mobile'
81
70
  )};
71
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
72
+ --swiper-navigation-size: #{core-functions-v3.fluidSize(
73
+ var(--arrows-size-portrait),
74
+ 'portrait'
75
+ )};
76
+ }
77
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
78
+ --swiper-navigation-size: #{core-functions-v3.fluidSize(
79
+ var(--arrows-size-desktop),
80
+ 'desktop'
81
+ )};
82
+ }
83
+ text-rendering: auto;
84
+ color: var(--swiper-arrow-colour);
82
85
  }
83
- text-rendering: auto;
84
- color: var(--swiper-arrow-colour);
85
86
  }
86
- }
87
87
 
88
- .custom_arrow {
89
- height: auto;
90
- width: core-functions-v3.fluidSize(
91
- var(--custom-arrows-size-mobile),
92
- 'mobile'
93
- );
94
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
88
+ .custom_arrow {
89
+ height: auto;
95
90
  width: core-functions-v3.fluidSize(
96
- var(--custom-arrows-size-portrait),
97
- 'portrait'
91
+ var(--custom-arrows-size-mobile),
92
+ 'mobile'
98
93
  );
94
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
95
+ width: core-functions-v3.fluidSize(
96
+ var(--custom-arrows-size-portrait),
97
+ 'portrait'
98
+ );
99
+ }
100
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
101
+ width: core-functions-v3.fluidSize(
102
+ var(--custom-arrows-size-desktop),
103
+ 'desktop'
104
+ );
105
+ }
99
106
  }
100
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
101
- width: core-functions-v3.fluidSize(
102
- var(--custom-arrows-size-desktop),
103
- 'desktop'
104
- );
107
+
108
+ .swiper-pagination-bullets.swiper-pagination-horizontal {
109
+ bottom: unset;
110
+ left: unset;
111
+ width: unset;
112
+ }
113
+ .swiper-pagination {
114
+ @include element-positioning-v3.elementPositioning();
105
115
  }
106
- }
107
116
 
108
- .swiper-pagination-bullets.swiper-pagination-horizontal {
109
- bottom: unset;
110
- left: unset;
111
- width: unset;
112
- }
113
- .swiper-pagination {
114
- @include element-positioning-v3.elementPositioning();
115
- }
117
+ .swiper-pagination-bullet {
118
+ background-color: transparent;
119
+ }
116
120
 
117
- .swiper-pagination-bullet {
118
- background-color: transparent;
119
- }
121
+ .swiper-pagination-bullet-active {
122
+ background-color: var(--swiper-pagination-colour);
123
+ }
120
124
 
121
- .swiper-pagination-bullet-active {
122
- background-color: var(--swiper-pagination-colour);
123
- }
125
+ .swiper-pagination-fraction {
126
+ color: var(--swiper-pagination-colour);
127
+ }
124
128
 
125
- .swiper-pagination-fraction {
126
- color: var(--swiper-pagination-colour);
127
- }
129
+ .swiper-slide {
130
+ opacity: var(--next-and-prev-slide-opacity-mobile);
128
131
 
129
- .swiper-slide {
130
- opacity: var(--next-and-prev-slide-opacity-mobile);
132
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
133
+ opacity: var(--next-and-prev-slide-opacity-portrait);
134
+ }
131
135
 
132
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
133
- opacity: var(--next-and-prev-slide-opacity-portrait);
136
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
137
+ opacity: var(--next-and-prev-slide-opacity-desktop);
138
+ }
134
139
  }
135
140
 
136
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
137
- opacity: var(--next-and-prev-slide-opacity-desktop);
141
+ .swiper-slide-active {
142
+ opacity: unset;
138
143
  }
139
- }
140
144
 
141
- .swiper-slide-active {
142
- opacity: unset;
143
- }
144
-
145
- .swiper-button-next,
146
- .swiper-button-prev {
147
- display: var(--display-arrows-mobile);
148
- @include core-mixins-v3.device(breakpoints.$tabPortrait) {
149
- display: var(--display-arrows-portrait);
150
- }
151
- @include core-mixins-v3.device(breakpoints.$tabLandscape) {
152
- display: var(--display-arrows-desktop);
145
+ .swiper-button-next,
146
+ .swiper-button-prev {
147
+ display: var(--display-arrows-mobile);
148
+ @include core-mixins-v3.device(breakpoints.$tabPortrait) {
149
+ display: var(--display-arrows-portrait);
150
+ }
151
+ @include core-mixins-v3.device(breakpoints.$tabLandscape) {
152
+ display: var(--display-arrows-desktop);
153
+ }
153
154
  }
154
155
  }
155
156
  }
@@ -42,19 +42,19 @@
42
42
 
43
43
  <script type="speculationrules">
44
44
  {
45
- "prefetch": [
46
- {
47
- "where": { "href_matches": ["/"] },
48
- "eagerness": "eager"
49
- }
50
- ]
51
- }
45
+ "prefetch": [
46
+ {
47
+ "where": { "href_matches": ["/"] },
48
+ "eagerness": "eager"
49
+ }
50
+ ]
51
+ }
52
52
  </script>
53
53
  {# speculation api end #}
54
54
 
55
55
  {# core design settings #}
56
56
  {{function('core_design_settings_v3', options).0}}
57
- {{function('core_site_global_v3', options).0}}
57
+ {{function('core_post_overrides_v3', options).0}}
58
58
  {{function('core_font_modifiers_v3', options).0}}
59
59
  {{function('core_critical_css_v3').0}}
60
60
  {{function('core_typography_v3', options).0}}
@@ -1,2 +1,20 @@
1
1
  loadmore-trigger {
2
+ grid-area: loadmore;
3
+ display: grid;
4
+ width: 100%;
5
+ place-items: center;
6
+ .loadmore-trigger__button {
7
+ background-color: black;
8
+ padding: 20px;
9
+ color: var(--theme-primary-text-colour, white);
10
+ width: max-content;
11
+ }
12
+ .loadmore-trigger__button:hover {
13
+ cursor: pointer;
14
+ background-color: greenyellow;
15
+ }
16
+ }
17
+ loadmore-trigger.hide {
18
+ opacity: 0.3;
19
+ pointer-events: none;
2
20
  }
@@ -1,2 +1,6 @@
1
- <loadmore-trigger id="loadmore-trigger" class="loadmore-trigger">
1
+ <loadmore-trigger
2
+ id="loadmore-trigger"
3
+ data-buttontext="Load More"
4
+ class="loadmore-trigger"
5
+ >
2
6
  </loadmore-trigger>
@@ -1,36 +1,57 @@
1
1
  post-filter-module {
2
+ grid-area: filter;
3
+ transform: translateX(-100%);
4
+ @starting-style {
5
+ transform: translateX(-100%);
6
+ }
2
7
  position: fixed;
3
8
  inset: 0;
4
9
  background-color: black;
5
10
  right: unset;
6
11
  display: block;
7
12
  width: 100vw;
8
- transform: translateX(-100%);
13
+ z-index: 99;
9
14
  max-width: 414px;
10
- z-index: 10;
11
15
  transition: transform ease-in-out 0.3s;
12
16
 
13
- @starting-style {
14
- transform: translateX(-100%);
17
+ &.active {
18
+ transform: translateX(0%);
15
19
  }
16
-
17
20
  @media (min-width: 768px) {
18
21
  max-width: unset;
19
22
  width: 475px;
20
23
  }
21
24
 
22
- .post-filter-module__grouping-category-button {
25
+ .post-filter-module__clear-filters-button {
26
+ border: none;
23
27
  }
24
28
 
29
+ .post-filter-module__grouping-category-button {
30
+ text-transform: uppercase;
31
+ border: none;
32
+ color: var(--theme-primary-text-colour);
33
+ font-family: var(--secondary-font-family);
34
+ font-size: 24;
35
+
36
+ &.active {
37
+ }
38
+ }
39
+ .post-filter-module__filter-category-container {
40
+ height: 0px;
41
+ overflow: hidden;
42
+ transition: height ease-out 0.3s;
43
+ }
25
44
  .post-filter-module__filter-category-button {
26
- appearance: none;
27
- color: var(--theme-primary-text-colour, white);
45
+ color: var(--theme-primary-text-colour);
46
+ font-family: var(--primary-font-family);
28
47
  border: 1px solid transparent;
29
- background-color: var(--theme-primary-background-colour, black);
48
+ font-size: 14;
30
49
  }
31
50
  .post-filter-module__filter-category-button.active-cat {
32
- color: gold;
33
- border: 1px solid gold;
51
+ color: var(--primary-gold-100);
52
+ }
53
+ .post-filter-module__clear-filters-button {
54
+ color: var(--theme-primary-text-colour);
34
55
  }
35
56
  }
36
57
  post-filter-module.active {
@@ -7,6 +7,7 @@
7
7
  data-postsperpagedesktop="8"
8
8
  data-postsperpagemobile="6"
9
9
  data-loadmoretriggerclass="loadmore-trigger"
10
+ data-textinputclass="text-input-trigger"
10
11
  class="post-filter-module"
11
12
  >
12
13
  </post-filter-module>
@@ -4,10 +4,12 @@ export default function postfiltermoduleJs(options = {}) {
4
4
  customElements.define(
5
5
  'post-filter-module',
6
6
  class extends HTMLElement {
7
+ static observedAttributes = ['data-devcontent'];
7
8
  constructor() {
8
9
  super();
9
- this.enableLogs = this.dataset.enablelogs;
10
+ this.enableLogs = true;
10
11
  this.filterState = {
12
+ enableLogs: false,
11
13
  allposts: [],
12
14
  filteredposts: [],
13
15
  activefilters: new Set(),
@@ -50,6 +52,40 @@ export default function postfiltermoduleJs(options = {}) {
50
52
  });
51
53
  });
52
54
 
55
+ this.textSearchTriggers = document.querySelectorAll(
56
+ `.${this.dataset.textinputclass}`
57
+ );
58
+
59
+ this.textSearchTriggers.forEach((trigger) => {
60
+ trigger.addEventListener('textinput', (e) => {
61
+ const inputText =
62
+ e.target.querySelector('input')?.value;
63
+
64
+ console.log(
65
+ '🚀 ~ constructor ~ inputEl:',
66
+ inputText
67
+ );
68
+ this.filterPosts();
69
+ const searchPosts =
70
+ this.filterState.filteredposts.filter(
71
+ (post) => {
72
+ if (
73
+ post.name
74
+ ?.toLowerCase()
75
+ .includes(
76
+ inputText.toLowerCase()
77
+ )
78
+ ) {
79
+ return post;
80
+ }
81
+ }
82
+ );
83
+
84
+ this.filterState.setFilteredPosts.bind(this)({
85
+ filteredposts: searchPosts
86
+ });
87
+ });
88
+ });
53
89
  const postFilterContainer =
54
90
  document.createElement('div');
55
91
  postFilterContainer.className =
@@ -84,31 +120,26 @@ export default function postfiltermoduleJs(options = {}) {
84
120
  this.clearFilters.bind(this)
85
121
  );
86
122
 
87
- this.devMode = this.dataset.dev;
88
123
  this.devModeContent = this.dataset.devcontent;
89
124
  }
90
125
  async connectedCallback() {
91
126
  console.log('Filter Module element added to page.');
92
127
  let data;
93
128
  if (
94
- this.devMode == 'true' ||
95
- this.classList.contains('dev-petz') //Easter Egg :D
129
+ this.dataset.dev === 'true' ||
130
+ this.dataset.devcontent === 'dev-petz' ||
131
+ this.classList.contains('dev-pets') //Easter Egg :D
96
132
  ) {
97
- const devdatalocation =
98
- this.dataset.devdatalocation;
99
- data = await import(
100
- `./dev-content/dev-content${devdatalocation}.js`
101
- );
102
- this.filterState.allposts = data[`devContentPets`];
103
-
104
- this.filterState.allcategories =
105
- data[`devContentCategories`];
133
+ await this.getDevContent();
106
134
  } else {
107
135
  data = globalThis[this.dataset.dataobjectid];
108
136
  this.enableLogs &&
109
137
  console.log('🚀 dataobject: ', data);
110
- this.filterState.allposts = data[`posts`];
111
- this.filterState.allcategories = data[`categories`];
138
+ if (data) {
139
+ this.filterState.allposts = data[`posts`];
140
+ this.filterState.allcategories =
141
+ data[`categories`];
142
+ }
112
143
  }
113
144
 
114
145
  if (this.filterState.allcategories.length > 0) {
@@ -251,15 +282,31 @@ export default function postfiltermoduleJs(options = {}) {
251
282
  }
252
283
  });
253
284
  });
254
- this.filterPosts();
255
285
 
286
+ this.filterPosts();
256
287
  this.classList.add('loaded');
257
288
  }
258
289
 
259
290
  attributeChangedCallback(name, oldValue, newValue) {
260
- // console.log(`Attribute ${name} has changed.`);
291
+ console.log(`Attribute ${name} has changed.`);
292
+ if (newValue) {
293
+ this.getDevContent();
294
+ }
295
+ }
296
+ async getDevContent() {
297
+ this.enableLogs && console.log('Getting dev content..');
298
+ const data = await import(
299
+ `./dev-content/dev-content${this.dataset.devdatalocation}.js`
300
+ );
301
+ this.filterState.allposts = data[`devContentPets`];
302
+ this.filterState.allcategories =
303
+ data[`devContentCategories`];
304
+ this.filterPosts();
261
305
  }
262
306
  filterPosts(event) {
307
+ if (this.filterState.allposts.length == 0) {
308
+ return;
309
+ }
263
310
  if (this.filterState.activefilters.size === 0) {
264
311
  const numberPosts =
265
312
  Number(this.filterState.postsperpagedesktop) *
@@ -270,9 +317,10 @@ export default function postfiltermoduleJs(options = {}) {
270
317
  numberPosts
271
318
  )
272
319
  });
320
+
273
321
  if (
274
- this.filterState.allposts.length ==
275
- this.filterState.filteredposts.length
322
+ this.filterState.filteredposts.length >=
323
+ this.filterState.allposts.length
276
324
  ) {
277
325
  this.loadMoreTriggers.forEach((trigger) => {
278
326
  trigger.classList.add('hide');
@@ -1,16 +1,42 @@
1
1
  post-grid-display-module {
2
+ grid-area: display;
2
3
  display: grid;
3
- background-color: hotpink;
4
4
  .post-grid-display-module__grid-container {
5
5
  place-self: stretch;
6
6
  display: grid;
7
7
  padding: 10px;
8
- gap: 10px;
9
- grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
8
+ gap: 30px;
9
+ grid-template-columns: 1fr;
10
+ @media screen and (min-width: 768px) {
11
+ grid-template-columns: repeat(3, 1fr);
12
+ }
13
+ @media screen and (min-width: 1440px) {
14
+ grid-template-columns: repeat(4, 1fr);
15
+ }
10
16
  }
11
- .post-grid-display-module__post-image {
12
- width: 100%;
13
- height: 100%;
14
- object-fit: cover;
17
+ .post-grid-display-module__post-container {
18
+ display: grid;
19
+ place-items: stretch;
20
+ grid-template-rows: max-content;
21
+ .post-grid-display-module__post-title {
22
+ color: white;
23
+ grid-row: 2;
24
+ text-box-edge: unset;
25
+ line-height: 120%;
26
+ text-transform: uppercase;
27
+ text-align: center;
28
+ font-size: 36px;
29
+ .font-secondary {
30
+ display: block;
31
+ }
32
+ }
33
+ .post-grid-display-module__post-image {
34
+ grid-row: 1;
35
+ width: 100%;
36
+ height: auto;
37
+ place-self: stretch;
38
+ object-fit: cover;
39
+ aspect-ratio: 9 / 11;
40
+ }
15
41
  }
16
42
  }