@wishbone-media/spark 0.6.0 → 0.8.5

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/dist/index.js CHANGED
@@ -217,43 +217,51 @@ const Oe = { class: "flex items-center" }, De = { class: "shrink-0 self-start" }
217
217
  ]);
218
218
  };
219
219
  }
220
- }, W = M("brandFilter", () => {
221
- const e = z({
222
- brands: []
223
- }), o = (f = {}) => {
224
- if (!f.brands || !Array.isArray(f.brands)) {
225
- console.warn("useSparkBrandFilterStore: No brands provided to initialize()"), e.brands = [];
226
- return;
227
- }
228
- const a = f.brands.filter((t) => {
229
- const n = t.id && t.name && t.logo;
230
- return n || console.warn("useSparkBrandFilterStore: Invalid brand object", t), n;
231
- }), i = a.filter((t) => t.current);
232
- i.length === 0 && a.length > 0 ? a[0].current = !0 : i.length > 1 && a.forEach((t) => {
233
- t.current = t === i[0];
234
- }), e.brands = a.map((t) => ({
235
- id: t.id,
236
- name: t.name,
237
- logo: t.logo,
238
- current: t.current || !1
239
- }));
240
- }, r = y(() => e.brands.find((f) => f.current) || null), c = y(() => e.brands);
241
- return {
242
- state: e,
243
- initialize: o,
244
- currentBrand: r,
245
- allBrands: c,
246
- toggleBrand: (f) => {
247
- if (!f || !e.brands.includes(f)) {
248
- console.warn("useSparkBrandFilterStore: Invalid brand provided to toggleBrand()");
220
+ }, W = M(
221
+ "brandFilter",
222
+ () => {
223
+ const e = z({
224
+ brands: []
225
+ }), o = (f = {}) => {
226
+ if (!f.brands || !Array.isArray(f.brands)) {
227
+ console.warn("useSparkBrandFilterStore: No brands provided to initialize()"), e.brands = [];
249
228
  return;
250
229
  }
251
- e.brands.forEach((a) => {
252
- a.current = a === f;
253
- });
230
+ const a = f.brands.filter((t) => {
231
+ const n = t.id && t.name && t.logo;
232
+ return n || console.warn("useSparkBrandFilterStore: Invalid brand object", t), n;
233
+ }), i = a.filter((t) => t.current);
234
+ i.length === 0 && a.length > 0 ? a[0].current = !0 : i.length > 1 && a.forEach((t) => {
235
+ t.current = t === i[0];
236
+ }), e.brands = a.map((t) => ({
237
+ id: t.id,
238
+ name: t.name,
239
+ logo: t.logo,
240
+ current: t.current || !1
241
+ }));
242
+ }, r = y(() => e.brands.find((f) => f.current) || null), c = y(() => e.brands);
243
+ return {
244
+ state: e,
245
+ initialize: o,
246
+ currentBrand: r,
247
+ allBrands: c,
248
+ toggleBrand: (f) => {
249
+ if (!f || !e.brands.includes(f)) {
250
+ console.warn("useSparkBrandFilterStore: Invalid brand provided to toggleBrand()");
251
+ return;
252
+ }
253
+ e.brands.forEach((a) => {
254
+ a.current = a === f;
255
+ });
256
+ }
257
+ };
258
+ },
259
+ {
260
+ persist: {
261
+ paths: ["state.brands"]
254
262
  }
255
- };
256
- }), nt = { class: "flex grow flex-col gap-y-5 overflow-y-auto bg-white rounded-lg" }, ot = { class: "flex flex-1 flex-col" }, rt = { class: "divide-y divide-gray-200" }, at = { class: "flex px-[22px] py-2.5 text-[12px] items-center" }, lt = { class: "ml-auto flex items-center" }, it = {
263
+ }
264
+ ), nt = { class: "flex grow flex-col gap-y-5 overflow-y-auto bg-white rounded-lg" }, ot = { class: "flex flex-1 flex-col" }, rt = { class: "divide-y divide-gray-200" }, at = { class: "flex px-[22px] py-2.5 text-[12px] items-center" }, lt = { class: "ml-auto flex items-center" }, it = {
257
265
  key: 0,
258
266
  class: "flex px-[22px] py-[15px] text-gray-500 text-sm"
259
267
  }, ct = ["onClick"], dt = { class: "gap-y-1 flex" }, ut = { class: "flex items-center mr-4" }, pt = ["src", "alt"], ft = { class: "ml-auto flex flex-col" }, mt = { class: "text-base text-gray-800 flex items-center" }, gt = { class: "font-medium" }, ht = {
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@wishbone-media/spark",
3
- "version": "0.6.0",
3
+ "version": "0.8.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/wishbone-media/spark.git"
10
+ },
7
11
  "files": [
8
12
  "dist",
9
13
  "src",
@@ -21,6 +25,7 @@
21
25
  "@fortawesome/pro-regular-svg-icons": "^7.1.0",
22
26
  "@headlessui/vue": "^1.7.23",
23
27
  "pinia": "^3.0.4",
28
+ "pinia-plugin-persistedstate": "^4.0.0",
24
29
  "vue": "^3.5.24",
25
30
  "vue-router": "^4.6.3"
26
31
  },
@@ -1,10 +1,12 @@
1
1
  import { defineStore } from 'pinia'
2
2
  import { computed, reactive } from 'vue'
3
3
 
4
- export const useSparkBrandFilterStore = defineStore('brandFilter', () => {
5
- const state = reactive({
6
- brands: [],
7
- })
4
+ export const useSparkBrandFilterStore = defineStore(
5
+ 'brandFilter',
6
+ () => {
7
+ const state = reactive({
8
+ brands: [],
9
+ })
8
10
 
9
11
  const initialize = (config = {}) => {
10
12
  if (!config.brands || !Array.isArray(config.brands)) {
@@ -55,11 +57,17 @@ export const useSparkBrandFilterStore = defineStore('brandFilter', () => {
55
57
  })
56
58
  }
57
59
 
58
- return {
59
- state,
60
- initialize,
61
- currentBrand,
62
- allBrands,
63
- toggleBrand,
64
- }
65
- })
60
+ return {
61
+ state,
62
+ initialize,
63
+ currentBrand,
64
+ allBrands,
65
+ toggleBrand,
66
+ }
67
+ },
68
+ {
69
+ persist: {
70
+ paths: ['state.brands'],
71
+ },
72
+ },
73
+ )