@marvalt/shcoder 0.1.0
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/LICENSE +674 -0
- package/README.md +64 -0
- package/dist/components/MemberCard.d.ts +17 -0
- package/dist/components/MemberCard.d.ts.map +1 -0
- package/dist/components/MemberCardsGrid.d.ts +17 -0
- package/dist/components/MemberCardsGrid.d.ts.map +1 -0
- package/dist/components/MemberSlideshow.d.ts +17 -0
- package/dist/components/MemberSlideshow.d.ts.map +1 -0
- package/dist/components/TestimonialCard.d.ts +17 -0
- package/dist/components/TestimonialCard.d.ts.map +1 -0
- package/dist/components/TestimonialCardsGrid.d.ts +17 -0
- package/dist/components/TestimonialCardsGrid.d.ts.map +1 -0
- package/dist/components/TestimonialSlideshow.d.ts +17 -0
- package/dist/components/TestimonialSlideshow.d.ts.map +1 -0
- package/dist/hooks/useMembers.d.ts +26 -0
- package/dist/hooks/useMembers.d.ts.map +1 -0
- package/dist/hooks/useTestimonials.d.ts +26 -0
- package/dist/hooks/useTestimonials.d.ts.map +1 -0
- package/dist/index.cjs +1887 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1875 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/types/member.d.ts +67 -0
- package/dist/types/member.d.ts.map +1 -0
- package/dist/types/shortcode.d.ts +32 -0
- package/dist/types/shortcode.d.ts.map +1 -0
- package/dist/types/testimonial.d.ts +39 -0
- package/dist/types/testimonial.d.ts.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @marvalt/shcoder
|
|
2
|
+
|
|
3
|
+
Shortcode renderer components for DigiValt Custom Post Types (Members, Testimonials, Projects, etc.)
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides React components and hooks for rendering WordPress shortcodes in headless React applications. It works in conjunction with the `wp-custom-api-endpoints` WordPress plugin, which auto-discovers CPTs and registers shortcodes dynamically.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @marvalt/shcoder
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Components
|
|
18
|
+
|
|
19
|
+
#### Member Components
|
|
20
|
+
|
|
21
|
+
- **MemberCard** - Displays a single member profile
|
|
22
|
+
- **MemberCardsGrid** - Displays multiple members in a grid layout
|
|
23
|
+
- **MemberSlideshow** - Displays members in a rotating slideshow
|
|
24
|
+
|
|
25
|
+
#### Testimonial Components
|
|
26
|
+
|
|
27
|
+
- **TestimonialCard** - Displays a single testimonial
|
|
28
|
+
- **TestimonialCardsGrid** - Displays multiple testimonials in a grid layout
|
|
29
|
+
- **TestimonialSlideshow** - Displays testimonials in a rotating slideshow
|
|
30
|
+
|
|
31
|
+
### Hooks
|
|
32
|
+
|
|
33
|
+
- **useMembers** - Fetch members based on shortcode attributes
|
|
34
|
+
- **useMember** - Fetch a single member by ID
|
|
35
|
+
- **useTestimonials** - Fetch testimonials based on shortcode attributes
|
|
36
|
+
- **useTestimonial** - Fetch a single testimonial by ID
|
|
37
|
+
|
|
38
|
+
## WordPress Shortcodes
|
|
39
|
+
|
|
40
|
+
The following shortcodes are automatically registered by the `wp-custom-api-endpoints` plugin:
|
|
41
|
+
|
|
42
|
+
### Member Shortcodes
|
|
43
|
+
|
|
44
|
+
- `[member_card id="123"]` - Single member profile
|
|
45
|
+
- `[member_cards tax="leadership" cols="3" image="true"]` - Member grid
|
|
46
|
+
- `[member_slideshow category="leadership" interval="5000" show_bio="true"]` - Member slideshow
|
|
47
|
+
|
|
48
|
+
### Testimonial Shortcodes
|
|
49
|
+
|
|
50
|
+
- `[testimonial_card id="123"]` - Single testimonial
|
|
51
|
+
- `[testimonial_cards category="external" cols="2"]` - Testimonial grid
|
|
52
|
+
- `[testimonial_slideshow category="external" interval="5000"]` - Testimonial slideshow
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Set the WordPress API URL in your environment:
|
|
57
|
+
|
|
58
|
+
```env
|
|
59
|
+
VITE_WORDPRESS_API_URL=https://your-wordpress-site.com/wp-json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
GPL-3.0-or-later
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/member';
|
|
9
|
+
export interface MemberCardProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* MemberCard component - displays a single member profile
|
|
14
|
+
* Usage: [member_card id="123"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const MemberCard: React.FC<MemberCardProps>;
|
|
17
|
+
//# sourceMappingURL=MemberCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberCard.d.ts","sourceRoot":"","sources":["../../src/components/MemberCard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyChD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/member';
|
|
9
|
+
export interface MemberCardsGridProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* MemberCardsGrid component - displays multiple members in a grid
|
|
14
|
+
* Usage: [member_cards tax="leadership" cols="3" image="true"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const MemberCardsGrid: React.FC<MemberCardsGridProps>;
|
|
17
|
+
//# sourceMappingURL=MemberCardsGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberCardsGrid.d.ts","sourceRoot":"","sources":["../../src/components/MemberCardsGrid.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAyF1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/member';
|
|
9
|
+
export interface MemberSlideshowProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* MemberSlideshow component - displays members in a rotating slideshow
|
|
14
|
+
* Usage: [member_slideshow category="leadership" interval="5000" show_bio="true"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const MemberSlideshow: React.FC<MemberSlideshowProps>;
|
|
17
|
+
//# sourceMappingURL=MemberSlideshow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberSlideshow.d.ts","sourceRoot":"","sources":["../../src/components/MemberSlideshow.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgH1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/testimonial';
|
|
9
|
+
export interface TestimonialCardProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TestimonialCard component - displays a single testimonial
|
|
14
|
+
* Usage: [testimonial_card id="123"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const TestimonialCard: React.FC<TestimonialCardProps>;
|
|
17
|
+
//# sourceMappingURL=TestimonialCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestimonialCard.d.ts","sourceRoot":"","sources":["../../src/components/TestimonialCard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqC1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/testimonial';
|
|
9
|
+
export interface TestimonialCardsGridProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TestimonialCardsGrid component - displays multiple testimonials in a grid
|
|
14
|
+
* Usage: [testimonial_cards category="external" cols="2"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const TestimonialCardsGrid: React.FC<TestimonialCardsGridProps>;
|
|
17
|
+
//# sourceMappingURL=TestimonialCardsGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestimonialCardsGrid.d.ts","sourceRoot":"","sources":["../../src/components/TestimonialCardsGrid.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA0FpE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/testimonial';
|
|
9
|
+
export interface TestimonialSlideshowProps extends ShortcodeAttributes {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TestimonialSlideshow component - displays testimonials in a rotating slideshow
|
|
14
|
+
* Usage: [testimonial_slideshow category="external" interval="5000" showContent="true"]
|
|
15
|
+
*/
|
|
16
|
+
export declare const TestimonialSlideshow: React.FC<TestimonialSlideshowProps>;
|
|
17
|
+
//# sourceMappingURL=TestimonialSlideshow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestimonialSlideshow.d.ts","sourceRoot":"","sources":["../../src/components/TestimonialSlideshow.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA+GpE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import type { Member } from '../types/member';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/shortcode';
|
|
9
|
+
export declare function setWordPressApiUrl(url: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Hook to fetch members based on shortcode attributes
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMembers(attrs: ShortcodeAttributes): {
|
|
14
|
+
members: Member[];
|
|
15
|
+
loading: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Hook to fetch a single member by ID
|
|
20
|
+
*/
|
|
21
|
+
export declare function useMember(id: string | number): {
|
|
22
|
+
member: Member | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useMembers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMembers.d.ts","sourceRoot":"","sources":["../../src/hooks/useMembers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAS9D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,QAE7C;AAyBD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,mBAAmB;;;;EAsGpD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;;;;EAwE5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*/
|
|
7
|
+
import type { Testimonial } from '../types/testimonial';
|
|
8
|
+
import type { ShortcodeAttributes } from '../types/shortcode';
|
|
9
|
+
export declare function setWordPressApiUrl(url: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Hook to fetch testimonials based on shortcode attributes
|
|
12
|
+
*/
|
|
13
|
+
export declare function useTestimonials(attrs: ShortcodeAttributes): {
|
|
14
|
+
testimonials: Testimonial[];
|
|
15
|
+
loading: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Hook to fetch a single testimonial by ID
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTestimonial(id: string | number): {
|
|
22
|
+
testimonial: Testimonial | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useTestimonials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTestimonials.d.ts","sourceRoot":"","sources":["../../src/hooks/useTestimonials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAS9D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,QAE7C;AAyBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,mBAAmB;;;;EA6EzD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;;;;EAsCjD"}
|