@kizmann/pico-js 1.0.13 → 2.0.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.
- package/README.md +27 -7
- package/dist/pico-js.browser.js +2 -0
- package/dist/pico-js.browser.js.map +1 -0
- package/dist/pico-js.esm.js +2 -0
- package/dist/pico-js.esm.js.map +1 -0
- package/package.json +20 -7
- package/src/dom/DomAttribute.js +374 -0
- package/src/dom/DomBuilder.js +152 -0
- package/src/dom/DomEvent.js +253 -0
- package/src/dom/DomFinder.js +669 -0
- package/src/dom/DomForm.js +57 -0
- package/src/dom/DomGlobal.js +193 -0
- package/src/dom/DomInview.js +332 -0
- package/src/dom/DomMeta.js +66 -0
- package/src/dom/DomObserver.js +57 -0
- package/src/dom/DomRectangle.js +657 -0
- package/src/format/FormatFile.js +54 -0
- package/src/format/FormatOption.js +108 -0
- package/src/format/FormatParam.js +107 -0
- package/src/format/FormatParser.js +156 -0
- package/src/format/FormatUrl.js +75 -0
- package/src/index.browser.js +10 -0
- package/src/index.esm.js +138 -0
- package/src/now/NowDefault.js +533 -0
- package/src/now/NowFormat.js +196 -0
- package/src/now/NowGrid.js +251 -0
- package/src/now/NowHuman.js +118 -0
- package/src/now/NowMatch.js +175 -0
- package/src/now/NowRange.js +70 -0
- package/src/now/NowWalker.js +544 -0
- package/src/tool/scope.js +103 -0
- package/src/utils/Array.js +986 -0
- package/src/utils/Cookie.js +184 -0
- package/src/utils/Data.js +200 -0
- package/src/utils/Dom.js +208 -0
- package/src/utils/Event.js +140 -0
- package/src/utils/Format.js +62 -0
- package/src/utils/Hash.js +164 -0
- package/src/utils/Locale.js +229 -0
- package/src/utils/Mixed.js +887 -0
- package/src/utils/Now.js +234 -0
- package/src/utils/Number.js +238 -0
- package/src/utils/Object.js +655 -0
- package/src/utils/Route.js +67 -0
- package/src/utils/Runner.js +327 -0
- package/src/utils/String.js +618 -0
- package/src/{library/element.js → wip/Element.js} +90 -16
- package/src/{library/map.js → wip/Map.js} +256 -40
- package/types/dom/DomAttribute.d.ts +137 -0
- package/types/dom/DomBuilder.d.ts +67 -0
- package/types/dom/DomEvent.d.ts +103 -0
- package/types/dom/DomFinder.d.ts +321 -0
- package/types/dom/DomForm.d.ts +21 -0
- package/types/dom/DomGlobal.d.ts +79 -0
- package/types/dom/DomInview.d.ts +114 -0
- package/types/dom/DomMeta.d.ts +29 -0
- package/types/dom/DomObserver.d.ts +21 -0
- package/types/dom/DomRectangle.d.ts +270 -0
- package/types/format/FormatFile.d.ts +18 -0
- package/types/format/FormatOption.d.ts +40 -0
- package/types/format/FormatParam.d.ts +39 -0
- package/types/format/FormatParser.d.ts +46 -0
- package/types/format/FormatUrl.d.ts +17 -0
- package/types/index.browser.d.ts +1 -0
- package/types/index.esm.d.ts +52 -0
- package/types/now/NowDefault.d.ts +183 -0
- package/types/now/NowFormat.d.ts +70 -0
- package/types/now/NowGrid.d.ts +107 -0
- package/types/now/NowHuman.d.ts +37 -0
- package/types/now/NowMatch.d.ts +108 -0
- package/types/now/NowRange.d.ts +21 -0
- package/types/now/NowWalker.d.ts +301 -0
- package/types/tool/scope.d.ts +24 -0
- package/types/utils/Array.d.ts +480 -0
- package/types/utils/Cookie.d.ts +60 -0
- package/types/utils/Data.d.ts +91 -0
- package/types/utils/Dom.d.ts +138 -0
- package/types/utils/Event.d.ts +58 -0
- package/types/utils/Format.d.ts +37 -0
- package/types/utils/Hash.d.ts +81 -0
- package/types/utils/Locale.d.ts +115 -0
- package/types/utils/Mixed.d.ts +469 -0
- package/types/utils/Now.d.ts +125 -0
- package/types/utils/Number.d.ts +127 -0
- package/types/utils/Object.d.ts +255 -0
- package/types/utils/Route.d.ts +37 -0
- package/types/utils/Runner.d.ts +139 -0
- package/types/utils/String.d.ts +330 -0
- package/types/wip/Element.d.ts +119 -0
- package/types/wip/Map.d.ts +254 -0
- package/dist/.ignore.js +0 -0
- package/dist/pico-js.js +0 -2
- package/dist/pico-js.js.map +0 -1
- package/src/element/default.js +0 -46
- package/src/element/example.js +0 -58
- package/src/index.js +0 -90
- package/src/library/cookie.js +0 -123
- package/src/library/data.js +0 -111
- package/src/library/event.js +0 -91
- package/src/library/locale.js +0 -84
- package/src/library/queue.js +0 -64
- package/src/library/route.js +0 -28
- package/src/utility/any.js +0 -369
- package/src/utility/array.js +0 -410
- package/src/utility/dom.js +0 -1425
- package/src/utility/now.js +0 -544
- package/src/utility/number.js +0 -128
- package/src/utility/object.js +0 -429
- package/src/utility/string.js +0 -328
- package/types/index.d.ts +0 -77
- package/types/library/cookie.d.ts +0 -10
- package/types/library/data.d.ts +0 -15
- package/types/library/element.d.ts +0 -22
- package/types/library/event.d.ts +0 -13
- package/types/library/locale.d.ts +0 -14
- package/types/library/map.d.ts +0 -43
- package/types/library/queue.d.ts +0 -18
- package/types/library/route.d.ts +0 -11
- package/types/utility/any.d.ts +0 -35
- package/types/utility/array.d.ts +0 -46
- package/types/utility/dom.d.ts +0 -101
- package/types/utility/now.d.ts +0 -79
- package/types/utility/number.d.ts +0 -17
- package/types/utility/object.d.ts +0 -29
- package/types/utility/string.d.ts +0 -26
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
export class PicoString {
|
|
2
|
+
/**
|
|
3
|
+
* Get character at index
|
|
4
|
+
*
|
|
5
|
+
* @example Str.get("abc", 1) // => "b"
|
|
6
|
+
*
|
|
7
|
+
* @param {any} value Input string
|
|
8
|
+
* @param {any} index Char index
|
|
9
|
+
* @returns {string} Single char
|
|
10
|
+
*/
|
|
11
|
+
static get(value: any, index: any): string;
|
|
12
|
+
/**
|
|
13
|
+
* Replace substring at index
|
|
14
|
+
*
|
|
15
|
+
* @example Str.set("abc", 1, "X") // => "aXc"
|
|
16
|
+
*
|
|
17
|
+
* @param {any} value Input string
|
|
18
|
+
* @param {any} index Start index
|
|
19
|
+
* @param {string} [replace] Replace value
|
|
20
|
+
* @returns {string} Updated string
|
|
21
|
+
*/
|
|
22
|
+
static set(value: any, index: any, replace?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Replace first occurrence
|
|
25
|
+
*
|
|
26
|
+
* @example Str.replace("abc", "X", "b") // => "aXc"
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value Input string
|
|
29
|
+
* @param {string} replace Replace value
|
|
30
|
+
* @param {any} [search] Search value
|
|
31
|
+
* @returns {string} Updated string
|
|
32
|
+
*/
|
|
33
|
+
static replace(value: any, replace: string, search?: any): string;
|
|
34
|
+
/**
|
|
35
|
+
* Extract substring by range
|
|
36
|
+
*
|
|
37
|
+
* @example Str.extract("abc", "b") // => "b"
|
|
38
|
+
*
|
|
39
|
+
* @param {any} value Input string
|
|
40
|
+
* @param {string} replace Search value
|
|
41
|
+
* @param {any} [search] Match source
|
|
42
|
+
* @returns {string|null} Extracted string
|
|
43
|
+
*/
|
|
44
|
+
static extract(value: any, replace: string, search?: any): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Match pattern in string
|
|
47
|
+
*
|
|
48
|
+
* @example Str.match("abc", /b/) // => ["b"]
|
|
49
|
+
*
|
|
50
|
+
* @param {any} value Input string
|
|
51
|
+
* @param {RegExp|string} pattern Match pattern
|
|
52
|
+
* @param {any} [cb] Callback fn
|
|
53
|
+
* @returns {any} Match result
|
|
54
|
+
*/
|
|
55
|
+
static match(value: any, pattern: RegExp | string, cb?: any): any;
|
|
56
|
+
/**
|
|
57
|
+
* Escape regex characters
|
|
58
|
+
*
|
|
59
|
+
* @example Str.regex("a.b") // => "a\\.b"
|
|
60
|
+
*
|
|
61
|
+
* @param {any} val Input string
|
|
62
|
+
* @returns {string} Escaped string
|
|
63
|
+
*/
|
|
64
|
+
static regex(val: any): string;
|
|
65
|
+
/**
|
|
66
|
+
* Convert to uppercase
|
|
67
|
+
*
|
|
68
|
+
* @example Str.uc("abc") // => "ABC"
|
|
69
|
+
*
|
|
70
|
+
* @param {any} value Input string
|
|
71
|
+
* @returns {string} Uppercase string
|
|
72
|
+
*/
|
|
73
|
+
static uc(value: any): string;
|
|
74
|
+
/**
|
|
75
|
+
* @see PicoString.uc
|
|
76
|
+
*/
|
|
77
|
+
static upper: typeof PicoString.uc;
|
|
78
|
+
/**
|
|
79
|
+
* Uppercase first character
|
|
80
|
+
*
|
|
81
|
+
* @example Str.ucfirst("abc") // => "Abc"
|
|
82
|
+
*
|
|
83
|
+
* @param {string} value Input string
|
|
84
|
+
* @returns {string} Updated string
|
|
85
|
+
*/
|
|
86
|
+
static ucfirst(value: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Convert to lowercase
|
|
89
|
+
*
|
|
90
|
+
* @example Str.lc("ABC") // => "abc"
|
|
91
|
+
*
|
|
92
|
+
* @param {any} value Input string
|
|
93
|
+
* @returns {string} Lowercase string
|
|
94
|
+
*/
|
|
95
|
+
static lc(value: any): string;
|
|
96
|
+
/**
|
|
97
|
+
* @see PicoString.lc
|
|
98
|
+
*/
|
|
99
|
+
static lower: typeof PicoString.lc;
|
|
100
|
+
/**
|
|
101
|
+
* Lowercase first character
|
|
102
|
+
*
|
|
103
|
+
* @example Str.lcfirst("ABC") // => "aBC"
|
|
104
|
+
*
|
|
105
|
+
* @param {string} value Input string
|
|
106
|
+
* @returns {string} Updated string
|
|
107
|
+
*/
|
|
108
|
+
static lcfirst(value: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Convert to camelCase
|
|
111
|
+
*
|
|
112
|
+
* @example Str.cc("hello-world") // => "helloWorld"
|
|
113
|
+
*
|
|
114
|
+
* @param {string} value Input string
|
|
115
|
+
* @returns {string} camelCase string
|
|
116
|
+
*/
|
|
117
|
+
static cc(value: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* @see PicoString.cc
|
|
120
|
+
*/
|
|
121
|
+
static camelcase: typeof PicoString.cc;
|
|
122
|
+
/**
|
|
123
|
+
* Convert to kebab-case
|
|
124
|
+
*
|
|
125
|
+
* @example Str.kc("helloWorld") // => "hello-world"
|
|
126
|
+
*
|
|
127
|
+
* @param {string} value Input string
|
|
128
|
+
* @returns {string} kebab-case string
|
|
129
|
+
*/
|
|
130
|
+
static kc(value: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* @see PicoString.kc
|
|
133
|
+
*/
|
|
134
|
+
static kebabcase: typeof PicoString.kc;
|
|
135
|
+
/**
|
|
136
|
+
* Convert to snake_case
|
|
137
|
+
*
|
|
138
|
+
* @example Str.sc("helloWorld") // => "hello_world"
|
|
139
|
+
*
|
|
140
|
+
* @param {string} value Input string
|
|
141
|
+
* @returns {string} snake_case string
|
|
142
|
+
*/
|
|
143
|
+
static sc(value: string): string;
|
|
144
|
+
/**
|
|
145
|
+
* @see PicoString.sc
|
|
146
|
+
*/
|
|
147
|
+
static snakecase: typeof PicoString.sc;
|
|
148
|
+
/**
|
|
149
|
+
* Convert to PascalCase
|
|
150
|
+
*
|
|
151
|
+
* @example Str.pc("hello-world") // => "HelloWorld"
|
|
152
|
+
*
|
|
153
|
+
* @param {string} value Input string
|
|
154
|
+
* @returns {string} PascalCase string
|
|
155
|
+
*/
|
|
156
|
+
static pc(value: string): string;
|
|
157
|
+
/**
|
|
158
|
+
* @see PicoString.pc
|
|
159
|
+
*/
|
|
160
|
+
static pascalcase: typeof PicoString.pc;
|
|
161
|
+
/**
|
|
162
|
+
* Check if string contains value
|
|
163
|
+
*
|
|
164
|
+
* @example Str.has("abc", "b") // => true
|
|
165
|
+
*
|
|
166
|
+
* @param {string} value Input string
|
|
167
|
+
* @param {string} search Search string
|
|
168
|
+
* @returns {boolean} True if found
|
|
169
|
+
*/
|
|
170
|
+
static has(value: string, search: string): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Get index range of search
|
|
173
|
+
*
|
|
174
|
+
* @example Str.range("abc", "b") // => [1, 2]
|
|
175
|
+
*
|
|
176
|
+
* @param {any} value Input string
|
|
177
|
+
* @param {string} search Search string
|
|
178
|
+
* @param {any} [fallback] Fallback value
|
|
179
|
+
* @returns {Array<number>|any} Index range
|
|
180
|
+
*/
|
|
181
|
+
static range(value: any, search: string, fallback?: any): Array<number> | any;
|
|
182
|
+
/**
|
|
183
|
+
* Extract substring by range
|
|
184
|
+
*
|
|
185
|
+
* @example Str.slice("abc", 1, 2) // => "b"
|
|
186
|
+
*
|
|
187
|
+
* @param {any} value Input string
|
|
188
|
+
* @param {number} start Start index
|
|
189
|
+
* @param {number} limit End index
|
|
190
|
+
* @returns {string} Sliced string
|
|
191
|
+
*/
|
|
192
|
+
static slice(value: any, start: number, limit: number): string;
|
|
193
|
+
/**
|
|
194
|
+
* Get string representation
|
|
195
|
+
*
|
|
196
|
+
* @example Str.string("<b>a</b>") // => "a"
|
|
197
|
+
*
|
|
198
|
+
* @param {any} value Input value
|
|
199
|
+
* @param {any} [empty] Empty fallback
|
|
200
|
+
* @param {boolean} [html] Keep HTML
|
|
201
|
+
* @returns {string} String value
|
|
202
|
+
*/
|
|
203
|
+
static string(value: any, empty?: any, html?: boolean): string;
|
|
204
|
+
/**
|
|
205
|
+
* Get boolean representation
|
|
206
|
+
*
|
|
207
|
+
* @example Str.boolean(true) // => "Yes"
|
|
208
|
+
*
|
|
209
|
+
* @param {any} value Input value
|
|
210
|
+
* @param {string} [yes] True string
|
|
211
|
+
* @param {string} [no] False string
|
|
212
|
+
* @param {any} [empty] Empty fallback
|
|
213
|
+
* @returns {string|any} Boolean string
|
|
214
|
+
*/
|
|
215
|
+
static boolean(value: any, yes?: string, no?: string, empty?: any): string | any;
|
|
216
|
+
/**
|
|
217
|
+
* Get formatted number
|
|
218
|
+
*
|
|
219
|
+
* @example Str.number(1234.56, 1) // => "1,234.6"
|
|
220
|
+
*
|
|
221
|
+
* @param {any} value Input value
|
|
222
|
+
* @param {number} [fixed] Decimal points
|
|
223
|
+
* @param {string} [locale] Locale code
|
|
224
|
+
* @param {any} [config] Format config
|
|
225
|
+
* @returns {string|any} Formatted string
|
|
226
|
+
*/
|
|
227
|
+
static number(value: any, fixed?: number, locale?: string, config?: any): string | any;
|
|
228
|
+
/**
|
|
229
|
+
* Get formatted integer
|
|
230
|
+
*
|
|
231
|
+
* @example Str.integer(1, 2) // => "01"
|
|
232
|
+
*
|
|
233
|
+
* @param {any} value Input value
|
|
234
|
+
* @param {number} [leading] Leading zeros
|
|
235
|
+
* @param {string} [padding] Padding char
|
|
236
|
+
* @returns {string|any} Formatted string
|
|
237
|
+
*/
|
|
238
|
+
static integer(value: any, leading?: number, padding?: string): string | any;
|
|
239
|
+
/**
|
|
240
|
+
* Get formatted datetime
|
|
241
|
+
*
|
|
242
|
+
* @example Str.datetime("2026-01-01", "DD.MM.YYYY")
|
|
243
|
+
*
|
|
244
|
+
* @param {any} value Input value
|
|
245
|
+
* @param {string} [format] Output format
|
|
246
|
+
* @param {any} [empty] Empty fallback
|
|
247
|
+
* @returns {string} Formatted string
|
|
248
|
+
*/
|
|
249
|
+
static datetime(value: any, format?: string, empty?: any): string;
|
|
250
|
+
/**
|
|
251
|
+
* Get formatted date
|
|
252
|
+
*
|
|
253
|
+
* @example Str.date("2026-01-01", "DD.MM.YYYY")
|
|
254
|
+
*
|
|
255
|
+
* @param {any} value Input value
|
|
256
|
+
* @param {string} [format] Output format
|
|
257
|
+
* @param {any} [empty] Empty fallback
|
|
258
|
+
* @returns {string} Formatted string
|
|
259
|
+
*/
|
|
260
|
+
static date(value: any, format?: string, empty?: any): string;
|
|
261
|
+
/**
|
|
262
|
+
* Get formatted time
|
|
263
|
+
*
|
|
264
|
+
* @example Str.time("12:00:00", "HH:mm")
|
|
265
|
+
*
|
|
266
|
+
* @param {any} value Input value
|
|
267
|
+
* @param {string} [format] Output format
|
|
268
|
+
* @param {any} [empty] Empty fallback
|
|
269
|
+
* @returns {string} Formatted string
|
|
270
|
+
*/
|
|
271
|
+
static time(value: any, format?: string, empty?: any): string;
|
|
272
|
+
/**
|
|
273
|
+
* Parse string to object
|
|
274
|
+
*
|
|
275
|
+
* @example Str.objectify("a: 1;") // => { a: 1 }
|
|
276
|
+
*
|
|
277
|
+
* @param {any} value Input string
|
|
278
|
+
* @param {string} [mode] Parse mode
|
|
279
|
+
* @param {boolean} [toarray] Return array
|
|
280
|
+
* @returns {any} Parsed value
|
|
281
|
+
*/
|
|
282
|
+
static objectify(value: any, mode?: string, toarray?: boolean): any;
|
|
283
|
+
/**
|
|
284
|
+
* Cast object to string
|
|
285
|
+
*
|
|
286
|
+
* @example Str.stringify({ a: 1 }) // => "a: 1;"
|
|
287
|
+
*
|
|
288
|
+
* @param {any} value Input value
|
|
289
|
+
* @param {string} [mode] Cast mode
|
|
290
|
+
* @returns {string} Casted string
|
|
291
|
+
*/
|
|
292
|
+
static stringify(value: any, mode?: string): string;
|
|
293
|
+
}
|
|
294
|
+
export namespace PicoString {
|
|
295
|
+
/**
|
|
296
|
+
* @see PicoStr.regex
|
|
297
|
+
*/
|
|
298
|
+
function regexEscape(...args: any[]): string;
|
|
299
|
+
/**
|
|
300
|
+
* @see PicoStr.pascalcase
|
|
301
|
+
*/
|
|
302
|
+
function humancase(...args: any[]): string;
|
|
303
|
+
/**
|
|
304
|
+
* @see PicoFormat.slugify
|
|
305
|
+
*/
|
|
306
|
+
function slugify(...args: any[]): any;
|
|
307
|
+
/**
|
|
308
|
+
* @see PicoFormat.castOptions
|
|
309
|
+
*/
|
|
310
|
+
function options(...args: any[]): any;
|
|
311
|
+
/**
|
|
312
|
+
* @see PicoFormat.parseOptions
|
|
313
|
+
*/
|
|
314
|
+
function fromOptions(...args: any[]): any;
|
|
315
|
+
/**
|
|
316
|
+
* @see PicoFormat.castParams
|
|
317
|
+
*/
|
|
318
|
+
function params(...args: any[]): any;
|
|
319
|
+
/**
|
|
320
|
+
* @see PicoFormat.parseParams
|
|
321
|
+
*/
|
|
322
|
+
function fromParams(...args: any[]): any;
|
|
323
|
+
/**
|
|
324
|
+
* @see PicoFormat.filesize
|
|
325
|
+
*/
|
|
326
|
+
function filesize(...args: any[]): any;
|
|
327
|
+
function real(): void;
|
|
328
|
+
function array(): void;
|
|
329
|
+
}
|
|
330
|
+
export default PicoString;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export class PicoElement {
|
|
2
|
+
/**
|
|
3
|
+
* Prefix for attribute selector.
|
|
4
|
+
*/
|
|
5
|
+
static prefix: string;
|
|
6
|
+
/**
|
|
7
|
+
* Mounted identifier.
|
|
8
|
+
*/
|
|
9
|
+
static mount: string;
|
|
10
|
+
/**
|
|
11
|
+
* Instance storage.
|
|
12
|
+
*/
|
|
13
|
+
static inis: {};
|
|
14
|
+
/**
|
|
15
|
+
* Runtime storage.
|
|
16
|
+
*/
|
|
17
|
+
static runs: any[];
|
|
18
|
+
/**
|
|
19
|
+
* Instance storage.
|
|
20
|
+
*/
|
|
21
|
+
static invi: any[];
|
|
22
|
+
/**
|
|
23
|
+
* Listen to scroll events
|
|
24
|
+
*
|
|
25
|
+
* @example PicoElement.listen()
|
|
26
|
+
*
|
|
27
|
+
* @returns {void} No return value
|
|
28
|
+
*/
|
|
29
|
+
static listen(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Handle scroll visibility
|
|
32
|
+
*
|
|
33
|
+
* @example PicoElement.scroll()
|
|
34
|
+
*
|
|
35
|
+
* @returns {void} No return value
|
|
36
|
+
*/
|
|
37
|
+
static scroll(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register element alias
|
|
40
|
+
*
|
|
41
|
+
* @example PicoElement.alias("tab", Tab)
|
|
42
|
+
*
|
|
43
|
+
* @param {string} key Alias key
|
|
44
|
+
* @param {any} instance Class instance
|
|
45
|
+
* @returns {this} Current class
|
|
46
|
+
*/
|
|
47
|
+
static alias(key: string, instance: any): this;
|
|
48
|
+
/**
|
|
49
|
+
* Bind element to selector
|
|
50
|
+
*
|
|
51
|
+
* @example PicoElement.bind("tab", ".tabs")
|
|
52
|
+
*
|
|
53
|
+
* @param {string} key Alias key
|
|
54
|
+
* @param {any} selector Dom selector
|
|
55
|
+
* @param {any} [options] Init options
|
|
56
|
+
* @returns {this} Current class
|
|
57
|
+
*/
|
|
58
|
+
static bind(key: string, selector: any, options?: any): this;
|
|
59
|
+
/**
|
|
60
|
+
* Unbind element from selector
|
|
61
|
+
*
|
|
62
|
+
* @example PicoElement.unbind("tab", ".tabs")
|
|
63
|
+
*
|
|
64
|
+
* @param {string} key Alias key
|
|
65
|
+
* @param {any} selector Dom selector
|
|
66
|
+
* @param {any} [options] Init options
|
|
67
|
+
* @returns {this} Current class
|
|
68
|
+
*/
|
|
69
|
+
static unbind(key: string, selector: any, options?: any): this;
|
|
70
|
+
/**
|
|
71
|
+
* Observe DOM changes
|
|
72
|
+
*
|
|
73
|
+
* @example PicoElement.observe("tab")
|
|
74
|
+
*
|
|
75
|
+
* @param {string} key Alias key
|
|
76
|
+
* @param {boolean} [plain] Plain options
|
|
77
|
+
* @returns {this} Current class
|
|
78
|
+
*/
|
|
79
|
+
static observe(key: string, plain?: boolean): this;
|
|
80
|
+
/**
|
|
81
|
+
* Bind element on inview
|
|
82
|
+
*
|
|
83
|
+
* @example PicoElement.bindInview(el, cb)
|
|
84
|
+
*
|
|
85
|
+
* @param {Element} el Target element
|
|
86
|
+
* @param {function} cb Callback fn
|
|
87
|
+
* @returns {void} No return value
|
|
88
|
+
*/
|
|
89
|
+
static bindInview(el: Element, cb: Function): void;
|
|
90
|
+
/**
|
|
91
|
+
* Unbind element on inview
|
|
92
|
+
*
|
|
93
|
+
* @example PicoElement.unbindInview(el, cb)
|
|
94
|
+
*
|
|
95
|
+
* @param {Element} el Target element
|
|
96
|
+
* @param {function} cb Callback fn
|
|
97
|
+
* @returns {void} No return value
|
|
98
|
+
*/
|
|
99
|
+
static unbindInview(el: Element, cb: Function): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get attribute prefix
|
|
102
|
+
*
|
|
103
|
+
* @example PicoElement.getPrefix("tab") // => "js-tab"
|
|
104
|
+
*
|
|
105
|
+
* @param {string} [key] Alias key
|
|
106
|
+
* @returns {string} Attribute prefix
|
|
107
|
+
*/
|
|
108
|
+
static getPrefix(key?: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Set attribute prefix
|
|
111
|
+
*
|
|
112
|
+
* @example PicoElement.setPrefix("pi")
|
|
113
|
+
*
|
|
114
|
+
* @param {string} prefix New prefix
|
|
115
|
+
* @returns {void} No return value
|
|
116
|
+
*/
|
|
117
|
+
static setPrefix(prefix: string): void;
|
|
118
|
+
}
|
|
119
|
+
export default PicoElement;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @const {object} google
|
|
3
|
+
*/
|
|
4
|
+
export class PicoMap {
|
|
5
|
+
static mapStyle: any[];
|
|
6
|
+
static markerStyles: {};
|
|
7
|
+
static hideMarkers: boolean;
|
|
8
|
+
static closeInfoWindows: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Set global map style
|
|
11
|
+
*
|
|
12
|
+
* @example Map.setMapStyle(style)
|
|
13
|
+
*
|
|
14
|
+
* @param {Array<any>} [style] Style array
|
|
15
|
+
* @returns {this} Current class
|
|
16
|
+
*/
|
|
17
|
+
static setMapStyle(style?: Array<any>): this;
|
|
18
|
+
/**
|
|
19
|
+
* Set marker style
|
|
20
|
+
*
|
|
21
|
+
* @example Map.setMarkerStyle("default", { default: "icon.png" })
|
|
22
|
+
*
|
|
23
|
+
* @param {string} key Style key
|
|
24
|
+
* @param {any} [style] Style options
|
|
25
|
+
* @param {any} [extra] Extra options
|
|
26
|
+
* @returns {this} Current class
|
|
27
|
+
*/
|
|
28
|
+
static setMarkerStyle(key: string, style?: any, extra?: any): this;
|
|
29
|
+
/**
|
|
30
|
+
* Create map instance
|
|
31
|
+
*
|
|
32
|
+
* @example new Map("#map", { lat: 0, lng: 0 })
|
|
33
|
+
*
|
|
34
|
+
* @param {any} el Target element
|
|
35
|
+
* @param {any} [options] Map options
|
|
36
|
+
*/
|
|
37
|
+
constructor(el: any, options?: any);
|
|
38
|
+
map: any;
|
|
39
|
+
markers: {};
|
|
40
|
+
cluster: any;
|
|
41
|
+
clusterFilter: any;
|
|
42
|
+
clusterOptions: {};
|
|
43
|
+
/**
|
|
44
|
+
* Cluster map markers
|
|
45
|
+
*
|
|
46
|
+
* @example map.clusterMarkers()
|
|
47
|
+
*
|
|
48
|
+
* @param {any} [options] Cluster options
|
|
49
|
+
* @param {any} [filter] Marker filter
|
|
50
|
+
* @param {boolean} [allowCreate] Create cluster
|
|
51
|
+
* @returns {void} No return value
|
|
52
|
+
*/
|
|
53
|
+
clusterMarkers(options?: any, filter?: any, allowCreate?: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Apply style to marker
|
|
56
|
+
*
|
|
57
|
+
* @example map.styleMarker("m1", "hover")
|
|
58
|
+
*
|
|
59
|
+
* @param {string} key Marker key
|
|
60
|
+
* @param {any} [type] Style type
|
|
61
|
+
* @returns {void} No return value
|
|
62
|
+
*/
|
|
63
|
+
styleMarker(key: string, type?: any): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get marker by key
|
|
66
|
+
*
|
|
67
|
+
* @example map.getMarker("m1")
|
|
68
|
+
*
|
|
69
|
+
* @param {string} key Marker key
|
|
70
|
+
* @returns {any} Marker object
|
|
71
|
+
*/
|
|
72
|
+
getMarker(key: string): any;
|
|
73
|
+
/**
|
|
74
|
+
* Check if marker is visible
|
|
75
|
+
*
|
|
76
|
+
* @example map.getMarkerVisibility("m1") // => true
|
|
77
|
+
*
|
|
78
|
+
* @param {string} key Marker key
|
|
79
|
+
* @param {boolean} [fallback] Fallback value
|
|
80
|
+
* @returns {boolean} Visibility state
|
|
81
|
+
*/
|
|
82
|
+
getMarkerVisibility(key: string, fallback?: boolean): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get marker position
|
|
85
|
+
*
|
|
86
|
+
* @example map.getMarkerPositon("m1") // => LatLng
|
|
87
|
+
*
|
|
88
|
+
* @param {string} key Marker key
|
|
89
|
+
* @param {any} [fallback] Fallback value
|
|
90
|
+
* @returns {any} Position object
|
|
91
|
+
*/
|
|
92
|
+
getMarkerPositon(key: string, fallback?: any): any;
|
|
93
|
+
/**
|
|
94
|
+
* Toggle marker visibility
|
|
95
|
+
*
|
|
96
|
+
* @example map.toggleMarker("m1")
|
|
97
|
+
*
|
|
98
|
+
* @param {string} key Marker key
|
|
99
|
+
* @returns {boolean|void} Visibility state
|
|
100
|
+
*/
|
|
101
|
+
toggleMarker(key: string): boolean | void;
|
|
102
|
+
/**
|
|
103
|
+
* Show marker on map
|
|
104
|
+
*
|
|
105
|
+
* @example map.showMarker("m1")
|
|
106
|
+
*
|
|
107
|
+
* @param {string} key Marker key
|
|
108
|
+
* @returns {boolean|void} Previous state
|
|
109
|
+
*/
|
|
110
|
+
showMarker(key: string): boolean | void;
|
|
111
|
+
/**
|
|
112
|
+
* Hide marker on map
|
|
113
|
+
*
|
|
114
|
+
* @example map.hideMarker("m1")
|
|
115
|
+
*
|
|
116
|
+
* @param {string} key Marker key
|
|
117
|
+
* @returns {boolean|void} Previous state
|
|
118
|
+
*/
|
|
119
|
+
hideMarker(key: string): boolean | void;
|
|
120
|
+
/**
|
|
121
|
+
* Marker hover enter
|
|
122
|
+
*
|
|
123
|
+
* @example map.enterMarker("m1")
|
|
124
|
+
*
|
|
125
|
+
* @param {string} key Marker key
|
|
126
|
+
* @returns {this|void} Current instance
|
|
127
|
+
*/
|
|
128
|
+
enterMarker(key: string): this | void;
|
|
129
|
+
/**
|
|
130
|
+
* Marker hover leave
|
|
131
|
+
*
|
|
132
|
+
* @example map.leaveMarker("m1")
|
|
133
|
+
*
|
|
134
|
+
* @param {string} key Marker key
|
|
135
|
+
* @returns {this|void} Current instance
|
|
136
|
+
*/
|
|
137
|
+
leaveMarker(key: string): this | void;
|
|
138
|
+
/**
|
|
139
|
+
* Check if info is open
|
|
140
|
+
*
|
|
141
|
+
* @example map.getInfoVisibility("m1") // => true
|
|
142
|
+
*
|
|
143
|
+
* @param {string} key Marker key
|
|
144
|
+
* @param {boolean} [fallback] Fallback value
|
|
145
|
+
* @returns {boolean} Visibility state
|
|
146
|
+
*/
|
|
147
|
+
getInfoVisibility(key: string, fallback?: boolean): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Toggle info window
|
|
150
|
+
*
|
|
151
|
+
* @example map.toggleInfo("m1")
|
|
152
|
+
*
|
|
153
|
+
* @param {string} key Marker key
|
|
154
|
+
* @returns {boolean|void} Visibility state
|
|
155
|
+
*/
|
|
156
|
+
toggleInfo(key: string): boolean | void;
|
|
157
|
+
/**
|
|
158
|
+
* Open info window
|
|
159
|
+
*
|
|
160
|
+
* @example map.openInfo("m1")
|
|
161
|
+
*
|
|
162
|
+
* @param {string} key Marker key
|
|
163
|
+
* @returns {boolean|void} Previous state
|
|
164
|
+
*/
|
|
165
|
+
openInfo(key: string): boolean | void;
|
|
166
|
+
/**
|
|
167
|
+
* Close info window
|
|
168
|
+
*
|
|
169
|
+
* @example map.closeInfo("m1")
|
|
170
|
+
*
|
|
171
|
+
* @param {string} key Marker key
|
|
172
|
+
* @returns {boolean|void} Previous state
|
|
173
|
+
*/
|
|
174
|
+
closeInfo(key: string): boolean | void;
|
|
175
|
+
/**
|
|
176
|
+
* Create map marker
|
|
177
|
+
*
|
|
178
|
+
* @example map.createMarker("m1", { lat: 0, lng: 0 })
|
|
179
|
+
*
|
|
180
|
+
* @param {any} [key] Marker key
|
|
181
|
+
* @param {any} [options] Marker options
|
|
182
|
+
* @returns {any} Marker object
|
|
183
|
+
*/
|
|
184
|
+
createMarker(key?: any, options?: any): any;
|
|
185
|
+
/**
|
|
186
|
+
* Set marker position
|
|
187
|
+
*
|
|
188
|
+
* @example map.setMarkerPosition("m1", { lat: 0, lng: 0 })
|
|
189
|
+
*
|
|
190
|
+
* @param {string} key Marker key
|
|
191
|
+
* @param {any} [options] Position options
|
|
192
|
+
* @returns {void} No return value
|
|
193
|
+
*/
|
|
194
|
+
setMarkerPosition(key: string, options?: any): void;
|
|
195
|
+
/**
|
|
196
|
+
* Set marker by address
|
|
197
|
+
*
|
|
198
|
+
* @example map.setMarkerByAddress("m1", "Address")
|
|
199
|
+
*
|
|
200
|
+
* @param {string} key Marker key
|
|
201
|
+
* @param {any} address Search address
|
|
202
|
+
* @returns {Promise<any>} Response promise
|
|
203
|
+
*/
|
|
204
|
+
setMarkerByAddress(key: string, address: any): Promise<any>;
|
|
205
|
+
/**
|
|
206
|
+
* Get location by address
|
|
207
|
+
*
|
|
208
|
+
* @example map.getLocationByAddress("Address")
|
|
209
|
+
*
|
|
210
|
+
* @param {any} address Search address
|
|
211
|
+
* @param {function} [callback] Success callback
|
|
212
|
+
* @returns {Promise<any>} Response promise
|
|
213
|
+
*/
|
|
214
|
+
getLocationByAddress(address: any, callback?: Function): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* Show markers on map
|
|
217
|
+
*
|
|
218
|
+
* @example map.showMarkers()
|
|
219
|
+
*
|
|
220
|
+
* @param {any} [filter] Marker filter
|
|
221
|
+
* @returns {this} Current instance
|
|
222
|
+
*/
|
|
223
|
+
showMarkers(filter?: any): this;
|
|
224
|
+
/**
|
|
225
|
+
* Get marker boundary
|
|
226
|
+
*
|
|
227
|
+
* @example map.getMarkerBoundry() // => LatLngBounds
|
|
228
|
+
*
|
|
229
|
+
* @param {any} [filter] Marker filter
|
|
230
|
+
* @returns {any} Boundary object
|
|
231
|
+
*/
|
|
232
|
+
getMarkerBoundry(filter?: any): any;
|
|
233
|
+
/**
|
|
234
|
+
* Focus markers on map
|
|
235
|
+
*
|
|
236
|
+
* @example map.focusMarkers()
|
|
237
|
+
*
|
|
238
|
+
* @param {any} [filter] Marker filter
|
|
239
|
+
* @param {number} [maxZoom] Max zoom level
|
|
240
|
+
* @param {number} [boundSpace] Viewport space
|
|
241
|
+
* @returns {this} Current instance
|
|
242
|
+
*/
|
|
243
|
+
focusMarkers(filter?: any, maxZoom?: number, boundSpace?: number): this;
|
|
244
|
+
/**
|
|
245
|
+
* Render directions on map
|
|
246
|
+
*
|
|
247
|
+
* @example map.renderDirections({ origin: "A", destination: "B" })
|
|
248
|
+
*
|
|
249
|
+
* @param {any} options Render options
|
|
250
|
+
* @returns {Promise<any>} Response promise
|
|
251
|
+
*/
|
|
252
|
+
renderDirections(options: any): Promise<any>;
|
|
253
|
+
}
|
|
254
|
+
export default PicoMap;
|
package/dist/.ignore.js
DELETED
|
File without changes
|