@pumpkin-tech/pumpkin-tech-ng 0.2.13 → 0.2.14

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.
@@ -134,22 +134,16 @@ class PtechGridDirective {
134
134
  this.columns = `repeat(${cols}, minmax(0, 1fr))`;
135
135
  }
136
136
  resolveColsForBp() {
137
- const xs = this.asNum(this.ptechColsXs);
138
- const sm = this.asNum(this.ptechColsSm);
139
- const md = this.asNum(this.ptechColsMd);
140
- const lg = this.asNum(this.ptechColsLg);
141
- const xl = this.asNum(this.ptechColsXl);
137
+ const map = {
138
+ xs: this.asNum(this.ptechColsXs),
139
+ sm: this.asNum(this.ptechColsSm),
140
+ md: this.asNum(this.ptechColsMd),
141
+ lg: this.asNum(this.ptechColsLg),
142
+ xl: this.asNum(this.ptechColsXl),
143
+ };
142
144
  const bp = this.activeBp;
143
- if (!bp)
144
- return this._cols ?? 12;
145
- switch (bp) {
146
- case 'xl': return xl ?? lg ?? md ?? sm ?? xs ?? this._cols ?? 12;
147
- case 'lg': return lg ?? md ?? sm ?? xs ?? this._cols ?? 12;
148
- case 'md': return md ?? sm ?? xs ?? this._cols ?? 12;
149
- case 'sm': return sm ?? xs ?? this._cols ?? 12;
150
- case 'xs': return xs ?? this._cols ?? 12;
151
- default: return this._cols ?? 12;
152
- }
145
+ const span = bp ? map[bp] : undefined;
146
+ return span ?? this._cols ?? 12;
153
147
  }
154
148
  asNum(v, fallback) {
155
149
  if (v === null || v === undefined || v === '')
@@ -307,28 +301,16 @@ class PtechColDirective {
307
301
  this.gridColumn = `auto / span ${span}`;
308
302
  }
309
303
  resolveColForBp() {
310
- const xs = this.asNum(this.ptechColXs);
311
- const sm = this.asNum(this.ptechColSm);
312
- const md = this.asNum(this.ptechColMd);
313
- const lg = this.asNum(this.ptechColLg);
314
- const xl = this.asNum(this.ptechColXl);
304
+ const map = {
305
+ xs: this.asNum(this.ptechColXs),
306
+ sm: this.asNum(this.ptechColSm),
307
+ md: this.asNum(this.ptechColMd),
308
+ lg: this.asNum(this.ptechColLg),
309
+ xl: this.asNum(this.ptechColXl),
310
+ };
315
311
  const bp = this.activeBp;
316
- if (!bp)
317
- return this._col ?? 12;
318
- // Cascata mobile-first:
319
- // xl -> lg -> md -> sm -> xs -> base
320
- // lg -> md -> sm -> xs -> base
321
- // md -> sm -> xs -> base
322
- // sm -> xs -> base
323
- // xs -> base
324
- switch (bp) {
325
- case 'xl': return xl ?? lg ?? md ?? sm ?? xs ?? this._col ?? 12;
326
- case 'lg': return lg ?? md ?? sm ?? xs ?? this._col ?? 12;
327
- case 'md': return md ?? sm ?? xs ?? this._col ?? 12;
328
- case 'sm': return sm ?? xs ?? this._col ?? 12;
329
- case 'xs': return xs ?? this._col ?? 12;
330
- default: return this._col ?? 12;
331
- }
312
+ const span = bp ? map[bp] : undefined;
313
+ return span ?? this._col ?? 12;
332
314
  }
333
315
  asNum(v, fallback) {
334
316
  if (v === null || v === undefined || v === '')