feather-k-demo-utils 0.0.13 → 0.0.15
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 +43 -0
- package/lib/components/index.js +1 -0
- package/lib/styles/demo.css +33 -0
- package/lib/styles/styles.d.ts +4 -0
- package/lib/utils/cdnVersion.js +14 -0
- package/lib/utils/constants.js +20 -0
- package/lib/utils/index.js +6 -0
- package/lib/utils/publishDate.js +8 -0
- package/package.json +16 -12
package/README.md
CHANGED
|
@@ -46,3 +46,46 @@ import { PUBLISH_DATE } from '@feather-k-demo-utils/utils/publishDate';
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
This ensures the publish date is unique to each deployment and requires no code duplication across consuming projects.
|
|
49
|
+
|
|
50
|
+
## Quick Usage
|
|
51
|
+
|
|
52
|
+
- **Install:**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install feather-k-demo-utils
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- **Include demo styles:**
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import 'feather-k-demo-utils/styles/demo.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- **Use utils:**
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { PUBLISH_DATE, featherkStylesVersion } from 'feather-k-demo-utils/utils';
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- **Use components:**
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<script setup lang="ts">
|
|
74
|
+
import { DemoStats } from 'feather-k-demo-utils';
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<DemoStats />
|
|
79
|
+
</template>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **Verify package contents locally:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run build
|
|
86
|
+
npm pack
|
|
87
|
+
tar -tf feather-k-demo-utils-<version>.tgz
|
|
88
|
+
# confirm package/lib/styles/demo.css and package/lib/utils/index.js are present
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> Note: If you want a dedicated components subpath (e.g. `feather-k-demo-utils/components`), we can add it to `package.json` `exports`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DemoStats } from './DemoStats.vue';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
h1 {
|
|
2
|
+
color: var(--kendo-color-primary, limegreen);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* moved from demo-utilities */
|
|
6
|
+
.featherk-demo-form {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 1em;
|
|
10
|
+
|
|
11
|
+
.actions {
|
|
12
|
+
margin-top: 1em;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
gap: 0.5em;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.demo-stats-wrapper {
|
|
21
|
+
.demo-stats {
|
|
22
|
+
position: fixed;
|
|
23
|
+
right: var(--kendo-spacing-4);
|
|
24
|
+
bottom: var(--kendo-spacing-4);
|
|
25
|
+
background: hsl(from var(--kendo-color-primary) h s 90% / 0.5);
|
|
26
|
+
font-size: var(--kendo-font-size-sm);
|
|
27
|
+
margin: var(--kendo-spacing-2);
|
|
28
|
+
padding: var(--kendo-spacing-2);
|
|
29
|
+
border-radius: var(--kendo-border-radius-md);
|
|
30
|
+
box-shadow: var(--kendo-elevation-2);
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FEATHERK_STYLES_CDN_URL } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the version string (e.g. "1.2.3" or "latest") from a CDN URL for @featherk/styles.
|
|
4
|
+
* Returns the version as a string, or null if not found.
|
|
5
|
+
*/
|
|
6
|
+
export const getFeatherkStylesVersionFromUrl = (url) => {
|
|
7
|
+
const match = url.match(/@featherk\/styles@([^/]+)\//);
|
|
8
|
+
return match && typeof match[1] === "string" ? match[1] : null;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The resolved FeatherK styles version (evaluated at import time).
|
|
12
|
+
*/
|
|
13
|
+
export const FEATHERK_STYLES_VERSION = getFeatherkStylesVersionFromUrl(FEATHERK_STYLES_CDN_URL);
|
|
14
|
+
export const featherkStylesVersion = FEATHERK_STYLES_VERSION;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/utils/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Returns the FeatherK styles CDN URL.
|
|
4
|
+
* Uses import.meta.env.VITE_FEATHERK_STYLES_CDN_URL if available (Vite), otherwise falls back to the default CDN URL.
|
|
5
|
+
*/
|
|
6
|
+
export function getFeatherKStylesCdnUrl() {
|
|
7
|
+
// Check for Vite env variable if running in a Vite environment (type-safe)
|
|
8
|
+
if (typeof import.meta === 'object' &&
|
|
9
|
+
import.meta &&
|
|
10
|
+
'env' in import.meta &&
|
|
11
|
+
import.meta.env &&
|
|
12
|
+
import.meta.env.VITE_FEATHERK_STYLES_CDN_URL) {
|
|
13
|
+
return import.meta.env.VITE_FEATHERK_STYLES_CDN_URL;
|
|
14
|
+
}
|
|
15
|
+
return "https://cdn.jsdelivr.net/npm/@featherk/styles@latest/dist/styles.css";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The resolved FeatherK styles CDN URL (evaluated at import time).
|
|
19
|
+
*/
|
|
20
|
+
export const FEATHERK_STYLES_CDN_URL = getFeatherKStylesCdnUrl();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// publishDate.ts
|
|
2
|
+
/// <reference types="vite/client" />
|
|
3
|
+
// Utility to provide the publish date of the demo or app
|
|
4
|
+
// This value is injected by the consuming project at build time using Vite's define option.
|
|
5
|
+
// In your vite.config.ts, add:
|
|
6
|
+
// define: { 'import.meta.env.PUBLISH_DATE': JSON.stringify(process.env.PUBLISH_DATE || new Date().toISOString()) }
|
|
7
|
+
// Then, PUBLISH_DATE will be set at build time for each consuming app.
|
|
8
|
+
export const PUBLISH_DATE = import.meta.env.PUBLISH_DATE ?? "";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feather-k-demo-utils",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.es.js",
|
|
7
7
|
"module": "lib/index.es.js",
|
|
@@ -22,21 +22,28 @@
|
|
|
22
22
|
],
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
+
"types": "./lib/index.d.ts",
|
|
25
26
|
"import": "./lib/index.es.js",
|
|
26
27
|
"require": "./lib/index.umd.js",
|
|
27
28
|
"default": "./lib/index.es.js"
|
|
28
29
|
},
|
|
29
|
-
"./utils":
|
|
30
|
-
|
|
31
|
-
"import": "./lib/
|
|
32
|
-
"require": "./lib/
|
|
33
|
-
"default": "./lib/
|
|
30
|
+
"./utils": {
|
|
31
|
+
"types": "./lib/utils/index.d.ts",
|
|
32
|
+
"import": "./lib/utils/index.js",
|
|
33
|
+
"require": "./lib/utils/index.js",
|
|
34
|
+
"default": "./lib/utils/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./components": {
|
|
37
|
+
"types": "./lib/components/index.d.ts",
|
|
38
|
+
"import": "./lib/components/index.js",
|
|
39
|
+
"require": "./lib/components/index.js",
|
|
40
|
+
"default": "./lib/components/index.js"
|
|
34
41
|
},
|
|
35
42
|
"./styles/demo.css": "./lib/styles/demo.css"
|
|
36
43
|
},
|
|
37
44
|
"scripts": {
|
|
38
45
|
"dev": "vite",
|
|
39
|
-
"build": "tsc --project tsconfig.build.json && npm run copy-styles && npm run clean-lib
|
|
46
|
+
"build": "vite build && tsc --project tsconfig.build.json && npm run copy-styles && npm run clean-lib",
|
|
40
47
|
"copy-styles": "node scripts/copy-style.js",
|
|
41
48
|
"clean-lib": "node scripts/cleanup-lib.js",
|
|
42
49
|
"preview": "vite preview",
|
|
@@ -58,11 +65,8 @@
|
|
|
58
65
|
"lib/index.es.js",
|
|
59
66
|
"lib/index.d.ts",
|
|
60
67
|
"lib/index.umd.js",
|
|
61
|
-
"lib/utils",
|
|
62
|
-
"lib/styles",
|
|
63
68
|
"lib/components",
|
|
64
|
-
"lib/
|
|
65
|
-
"lib/styles
|
|
66
|
-
"lib/styles/index.d.ts"
|
|
69
|
+
"lib/utils",
|
|
70
|
+
"lib/styles"
|
|
67
71
|
]
|
|
68
72
|
}
|