@mgdis/stencil-helpers 3.1.1 → 3.2.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.
@@ -1,200 +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
- * Class to manage component classlist
16
- */
17
- export declare class ClassList {
18
- /**
19
- * Available classes
20
- */
21
- classes: string[];
22
- constructor(classlist?: string[]);
23
- /**
24
- * Add class
25
- * @param className - class name to add
26
- */
27
- add: (className: string) => void;
28
- /**
29
- * Delete class
30
- * @param className - class name to delete
31
- */
32
- delete: (className: string) => void;
33
- /**
34
- * Check if class exist in list
35
- * @param className - class name to check
36
- * @returns class name is in the list
37
- */
38
- has: (className: string) => boolean;
39
- /**
40
- * Join classes seperated by spaces
41
- * @returns joined values
42
- */
43
- join: () => string;
44
- }
45
- /**
46
- * Typeguard function to check if all array items are strings.
47
- * @param items - items to check
48
- * @returns `true` if all items are strings
49
- */
50
- export declare const allItemsAreString: (items: unknown) => items is string[];
51
- /**
52
- * Check if element belongs to the given tagNames list
53
- * @param element - element to check
54
- * @param tagNames - allowed tag names list
55
- * @returns `true` if element tagName is in the tagNames list
56
- */
57
- export declare const isTagName: (element: Element, tagNames: string[]) => boolean;
58
- /**
59
- * CSS selector to select focusable elements.
60
- * @example
61
- * ```ts
62
- * const allFocusableElements: HTMLElement[] = Array.from(this.element.querySelectorAll(focusableElements));
63
- * ```
64
- */
65
- export declare const focusableElements = "a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier], mg-button";
66
- /**
67
- * Get windows
68
- * @param localWindow - the window we are lookink for other windows
69
- * @returns The list of windows found
70
- */
71
- export declare const getWindows: (localWindow: Window) => Window[];
72
- /**
73
- * Get parent windows
74
- * @param localWindow - the window we are lookink for parents
75
- * @param windows - The list of allready found windows
76
- * @returns The list of windows found
77
- */
78
- export declare const getParentWindows: (localWindow: Window, windows?: Window[]) => Window[];
79
- /**
80
- * Validate string
81
- * @param value - value to check
82
- * @returns `true` if string is valid
83
- */
84
- export declare const isValidString: (value: unknown) => value is string;
85
- /**
86
- * Stringify value
87
- * @param value - value to stringify
88
- * @returns stringified value
89
- */
90
- export declare const toString: (value: unknown) => string;
91
- /**
92
- * Validate number
93
- * @param value - value to check
94
- * @returns `true` if number is valid
95
- */
96
- export declare const isValidNumber: (value: unknown) => value is number;
97
- /**
98
- * Cleans string characters by removing special characters and converting to lowercase.
99
- * @param text - text to clean
100
- * @returns cleaned string
101
- * @example
102
- * ```ts
103
- * cleanString('âäàçéèêñù') // 'aaaceeenu'
104
- * cleanString('BATMAN') // 'batman'
105
- * ```
106
- */
107
- export declare const cleanString: (text: string) => string;
108
- /**
109
- * Use to process code next tick in the event loop
110
- * @param callback - code to excute on next tick
111
- * @returns differed code excution
112
- */
113
- export declare const nextTick: (callback?: () => void) => Promise<void>;
114
- /**
115
- * Check if a value is of object type.
116
- * @param object - The value to validate.
117
- * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.
118
- */
119
- export declare const isObject: <T>(object: unknown) => object is T;
120
- /**
121
- * Get object value from key
122
- * @param object - object to query
123
- * @param path - path of the property to get. Nested keys are allowed with `.` separators (eg: 'key0.key1.key2' = object[key0][key1][key2])
124
- * @param defaultValue - The value returned for `undefined` resolved values
125
- * @returns object value
126
- */
127
- export declare const getObjectValueFromKey: <T, R>(object: T, path: string, defaultValue?: R) => R | undefined;
128
- /**
129
- * Define getPage methode interface
130
- */
131
- export interface IGetPage<T> {
132
- (offset?: number, filter?: Parameters<Array<T>['filter']>[0]): Page<T>;
133
- }
134
- /**
135
- * Cursor type
136
- */
137
- export type CursorType = 'first' | 'next' | 'previous' | 'last';
138
- /**
139
- * Cursor possible values
140
- */
141
- export declare const Cursor: Record<string, CursorType>;
142
- /**
143
- * Define a valid Page object and navigate throw page items with cursor.
144
- * Page object entries follow the REST API page practices.
145
- */
146
- export declare class Page<T> {
147
- /**
148
- * Define items
149
- */
150
- items: T[];
151
- /**
152
- * Define total
153
- */
154
- total: number;
155
- /**
156
- * Define top
157
- */
158
- top: number;
159
- /**
160
- * Define next
161
- */
162
- next?: IGetPage<T> | string | URL;
163
- /**
164
- * Define base index
165
- */
166
- readonly baseIndex = 1;
167
- constructor(init: Partial<Pick<Page<T>, 'items' | 'top' | 'total' | 'next'>>);
168
- /**
169
- * Get index of items from cursor
170
- * @param cursor - cursor to find
171
- * @param oldItem - previous item
172
- * @returns item index
173
- */
174
- getIndexFromCursor: (cursor?: CursorType, oldItem?: T) => number | null;
175
- }
176
- /**
177
- * Paginate an items array to navigate into with pages.
178
- * It follow REST standard and allow to navigate in items array with a similar format.
179
- */
180
- export declare class Paginate<T> {
181
- #private;
182
- /**
183
- * Define paginated items
184
- */
185
- items: Page<T>['items'];
186
- constructor(items: Page<T>['items'], options?: {
187
- step?: number;
188
- top?: Page<T>['top'];
189
- total?: Page<T>['total'];
190
- next?: Page<T>['next'];
191
- });
192
- /**
193
- * Get page
194
- * @param offset - pagiantion offset
195
- * @param filter - filter methode
196
- * @returns formated page
197
- */
198
- getPage: IGetPage<T>;
199
- }
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';
200
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,eAAW,EAAE,eAAW,KAAG,MAWnD,CAAC;AAEF;;;;GAIG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AG,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"}