@skeletonizer/utils 1.0.0 → 1.1.1
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 +1 -1
- package/README.md +4 -4
- package/dist/src/types/schema.types.d.ts.map +1 -1
- package/package.json +10 -9
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -89,13 +89,13 @@ type TSchemaConfig<T extends object> = {
|
|
|
89
89
|
The `repeat` property specifies the number of times the skeleton part of the component should be repeated whilst in loading state. Eg. if you pass a single `div` inside the skeleton-projected content, and set `repeat` to `5`, there will be 5 `div`s in the skeletonized content when `showSkeleton` is `true`.
|
|
90
90
|
The `schemaGenerator` property is a function that requires you to return the skeleton structure based on the provided schema configuration. It is a generic function that accepts an object of `T` and expects you to return a mirrored shape where all underlying primitive props should be of shape `SchemaItem<T[K]>`.
|
|
91
91
|
|
|
92
|
-
For example, if you want to render 10 students that have borrowed a book from a library, where the underlying data of each student looks like:
|
|
92
|
+
For example, if you want to render 10 (ex)students that have borrowed a book from a library, where the underlying data of each (ex)student looks like:
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
95
|
type TStudentLibraryMember = {
|
|
96
96
|
name: string;
|
|
97
97
|
age: number;
|
|
98
|
-
|
|
98
|
+
exStudent: boolean;
|
|
99
99
|
profilePicture: string | null;
|
|
100
100
|
booksBorrowed: Array<{ title: string; id: number }>;
|
|
101
101
|
};
|
|
@@ -109,7 +109,7 @@ const studentLibraryMemberSchemaGenerator: TSchemaConfig<TStudentLibraryMember>
|
|
|
109
109
|
schemaGenerator: () => ({
|
|
110
110
|
name: new SchemaItem<string>().words(2),
|
|
111
111
|
age: new SchemaItem<number>().number(18, 30),
|
|
112
|
-
|
|
112
|
+
exStudent: new SchemaItem<boolean>().boolean(),
|
|
113
113
|
profilePicture: new SchemaItem().identical('https://your-placeholder-image.jpg'),
|
|
114
114
|
booksBorrowed: Array.from({ length: 3 }, () => ({
|
|
115
115
|
title: new SchemaItem<string>().words(new SchemaItem<number>().number(3, 10).value),
|
|
@@ -122,7 +122,7 @@ const studentLibraryMemberSchemaGenerator: TSchemaConfig<TStudentLibraryMember>
|
|
|
122
122
|
Note: the underlying types must match - eg. you cannot use `name: new SchemaItem<number>().number(18, 30)` in the above example since the underlying type of the `name` property defined by `TStudentLibraryMember` is `string`. This ensures you can safely operate on the generated data in the skeletonized content.
|
|
123
123
|
|
|
124
124
|
## colorSchema
|
|
125
|
-
Generally speaking, you shouldn't need to adjust the color scheme of the skeletonized component in most cases. However, should you need to, the color scheme of the skeletonized views can be customized by providing the `
|
|
125
|
+
Generally speaking, you shouldn't need to adjust the color scheme of the skeletonized component in most cases. However, should you need to, the color scheme of the skeletonized views can be customized by providing the `colorSchema` input bound property to the `SkeletonizerSkeletonComponent`.
|
|
126
126
|
You can provide a custom color scheme by providing an object with the following shape:
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.types.d.ts","sourceRoot":"","sources":["../../../src/types/schema.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.types.d.ts","sourceRoot":"","sources":["../../../src/types/schema.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAG7E,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonizer/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Utils for all skeletonizer packages",
|
|
5
5
|
"author": "Luka Varga",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
"import": "./dist/utils.mjs",
|
|
23
23
|
"require": "./dist/utils.umd.js",
|
|
24
|
-
"types": "./dist/src/index.d.ts"
|
|
24
|
+
"types": "./dist/src/index.d.ts",
|
|
25
|
+
"default": "./dist/utils.mjs"
|
|
25
26
|
},
|
|
26
27
|
"publishConfig": {
|
|
27
28
|
"access": "public"
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
"type-check": "vitest --typecheck.only --watch=false",
|
|
41
42
|
"style-lint": "stylelint 'src/**/*.?(css|scss)' --color",
|
|
42
43
|
"style-lintfix": "stylelint 'src/**/*.?(css|scss)' --color --fix",
|
|
43
|
-
"lint": "eslint
|
|
44
|
-
"lintfix": "npm run style-lintfix && eslint
|
|
44
|
+
"lint": "eslint src/ && npm run style-lint",
|
|
45
|
+
"lintfix": "npm run style-lintfix && eslint src/ --fix",
|
|
45
46
|
"lint-staged": "lint-staged"
|
|
46
47
|
},
|
|
47
48
|
"lint-staged": {
|
|
@@ -49,10 +50,10 @@
|
|
|
49
50
|
"**/*.{ts,js}": "eslint --fix"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@vitest/coverage-istanbul": "2.1.
|
|
53
|
-
"sass": "^1.
|
|
54
|
-
"vite-plugin-dts": "^4.
|
|
55
|
-
"vitest": "2.1.
|
|
53
|
+
"@vitest/coverage-istanbul": "2.1.4",
|
|
54
|
+
"sass": "^1.80.5",
|
|
55
|
+
"vite-plugin-dts": "^4.3.0",
|
|
56
|
+
"vitest": "2.1.4"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a0b3a5c3b3d12cec97f9bf22830437ce1166c2a3"
|
|
58
59
|
}
|