@mgdis/stencil-helpers 3.2.0 → 3.2.2

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.
@@ -1,206 +1,2 @@
1
- /**
2
- * Create random ID
3
- * @param prefix - add prefix to created ID
4
- * @param length - ID length
5
- * @returns ID
6
- */
7
- export declare const createID: (prefix?: string, length?: number) => string;
8
- /**
9
- * Validate html `id` format
10
- * @param newValue - id value to validate
11
- * @returns true if `id` is valid
12
- */
13
- export declare const isValideID: (newValue: unknown) => boolean;
14
- /**
15
- * Format id from value
16
- * @param value - id to transforme
17
- * @returns valid id
18
- */
19
- export declare const formatID: (value: unknown) => string | undefined;
20
- /**
21
- * Class to manage component classlist
22
- */
23
- export declare class ClassList {
24
- /**
25
- * Available classes
26
- */
27
- classes: string[];
28
- constructor(classlist?: string[]);
29
- /**
30
- * Add class
31
- * @param className - class name to add
32
- */
33
- add: (className: string) => void;
34
- /**
35
- * Delete class
36
- * @param className - class name to delete
37
- */
38
- delete: (className: string) => void;
39
- /**
40
- * Check if class exist in list
41
- * @param className - class name to check
42
- * @returns class name is in the list
43
- */
44
- has: (className: string) => boolean;
45
- /**
46
- * Join classes seperated by spaces
47
- * @returns joined values
48
- */
49
- join: () => string;
50
- }
51
- /**
52
- * Typeguard function to check if all array items are strings.
53
- * @param items - items to check
54
- * @returns `true` if all items are strings
55
- */
56
- export declare const allItemsAreString: (items: unknown) => items is string[];
57
- /**
58
- * Check if element belongs to the given tagNames list
59
- * @param element - element to check
60
- * @param tagNames - allowed tag names list
61
- * @returns `true` if element tagName is in the tagNames list
62
- */
63
- export declare const isTagName: (element: Element, tagNames: string[]) => boolean;
64
- /**
65
- * CSS selector to select focusable elements.
66
- * @example
67
- * ```ts
68
- * const allFocusableElements: HTMLElement[] = Array.from(this.element.querySelectorAll(focusableElements));
69
- * ```
70
- */
71
- export declare const focusableElements = "a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier], mg-button";
72
- /**
73
- * Get windows
74
- * @param localWindow - the window we are lookink for other windows
75
- * @returns The list of windows found
76
- */
77
- export declare const getWindows: (localWindow: Window) => Window[];
78
- /**
79
- * Get parent windows
80
- * @param localWindow - the window we are lookink for parents
81
- * @param windows - The list of allready found windows
82
- * @returns The list of windows found
83
- */
84
- export declare const getParentWindows: (localWindow: Window, windows?: Window[]) => Window[];
85
- /**
86
- * Validate string
87
- * @param value - value to check
88
- * @returns `true` if string is valid
89
- */
90
- export declare const isValidString: (value: unknown) => value is string;
91
- /**
92
- * Stringify value
93
- * @param value - value to stringify
94
- * @returns stringified value
95
- */
96
- export declare const toString: (value: unknown) => string;
97
- /**
98
- * Validate number
99
- * @param value - value to check
100
- * @returns `true` if number is valid
101
- */
102
- export declare const isValidNumber: (value: unknown) => value is number;
103
- /**
104
- * Cleans string characters by removing special characters and converting to lowercase.
105
- * @param text - text to clean
106
- * @returns cleaned string
107
- * @example
108
- * ```ts
109
- * cleanString('âäàçéèêñù') // 'aaaceeenu'
110
- * cleanString('BATMAN') // 'batman'
111
- * ```
112
- */
113
- export declare const cleanString: (text: string) => string;
114
- /**
115
- * Use to process code next tick in the event loop
116
- * @param callback - code to excute on next tick
117
- * @returns differed code excution
118
- */
119
- export declare const nextTick: (callback?: () => void) => Promise<void>;
120
- /**
121
- * Check if a value is of object type.
122
- * @param object - The value to validate.
123
- * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.
124
- */
125
- export declare const isObject: <T>(object: unknown) => object is T;
126
- /**
127
- * Get object value from key
128
- * @param object - object to query
129
- * @param path - path of the property to get. Nested keys are allowed with `.` separators (eg: 'key0.key1.key2' = object[key0][key1][key2])
130
- * @param defaultValue - The value returned for `undefined` resolved values
131
- * @returns object value
132
- */
133
- export declare const getObjectValueFromKey: <T, R>(object: T, path: string, defaultValue?: R) => R | undefined;
134
- /**
135
- * Define getPage methode interface
136
- */
137
- export interface IGetPage<T> {
138
- (offset?: number, filter?: Parameters<Array<T>['filter']>[0]): Page<T>;
139
- }
140
- /**
141
- * Cursor type
142
- */
143
- export type CursorType = 'first' | 'next' | 'previous' | 'last';
144
- /**
145
- * Cursor possible values
146
- */
147
- export declare const Cursor: Record<string, CursorType>;
148
- /**
149
- * Define a valid Page object and navigate throw page items with cursor.
150
- * Page object entries follow the REST API page practices.
151
- */
152
- export declare class Page<T> {
153
- /**
154
- * Define items
155
- */
156
- items: T[];
157
- /**
158
- * Define total
159
- */
160
- total: number;
161
- /**
162
- * Define top
163
- */
164
- top: number;
165
- /**
166
- * Define next
167
- */
168
- next?: IGetPage<T> | string | URL;
169
- /**
170
- * Define base index
171
- */
172
- readonly baseIndex = 1;
173
- constructor(init: Partial<Pick<Page<T>, 'items' | 'top' | 'total' | 'next'>>);
174
- /**
175
- * Get index of items from cursor
176
- * @param cursor - cursor to find
177
- * @param oldItem - previous item
178
- * @returns item index
179
- */
180
- getIndexFromCursor: (cursor?: CursorType, oldItem?: T) => number | null;
181
- }
182
- /**
183
- * Paginate an items array to navigate into with pages.
184
- * It follow REST standard and allow to navigate in items array with a similar format.
185
- */
186
- export declare class Paginate<T> {
187
- #private;
188
- /**
189
- * Define paginated items
190
- */
191
- items: Page<T>['items'];
192
- constructor(items: Page<T>['items'], options?: {
193
- step?: number;
194
- top?: Page<T>['top'];
195
- total?: Page<T>['total'];
196
- next?: Page<T>['next'];
197
- });
198
- /**
199
- * Get page
200
- * @param offset - pagiantion offset
201
- * @param filter - filter methode
202
- * @returns formated page
203
- */
204
- getPage: IGetPage<T>;
205
- }
1
+ export { createID, isValideID, formatID, ClassList, allItemsAreString, isTagName, focusableElements, getWindows, getParentWindows, isValidString, toString, isValidNumber, cleanString, nextTick, isObject, getObjectValueFromKey, type CursorType, Cursor, Page, Paginate, } from '@mgdis/core-ui-helpers/dist/utils';
206
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;G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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IAW5E;;;;;OAKG;IACI,kBAAkB,GAAI,SAAQ,UAAoB,EAAE,UAAU,CAAC,KAAG,MAAM,GAAG,IAAI,CAwBpF;CACH;AAED;;;GAGG;AACH,qBAAa,QAAQ,CAAC,CAAC;;IACrB;;OAEG;IACI,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAM;gBAOxB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;KAAE;IAOxI;;;;;OAKG;IACI,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAYzB;CACH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,KAAK,UAAU,EACf,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,MAAM,mCAAmC,CAAC"}
@@ -1,109 +1,2 @@
1
- import { JsonDocs } from '@stencil/core/internal';
2
- /**
3
- * Generate Web Types metadata for IntelliJ's IDE
4
- * @param name - Library name
5
- * @param version - Library version
6
- * @param jsonDocs - Stencil JSON doc
7
- * @param storybookBaseUrl - Storybook Base Url
8
- * @returns Web Types metadata
9
- * @example
10
- * ```ts
11
- * const webTypesJson = webTypesGenerator('@mgdis/mg-components', '1.0.0', jsonDocs, 'https://storybook.example.com');
12
- * ```
13
- */
14
- export declare const webTypesGenerator: (name: string, version: string, jsonDocs: JsonDocs, storybookBaseUrl: string) => {
15
- $schema: string;
16
- name: string;
17
- version: string;
18
- 'description-markup': string;
19
- contributions: {
20
- html: {
21
- elements: {
22
- name: string;
23
- description: string;
24
- 'doc-url': string | undefined;
25
- attributes: {
26
- name: string | undefined;
27
- description: string;
28
- 'doc-url': string | undefined;
29
- value: {
30
- type: string;
31
- default: string | undefined;
32
- required: boolean;
33
- };
34
- }[];
35
- js: {
36
- properties: {
37
- name: string;
38
- description: string;
39
- 'doc-url': string | undefined;
40
- value: {
41
- type: string;
42
- default: string | undefined;
43
- required: boolean;
44
- };
45
- }[];
46
- events: {
47
- name: string;
48
- description: string;
49
- }[];
50
- };
51
- css: {
52
- properties: {
53
- name: string;
54
- description: string;
55
- }[];
56
- };
57
- }[];
58
- };
59
- };
60
- };
61
- /**
62
- * Generate custom HTML datasets for VS Code
63
- * @param jsonDocs - Stencil JSON doc
64
- * @param storybookBaseUrl - Storybook Base Url
65
- * @returns custom HTML datasets
66
- * @example
67
- * ```ts
68
- * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');
69
- * ```
70
- */
71
- export declare const vsCodeGenerator: (jsonDocs: JsonDocs, storybookBaseUrl: string, sourceBaseUrl: string) => {
72
- version: number;
73
- tags: {
74
- name: string;
75
- description: string;
76
- attributes: {
77
- name: string;
78
- description: string;
79
- values: unknown[] | undefined;
80
- references: {
81
- name: string;
82
- url: string | undefined;
83
- }[];
84
- }[];
85
- references: {
86
- name: string;
87
- url: string | undefined;
88
- }[];
89
- }[];
90
- globalAttributes: never[];
91
- valueSets: never[];
92
- };
93
- /**
94
- * Generate custom CSS datasets for VS Code
95
- * @param jsonDocs - Stencil JSON doc
96
- * @returns custom CSS datasets
97
- * @example
98
- * ```ts
99
- * const customDataJson = vsCodeCssGenerator(jsonDocs);
100
- * ```
101
- */
102
- export declare const vsCodeCssGenerator: (jsonDocs: JsonDocs) => {
103
- version: number;
104
- properties: {
105
- name: string;
106
- description: string;
107
- }[];
108
- };
1
+ export { webTypesGenerator, vsCodeGenerator, vsCodeCssGenerator } from '@mgdis/core-ui-helpers/dist/stencil';
109
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmC,MAAM,wBAAwB,CAAC;AA2EnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,QAAQ,EAAE,kBAAkB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD3G,CAAC;AA4BH;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,QAAQ,EAAE,kBAAkB,MAAM,EAAE,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;CAkBjG,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,QAAQ;;;;;;CAQnD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC"}