@skeletonizer/utils 0.0.23-alpha.0 → 1.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.
Files changed (42) hide show
  1. package/README.md +4 -4
  2. package/package.json +10 -9
  3. package/dist/src/components/index.d.ts +0 -3
  4. package/dist/src/components/index.d.ts.map +0 -1
  5. package/dist/src/components/skeleton.abstract.component.d.ts +0 -8
  6. package/dist/src/components/skeleton.abstract.component.d.ts.map +0 -1
  7. package/dist/src/components/skeleton.adapter.component.d.ts +0 -8
  8. package/dist/src/components/skeleton.adapter.component.d.ts.map +0 -1
  9. package/dist/src/constants/enum.constants.d.ts +0 -12
  10. package/dist/src/constants/enum.constants.d.ts.map +0 -1
  11. package/dist/src/constants/index.d.ts +0 -3
  12. package/dist/src/constants/index.d.ts.map +0 -1
  13. package/dist/src/constants/text.constants.d.ts +0 -2
  14. package/dist/src/constants/text.constants.d.ts.map +0 -1
  15. package/dist/src/directives/index.d.ts +0 -2
  16. package/dist/src/directives/index.d.ts.map +0 -1
  17. package/dist/src/directives/skeleton.directive.d.ts +0 -8
  18. package/dist/src/directives/skeleton.directive.d.ts.map +0 -1
  19. package/dist/src/helpers/date.helpers.d.ts +0 -5
  20. package/dist/src/helpers/date.helpers.d.ts.map +0 -1
  21. package/dist/src/helpers/index.d.ts +0 -2
  22. package/dist/src/helpers/index.d.ts.map +0 -1
  23. package/dist/src/index.d.ts +0 -5
  24. package/dist/src/index.d.ts.map +0 -1
  25. package/dist/src/models/index.d.ts +0 -3
  26. package/dist/src/models/index.d.ts.map +0 -1
  27. package/dist/src/models/schema-item.model.d.ts +0 -23
  28. package/dist/src/models/schema-item.model.d.ts.map +0 -1
  29. package/dist/src/models/schema.model.d.ts +0 -11
  30. package/dist/src/models/schema.model.d.ts.map +0 -1
  31. package/dist/src/types/color-schema.types.d.ts +0 -5
  32. package/dist/src/types/color-schema.types.d.ts.map +0 -1
  33. package/dist/src/types/index.d.ts +0 -4
  34. package/dist/src/types/index.d.ts.map +0 -1
  35. package/dist/src/types/schema.types.d.ts +0 -7
  36. package/dist/src/types/schema.types.d.ts.map +0 -1
  37. package/dist/src/types/spec/transformer.types.spec-d.d.ts +0 -2
  38. package/dist/src/types/spec/transformer.types.spec-d.d.ts.map +0 -1
  39. package/dist/src/types/transformer.types.d.ts +0 -5
  40. package/dist/src/types/transformer.types.d.ts.map +0 -1
  41. package/dist/utils.mjs +0 -678
  42. package/dist/utils.umd.js +0 -2
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
- isStudent: boolean;
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
- isStudent: new SchemaItem<boolean>().boolean(),
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 `colorScheme` input bound property to the `SkeletonizerSkeletonComponent`.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonizer/utils",
3
- "version": "0.0.23-alpha.0",
3
+ "version": "1.1.0",
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 --ext .ts src/ && npm run style-lint",
44
- "lintfix": "npm run style-lintfix && eslint --ext .ts src/ --fix",
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.2",
53
- "sass": "^1.72.0",
54
- "vite-plugin-dts": "^4.2.3",
55
- "vitest": "2.1.2"
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": "e93fde814bee1e5c1488c7bc195057a74b7d2d91"
58
+ "gitHead": "1cc1b5c8a71f0f2490f555edf700c238a64df3d1"
58
59
  }
