@katlux/block-ecommerce 0.1.0-beta.1 → 0.1.0-beta.10

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/module.d.mts CHANGED
@@ -1,2 +1,6 @@
1
- export * from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module";
2
- export { default } from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module";
1
+ interface ModuleOptions {
2
+ }
3
+ declare const _default: any;
4
+
5
+ export { _default as default };
6
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.1.0",
7
+ "version": "0.1.0-beta.10",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,18 +1,23 @@
1
- import { createJiti } from "file:///home/cagatay/Desktop/projects/KatluxShowcase/node_modules/jiti/lib/jiti.mjs";
1
+ import { defineNuxtModule, createResolver, addComponentsDir } from '@nuxt/kit';
2
2
 
3
- const jiti = createJiti(import.meta.url, {
4
- "interopDefault": true,
5
- "alias": {
6
- "@katlux/block-ecommerce": "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce"
7
- },
8
- "transformOptions": {
9
- "babel": {
10
- "plugins": []
3
+ const module$1 = defineNuxtModule({
4
+ meta: {
5
+ name: "@katlux/block-ecommerce",
6
+ configKey: "katluxEcommerceBlocks",
7
+ compatibility: {
8
+ nuxt: "^3.0.0"
11
9
  }
10
+ },
11
+ defaults: {},
12
+ async setup(options, nuxt) {
13
+ const resolver = createResolver(import.meta.url);
14
+ addComponentsDir({
15
+ path: resolver.resolve("./runtime/components"),
16
+ pathPrefix: false,
17
+ prefix: "",
18
+ global: true
19
+ });
12
20
  }
13
- })
14
-
15
- /** @type {import("/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module")} */
16
- const _module = await jiti.import("/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module.ts");
21
+ });
17
22
 
18
- export default _module?.default ?? _module;
23
+ export { module$1 as default };
@@ -0,0 +1,32 @@
1
+ import type { KProductRowAction } from '@katlux/providers';
2
+ import { ADataProvider } from '@katlux/providers';
3
+ type __VLS_Props = {
4
+ dataProvider: ADataProvider;
5
+ layout?: 'grid' | 'list';
6
+ rowActions?: KProductRowAction[];
7
+ gridColumns?: number | string;
8
+ gap?: string;
9
+ };
10
+ declare var __VLS_1: {
11
+ item: import("@katlux/providers").TDataRow;
12
+ index: number;
13
+ }, __VLS_11: string, __VLS_12: any;
14
+ type __VLS_Slots = {} & {
15
+ [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
16
+ } & {
17
+ default?: (props: typeof __VLS_1) => any;
18
+ };
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
20
+ rowActions: KProductRowAction[];
21
+ layout: "grid" | "list";
22
+ gridColumns: number | string;
23
+ gap: string;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,52 @@
1
+ import type { ADataProvider, KProductRowAction } from '@katlux/providers';
2
+ import { type PropType } from 'vue';
3
+ export interface KProductListProps {
4
+ dataProvider: ADataProvider;
5
+ layout?: 'grid' | 'list';
6
+ rowActions?: KProductRowAction[];
7
+ gridColumns?: number | string;
8
+ gap?: string;
9
+ }
10
+ export declare const KProductListDefaultProps: {
11
+ dataProvider: {
12
+ type: PropType<ADataProvider>;
13
+ required: boolean;
14
+ };
15
+ layout: {
16
+ type: PropType<"grid" | "list">;
17
+ default: string;
18
+ };
19
+ rowActions: {
20
+ type: PropType<KProductRowAction[]>;
21
+ default: () => never[];
22
+ };
23
+ gridColumns: {
24
+ type: (StringConstructor | NumberConstructor)[];
25
+ default: number;
26
+ };
27
+ gap: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ };
32
+ export declare function useKProductListLogic(props: KProductListProps): {
33
+ isGrid: import("vue").ComputedRef<boolean>;
34
+ gridStyles: import("vue").ComputedRef<{
35
+ display?: undefined;
36
+ gridTemplateColumns?: undefined;
37
+ gap?: undefined;
38
+ } | {
39
+ display: string;
40
+ gridTemplateColumns: string;
41
+ gap: string | undefined;
42
+ }>;
43
+ listStyles: import("vue").ComputedRef<{
44
+ display?: undefined;
45
+ flexDirection?: undefined;
46
+ gap?: undefined;
47
+ } | {
48
+ display: string;
49
+ flexDirection: "column";
50
+ gap: string | undefined;
51
+ }>;
52
+ };
@@ -0,0 +1,48 @@
1
+ import { computed } from "vue";
2
+ export const KProductListDefaultProps = {
3
+ dataProvider: {
4
+ type: Object,
5
+ required: true
6
+ },
7
+ layout: {
8
+ type: String,
9
+ default: "grid"
10
+ },
11
+ rowActions: {
12
+ type: Array,
13
+ default: () => []
14
+ },
15
+ gridColumns: {
16
+ type: [Number, String],
17
+ default: 4
18
+ },
19
+ gap: {
20
+ type: String,
21
+ default: "1rem"
22
+ }
23
+ };
24
+ export function useKProductListLogic(props) {
25
+ const isGrid = computed(() => props.layout !== "list");
26
+ const gridStyles = computed(() => {
27
+ if (!isGrid.value) return {};
28
+ const cols = props.gridColumns;
29
+ return {
30
+ display: "grid",
31
+ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`,
32
+ gap: props.gap
33
+ };
34
+ });
35
+ const listStyles = computed(() => {
36
+ if (isGrid.value) return {};
37
+ return {
38
+ display: "flex",
39
+ flexDirection: "column",
40
+ gap: props.gap
41
+ };
42
+ });
43
+ return {
44
+ isGrid,
45
+ gridStyles,
46
+ listStyles
47
+ };
48
+ }
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="k-product-list" :class="{ 'is-grid': isGrid, 'is-list': !isGrid }">
3
+ <!-- If there's a custom template provided via default slot -->
4
+ <template v-if="$slots.default">
5
+ <div class="list-container" :style="isGrid ? gridStyles : listStyles">
6
+ <slot v-for="(item, index) in props.dataProvider.pageData.value" :item="item" :index="index"></slot>
7
+ </div>
8
+ </template>
9
+
10
+ <!-- Otherwise, use the default KProductListItem -->
11
+ <template v-else>
12
+ <div class="list-container" :style="isGrid ? gridStyles : listStyles">
13
+ <KProductListItem
14
+ v-for="(item, index) in props.dataProvider.pageData.value"
15
+ :key="item.id || index"
16
+ :item="item"
17
+ :row-actions="rowActions"
18
+ >
19
+ <template v-for="(_, slot) in $slots" #[slot]="scope">
20
+ <slot :name="slot" v-bind="scope"></slot>
21
+ </template>
22
+ </KProductListItem>
23
+ </div>
24
+ </template>
25
+
26
+ <div class="footer">
27
+ <KPagination class="pagination" :dataProvider="props.dataProvider" />
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { ADataProvider } from "@katlux/providers";
34
+ import { useKProductListLogic } from "./KProductList.logic";
35
+ const props = defineProps({
36
+ dataProvider: { type: Object, required: true },
37
+ layout: { type: String, required: false, default: "grid" },
38
+ rowActions: { type: Array, required: false, default: () => [] },
39
+ gridColumns: { type: [Number, String], required: false, default: 4 },
40
+ gap: { type: String, required: false, default: "1rem" }
41
+ });
42
+ const { isGrid, gridStyles, listStyles } = useKProductListLogic(props);
43
+ </script>
44
+
45
+ <style scoped>
46
+ .k-product-list {
47
+ width: 100%;
48
+ }
49
+ .k-product-list .list-container {
50
+ width: 100%;
51
+ }
52
+ .k-product-list .footer {
53
+ display: flex;
54
+ justify-content: flex-end;
55
+ margin-top: var(--gap-lg, 24px);
56
+ }
57
+ .k-product-list .footer .pagination {
58
+ flex: 1;
59
+ }
60
+ </style>
@@ -0,0 +1,32 @@
1
+ import type { KProductRowAction } from '@katlux/providers';
2
+ import { ADataProvider } from '@katlux/providers';
3
+ type __VLS_Props = {
4
+ dataProvider: ADataProvider;
5
+ layout?: 'grid' | 'list';
6
+ rowActions?: KProductRowAction[];
7
+ gridColumns?: number | string;
8
+ gap?: string;
9
+ };
10
+ declare var __VLS_1: {
11
+ item: import("@katlux/providers").TDataRow;
12
+ index: number;
13
+ }, __VLS_11: string, __VLS_12: any;
14
+ type __VLS_Slots = {} & {
15
+ [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
16
+ } & {
17
+ default?: (props: typeof __VLS_1) => any;
18
+ };
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
20
+ rowActions: KProductRowAction[];
21
+ layout: "grid" | "list";
22
+ gridColumns: number | string;
23
+ gap: string;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,8 @@
1
+ import type { KProductItemData, KProductRowAction } from '@katlux/providers';
2
+ type __VLS_Props = {
3
+ item: KProductItemData;
4
+ rowActions?: KProductRowAction[];
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { type PropType } from 'vue';
2
+ import type { KProductItemData, KProductRowAction } from '@katlux/providers';
3
+ export interface KProductListItemProps {
4
+ item: KProductItemData;
5
+ rowActions?: KProductRowAction[];
6
+ }
7
+ export declare const KProductListItemDefaultProps: {
8
+ item: {
9
+ type: PropType<KProductItemData>;
10
+ required: true;
11
+ };
12
+ rowActions: {
13
+ type: PropType<KProductRowAction[]>;
14
+ default: () => never[];
15
+ };
16
+ };
17
+ export declare function useKProductListItemLogic(props: KProductListItemProps): {
18
+ hasActions: import("vue").ComputedRef<boolean | undefined>;
19
+ formattedPrice: import("vue").ComputedRef<string>;
20
+ };
@@ -0,0 +1,25 @@
1
+ import { computed } from "vue";
2
+ export const KProductListItemDefaultProps = {
3
+ item: {
4
+ type: Object,
5
+ required: true
6
+ },
7
+ rowActions: {
8
+ type: Array,
9
+ default: () => []
10
+ }
11
+ };
12
+ export function useKProductListItemLogic(props) {
13
+ const hasActions = computed(() => props.rowActions && props.rowActions.length > 0);
14
+ const formattedPrice = computed(() => {
15
+ if (props.item.price === void 0) return "";
16
+ return new Intl.NumberFormat("en-US", {
17
+ style: "currency",
18
+ currency: props.item.currency || "USD"
19
+ }).format(props.item.price);
20
+ });
21
+ return {
22
+ hasActions,
23
+ formattedPrice
24
+ };
25
+ }
@@ -0,0 +1,113 @@
1
+ <template lang="pug">
2
+ .k-product-list-item
3
+ .item-image(v-if="item.image")
4
+ img(:src="item.image" :alt="item.title")
5
+ .item-image-placeholder(v-else)
6
+ KIcon(name="tabler:photo" class="placeholder-icon")
7
+ .item-details
8
+ h3.item-title {{ item.title }}
9
+ p.item-description(v-if="item.description") {{ item.description }}
10
+ .item-price(v-if="formattedPrice") {{ formattedPrice }}
11
+ .item-actions(v-if="hasActions")
12
+ KButton(
13
+ v-for="(action, index) in rowActions"
14
+ :key="index"
15
+ :class="action.color || 'primary'"
16
+ @click="action.action(item)"
17
+ )
18
+ template(v-if="action.icon" #icon)
19
+ KIcon(:name="action.icon")
20
+ | {{ action.label }}
21
+ </template>
22
+
23
+ <script setup>
24
+ const props = defineProps({
25
+ item: { type: Object, required: true },
26
+ rowActions: { type: Array, required: false }
27
+ });
28
+ import { useKProductListItemLogic } from "./KProductListItem.logic";
29
+ const { hasActions, formattedPrice } = useKProductListItemLogic(props);
30
+ </script>
31
+
32
+ <style scoped>
33
+ .k-product-list-item {
34
+ display: flex;
35
+ flex-direction: column;
36
+ border: 1px solid var(--border-color-light, #e9ecef);
37
+ border-radius: var(--border-radius-md, 8px);
38
+ overflow: hidden;
39
+ background: var(--bg-color-surface, #ffffff);
40
+ transition: box-shadow 0.2s ease, transform 0.2s ease;
41
+ height: 100%;
42
+ }
43
+ .k-product-list-item:hover {
44
+ box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
45
+ transform: translateY(-2px);
46
+ }
47
+ .k-product-list-item .item-image, .k-product-list-item .item-image-placeholder {
48
+ width: 100%;
49
+ aspect-ratio: 1;
50
+ overflow: hidden;
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ background: var(--bg-color-muted, #f8f9fa);
55
+ border-bottom: 1px solid var(--border-color-light, #e9ecef);
56
+ }
57
+ .k-product-list-item .item-image img {
58
+ width: 100%;
59
+ height: 100%;
60
+ object-fit: cover;
61
+ transition: transform 0.3s ease;
62
+ }
63
+ .k-product-list-item:hover .item-image img {
64
+ transform: scale(1.05);
65
+ }
66
+ .k-product-list-item .item-image-placeholder .placeholder-icon {
67
+ font-size: 3rem;
68
+ color: var(--text-color-muted, #adb5bd);
69
+ opacity: 0.5;
70
+ }
71
+ .k-product-list-item .item-details {
72
+ padding: var(--gap-md, 16px);
73
+ flex-grow: 1;
74
+ display: flex;
75
+ flex-direction: column;
76
+ }
77
+ .k-product-list-item .item-title {
78
+ margin: 0 0 var(--gap-xs, 4px) 0;
79
+ font-size: var(--font-size-lg, 1.1rem);
80
+ font-weight: 600;
81
+ color: var(--text-color-primary, #212529);
82
+ line-height: 1.3;
83
+ }
84
+ .k-product-list-item .item-description {
85
+ margin: 0 0 var(--gap-sm, 8px) 0;
86
+ font-size: var(--font-size-sm, 0.9rem);
87
+ color: var(--text-color-secondary, #6c757d);
88
+ line-height: 1.4;
89
+ flex-grow: 1;
90
+ display: -webkit-box;
91
+ -webkit-line-clamp: 2;
92
+ -webkit-box-orient: vertical;
93
+ overflow: hidden;
94
+ }
95
+ .k-product-list-item .item-price {
96
+ font-size: var(--font-size-xl, 1.25rem);
97
+ font-weight: 700;
98
+ color: var(--color-primary, #0d6efd);
99
+ margin-top: auto;
100
+ padding-top: var(--gap-sm, 8px);
101
+ }
102
+ .k-product-list-item .item-actions {
103
+ padding: var(--gap-md, 16px);
104
+ padding-top: 0;
105
+ display: flex;
106
+ gap: var(--gap-sm, 8px);
107
+ flex-wrap: wrap;
108
+ }
109
+ .k-product-list-item .item-actions :deep(.KButton) {
110
+ flex: 1;
111
+ min-width: 100px;
112
+ }
113
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { KProductItemData, KProductRowAction } from '@katlux/providers';
2
+ type __VLS_Props = {
3
+ item: KProductItemData;
4
+ rowActions?: KProductRowAction[];
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
package/dist/types.d.mts CHANGED
@@ -1,13 +1,3 @@
1
- import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.mjs'
1
+ export { default } from './module.mjs'
2
2
 
3
- declare module '#app' {
4
- interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
5
- }
6
-
7
- declare module '@nuxt/schema' {
8
- interface NuxtHooks extends ModuleHooks {}
9
- interface RuntimeConfig extends ModuleRuntimeConfig {}
10
- interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
11
- }
12
-
13
- export * from "./module.mjs"
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/block-ecommerce",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.10",
4
4
  "description": "Pre-built eCommerce block components for Katlux toolkit",
5
5
  "author": "Katlux",
6
6
  "license": "MIT",
@@ -10,7 +10,8 @@
10
10
  "main": "./dist/module.mjs",
11
11
  "scripts": {
12
12
  "build": "nuxt-module-build build",
13
- "dev": "nuxt-module-build build --stub"
13
+ "dev": "nuxt-module-build build --stub",
14
+ "prepublishOnly": "npm run build"
14
15
  },
15
16
  "exports": {
16
17
  ".": {
package/dist/module.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export * from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module";
2
- export { default } from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-block-ecommerce/src/module";