@hkdigital/lib-core 0.5.95 → 0.5.96
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/README.md +30 -16
- package/dist/assets/meta/favicon.png +0 -0
- package/dist/assets/meta/preview-landscape.png +0 -0
- package/dist/assets/meta/preview-square.png +0 -0
- package/dist/config/meta.d.ts +56 -0
- package/dist/config/meta.js +121 -0
- package/dist/meta/templates/lib/meta.d.ts +1 -0
- package/dist/meta/utils/sitemap/typedef.d.ts +1 -1
- package/dist/meta.d.ts +8 -0
- package/dist/meta.js +23 -0
- package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +1 -1
- package/dist/ui/primitives/inputs/text-input/TextInput.svelte.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,19 +204,26 @@ This library includes a complete design system with Tailwind CSS integration. Ba
|
|
|
204
204
|
import heroResponsive from '$lib/assets/hero.jpg?preset=photo&responsive';
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
6. **
|
|
207
|
+
6. **Meta setup** - Configure SEO, PWA, and favicons:
|
|
208
208
|
|
|
209
|
-
The library includes
|
|
210
|
-
favicon generation, manifest.json, sitemap.xml, and robots.txt
|
|
209
|
+
The library includes templates for PWA configuration, SEO metadata,
|
|
210
|
+
favicon generation, manifest.json, sitemap.xml, and robots.txt.
|
|
211
211
|
|
|
212
|
-
**Copy
|
|
212
|
+
**Copy template files to your project:**
|
|
213
213
|
```bash
|
|
214
|
-
|
|
214
|
+
# Copy configuration and assets to src/lib/
|
|
215
|
+
cp -r node_modules/@hkdigital/lib-core/meta/templates/lib/* src/lib/
|
|
216
|
+
|
|
217
|
+
# Copy route endpoints to src/routes/
|
|
218
|
+
cp -r node_modules/@hkdigital/lib-core/meta/templates/routes/* src/routes/
|
|
215
219
|
```
|
|
216
220
|
|
|
217
221
|
**Customize for your app:**
|
|
218
|
-
- Replace `src/
|
|
219
|
-
|
|
222
|
+
- Replace images in `src/lib/assets/meta/` with your own:
|
|
223
|
+
- `favicon.png` (512×512px)
|
|
224
|
+
- `preview-landscape.png` (1200×630px for social media)
|
|
225
|
+
- `preview-square.png` (1200×1200px for social media)
|
|
226
|
+
- Edit `src/lib/config/meta.js`:
|
|
220
227
|
```javascript
|
|
221
228
|
export const name = 'Your App Name';
|
|
222
229
|
export const shortName = 'App';
|
|
@@ -226,11 +233,12 @@ This library includes a complete design system with Tailwind CSS integration. Ba
|
|
|
226
233
|
// Add your site routes for sitemap
|
|
227
234
|
export const siteRoutes = ['/', '/about', '/contact'];
|
|
228
235
|
|
|
229
|
-
// Configure robots.txt
|
|
236
|
+
// Configure robots.txt
|
|
230
237
|
export const robotsConfig = {
|
|
231
|
-
allowedHosts:
|
|
232
|
-
disallowedPaths: [
|
|
233
|
-
|
|
238
|
+
allowedHosts: '*', // '*' allows all hosts
|
|
239
|
+
disallowedPaths: [],
|
|
240
|
+
allowAiTraining: true,
|
|
241
|
+
allowAiReading: true
|
|
234
242
|
};
|
|
235
243
|
```
|
|
236
244
|
|
|
@@ -238,11 +246,14 @@ This library includes a complete design system with Tailwind CSS integration. Ba
|
|
|
238
246
|
```svelte
|
|
239
247
|
<!-- src/routes/+layout.svelte -->
|
|
240
248
|
<script>
|
|
241
|
-
import { Favicons, PWA } from '
|
|
249
|
+
import { Favicons, PWA, SEO, config } from '$lib/meta.js';
|
|
250
|
+
|
|
251
|
+
let { children, data } = $props();
|
|
242
252
|
</script>
|
|
243
253
|
|
|
244
|
-
<Favicons />
|
|
245
|
-
<PWA />
|
|
254
|
+
<Favicons {config} />
|
|
255
|
+
<PWA {config} />
|
|
256
|
+
<SEO {config} locale={data?.locale} />
|
|
246
257
|
|
|
247
258
|
{@render children()}
|
|
248
259
|
```
|
|
@@ -250,11 +261,14 @@ This library includes a complete design system with Tailwind CSS integration. Ba
|
|
|
250
261
|
**What you get:**
|
|
251
262
|
- Automatic favicon generation (16, 32, 192, 512px)
|
|
252
263
|
- Apple touch icons (120, 152, 167, 180px)
|
|
264
|
+
- SEO meta tags and Open Graph support
|
|
265
|
+
- Social media preview images
|
|
266
|
+
- Multi-language support with auto-detection
|
|
253
267
|
- Dynamic `/manifest.json` endpoint
|
|
254
268
|
- Dynamic `/sitemap.xml` endpoint
|
|
255
|
-
- Dynamic `/robots.txt` with
|
|
269
|
+
- Dynamic `/robots.txt` with AI bot control
|
|
256
270
|
|
|
257
|
-
See [
|
|
271
|
+
See the [meta template README](./src/lib/meta/templates/README.md) for
|
|
258
272
|
complete documentation.
|
|
259
273
|
|
|
260
274
|
### Logging System
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta data configuration
|
|
3
|
+
*/
|
|
4
|
+
export const name: "HKdigital Lib Core Test";
|
|
5
|
+
export const shortName: "HKlib Core";
|
|
6
|
+
export const description: "Base library that powers up Sveltekit projects";
|
|
7
|
+
/**
|
|
8
|
+
* Language and locale configuration
|
|
9
|
+
*
|
|
10
|
+
* Configure supported languages with their locale mappings.
|
|
11
|
+
* Short codes (e.g., 'en') are defaults, explicit variants optional.
|
|
12
|
+
*
|
|
13
|
+
* @type {Record<string, {lang: string, locale: string}>}
|
|
14
|
+
*/
|
|
15
|
+
export const languages: Record<string, {
|
|
16
|
+
lang: string;
|
|
17
|
+
locale: string;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Default language code (fallback)
|
|
21
|
+
*
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
export const defaultLanguage: string;
|
|
25
|
+
/**
|
|
26
|
+
* Default locale (derived from defaultLanguage)
|
|
27
|
+
*
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
30
|
+
export const defaultLocale: string;
|
|
31
|
+
export const backgroundAndThemeColor: "#082962";
|
|
32
|
+
export const themeColor: "#082962";
|
|
33
|
+
export const backgroundColor: "#082962";
|
|
34
|
+
export const statusBarStyle: "black-translucent";
|
|
35
|
+
export const orientation: "any";
|
|
36
|
+
export const disablePageZoom: true;
|
|
37
|
+
export const SeoImageLandscape: string;
|
|
38
|
+
export const SeoImageSquare: string;
|
|
39
|
+
export const faviconImages: import("./typedef").ImageSource;
|
|
40
|
+
export const appleTouchIcons: import("./typedef").ImageSource;
|
|
41
|
+
/**
|
|
42
|
+
* Site routes for sitemap.xml
|
|
43
|
+
*
|
|
44
|
+
* @type {import('../meta/typedef.js').SitemapRoute[]}
|
|
45
|
+
*
|
|
46
|
+
* @see hkdigital/lib-core/meta/README.md for detailed configuration options
|
|
47
|
+
*/
|
|
48
|
+
export const siteRoutes: import("../meta/typedef.js").SitemapRoute[];
|
|
49
|
+
/**
|
|
50
|
+
* Robots.txt configuration
|
|
51
|
+
*
|
|
52
|
+
* @type {import('../meta/typedef.js').RobotsConfig}
|
|
53
|
+
*
|
|
54
|
+
* @see hkdigital/lib-core/meta/README.md for detailed configuration options
|
|
55
|
+
*/
|
|
56
|
+
export const robotsConfig: import("../meta/typedef.js").RobotsConfig;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta data configuration
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const name = 'HKdigital Lib Core Test';
|
|
6
|
+
export const shortName = 'HKlib Core'; // max 12 characters
|
|
7
|
+
|
|
8
|
+
export const description = 'Base library that powers up Sveltekit projects';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Language and locale configuration
|
|
12
|
+
*
|
|
13
|
+
* Configure supported languages with their locale mappings.
|
|
14
|
+
* Short codes (e.g., 'en') are defaults, explicit variants optional.
|
|
15
|
+
*
|
|
16
|
+
* @type {Record<string, {lang: string, locale: string}>}
|
|
17
|
+
*/
|
|
18
|
+
export const languages = {
|
|
19
|
+
// Short codes (defaults)
|
|
20
|
+
'en': { lang: 'en-GB', locale: 'en_GB' },
|
|
21
|
+
'nl': { lang: 'nl-NL', locale: 'nl_NL' },
|
|
22
|
+
|
|
23
|
+
// Explicit variants (add as needed)
|
|
24
|
+
// 'en-us': { lang: 'en-US', locale: 'en_US' },
|
|
25
|
+
// 'es': { lang: 'es-ES', locale: 'es_ES' },
|
|
26
|
+
// 'es-mx': { lang: 'es-MX', locale: 'es_MX' }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Default language code (fallback)
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
export const defaultLanguage = 'en';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Default locale (derived from defaultLanguage)
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
*/
|
|
41
|
+
export const defaultLocale = languages[defaultLanguage].locale;
|
|
42
|
+
|
|
43
|
+
export const backgroundAndThemeColor = '#082962';
|
|
44
|
+
|
|
45
|
+
export const themeColor = backgroundAndThemeColor;
|
|
46
|
+
export const backgroundColor = backgroundAndThemeColor;
|
|
47
|
+
|
|
48
|
+
export const statusBarStyle = 'black-translucent';
|
|
49
|
+
|
|
50
|
+
export const orientation = 'any'; // "landscape"
|
|
51
|
+
|
|
52
|
+
//
|
|
53
|
+
// Only disable zoom if:
|
|
54
|
+
// - You're building a game
|
|
55
|
+
// - Canvas-based app where zoom breaks functionality
|
|
56
|
+
// - You have a very specific (technical) reason...
|
|
57
|
+
//
|
|
58
|
+
export const disablePageZoom = true;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* SEO social media preview images
|
|
62
|
+
*
|
|
63
|
+
* To enable: Import the image and export it
|
|
64
|
+
* To disable: Comment out the import and export null instead
|
|
65
|
+
*
|
|
66
|
+
* Processed dimensions:
|
|
67
|
+
* - Landscape: 1200×630 (Facebook, LinkedIn, Discord)
|
|
68
|
+
* - Square: 1200×1200 (various platforms)
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
// Import and export processed images
|
|
72
|
+
import SeoLandscapeImg from '../assets/meta/preview-landscape.png?seo-landscape';
|
|
73
|
+
import SeoSquareImg from '../assets/meta/preview-square.png?seo-square';
|
|
74
|
+
|
|
75
|
+
export const SeoImageLandscape = SeoLandscapeImg;
|
|
76
|
+
export const SeoImageSquare = SeoSquareImg;
|
|
77
|
+
|
|
78
|
+
// To disable, comment out imports above and uncomment below:
|
|
79
|
+
// export const SeoImageLandscape = null;
|
|
80
|
+
// export const SeoImageSquare = null;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Favicon images (processed by Vite imagetools)
|
|
84
|
+
*/
|
|
85
|
+
import FaviconImgs from '../assets/meta/favicon.png?favicons';
|
|
86
|
+
import AppleTouchImgs from '../assets/meta/favicon.png?apple-touch-icons';
|
|
87
|
+
|
|
88
|
+
export const faviconImages = FaviconImgs;
|
|
89
|
+
export const appleTouchIcons = AppleTouchImgs;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Site routes for sitemap.xml
|
|
93
|
+
*
|
|
94
|
+
* @type {import('../meta/typedef.js').SitemapRoute[]}
|
|
95
|
+
*
|
|
96
|
+
* @see hkdigital/lib-core/meta/README.md for detailed configuration options
|
|
97
|
+
*/
|
|
98
|
+
export const siteRoutes = [
|
|
99
|
+
'/'
|
|
100
|
+
// Add your routes:
|
|
101
|
+
// '/about',
|
|
102
|
+
// '/contact',
|
|
103
|
+
// { path: '/blog', priority: 0.9, changefreq: 'daily' }
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Robots.txt configuration
|
|
108
|
+
*
|
|
109
|
+
* @type {import('../meta/typedef.js').RobotsConfig}
|
|
110
|
+
*
|
|
111
|
+
* @see hkdigital/lib-core/meta/README.md for detailed configuration options
|
|
112
|
+
*/
|
|
113
|
+
export const robotsConfig = {
|
|
114
|
+
allowedHosts: '*', // '*' allows all hosts
|
|
115
|
+
disallowedPaths: [], // e.g., ['/admin', '/api']
|
|
116
|
+
|
|
117
|
+
// AI bot control (site-wide via robots.txt)
|
|
118
|
+
allowAiTraining: true, // GPTBot, Google-Extended, CCBot, anthropic-ai
|
|
119
|
+
allowAiReading: true // ChatGPT-User, Claude-Web, cohere-ai
|
|
120
|
+
};
|
|
121
|
+
|
|
@@ -12,7 +12,7 @@ export type SitemapRouteObject = {
|
|
|
12
12
|
/**
|
|
13
13
|
* - Change frequency
|
|
14
14
|
*/
|
|
15
|
-
changefreq?: "
|
|
15
|
+
changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Route can be a simple string path or an object with details
|
package/dist/meta.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Favicons } from './meta/components.js';
|
|
2
|
+
import { PWA } from './meta/components.js';
|
|
3
|
+
import { SEO } from './meta/components.js';
|
|
4
|
+
export const getLangFromPath: Function;
|
|
5
|
+
export const injectLang: Function;
|
|
6
|
+
export const handleLang: Function;
|
|
7
|
+
import * as config from './config/meta.js';
|
|
8
|
+
export { Favicons, PWA, SEO, config };
|
package/dist/meta.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta components configured for your app
|
|
3
|
+
*
|
|
4
|
+
* This file imports the library components and configures them with your
|
|
5
|
+
* app's config. Components are automatically updated when you update the
|
|
6
|
+
* @hkdigital/lib-core library.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Favicons, PWA, SEO } from './meta/components.js';
|
|
10
|
+
import { createLangUtils } from './meta/utils.js';
|
|
11
|
+
import * as config from './config/meta.js';
|
|
12
|
+
|
|
13
|
+
// Create configured language utilities
|
|
14
|
+
const { getLangFromPath, injectLang, handleLang } = createLangUtils(config);
|
|
15
|
+
|
|
16
|
+
// Re-export components (they'll receive config as a prop in your layout)
|
|
17
|
+
export { Favicons, PWA, SEO };
|
|
18
|
+
|
|
19
|
+
// Export language utilities
|
|
20
|
+
export { getLangFromPath, injectLang, handleLang };
|
|
21
|
+
|
|
22
|
+
// Export config for convenience
|
|
23
|
+
export { config };
|
|
@@ -12,7 +12,7 @@ type Button = {
|
|
|
12
12
|
size?: "sm" | "md" | "lg" | undefined;
|
|
13
13
|
variant?: string | undefined;
|
|
14
14
|
mode?: "light" | "dark" | undefined;
|
|
15
|
-
buttonType?: "
|
|
15
|
+
buttonType?: "button" | "reset" | "submit" | undefined;
|
|
16
16
|
active?: boolean | undefined;
|
|
17
17
|
selected?: boolean | undefined;
|
|
18
18
|
loading?: boolean | undefined;
|
|
@@ -12,7 +12,7 @@ type TextInput = {
|
|
|
12
12
|
iconClasses?: string | undefined;
|
|
13
13
|
initialValue?: string | undefined;
|
|
14
14
|
value?: string | undefined;
|
|
15
|
-
type?: "number" | "
|
|
15
|
+
type?: "number" | "url" | "email" | "text" | undefined;
|
|
16
16
|
pattern?: string | undefined;
|
|
17
17
|
required?: boolean | undefined;
|
|
18
18
|
title?: string | undefined;
|