@@ -1,3 +0,0 @@
1
- export * from './skeleton.abstract.component';
2
- export * from './skeleton.adapter.component';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Schema } from '../models';
2
- import { TSchemaConfig } from '../types';
3
- export declare abstract class SkeletonAbstractComponent<T extends object> {
4
- abstract skeletonConfig: TSchemaConfig<T>;
5
- abstract showSkeleton: boolean;
6
- proxy(scope: T | Schema<T>): T;
7
- }
8
- //# sourceMappingURL=skeleton.abstract.component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton.abstract.component.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton.abstract.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,8BAAsB,yBAAyB,CAAC,CAAC,SAAS,MAAM;IAC9D,SAAgB,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACjD,SAAgB,YAAY,EAAE,OAAO,CAAC;IAM/B,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;CAGtC"}
@@ -1,8 +0,0 @@
1
- import { TSchemaConfig } from '../types';
2
- import { Schema } from '../models';
3
- export declare class SkeletonAdapterComponent<T extends object> {
4
- config: TSchemaConfig<T> | null;
5
- viewModels: Array<Schema<T>>;
6
- setupModels(): void;
7
- }
8
- //# sourceMappingURL=skeleton.adapter.component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton.adapter.component.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton.adapter.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,qBAAa,wBAAwB,CAAC,CAAC,SAAS,MAAM;IAC7C,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IACvC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAM;IAGlC,WAAW,IAAI,IAAI;CAM3B"}
@@ -1,12 +0,0 @@
1
- export declare enum SkeletonizedDataEnum {
2
- Text = "text",
3
- Input = "input",
4
- Image = "image",
5
- Video = "video",
6
- WrapperElement = "wrapper-element"
7
- }
8
- export declare enum SkeletonizerColorSchemaEnum {
9
- PrimaryColor = "rgba(100, 100, 100, .6)",
10
- SecondaryColor = "rgba(100, 100, 100, .3)"
11
- }
12
- //# sourceMappingURL=enum.constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enum.constants.d.ts","sourceRoot":"","sources":["../../../src/constants/enum.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,cAAc,oBAAoB;CACnC;AAED,oBAAY,2BAA2B;IACrC,YAAY,4BAA4B;IACxC,cAAc,4BAA4B;CAC3C"}
@@ -1,3 +0,0 @@
1
- export * from './text.constants';
2
- export * from './enum.constants';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const LOREM_IPSUM: string[];
2
- //# sourceMappingURL=text.constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.constants.d.ts","sourceRoot":"","sources":["../../../src/constants/text.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAE,MAAM,EA8e/B,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './skeleton.directive';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1,8 +0,0 @@
1
- import { ISkeletonizerColorSchema } from '../types';
2
- export declare class SkeletonDirective {
3
- static readonly dataAttr: string;
4
- static skeletonizeProjectedTemplate(template: HTMLElement, colorSchema?: ISkeletonizerColorSchema): void;
5
- private static skeletonizedSpanGenerator;
6
- private static assertAs;
7
- }
8
- //# sourceMappingURL=skeleton.directive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton.directive.d.ts","sourceRoot":"","sources":["../../../src/directives/skeleton.directive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,iBAAiB;IAC5B,gBAAuB,QAAQ,EAAE,MAAM,CAAuB;WAEhD,4BAA4B,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,wBAAwB,GAAG,IAAI;IAiF/G,OAAO,CAAC,MAAM,CAAC,yBAAyB;IASxC,OAAO,CAAC,MAAM,CAAC,QAAQ;CACxB"}
@@ -1,5 +0,0 @@
1
- export declare class DateHelpers {
2
- static daysInMs(days: number): number;
3
- static dateBetween(min: Date, max: Date): Date;
4
- }
5
- //# sourceMappingURL=date.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/date.helpers.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;WACR,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;WAI9B,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI;CAGtD"}
@@ -1,2 +0,0 @@
1
- export * from './date.helpers';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from './components';
2
- export * from './models';
3
- export * from './types';
4
- export * from './directives';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './schema.model';
2
- export * from './schema-item.model';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
@@ -1,23 +0,0 @@
1
- type TSchemaInstance<T> = InstanceType<typeof SchemaItem<T>>;
2
- export declare class SchemaItem<T = never> {
3
- #private;
4
- get value(): T;
5
- words(this: TSchemaInstance<string | undefined>, count: number): TSchemaInstance<string>;
6
- paragraphs(this: TSchemaInstance<string | undefined>, count: number): TSchemaInstance<string>;
7
- number(this: TSchemaInstance<number | undefined>, min?: number, max?: number): TSchemaInstance<number>;
8
- multiply(this: TSchemaInstance<number>, multiplier: number): TSchemaInstance<number>;
9
- date(this: TSchemaInstance<Date | undefined>, config?: Partial<{
10
- isFuture: boolean;
11
- isPast: boolean;
12
- max: Date;
13
- min: Date;
14
- }>): TSchemaInstance<Date>;
15
- uuid(this: TSchemaInstance<number | undefined>): TSchemaInstance<number>;
16
- boolean(this: TSchemaInstance<boolean | undefined>): TSchemaInstance<boolean>;
17
- symbol(this: TSchemaInstance<symbol | undefined>, val?: string | number): TSchemaInstance<symbol>;
18
- identical<R>(this: TSchemaInstance<R | undefined>, identity: R): TSchemaInstance<R>;
19
- private assertType;
20
- private randomLoremWord;
21
- }
22
- export {};
23
- //# sourceMappingURL=schema-item.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-item.model.d.ts","sourceRoot":"","sources":["../../../src/models/schema-item.model.ts"],"names":[],"mappings":"AAKA,KAAK,eAAe,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D,qBAAa,UAAU,CAAC,CAAC,GAAG,KAAK;;IAC/B,IAAW,KAAK,IAAI,CAAC,CAEpB;IAIM,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAexF,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAsB7F,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,GAAE,MAAU,EAAE,GAAG,GAAE,MAAa,GAAG,eAAe,CAAC,MAAM,CAAC;IAO/G,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAOpF,IAAI,CACT,IAAI,EAAE,eAAe,CAAC,IAAI,GAAG,SAAS,CAAC,EACvC,MAAM,GAAE,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,CAAM,GACjF,eAAe,CAAC,IAAI,CAAC;IAiBjB,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC;IAQxE,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC;IAO7E,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,GAAE,MAAM,GAAG,MAAU,GAAG,eAAe,CAAC,MAAM,CAAC;IAOpG,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAO1F,OAAO,CAAC,UAAU;IAElB,OAAO,CAAC,eAAe;CAKxB"}
@@ -1,11 +0,0 @@
1
- import { TSchemaGenerator, TSchemaTransformer } from '../types';
2
- export declare class Schema<T extends object> {
3
- readonly generator: TSchemaGenerator<T>;
4
- readonly uuid: number;
5
- readonly viewModel: TSchemaTransformer<T>;
6
- get value(): T;
7
- private readonly val;
8
- constructor(generator: TSchemaGenerator<T>);
9
- private static modelToValue;
10
- }
11
- //# sourceMappingURL=schema.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.model.d.ts","sourceRoot":"","sources":["../../../src/models/schema.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIhE,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM;aAWhB,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAVhD,SAAgB,IAAI,EAAE,MAAM,CAAe;IAC3C,SAAgB,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAEjD,IAAW,KAAK,IAAI,CAAC,CAEpB;IAED,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAI;gBAGN,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAMhD,OAAO,CAAC,MAAM,CAAC,YAAY;CAiB5B"}
@@ -1,5 +0,0 @@
1
- export interface ISkeletonizerColorSchema {
2
- primaryColor: string;
3
- secondaryColor: string;
4
- }
5
- //# sourceMappingURL=color-schema.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-schema.types.d.ts","sourceRoot":"","sources":["../../../src/types/color-schema.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB"}
@@ -1,4 +0,0 @@
1
- export * from './color-schema.types';
2
- export * from './schema.types';
3
- export * from './transformer.types';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
@@ -1,7 +0,0 @@
1
- import { TSchemaTransformer } from './transformer.types';
2
- export type TSchemaGenerator<T extends object> = () => TSchemaTransformer<T>;
3
- export type TSchemaConfig<T extends object> = {
4
- repeat: number;
5
- schemaGenerator: TSchemaGenerator<T>;
6
- };
7
- //# sourceMappingURL=schema.types.d.ts.map
@@ -1 +0,0 @@
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;AAE7E,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=transformer.types.spec-d.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformer.types.spec-d.d.ts","sourceRoot":"","sources":["../../../../src/types/spec/transformer.types.spec-d.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { SchemaItem } from '../models';
2
- export type TSchemaTransformer<T> = T extends Array<infer Element> ? Array<TSchemaTransformer<Element>> : T extends Date ? SchemaItem<Date> : T extends boolean ? SchemaItem<boolean> : T extends object ? {
3
- [K in keyof T]: TSchemaTransformer<T[K]>;
4
- } : SchemaItem<T>;
5
- //# sourceMappingURL=transformer.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformer.types.d.ts","sourceRoot":"","sources":["../../../src/types/transformer.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC9B,CAAC,SAAS,KAAK,CAAC,MAAM,OAAO,CAAC,GAC1B,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAClC,CAAC,SAAS,IAAI,GACZ,UAAU,CAAC,IAAI,CAAC,GAChB,CAAC,SAAS,OAAO,GACf,UAAU,CAAC,OAAO,CAAC,GACnB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC5C,UAAU,CAAC,CAAC,CAAC,CAAC"}
package/dist/utils.mjs DELETED
@@ -1,678 +0,0 @@
1
- var b = (s) => {
2
- throw TypeError(s);
3
- };
4
- var f = (s, e, t) => e.has(s) || b("Cannot " + t);
5
- var h = (s, e, t) => (f(s, e, "read from private field"), t ? t.call(s) : e.get(s)), q = (s, e, t) => e.has(s) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), u = (s, e, t, i) => (f(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t);
6
- const y = [
7
- "Lorem",
8
- "ipsum",
9
- "dolor",
10
- "sit",
11
- "amet,",
12
- "consectetur",
13
- "adipiscing",
14
- "elit.",
15
- "Mauris",
16
- "posuere",
17
- "tincidunt",
18
- "purus,",
19
- "id",
20
- "laoreet",
21
- "mauris",
22
- "cursus",
23
- "nec.",
24
- "Quisque",
25
- "id",
26
- "ante",
27
- "id",
28
- "tellus",
29
- "aliquam",
30
- "pulvinar",
31
- "eget",
32
- "eu",
33
- "dolor.",
34
- "Donec",
35
- "egestas",
36
- "dapibus",
37
- "massa,",
38
- "vel",
39
- "finibus",
40
- "lectus",
41
- "congue",
42
- "eu.",
43
- "Morbi",
44
- "quis",
45
- "erat",
46
- "condimentum,",
47
- "molestie",
48
- "ex",
49
- "a,",
50
- "sollicitudin",
51
- "metus.",
52
- "Vestibulum",
53
- "orci",
54
- "metus,",
55
- "sagittis",
56
- "a",
57
- "sagittis",
58
- "a,",
59
- "varius",
60
- "id",
61
- "diam.",
62
- "Cras",
63
- "egestas",
64
- "eros",
65
- "vestibulum,",
66
- "tempus",
67
- "ipsum",
68
- "pellentesque,",
69
- "dictum",
70
- "justo.",
71
- "Quisque",
72
- "sed",
73
- "justo",
74
- "metus.",
75
- "Suspendisse",
76
- "id",
77
- "felis",
78
- "vitae",
79
- "nunc",
80
- "auctor",
81
- "tristique",
82
- "eu",
83
- "sit",
84
- "amet",
85
- "mi.",
86
- "Ut",
87
- "luctus",
88
- "posuere",
89
- "viverra.",
90
- "Nunc",
91
- "sed",
92
- "augue",
93
- "a",
94
- "velit",
95
- "sodales",
96
- "iaculis.",
97
- "Sed",
98
- "at",
99
- "arcu",
100
- "non",
101
- "massa",
102
- "hendrerit",
103
- "scelerisque.",
104
- "Nunc",
105
- "commodo",
106
- "vulputate",
107
- "vestibulum.",
108
- "Duis",
109
- "ut",
110
- "leo",
111
- "nisi.",
112
- "Mauris",
113
- "dignissim",
114
- "quis",
115
- "sem",
116
- "non",
117
- "blandit.",
118
- "Suspendisse",
119
- "id",
120
- "elit",
121
- "eget",
122
- "leo",
123
- "efficitur",
124
- "maximus.",
125
- "Ut",
126
- "eu",
127
- "auctor",
128
- "ligula.",
129
- "Nulla",
130
- "in",
131
- "leo",
132
- "luctus,",
133
- "tempor",
134
- "justo",
135
- "vitae,",
136
- "condimentum",
137
- "massa.",
138
- "Quisque",
139
- "venenatis",
140
- "elementum",
141
- "posuere.",
142
- "Sed",
143
- "bibendum",
144
- "bibendum",
145
- "enim,",
146
- "in",
147
- "faucibus",
148
- "ante.",
149
- "Aliquam",
150
- "pretium",
151
- "sapien",
152
- "ac",
153
- "eleifend",
154
- "suscipit.",
155
- "Duis",
156
- "lacinia",
157
- "justo",
158
- "quis",
159
- "diam",
160
- "elementum,",
161
- "vitae",
162
- "fringilla",
163
- "lectus",
164
- "faucibus.",
165
- "Integer",
166
- "dictum",
167
- "commodo",
168
- "diam",
169
- "a",
170
- "tempus.",
171
- "Aenean",
172
- "elementum",
173
- "egestas",
174
- "quam,",
175
- "eget",
176
- "feugiat",
177
- "ligula",
178
- "imperdiet",
179
- "vitae.",
180
- "Morbi",
181
- "mattis",
182
- "dui",
183
- "sed",
184
- "elementum",
185
- "mollis.",
186
- "In",
187
- "interdum",
188
- "viverra",
189
- "urna,",
190
- "at",
191
- "scelerisque",
192
- "sapien.",
193
- "Sed",
194
- "molestie",
195
- "blandit",
196
- "risus",
197
- "nec",
198
- "ornare.",
199
- "Integer",
200
- "pharetra",
201
- "massa",
202
- "purus,",
203
- "ut",
204
- "fringilla",
205
- "augue",
206
- "sollicitudin",
207
- "in.",
208
- "Pellentesque",
209
- "eu",
210
- "leo",
211
- "pharetra,",
212
- "hendrerit",
213
- "lectus",
214
- "id,",
215
- "dapibus",
216
- "ipsum.",
217
- "Quisque",
218
- "tincidunt",
219
- "euismod",
220
- "venenatis.",
221
- "Sed",
222
- "lacus",
223
- "ex,",
224
- "pulvinar",
225
- "at",
226
- "dui",
227
- "vitae,",
228
- "condimentum",
229
- "rutrum",
230
- "eros.",
231
- "Nunc",
232
- "viverra",
233
- "cursus",
234
- "ante,",
235
- "ac",
236
- "dapibus",
237
- "ligula",
238
- "volutpat",
239
- "nec.",
240
- "Integer",
241
- "commodo",
242
- "in",
243
- "tortor",
244
- "eget",
245
- "aliquet.",
246
- "Nam",
247
- "bibendum",
248
- "lectus",
249
- "vitae",
250
- "ligula",
251
- "interdum",
252
- "scelerisque.",
253
- "Morbi",
254
- "sit",
255
- "amet",
256
- "augue",
257
- "diam.",
258
- "Etiam",
259
- "purus",
260
- "lorem,",
261
- "sodales",
262
- "sed",
263
- "sodales",
264
- "ac,",
265
- "dignissim",
266
- "a",
267
- "tellus.",
268
- "Nunc",
269
- "vehicula",
270
- "nibh",
271
- "in",
272
- "erat",
273
- "rhoncus",
274
- "ullamcorper.",
275
- "Orci",
276
- "varius",
277
- "natoque",
278
- "penatibus",
279
- "et",
280
- "magnis",
281
- "dis",
282
- "parturient",
283
- "montes,",
284
- "nascetur",
285
- "ridiculus",
286
- "mus.",
287
- "Aliquam",
288
- "augue",
289
- "nunc,",
290
- "fringilla",
291
- "at",
292
- "dictum",
293
- "quis,",
294
- "luctus",
295
- "sit",
296
- "amet",
297
- "nisl.",
298
- "Nam",
299
- "lectus",
300
- "felis,",
301
- "egestas",
302
- "nec",
303
- "lacinia",
304
- "non,",
305
- "auctor",
306
- "eget",
307
- "lorem.",
308
- "Nunc",
309
- "vel",
310
- "velit",
311
- "quis",
312
- "magna",
313
- "hendrerit",
314
- "volutpat",
315
- "in",
316
- "nec",
317
- "leo.",
318
- "Aenean",
319
- "tempor",
320
- "lectus",
321
- "tortor,",
322
- "nec",
323
- "bibendum",
324
- "elit",
325
- "aliquam",
326
- "at.",
327
- "In",
328
- "id",
329
- "libero",
330
- "tincidunt,",
331
- "interdum",
332
- "libero",
333
- "sit",
334
- "amet,",
335
- "gravida",
336
- "est.",
337
- "Morbi",
338
- "ut",
339
- "ipsum",
340
- "enim.",
341
- "Duis",
342
- "vel",
343
- "posuere",
344
- "ante.",
345
- "Praesent",
346
- "sollicitudin",
347
- "lacus",
348
- "sit",
349
- "amet",
350
- "luctus",
351
- "euismod.",
352
- "Phasellus",
353
- "lorem",
354
- "elit,",
355
- "auctor",
356
- "sed",
357
- "risus",
358
- "a,",
359
- "faucibus",
360
- "tempor",
361
- "lacus.",
362
- "Integer",
363
- "id",
364
- "tellus",
365
- "ut",
366
- "eros",
367
- "congue",
368
- "ornare.",
369
- "Cras",
370
- "vitae",
371
- "ornare",
372
- "sem.",
373
- "Cras",
374
- "tincidunt",
375
- "arcu",
376
- "efficitur",
377
- "mauris",
378
- "molestie,",
379
- "eu",
380
- "eleifend",
381
- "eros",
382
- "mattis.",
383
- "Integer",
384
- "id",
385
- "diam",
386
- "mauris.",
387
- "Duis",
388
- "suscipit",
389
- "enim",
390
- "risus,",
391
- "non",
392
- "dignissim",
393
- "nulla",
394
- "imperdiet",
395
- "hendrerit.",
396
- "Vestibulum",
397
- "sed",
398
- "dignissim",
399
- "erat.",
400
- "Aliquam",
401
- "erat",
402
- "volutpat.",
403
- "Nunc",
404
- "mattis",
405
- "auctor",
406
- "justo,",
407
- "non",
408
- "fringilla",
409
- "dolor",
410
- "blandit",
411
- "a.",
412
- "Donec",
413
- "et",
414
- "velit",
415
- "tristique",
416
- "lacus",
417
- "varius",
418
- "aliquam.",
419
- "Praesent",
420
- "ac",
421
- "molestie",
422
- "quam,",
423
- "vitae",
424
- "scelerisque",
425
- "tellus.",
426
- "Praesent",
427
- "eleifend",
428
- "sed",
429
- "diam",
430
- "in",
431
- "gravida.",
432
- "Donec",
433
- "tristique",
434
- "sapien",
435
- "ante,",
436
- "in",
437
- "egestas",
438
- "diam",
439
- "porta",
440
- "ac.",
441
- "Proin",
442
- "ac",
443
- "justo",
444
- "eleifend,",
445
- "consequat",
446
- "ante",
447
- "vitae,",
448
- "laoreet",
449
- "augue.",
450
- "Mauris",
451
- "scelerisque",
452
- "arcu",
453
- "dolor,",
454
- "quis",
455
- "lobortis",
456
- "risus",
457
- "pellentesque",
458
- "eu.",
459
- "Praesent",
460
- "in",
461
- "enim",
462
- "a",
463
- "elit",
464
- "feugiat",
465
- "dapibus.",
466
- "Duis",
467
- "quis",
468
- "bibendum",
469
- "mi.",
470
- "Vestibulum",
471
- "lacinia,",
472
- "sem",
473
- "at",
474
- "efficitur",
475
- "volutpat,",
476
- "velit",
477
- "ligula",
478
- "vulputate",
479
- "nisi,",
480
- "sit",
481
- "amet",
482
- "dapibus",
483
- "risus",
484
- "metus",
485
- "sed",
486
- "est.",
487
- "Sed",
488
- "in",
489
- "venenatis",
490
- "ante.",
491
- "Pellentesque",
492
- "vel",
493
- "ipsum",
494
- "pharetra,",
495
- "efficitur",
496
- "quam",
497
- "ut,",
498
- "hendrerit",
499
- "dolor."
500
- ];
501
- var l = /* @__PURE__ */ ((s) => (s.Text = "text", s.Input = "input", s.Image = "image", s.Video = "video", s.WrapperElement = "wrapper-element", s))(l || {}), v = /* @__PURE__ */ ((s) => (s.PrimaryColor = "rgba(100, 100, 100, .6)", s.SecondaryColor = "rgba(100, 100, 100, .3)", s))(v || {});
502
- class g {
503
- static daysInMs(e) {
504
- return e * 24 * 60 * 60 * 1e3;
505
- }
506
- static dateBetween(e, t) {
507
- return new Date(e.getTime() + Math.random() * (t.getTime() - e.getTime()));
508
- }
509
- }
510
- let M = 0;
511
- var r;
512
- class x {
513
- constructor() {
514
- q(this, r);
515
- }
516
- get value() {
517
- return h(this, r);
518
- }
519
- words(e) {
520
- this.assertType();
521
- let t = "", i = 0;
522
- for (; i < e; )
523
- t += this.randomLoremWord() + " ", i++;
524
- return u(this, r, t.trim()), this;
525
- }
526
- paragraphs(e) {
527
- this.assertType();
528
- let t = "", i = 0;
529
- const c = 50;
530
- for (; i < e; ) {
531
- const o = c - Math.round(c * Math.random() * 0.2) * (Math.random() < 0.5 ? -1 : 1);
532
- t += this.words(o).value, i !== e - 1 && (t += `
533
- `), i++;
534
- }
535
- return u(this, r, t), this;
536
- }
537
- number(e = 0, t = 1e3) {
538
- return this.assertType(), u(this, r, Math.ceil(Math.random() * (t - e)) + e), this;
539
- }
540
- multiply(e) {
541
- return this.assertType(), u(this, r, h(this, r) * e), this;
542
- }
543
- date(e = {}) {
544
- this.assertType();
545
- let t = e.max ?? /* @__PURE__ */ new Date("2100-01-01"), i = e.min ?? /* @__PURE__ */ new Date("1970-01-01");
546
- return e.isFuture ? i = new Date(Date.now() + g.daysInMs(1)) : e.isPast && (t = new Date(Date.now() - g.daysInMs(1))), u(this, r, g.dateBetween(i, t)), this;
547
- }
548
- uuid() {
549
- return M++, this.assertType(), u(this, r, M), this;
550
- }
551
- boolean() {
552
- return this.assertType(), u(this, r, Math.random() <= 0.5), this;
553
- }
554
- symbol(e = 0) {
555
- return this.assertType(), u(this, r, Symbol(e)), this;
556
- }
557
- identical(e) {
558
- return this.assertType(), u(this, r, e), this;
559
- }
560
- assertType() {
561
- }
562
- randomLoremWord() {
563
- const e = Math.floor(Math.random() * y.length);
564
- return y[e] ?? "lorem";
565
- }
566
- }
567
- r = new WeakMap();
568
- let I = 0;
569
- class d {
570
- constructor(e) {
571
- this.generator = e, this.uuid = I++, this.viewModel = this.generator(), this.val = d.modelToValue(this.viewModel);
572
- }
573
- get value() {
574
- return this.val;
575
- }
576
- static modelToValue(e) {
577
- if (e instanceof x)
578
- return e.value;
579
- if (Array.isArray(e))
580
- return e.map(this.modelToValue);
581
- {
582
- const t = {};
583
- return Object.keys(e).forEach((i) => {
584
- t[i] = d.modelToValue(
585
- e[i]
586
- );
587
- }), t;
588
- }
589
- }
590
- }
591
- class P {
592
- // when accessing skeletonized component properties / methods from within the view, they should be accessed via proxy method
593
- // this is necessary to ensure:
594
- // - that all properties / methods accessed from within skeletonized part of the view are a part of skeletonSchema
595
- // - that typescript understands correct type of each property / method accessed from within the skeletonized part of the view
596
- proxy(e) {
597
- return e instanceof d ? e.value : e;
598
- }
599
- }
600
- class D {
601
- constructor() {
602
- this.config = null, this.viewModels = [];
603
- }
604
- // the method should be called from within specific packages whenever the adapter component's config changes
605
- setupModels() {
606
- if (this.config) {
607
- const e = this.config.schemaGenerator;
608
- this.viewModels = Array.from({ length: this.config.repeat }, () => new d(e));
609
- }
610
- }
611
- }
612
- const n = class n {
613
- static skeletonizeProjectedTemplate(e, t) {
614
- const i = (t == null ? void 0 : t.primaryColor) ?? v.PrimaryColor, c = (t == null ? void 0 : t.secondaryColor) ?? v.SecondaryColor;
615
- e.setAttribute(
616
- "style",
617
- `--skeletonizer-primary-color: ${i}; --skeletonizer-secondary-color: ${c};`
618
- ), Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach((o) => {
619
- const A = [
620
- "br",
621
- "b",
622
- "strong",
623
- "i",
624
- "em",
625
- "mark",
626
- "small",
627
- "del",
628
- "ins",
629
- "sub",
630
- "sup"
631
- ], p = Array.from(o.childNodes).map((a) => a.nodeName.toLowerCase()).filter((a) => !A.includes(a)), w = p.length > 0 && p.some((a) => a !== p[0]);
632
- o.childNodes.forEach((a) => {
633
- switch (a.nodeName.toLowerCase()) {
634
- case "#text": {
635
- if (this.assertAs(a), a.wholeText.trim())
636
- if (w) {
637
- const m = document.createElement("span");
638
- m.innerText = a.cloneNode().wholeText, m.innerText.length && a.replaceWith(
639
- n.skeletonizedSpanGenerator(m.innerText, l.Text)
640
- );
641
- } else {
642
- const m = n.skeletonizedSpanGenerator(o.innerHTML, l.Text);
643
- o.innerHTML = m.outerHTML;
644
- }
645
- break;
646
- }
647
- case "input": {
648
- a.setAttribute(n.dataAttr, l.Input);
649
- break;
650
- }
651
- case "img": {
652
- a.setAttribute(n.dataAttr, l.Image);
653
- break;
654
- }
655
- case "video": {
656
- a.setAttribute(n.dataAttr, l.Video);
657
- break;
658
- }
659
- }
660
- });
661
- }), e.setAttribute(n.dataAttr, l.WrapperElement);
662
- }
663
- static skeletonizedSpanGenerator(e, t) {
664
- const i = document.createElement("span");
665
- return i.innerHTML = e, i.setAttribute(n.dataAttr, t), i;
666
- }
667
- static assertAs(e) {
668
- }
669
- };
670
- n.dataAttr = "data-skeletonizer";
671
- let T = n;
672
- export {
673
- d as Schema,
674
- x as SchemaItem,
675
- P as SkeletonAbstractComponent,
676
- D as SkeletonAdapterComponent,
677
- T as SkeletonDirective
678
- };
package/dist/utils.umd.js DELETED
@@ -1,2 +0,0 @@
1
- (function(t,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(t=typeof globalThis<"u"?globalThis:t||self,s(t["@skeletonizer/utils"]={}))})(this,function(t){"use strict";var M=t=>{throw TypeError(t)};var A=(t,s,a)=>s.has(t)||M("Cannot "+a);var y=(t,s,a)=>(A(t,s,"read from private field"),a?a.call(t):s.get(t)),w=(t,s,a)=>s.has(t)?M("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),m=(t,s,a,d)=>(A(t,s,"write to private field"),d?d.call(t,a):s.set(t,a),a);var l;const s=["Lorem","ipsum","dolor","sit","amet,","consectetur","adipiscing","elit.","Mauris","posuere","tincidunt","purus,","id","laoreet","mauris","cursus","nec.","Quisque","id","ante","id","tellus","aliquam","pulvinar","eget","eu","dolor.","Donec","egestas","dapibus","massa,","vel","finibus","lectus","congue","eu.","Morbi","quis","erat","condimentum,","molestie","ex","a,","sollicitudin","metus.","Vestibulum","orci","metus,","sagittis","a","sagittis","a,","varius","id","diam.","Cras","egestas","eros","vestibulum,","tempus","ipsum","pellentesque,","dictum","justo.","Quisque","sed","justo","metus.","Suspendisse","id","felis","vitae","nunc","auctor","tristique","eu","sit","amet","mi.","Ut","luctus","posuere","viverra.","Nunc","sed","augue","a","velit","sodales","iaculis.","Sed","at","arcu","non","massa","hendrerit","scelerisque.","Nunc","commodo","vulputate","vestibulum.","Duis","ut","leo","nisi.","Mauris","dignissim","quis","sem","non","blandit.","Suspendisse","id","elit","eget","leo","efficitur","maximus.","Ut","eu","auctor","ligula.","Nulla","in","leo","luctus,","tempor","justo","vitae,","condimentum","massa.","Quisque","venenatis","elementum","posuere.","Sed","bibendum","bibendum","enim,","in","faucibus","ante.","Aliquam","pretium","sapien","ac","eleifend","suscipit.","Duis","lacinia","justo","quis","diam","elementum,","vitae","fringilla","lectus","faucibus.","Integer","dictum","commodo","diam","a","tempus.","Aenean","elementum","egestas","quam,","eget","feugiat","ligula","imperdiet","vitae.","Morbi","mattis","dui","sed","elementum","mollis.","In","interdum","viverra","urna,","at","scelerisque","sapien.","Sed","molestie","blandit","risus","nec","ornare.","Integer","pharetra","massa","purus,","ut","fringilla","augue","sollicitudin","in.","Pellentesque","eu","leo","pharetra,","hendrerit","lectus","id,","dapibus","ipsum.","Quisque","tincidunt","euismod","venenatis.","Sed","lacus","ex,","pulvinar","at","dui","vitae,","condimentum","rutrum","eros.","Nunc","viverra","cursus","ante,","ac","dapibus","ligula","volutpat","nec.","Integer","commodo","in","tortor","eget","aliquet.","Nam","bibendum","lectus","vitae","ligula","interdum","scelerisque.","Morbi","sit","amet","augue","diam.","Etiam","purus","lorem,","sodales","sed","sodales","ac,","dignissim","a","tellus.","Nunc","vehicula","nibh","in","erat","rhoncus","ullamcorper.","Orci","varius","natoque","penatibus","et","magnis","dis","parturient","montes,","nascetur","ridiculus","mus.","Aliquam","augue","nunc,","fringilla","at","dictum","quis,","luctus","sit","amet","nisl.","Nam","lectus","felis,","egestas","nec","lacinia","non,","auctor","eget","lorem.","Nunc","vel","velit","quis","magna","hendrerit","volutpat","in","nec","leo.","Aenean","tempor","lectus","tortor,","nec","bibendum","elit","aliquam","at.","In","id","libero","tincidunt,","interdum","libero","sit","amet,","gravida","est.","Morbi","ut","ipsum","enim.","Duis","vel","posuere","ante.","Praesent","sollicitudin","lacus","sit","amet","luctus","euismod.","Phasellus","lorem","elit,","auctor","sed","risus","a,","faucibus","tempor","lacus.","Integer","id","tellus","ut","eros","congue","ornare.","Cras","vitae","ornare","sem.","Cras","tincidunt","arcu","efficitur","mauris","molestie,","eu","eleifend","eros","mattis.","Integer","id","diam","mauris.","Duis","suscipit","enim","risus,","non","dignissim","nulla","imperdiet","hendrerit.","Vestibulum","sed","dignissim","erat.","Aliquam","erat","volutpat.","Nunc","mattis","auctor","justo,","non","fringilla","dolor","blandit","a.","Donec","et","velit","tristique","lacus","varius","aliquam.","Praesent","ac","molestie","quam,","vitae","scelerisque","tellus.","Praesent","eleifend","sed","diam","in","gravida.","Donec","tristique","sapien","ante,","in","egestas","diam","porta","ac.","Proin","ac","justo","eleifend,","consequat","ante","vitae,","laoreet","augue.","Mauris","scelerisque","arcu","dolor,","quis","lobortis","risus","pellentesque","eu.","Praesent","in","enim","a","elit","feugiat","dapibus.","Duis","quis","bibendum","mi.","Vestibulum","lacinia,","sem","at","efficitur","volutpat,","velit","ligula","vulputate","nisi,","sit","amet","dapibus","risus","metus","sed","est.","Sed","in","venenatis","ante.","Pellentesque","vel","ipsum","pharetra,","efficitur","quam","ut,","hendrerit","dolor."];var a=(u=>(u.Text="text",u.Input="input",u.Image="image",u.Video="video",u.WrapperElement="wrapper-element",u))(a||{}),d=(u=>(u.PrimaryColor="rgba(100, 100, 100, .6)",u.SecondaryColor="rgba(100, 100, 100, .3)",u))(d||{});class b{static daysInMs(e){return e*24*60*60*1e3}static dateBetween(e,i){return new Date(e.getTime()+Math.random()*(i.getTime()-e.getTime()))}}let q=0;class T{constructor(){w(this,l)}get value(){return y(this,l)}words(e){this.assertType();let i="",r=0;for(;r<e;)i+=this.randomLoremWord()+" ",r++;return m(this,l,i.trim()),this}paragraphs(e){this.assertType();let i="",r=0;const g=50;for(;r<e;){const p=g-Math.round(g*Math.random()*.2)*(Math.random()<.5?-1:1);i+=this.words(p).value,r!==e-1&&(i+=`
2
- `),r++}return m(this,l,i),this}number(e=0,i=1e3){return this.assertType(),m(this,l,Math.ceil(Math.random()*(i-e))+e),this}multiply(e){return this.assertType(),m(this,l,y(this,l)*e),this}date(e={}){this.assertType();let i=e.max??new Date("2100-01-01"),r=e.min??new Date("1970-01-01");return e.isFuture?r=new Date(Date.now()+b.daysInMs(1)):e.isPast&&(i=new Date(Date.now()-b.daysInMs(1))),m(this,l,b.dateBetween(r,i)),this}uuid(){return q++,this.assertType(),m(this,l,q),this}boolean(){return this.assertType(),m(this,l,Math.random()<=.5),this}symbol(e=0){return this.assertType(),m(this,l,Symbol(e)),this}identical(e){return this.assertType(),m(this,l,e),this}assertType(){}randomLoremWord(){const e=Math.floor(Math.random()*s.length);return s[e]??"lorem"}}l=new WeakMap;let I=0;class c{constructor(e){this.generator=e,this.uuid=I++,this.viewModel=this.generator(),this.val=c.modelToValue(this.viewModel)}get value(){return this.val}static modelToValue(e){if(e instanceof T)return e.value;if(Array.isArray(e))return e.map(this.modelToValue);{const i={};return Object.keys(e).forEach(r=>{i[r]=c.modelToValue(e[r])}),i}}}class x{proxy(e){return e instanceof c?e.value:e}}class C{constructor(){this.config=null,this.viewModels=[]}setupModels(){if(this.config){const e=this.config.schemaGenerator;this.viewModels=Array.from({length:this.config.repeat},()=>new c(e))}}}const o=class o{static skeletonizeProjectedTemplate(e,i){const r=(i==null?void 0:i.primaryColor)??d.PrimaryColor,g=(i==null?void 0:i.secondaryColor)??d.SecondaryColor;e.setAttribute("style",`--skeletonizer-primary-color: ${r}; --skeletonizer-secondary-color: ${g};`),Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach(p=>{const P=["br","b","strong","i","em","mark","small","del","ins","sub","sup"],f=Array.from(p.childNodes).map(n=>n.nodeName.toLowerCase()).filter(n=>!P.includes(n)),k=f.length>0&&f.some(n=>n!==f[0]);p.childNodes.forEach(n=>{switch(n.nodeName.toLowerCase()){case"#text":{if(this.assertAs(n),n.wholeText.trim())if(k){const h=document.createElement("span");h.innerText=n.cloneNode().wholeText,h.innerText.length&&n.replaceWith(o.skeletonizedSpanGenerator(h.innerText,a.Text))}else{const h=o.skeletonizedSpanGenerator(p.innerHTML,a.Text);p.innerHTML=h.outerHTML}break}case"input":{n.setAttribute(o.dataAttr,a.Input);break}case"img":{n.setAttribute(o.dataAttr,a.Image);break}case"video":{n.setAttribute(o.dataAttr,a.Video);break}}})}),e.setAttribute(o.dataAttr,a.WrapperElement)}static skeletonizedSpanGenerator(e,i){const r=document.createElement("span");return r.innerHTML=e,r.setAttribute(o.dataAttr,i),r}static assertAs(e){}};o.dataAttr="data-skeletonizer";let v=o;t.Schema=c,t.SchemaItem=T,t.SkeletonAbstractComponent=x,t.SkeletonAdapterComponent=C,t.SkeletonDirective=v,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});