@nubisco/cms-vue 0.0.0 → 1.0.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/resolve.d.ts +10 -0
- package/dist/resolve.js +25 -0
- package/package.json +12 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldValue, ImageValue, LinkValue, TRef } from './contract';
|
|
2
|
+
export declare function isTRef(v: unknown): v is TRef;
|
|
3
|
+
export declare function isImage(v: unknown): v is ImageValue;
|
|
4
|
+
export declare function isLink(v: unknown): v is LinkValue;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a field value to display text. String refs ({ $t }) resolve from the
|
|
7
|
+
* provided message table (Verba / locale JSON), falling back to the key so a
|
|
8
|
+
* missing translation is visible rather than blank.
|
|
9
|
+
*/
|
|
10
|
+
export declare function text(value: FieldValue | undefined, messages: Record<string, string>): string;
|
package/dist/resolve.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function isTRef(v) {
|
|
2
|
+
return typeof v === 'object' && v !== null && '$t' in v;
|
|
3
|
+
}
|
|
4
|
+
export function isImage(v) {
|
|
5
|
+
return typeof v === 'object' && v !== null && 'src' in v;
|
|
6
|
+
}
|
|
7
|
+
export function isLink(v) {
|
|
8
|
+
return typeof v === 'object' && v !== null && 'href' in v;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a field value to display text. String refs ({ $t }) resolve from the
|
|
12
|
+
* provided message table (Verba / locale JSON), falling back to the key so a
|
|
13
|
+
* missing translation is visible rather than blank.
|
|
14
|
+
*/
|
|
15
|
+
export function text(value, messages) {
|
|
16
|
+
if (value == null)
|
|
17
|
+
return '';
|
|
18
|
+
if (typeof value === 'string')
|
|
19
|
+
return value;
|
|
20
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
21
|
+
return String(value);
|
|
22
|
+
if (isTRef(value))
|
|
23
|
+
return messages[value.$t] ?? value.$t;
|
|
24
|
+
return '';
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubisco/cms-vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Nubisco CMS content contract and evaluator. The Vue render kit follows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"url": "git+https://github.com/nubisco/cms-vue.git"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
+
"packageManager": "pnpm@10.33.0",
|
|
11
12
|
"main": "./dist/index.js",
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
13
14
|
"exports": {
|
|
@@ -16,7 +17,9 @@
|
|
|
16
17
|
"default": "./dist/index.js"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
|
-
"files": [
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
20
23
|
"scripts": {
|
|
21
24
|
"build": "tsc -p tsconfig.json",
|
|
22
25
|
"types:check": "tsc --noEmit",
|
|
@@ -32,7 +35,9 @@
|
|
|
32
35
|
"access": "public"
|
|
33
36
|
},
|
|
34
37
|
"release": {
|
|
35
|
-
"branches": [
|
|
38
|
+
"branches": [
|
|
39
|
+
"master"
|
|
40
|
+
],
|
|
36
41
|
"plugins": [
|
|
37
42
|
"@semantic-release/commit-analyzer",
|
|
38
43
|
"@semantic-release/release-notes-generator",
|
|
@@ -42,7 +47,10 @@
|
|
|
42
47
|
[
|
|
43
48
|
"@semantic-release/git",
|
|
44
49
|
{
|
|
45
|
-
"assets": [
|
|
50
|
+
"assets": [
|
|
51
|
+
"package.json",
|
|
52
|
+
"CHANGELOG.md"
|
|
53
|
+
],
|
|
46
54
|
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
|
47
55
|
}
|
|
48
56
|
]
|