@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.
- package/dist/components/index.d.ts +1 -205
- package/dist/components/index.d.ts.map +1 -1
- package/dist/ide/index.d.ts +1 -108
- package/dist/ide/index.d.ts.map +1 -1
- package/dist/index.es.js +702 -623
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +17 -20
- package/dist/index.umd.js.map +1 -1
- package/dist/locale/index.d.ts +2 -116
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/storybook/index.d.ts +1 -76
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/tests/index.d.ts +1 -1
- package/dist/tests/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -15
- package/dist/storybook/index.conf.d.ts +0 -7
- package/dist/storybook/index.conf.d.ts.map +0 -1
- package/dist/tests/unit.conf.d.ts +0 -16
- package/dist/tests/unit.conf.d.ts.map +0 -1
- package/dist/tests/unit.d.ts +0 -76
- package/dist/tests/unit.d.ts.map +0 -1
|
@@ -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":"
|
|
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"}
|
package/dist/ide/index.d.ts
CHANGED
|
@@ -1,109 +1,2 @@
|
|
|
1
|
-
|
|
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
|
package/dist/ide/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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"}
|