@techninja/staticart 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/staticart",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "StatiCart — a full-featured e-commerce platform built 99% on static hosting",
5
5
  "repository": {
6
6
  "type": "git",
@@ -7,7 +7,7 @@
7
7
  * @module scripts/sync-vendor
8
8
  */
9
9
 
10
- import { cpSync, mkdirSync, rmSync } from 'node:fs';
10
+ import { cpSync, mkdirSync, rmSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
11
11
  import { resolve, dirname } from 'node:path';
12
12
  import { fileURLToPath } from 'node:url';
13
13
 
@@ -16,6 +16,14 @@ const SRC = resolve(ROOT, 'src');
16
16
  const DEST = resolve(ROOT, 'vendor');
17
17
 
18
18
  const DIRS = ['components', 'locales', 'pages', 'router', 'store', 'styles', 'utils'];
19
+ const ROOT_FILES = ['icons.json'];
20
+
21
+ // Preserve root-level vendor files before clean
22
+ const preserved = {};
23
+ for (const f of ROOT_FILES) {
24
+ const p = resolve(DEST, f);
25
+ if (existsSync(p)) preserved[f] = readFileSync(p, 'utf-8');
26
+ }
19
27
 
20
28
  // Clean and rebuild
21
29
  rmSync(DEST, { recursive: true, force: true });
@@ -25,5 +33,9 @@ for (const dir of DIRS) {
25
33
  cpSync(resolve(SRC, dir), resolve(DEST, dir), { recursive: true });
26
34
  console.log(`✓ ${dir}/`);
27
35
  }
36
+ for (const [f, content] of Object.entries(preserved)) {
37
+ writeFileSync(resolve(DEST, f), content);
38
+ console.log(`✓ ${f} (preserved)`);
39
+ }
28
40
 
29
41
  console.log(`\nVendor synced from src/ → vendor/`);
@@ -74,7 +74,7 @@ export default define({
74
74
  class="btn btn-primary btn-sm"
75
75
  data-vid="${v.id}"
76
76
  onclick="${handlePick}"
77
- disabled="${v.stock <= 0}"
77
+ disabled="${v.stock === 0}"
78
78
  >
79
79
  ${v.label}
80
80
  </button>
@@ -87,7 +87,7 @@ export default define({
87
87
  <button
88
88
  class="btn btn-primary product-card__add"
89
89
  onclick="${handleAdd}"
90
- disabled="${stock <= 0}"
90
+ disabled="${stock === 0}"
91
91
  >
92
92
  ${t('cart.add')}
93
93
  </button>
@@ -115,7 +115,7 @@ export default define({
115
115
  <button
116
116
  class="btn btn-primary"
117
117
  onclick="${handleAdd}"
118
- disabled="${stock <= 0 || (variants.length > 0 && !selectedVariant)}"
118
+ disabled="${stock === 0 || (variants.length > 0 && !selectedVariant)}"
119
119
  >
120
120
  <app-icon name="cart" size="sm"></app-icon> ${t('cart.add')}
121
121
  </button>
@@ -20,14 +20,16 @@ export function effectiveStock(p, vid) {
20
20
 
21
21
  /** @param {number} stock */
22
22
  export function stockLabel(stock) {
23
- if (stock <= 0) return t('product.outOfStock');
23
+ if (stock < 0) return t('product.inStock');
24
+ if (stock === 0) return t('product.outOfStock');
24
25
  if (stock <= 5) return t('product.lowStock');
25
26
  return t('product.inStock');
26
27
  }
27
28
 
28
29
  /** @param {number} stock */
29
30
  export function stockColor(stock) {
30
- if (stock <= 0) return 'danger';
31
+ if (stock < 0) return 'success';
32
+ if (stock === 0) return 'danger';
31
33
  if (stock <= 5) return 'warning';
32
34
  return 'success';
33
35
  }
@@ -74,7 +74,7 @@ export default define({
74
74
  class="btn btn-primary btn-sm"
75
75
  data-vid="${v.id}"
76
76
  onclick="${handlePick}"
77
- disabled="${v.stock <= 0}"
77
+ disabled="${v.stock === 0}"
78
78
  >
79
79
  ${v.label}
80
80
  </button>
@@ -87,7 +87,7 @@ export default define({
87
87
  <button
88
88
  class="btn btn-primary product-card__add"
89
89
  onclick="${handleAdd}"
90
- disabled="${stock <= 0}"
90
+ disabled="${stock === 0}"
91
91
  >
92
92
  ${t('cart.add')}
93
93
  </button>
@@ -0,0 +1,26 @@
1
+ {
2
+ "plus": "plus",
3
+ "minus": "minus",
4
+ "check": "check",
5
+ "trash-2": "trash",
6
+ "x": "x",
7
+ "chevron-right": "chevron",
8
+ "chevron-left": "chevron-left",
9
+ "search": "search",
10
+ "shopping-cart": "cart",
11
+ "package": "package",
12
+ "tag": "tag",
13
+ "heart": "heart",
14
+ "star": "star",
15
+ "filter": "filter",
16
+ "arrow-left": "arrow-left",
17
+ "arrow-right": "arrow-right",
18
+ "sun": "sun",
19
+ "moon": "moon",
20
+ "user": "user",
21
+ "circle-check": "circle-check",
22
+ "circle-x": "circle-x",
23
+ "alert-triangle": "alert-triangle",
24
+ "image": "image",
25
+ "globe": "globe"
26
+ }
@@ -115,7 +115,7 @@ export default define({
115
115
  <button
116
116
  class="btn btn-primary"
117
117
  onclick="${handleAdd}"
118
- disabled="${stock <= 0 || (variants.length > 0 && !selectedVariant)}"
118
+ disabled="${stock === 0 || (variants.length > 0 && !selectedVariant)}"
119
119
  >
120
120
  <app-icon name="cart" size="sm"></app-icon> ${t('cart.add')}
121
121
  </button>
@@ -20,14 +20,16 @@ export function effectiveStock(p, vid) {
20
20
 
21
21
  /** @param {number} stock */
22
22
  export function stockLabel(stock) {
23
- if (stock <= 0) return t('product.outOfStock');
23
+ if (stock < 0) return t('product.inStock');
24
+ if (stock === 0) return t('product.outOfStock');
24
25
  if (stock <= 5) return t('product.lowStock');
25
26
  return t('product.inStock');
26
27
  }
27
28
 
28
29
  /** @param {number} stock */
29
30
  export function stockColor(stock) {
30
- if (stock <= 0) return 'danger';
31
+ if (stock < 0) return 'success';
32
+ if (stock === 0) return 'danger';
31
33
  if (stock <= 5) return 'warning';
32
34
  return 'success';
33
35
  }