@kizmann/pico-js 2.0.7 → 2.0.9
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/pico-js.browser.js +1 -1
- package/dist/pico-js.browser.js.map +1 -1
- package/dist/pico-js.esm.js +1 -1
- package/dist/pico-js.esm.js.map +1 -1
- package/package.json +4 -6
- package/src/dom/{DomAttribute.js → DomAttribute.ts} +40 -63
- package/src/dom/{DomBuilder.js → DomBuilder.ts} +27 -44
- package/src/dom/{DomEvent.js → DomEvent.ts} +101 -76
- package/src/dom/{DomFinder.js → DomFinder.ts} +103 -139
- package/src/dom/DomForm.ts +38 -0
- package/src/dom/{DomGlobal.js → DomGlobal.ts} +34 -51
- package/src/dom/{DomInview.js → DomInview.ts} +37 -57
- package/src/dom/DomMeta.ts +48 -0
- package/src/dom/DomObserver.ts +17 -0
- package/src/dom/{DomPopover.js → DomPopover.ts} +20 -39
- package/src/dom/{DomRectangle.js → DomRectangle.ts} +70 -87
- package/src/format/{FormatFile.js → FormatFile.ts} +12 -23
- package/src/format/{FormatOption.js → FormatOption.ts} +15 -24
- package/src/format/{FormatParam.js → FormatParam.ts} +14 -25
- package/src/format/{FormatParser.js → FormatParser.ts} +29 -39
- package/src/format/{FormatUrl.js → FormatUrl.ts} +9 -21
- package/src/index.browser.ts +32 -0
- package/src/index.esm.ts +64 -0
- package/src/now/{NowDefault.js → NowDefault.ts} +86 -121
- package/src/now/{NowFormat.js → NowFormat.ts} +23 -28
- package/src/now/{NowGrid.js → NowGrid.ts} +41 -58
- package/src/now/{NowHuman.js → NowHuman.ts} +18 -27
- package/src/now/{NowMatch.js → NowMatch.ts} +22 -28
- package/src/now/{NowRange.js → NowRange.ts} +13 -22
- package/src/now/{NowWalker.js → NowWalker.ts} +65 -71
- package/src/tool/{scope.js → scope.ts} +41 -11
- package/src/utils/{Array.js → Array.ts} +187 -152
- package/src/utils/{Cookie.js → Cookie.ts} +15 -12
- package/src/utils/{Data.js → Data.ts} +17 -17
- package/src/utils/Dom.ts +204 -0
- package/src/utils/Format.ts +48 -0
- package/src/utils/{Hash.js → Hash.ts} +20 -20
- package/src/utils/{Locale.js → Locale.ts} +21 -21
- package/src/utils/{Mixed.js → Mixed.ts} +104 -61
- package/src/utils/{Now.js → Now.ts} +68 -69
- package/src/utils/{Number.js → Number.ts} +34 -36
- package/src/utils/{Object.js → Object.ts} +68 -122
- package/src/utils/{Route.js → Route.ts} +11 -9
- package/src/utils/{Runner.js → Runner.ts} +89 -77
- package/src/utils/{Signal.js → Signal.ts} +35 -22
- package/src/utils/{String.js → String.ts} +79 -69
- package/src/wip/{Element.js → Element.ts} +2 -2
- package/src/wip/{Map.js → Map.ts} +1 -1
- package/types/dom/DomAttribute.d.ts +16 -27
- package/types/dom/DomBuilder.d.ts +6 -9
- package/types/dom/DomEvent.d.ts +19 -24
- package/types/dom/DomFinder.d.ts +38 -61
- package/types/dom/DomForm.d.ts +7 -10
- package/types/dom/DomGlobal.d.ts +8 -15
- package/types/dom/DomInview.d.ts +9 -19
- package/types/dom/DomMeta.d.ts +9 -16
- package/types/dom/DomObserver.d.ts +4 -8
- package/types/dom/DomPopover.d.ts +8 -11
- package/types/dom/DomRectangle.d.ts +21 -35
- package/types/format/FormatFile.d.ts +5 -8
- package/types/format/FormatOption.d.ts +6 -8
- package/types/format/FormatParam.d.ts +6 -9
- package/types/format/FormatParser.d.ts +10 -18
- package/types/format/FormatUrl.d.ts +5 -8
- package/types/index.esm.d.ts +25 -37
- package/types/now/NowDefault.d.ts +30 -99
- package/types/now/NowFormat.d.ts +8 -21
- package/types/now/NowGrid.d.ts +24 -46
- package/types/now/NowHuman.d.ts +10 -11
- package/types/now/NowMatch.d.ts +6 -4
- package/types/now/NowRange.d.ts +5 -8
- package/types/now/NowWalker.d.ts +6 -4
- package/types/tool/scope.d.ts +11 -3
- package/types/utils/Array.d.ts +83 -101
- package/types/utils/Cookie.d.ts +11 -8
- package/types/utils/Data.d.ts +7 -7
- package/types/utils/Dom.d.ts +63 -96
- package/types/utils/Format.d.ts +15 -28
- package/types/utils/Hash.d.ts +21 -21
- package/types/utils/Locale.d.ts +9 -9
- package/types/utils/Mixed.d.ts +19 -32
- package/types/utils/Now.d.ts +51 -56
- package/types/utils/Number.d.ts +9 -20
- package/types/utils/Object.d.ts +21 -36
- package/types/utils/Route.d.ts +5 -2
- package/types/utils/Runner.d.ts +45 -38
- package/types/utils/Signal.d.ts +16 -16
- package/types/utils/String.d.ts +40 -76
- package/src/dom/DomForm.js +0 -59
- package/src/dom/DomMeta.js +0 -68
- package/src/dom/DomObserver.js +0 -38
- package/src/index.browser.js +0 -36
- package/src/index.esm.js +0 -80
- package/src/utils/Dom.js +0 -214
- package/src/utils/Format.js +0 -62
- package/types/wip/Element.d.ts +0 -119
- package/types/wip/Map.d.ts +0 -254
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arr, For, Locale, Mix, Now, Str } from "../index.esm.
|
|
1
|
+
import { Arr, For, Locale, Mix, Now, Str } from "../index.esm.ts";
|
|
2
2
|
|
|
3
3
|
export class PicoString
|
|
4
4
|
{
|
|
@@ -8,12 +8,12 @@ export class PicoString
|
|
|
8
8
|
* @example Str.get("abc", 1) // => "b"
|
|
9
9
|
*
|
|
10
10
|
* @param {any} value Input string
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {number} index Char index
|
|
12
12
|
* @returns {string} Single char
|
|
13
13
|
*/
|
|
14
|
-
static get(value, index)
|
|
14
|
+
static get(value : any, index : number) : string
|
|
15
15
|
{
|
|
16
|
-
if ( !
|
|
16
|
+
if ( !Mix.isStr(value) ) {
|
|
17
17
|
value = Mix.str(value);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -34,9 +34,9 @@ export class PicoString
|
|
|
34
34
|
* @param {string} [replace] Replace value
|
|
35
35
|
* @returns {string} Updated string
|
|
36
36
|
*/
|
|
37
|
-
static set(value, index, replace = '')
|
|
37
|
+
static set(value : any, index : any, replace : string = '') : string
|
|
38
38
|
{
|
|
39
|
-
if ( !
|
|
39
|
+
if ( !Mix.isStr(value) ) {
|
|
40
40
|
value = Mix.str(value);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -58,7 +58,7 @@ export class PicoString
|
|
|
58
58
|
* @param {any} [search] Search value
|
|
59
59
|
* @returns {string} Updated string
|
|
60
60
|
*/
|
|
61
|
-
static replace(value, replace, search = null)
|
|
61
|
+
static replace(value : any, replace : string, search : any = null) : string
|
|
62
62
|
{
|
|
63
63
|
if ( Mix.isNull(search) ) {
|
|
64
64
|
search = value;
|
|
@@ -83,13 +83,13 @@ export class PicoString
|
|
|
83
83
|
* @param {any} [search] Match source
|
|
84
84
|
* @returns {string|null} Extracted string
|
|
85
85
|
*/
|
|
86
|
-
static extract(value, replace, search = null)
|
|
86
|
+
static extract(value : any, replace : string, search : any = null) : string
|
|
87
87
|
{
|
|
88
88
|
if ( Mix.isNull(search) ) {
|
|
89
89
|
search = value;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
let index = this.range(search, replace);
|
|
92
|
+
let index : [number, number] = this.range(search, replace);
|
|
93
93
|
|
|
94
94
|
if ( index === null ) {
|
|
95
95
|
return null;
|
|
@@ -105,10 +105,10 @@ export class PicoString
|
|
|
105
105
|
*
|
|
106
106
|
* @param {any} value Input string
|
|
107
107
|
* @param {RegExp|string} pattern Match pattern
|
|
108
|
-
* @param {
|
|
108
|
+
* @param {Function} [cb] Callback fn
|
|
109
109
|
* @returns {any} Match result
|
|
110
110
|
*/
|
|
111
|
-
static match(value, pattern, cb = null)
|
|
111
|
+
static match(value : any, pattern : RegExp | string, cb : Function = null) : any
|
|
112
112
|
{
|
|
113
113
|
let result = Mix.str(value).match(pattern);
|
|
114
114
|
|
|
@@ -124,12 +124,12 @@ export class PicoString
|
|
|
124
124
|
*
|
|
125
125
|
* @example Str.regex("a.b") // => "a\\.b"
|
|
126
126
|
*
|
|
127
|
-
* @param {any}
|
|
127
|
+
* @param {any} value Input string
|
|
128
128
|
* @returns {string} Escaped string
|
|
129
129
|
*/
|
|
130
|
-
static regex(
|
|
130
|
+
static regex(value : any) : string
|
|
131
131
|
{
|
|
132
|
-
return Mix.str(
|
|
132
|
+
return Mix.str(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
@@ -140,7 +140,7 @@ export class PicoString
|
|
|
140
140
|
* @param {any} value Input string
|
|
141
141
|
* @returns {string} Uppercase string
|
|
142
142
|
*/
|
|
143
|
-
static uc(value)
|
|
143
|
+
static uc(value : any) : string
|
|
144
144
|
{
|
|
145
145
|
return Mix.str(value).toUpperCase();
|
|
146
146
|
}
|
|
@@ -155,12 +155,12 @@ export class PicoString
|
|
|
155
155
|
*
|
|
156
156
|
* @example Str.ucfirst("abc") // => "Abc"
|
|
157
157
|
*
|
|
158
|
-
* @param {
|
|
158
|
+
* @param {any} value Input string
|
|
159
159
|
* @returns {string} Updated string
|
|
160
160
|
*/
|
|
161
|
-
static ucfirst(value)
|
|
161
|
+
static ucfirst(value : any) : string
|
|
162
162
|
{
|
|
163
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
163
|
+
return Mix.str(value).charAt(0).toUpperCase() + value.slice(1);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/**
|
|
@@ -171,7 +171,7 @@ export class PicoString
|
|
|
171
171
|
* @param {any} value Input string
|
|
172
172
|
* @returns {string} Lowercase string
|
|
173
173
|
*/
|
|
174
|
-
static lc(value)
|
|
174
|
+
static lc(value : any) : string
|
|
175
175
|
{
|
|
176
176
|
return Mix.str(value).toLowerCase();
|
|
177
177
|
}
|
|
@@ -186,12 +186,12 @@ export class PicoString
|
|
|
186
186
|
*
|
|
187
187
|
* @example Str.lcfirst("ABC") // => "aBC"
|
|
188
188
|
*
|
|
189
|
-
* @param {
|
|
189
|
+
* @param {any} value Input string
|
|
190
190
|
* @returns {string} Updated string
|
|
191
191
|
*/
|
|
192
|
-
static lcfirst(value)
|
|
192
|
+
static lcfirst(value : any) : string
|
|
193
193
|
{
|
|
194
|
-
return value.charAt(0).toLowerCase() + value.slice(1);
|
|
194
|
+
return Mix.str(value).charAt(0).toLowerCase() + value.slice(1);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -199,10 +199,10 @@ export class PicoString
|
|
|
199
199
|
*
|
|
200
200
|
* @example Str.cc("hello-world") // => "helloWorld"
|
|
201
201
|
*
|
|
202
|
-
* @param {
|
|
202
|
+
* @param {any} value Input string
|
|
203
203
|
* @returns {string} camelCase string
|
|
204
204
|
*/
|
|
205
|
-
static cc(value)
|
|
205
|
+
static cc(value : any) : string
|
|
206
206
|
{
|
|
207
207
|
let splits = Arr.each(For.slugify(value).split('-'), (v, i) => {
|
|
208
208
|
return i ? this.ucfirst(v) : v;
|
|
@@ -221,10 +221,10 @@ export class PicoString
|
|
|
221
221
|
*
|
|
222
222
|
* @example Str.kc("helloWorld") // => "hello-world"
|
|
223
223
|
*
|
|
224
|
-
* @param {
|
|
224
|
+
* @param {any} value Input string
|
|
225
225
|
* @returns {string} kebab-case string
|
|
226
226
|
*/
|
|
227
|
-
static kc(value)
|
|
227
|
+
static kc(value : any) : string
|
|
228
228
|
{
|
|
229
229
|
return For.slugify(value);
|
|
230
230
|
}
|
|
@@ -239,10 +239,10 @@ export class PicoString
|
|
|
239
239
|
*
|
|
240
240
|
* @example Str.sc("helloWorld") // => "hello_world"
|
|
241
241
|
*
|
|
242
|
-
* @param {
|
|
242
|
+
* @param {any} value Input string
|
|
243
243
|
* @returns {string} snake_case string
|
|
244
244
|
*/
|
|
245
|
-
static sc(value)
|
|
245
|
+
static sc(value : any) : string
|
|
246
246
|
{
|
|
247
247
|
return For.slugify(value).replace('-', '_');
|
|
248
248
|
}
|
|
@@ -257,10 +257,10 @@ export class PicoString
|
|
|
257
257
|
*
|
|
258
258
|
* @example Str.pc("hello-world") // => "HelloWorld"
|
|
259
259
|
*
|
|
260
|
-
* @param {
|
|
260
|
+
* @param {any} value Input string
|
|
261
261
|
* @returns {string} PascalCase string
|
|
262
262
|
*/
|
|
263
|
-
static pc(value)
|
|
263
|
+
static pc(value : any) : string
|
|
264
264
|
{
|
|
265
265
|
let splits = Arr.each(For.slugify(value).split('-'), (v) => {
|
|
266
266
|
return this.ucfirst(v);
|
|
@@ -279,11 +279,11 @@ export class PicoString
|
|
|
279
279
|
*
|
|
280
280
|
* @example Str.has("abc", "b") // => true
|
|
281
281
|
*
|
|
282
|
-
* @param {
|
|
283
|
-
* @param {
|
|
282
|
+
* @param {any} value Input string
|
|
283
|
+
* @param {any} search Search string
|
|
284
284
|
* @returns {boolean} True if found
|
|
285
285
|
*/
|
|
286
|
-
static has(value, search)
|
|
286
|
+
static has(value : any, search : any) : boolean
|
|
287
287
|
{
|
|
288
288
|
return this.lc(value).indexOf(this.lc(search)) !== -1;
|
|
289
289
|
}
|
|
@@ -296,9 +296,9 @@ export class PicoString
|
|
|
296
296
|
* @param {any} value Input string
|
|
297
297
|
* @param {string} search Search string
|
|
298
298
|
* @param {any} [fallback] Fallback value
|
|
299
|
-
* @returns {
|
|
299
|
+
* @returns {number[]|any} Index range
|
|
300
300
|
*/
|
|
301
|
-
static range(value, search, fallback = null)
|
|
301
|
+
static range(value : any, search : string, fallback : any = null) : number[] | any
|
|
302
302
|
{
|
|
303
303
|
let index = Mix.str(value).indexOf(search);
|
|
304
304
|
|
|
@@ -319,7 +319,7 @@ export class PicoString
|
|
|
319
319
|
* @param {number} limit End index
|
|
320
320
|
* @returns {string} Sliced string
|
|
321
321
|
*/
|
|
322
|
-
static slice(value, start, limit)
|
|
322
|
+
static slice(value : any, start : number, limit : number) : string
|
|
323
323
|
{
|
|
324
324
|
return Mix.str(value).slice(start, limit);
|
|
325
325
|
}
|
|
@@ -330,11 +330,11 @@ export class PicoString
|
|
|
330
330
|
* @example Str.string("<b>a</b>") // => "a"
|
|
331
331
|
*
|
|
332
332
|
* @param {any} value Input value
|
|
333
|
-
* @param {
|
|
333
|
+
* @param {string} [empty] Empty fallback
|
|
334
334
|
* @param {boolean} [html] Keep HTML
|
|
335
335
|
* @returns {string} String value
|
|
336
336
|
*/
|
|
337
|
-
static string(value, empty = '-', html = false)
|
|
337
|
+
static string(value : any, empty : string = '-', html : boolean = false) : string
|
|
338
338
|
{
|
|
339
339
|
if ( Mix.isEmpty(value) ) {
|
|
340
340
|
return empty;
|
|
@@ -357,10 +357,10 @@ export class PicoString
|
|
|
357
357
|
* @param {any} value Input value
|
|
358
358
|
* @param {string} [yes] True string
|
|
359
359
|
* @param {string} [no] False string
|
|
360
|
-
* @param {
|
|
361
|
-
* @returns {string
|
|
360
|
+
* @param {string} [empty] Empty fallback
|
|
361
|
+
* @returns {string} Boolean string
|
|
362
362
|
*/
|
|
363
|
-
static boolean(value, yes = 'Yes', no = 'No', empty = '-')
|
|
363
|
+
static boolean(value : any, yes : string = 'Yes', no : string = 'No', empty : string = '-') : string
|
|
364
364
|
{
|
|
365
365
|
if ( Mix.isEmpty(value) ) {
|
|
366
366
|
return empty;
|
|
@@ -378,12 +378,12 @@ export class PicoString
|
|
|
378
378
|
* @param {number} [fixed] Decimal points
|
|
379
379
|
* @param {string} [locale] Locale code
|
|
380
380
|
* @param {any} [config] Format config
|
|
381
|
-
* @returns {string
|
|
381
|
+
* @returns {string} Formatted string
|
|
382
382
|
*/
|
|
383
|
-
static number(value, fixed = null, locale = null, config = {})
|
|
383
|
+
static number(value : any, fixed : number = null, locale : string = null, config : any = {}) : string
|
|
384
384
|
{
|
|
385
|
-
if ( !
|
|
386
|
-
return value;
|
|
385
|
+
if ( !Mix.isNum(value) ) {
|
|
386
|
+
return Mix.str(value);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
if ( locale == null ) {
|
|
@@ -412,19 +412,19 @@ export class PicoString
|
|
|
412
412
|
* @param {string} [padding] Padding char
|
|
413
413
|
* @returns {string|any} Formatted string
|
|
414
414
|
*/
|
|
415
|
-
static integer(value, leading = 0, padding = '0')
|
|
415
|
+
static integer(value : any, leading : number = 0, padding : string = '0') : string
|
|
416
416
|
{
|
|
417
|
-
if ( !
|
|
418
|
-
return value;
|
|
417
|
+
if ( !Mix.isNum(value) ) {
|
|
418
|
+
return Mix.str(value);
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
if ( !
|
|
421
|
+
if ( !Mix.isInt(value) ) {
|
|
422
422
|
value = Mix.int(value);
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
value = Mix.int(value);
|
|
426
426
|
|
|
427
|
-
if ( !
|
|
427
|
+
if ( !leading ) {
|
|
428
428
|
return Mix.str(value);
|
|
429
429
|
}
|
|
430
430
|
|
|
@@ -438,16 +438,16 @@ export class PicoString
|
|
|
438
438
|
*
|
|
439
439
|
* @param {any} value Input value
|
|
440
440
|
* @param {string} [format] Output format
|
|
441
|
-
* @param {
|
|
441
|
+
* @param {string} [empty] Empty fallback
|
|
442
442
|
* @returns {string} Formatted string
|
|
443
443
|
*/
|
|
444
|
-
static datetime(value, format = 'YYYY-MM-DD HH:mm:ss', empty = '-')
|
|
444
|
+
static datetime(value : any, format : string = 'YYYY-MM-DD HH:mm:ss', empty : string = '-') : string
|
|
445
445
|
{
|
|
446
|
-
if ( !
|
|
446
|
+
if ( !Mix.isDate(value) ) {
|
|
447
447
|
value = Now.make(value);
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
if ( !
|
|
450
|
+
if ( !value.valid() ) {
|
|
451
451
|
return empty;
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -461,10 +461,10 @@ export class PicoString
|
|
|
461
461
|
*
|
|
462
462
|
* @param {any} value Input value
|
|
463
463
|
* @param {string} [format] Output format
|
|
464
|
-
* @param {
|
|
464
|
+
* @param {string} [empty] Empty fallback
|
|
465
465
|
* @returns {string} Formatted string
|
|
466
466
|
*/
|
|
467
|
-
static date(value, format = 'YYYY-MM-DD', empty = '-')
|
|
467
|
+
static date(value : any, format : string = 'YYYY-MM-DD', empty : string = '-') : string
|
|
468
468
|
{
|
|
469
469
|
return this.datetime(value, format, empty);
|
|
470
470
|
}
|
|
@@ -479,7 +479,7 @@ export class PicoString
|
|
|
479
479
|
* @param {any} [empty] Empty fallback
|
|
480
480
|
* @returns {string} Formatted string
|
|
481
481
|
*/
|
|
482
|
-
static time(value, format = 'HH:mm:ss', empty = '-')
|
|
482
|
+
static time(value : any, format : string = 'HH:mm:ss', empty : string = '-') : string
|
|
483
483
|
{
|
|
484
484
|
return this.datetime(value, format, empty);
|
|
485
485
|
}
|
|
@@ -494,7 +494,7 @@ export class PicoString
|
|
|
494
494
|
* @param {boolean} [toarray] Return array
|
|
495
495
|
* @returns {any} Parsed value
|
|
496
496
|
*/
|
|
497
|
-
static objectify(value, mode = 'options', toarray = false)
|
|
497
|
+
static objectify(value : any, mode : string = 'options', toarray : boolean = false) : any
|
|
498
498
|
{
|
|
499
499
|
if ( Mix.isRef(value) ) {
|
|
500
500
|
return value;
|
|
@@ -508,7 +508,7 @@ export class PicoString
|
|
|
508
508
|
value = For.parseOptions(value);
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
if ( !
|
|
511
|
+
if ( !Mix.isRef(value) ) {
|
|
512
512
|
value = JSON.parse(value)
|
|
513
513
|
}
|
|
514
514
|
|
|
@@ -524,7 +524,7 @@ export class PicoString
|
|
|
524
524
|
* @param {string} [mode] Cast mode
|
|
525
525
|
* @returns {string} Casted string
|
|
526
526
|
*/
|
|
527
|
-
static stringify(value, mode = 'options')
|
|
527
|
+
static stringify(value : any, mode : string = 'options') : string
|
|
528
528
|
{
|
|
529
529
|
if ( Mix.isStr(value) ) {
|
|
530
530
|
return value;
|
|
@@ -546,7 +546,8 @@ export class PicoString
|
|
|
546
546
|
/**
|
|
547
547
|
* @see PicoStr.regex
|
|
548
548
|
*/
|
|
549
|
-
|
|
549
|
+
// @ts-ignore
|
|
550
|
+
PicoString.regexEscape = (...args : Parameters<typeof Str.regex>) => {
|
|
550
551
|
console.warn('Str.regexEscape() is deprecated, use Str.regex() instead.');
|
|
551
552
|
return Str.regex(...args);
|
|
552
553
|
};
|
|
@@ -554,15 +555,17 @@ PicoString.regexEscape = (...args) => {
|
|
|
554
555
|
/**
|
|
555
556
|
* @see PicoStr.pascalcase
|
|
556
557
|
*/
|
|
557
|
-
|
|
558
|
+
// @ts-ignore
|
|
559
|
+
PicoString.humancase = (...args : Parameters<typeof Str.pc>) => {
|
|
558
560
|
console.warn('Str.humancase() is deprecated, use Str.pascalcase() instead.');
|
|
559
|
-
return Str.
|
|
561
|
+
return Str.pc(...args);
|
|
560
562
|
};
|
|
561
563
|
|
|
562
564
|
/**
|
|
563
565
|
* @see PicoFormat.slugify
|
|
564
566
|
*/
|
|
565
|
-
|
|
567
|
+
// @ts-ignore
|
|
568
|
+
PicoString.slugify = (...args : Parameters<typeof For.slugify>) => {
|
|
566
569
|
console.warn('Str.slugify() is deprecated, use For.slugify() instead.');
|
|
567
570
|
return For.slugify(...args);
|
|
568
571
|
};
|
|
@@ -570,7 +573,8 @@ PicoString.slugify = (...args) => {
|
|
|
570
573
|
/**
|
|
571
574
|
* @see PicoFormat.castOptions
|
|
572
575
|
*/
|
|
573
|
-
|
|
576
|
+
// @ts-ignore
|
|
577
|
+
PicoString.options = (...args : Parameters<typeof For.castOptions>) => {
|
|
574
578
|
console.warn('Str.options() is deprecated, use For.castOptions() instead.');
|
|
575
579
|
return For.castOptions(...args);
|
|
576
580
|
};
|
|
@@ -578,7 +582,8 @@ PicoString.options = (...args) => {
|
|
|
578
582
|
/**
|
|
579
583
|
* @see PicoFormat.parseOptions
|
|
580
584
|
*/
|
|
581
|
-
|
|
585
|
+
// @ts-ignore
|
|
586
|
+
PicoString.fromOptions = (...args : Parameters<typeof For.parseOptions>) => {
|
|
582
587
|
console.warn('Str.fromOptions() is deprecated, use For.parseOptions() instead.');
|
|
583
588
|
return For.parseOptions(...args);
|
|
584
589
|
};
|
|
@@ -586,7 +591,8 @@ PicoString.fromOptions = (...args) => {
|
|
|
586
591
|
/**
|
|
587
592
|
* @see PicoFormat.castParams
|
|
588
593
|
*/
|
|
589
|
-
|
|
594
|
+
// @ts-ignore
|
|
595
|
+
PicoString.params = (...args : Parameters<typeof For.castParams>) => {
|
|
590
596
|
console.warn('Str.params() is deprecated, use For.castParams() instead.');
|
|
591
597
|
return For.castParams(...args);
|
|
592
598
|
};
|
|
@@ -594,7 +600,8 @@ PicoString.params = (...args) => {
|
|
|
594
600
|
/**
|
|
595
601
|
* @see PicoFormat.parseParams
|
|
596
602
|
*/
|
|
597
|
-
|
|
603
|
+
// @ts-ignore
|
|
604
|
+
PicoString.fromParams = (...args : Parameters<typeof For.parseParams>) => {
|
|
598
605
|
console.warn('Str.fromParams() is deprecated, use For.parseParams() instead.');
|
|
599
606
|
return For.parseParams(...args);
|
|
600
607
|
};
|
|
@@ -602,15 +609,18 @@ PicoString.fromParams = (...args) => {
|
|
|
602
609
|
/**
|
|
603
610
|
* @see PicoFormat.filesize
|
|
604
611
|
*/
|
|
605
|
-
|
|
612
|
+
// @ts-ignore
|
|
613
|
+
PicoString.filesize = (...args : Parameters<typeof For.filesize>) => {
|
|
606
614
|
console.warn('Str.filesize() is deprecated, use For.filesize() instead.');
|
|
607
615
|
return For.filesize(...args);
|
|
608
616
|
};
|
|
609
617
|
|
|
618
|
+
// @ts-ignore
|
|
610
619
|
PicoString.real = () => {
|
|
611
620
|
console.error('Str.real() is not implemented anymore.');
|
|
612
621
|
};
|
|
613
622
|
|
|
623
|
+
// @ts-ignore
|
|
614
624
|
PicoString.array = () => {
|
|
615
625
|
console.error('Str.array() is not implemented anymore.');
|
|
616
626
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Str, Obj, Dom, Mix, Arr } from "
|
|
1
|
+
import { Str, Obj, Dom, Mix, Arr } from "../index.esm.ts";
|
|
2
2
|
|
|
3
3
|
export class PicoElement
|
|
4
4
|
{
|
|
@@ -58,7 +58,7 @@ export class PicoElement
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
Arr.
|
|
61
|
+
Arr.unset(this.invi, index);
|
|
62
62
|
|
|
63
63
|
item.cb();
|
|
64
64
|
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class PicoDomAttributeStatic {
|
|
1
|
+
import { PicoDom, PicoDomInterface } from "../utils/Dom.ts";
|
|
2
|
+
import PicoDomFinder from "./DomFinder.js";
|
|
3
|
+
export interface PicoDomAttribute extends PicoDomInterface, PicoDomFinder {
|
|
5
4
|
}
|
|
6
5
|
/**
|
|
7
6
|
* @memberof PicoDom
|
|
8
|
-
* @extends {PicoDom}
|
|
9
7
|
*/
|
|
10
|
-
export class
|
|
8
|
+
export declare class PicoDomAttribute {
|
|
11
9
|
/**
|
|
12
10
|
* Get or set attribute
|
|
13
11
|
*
|
|
@@ -16,9 +14,9 @@ export class PicoDomAttributeInstance {
|
|
|
16
14
|
* @param {string} key Attr key
|
|
17
15
|
* @param {any} [value] Attr value
|
|
18
16
|
* @param {any} [fallback] Fallback value
|
|
19
|
-
* @returns {any
|
|
17
|
+
* @returns {any} Attr value or instance
|
|
20
18
|
*/
|
|
21
|
-
attr(key: string, value?: any, fallback?: any): any
|
|
19
|
+
attr(key: string, value?: any, fallback?: any): any;
|
|
22
20
|
/**
|
|
23
21
|
* Get or set data attribute
|
|
24
22
|
*
|
|
@@ -27,9 +25,9 @@ export class PicoDomAttributeInstance {
|
|
|
27
25
|
* @param {string} key Data key
|
|
28
26
|
* @param {any} [value] Data value
|
|
29
27
|
* @param {any} [fallback] Fallback value
|
|
30
|
-
* @returns {any
|
|
28
|
+
* @returns {any} Data value or instance
|
|
31
29
|
*/
|
|
32
|
-
data(key: string, value?: any, fallback?: any): any
|
|
30
|
+
data(key: string, value?: any, fallback?: any): any;
|
|
33
31
|
/**
|
|
34
32
|
* Get computed style
|
|
35
33
|
*
|
|
@@ -47,9 +45,9 @@ export class PicoDomAttributeInstance {
|
|
|
47
45
|
*
|
|
48
46
|
* @param {any} [value] Style value
|
|
49
47
|
* @param {boolean} [combine] Combine style
|
|
50
|
-
* @returns {any
|
|
48
|
+
* @returns {any} Style or instance
|
|
51
49
|
*/
|
|
52
|
-
style(value?: any, combine?: boolean): any
|
|
50
|
+
style(value?: any, combine?: boolean): any;
|
|
53
51
|
/**
|
|
54
52
|
* Get or set classes
|
|
55
53
|
*
|
|
@@ -57,24 +55,24 @@ export class PicoDomAttributeInstance {
|
|
|
57
55
|
*
|
|
58
56
|
* @param {any} [value] Class value
|
|
59
57
|
* @param {boolean} [combine] Combine classes
|
|
60
|
-
* @returns {any
|
|
58
|
+
* @returns {any} Classes or instance
|
|
61
59
|
*/
|
|
62
|
-
class(value?: any, combine?: boolean): any
|
|
60
|
+
class(value?: any, combine?: boolean): any;
|
|
63
61
|
/**
|
|
64
62
|
* Get or set inner HTML
|
|
65
63
|
*
|
|
66
64
|
* @example Dom.find("div").html("<span></span>")
|
|
67
65
|
*
|
|
68
66
|
* @param {any} [html] HTML content
|
|
69
|
-
* @returns {
|
|
67
|
+
* @returns {any} HTML or instance
|
|
70
68
|
*/
|
|
71
|
-
html(html?: any):
|
|
69
|
+
html(html?: any): any;
|
|
72
70
|
/**
|
|
73
71
|
* Get actual style value
|
|
74
72
|
*
|
|
75
73
|
* @example Dom.find("div").actual((el) => el.offsetWidth, { display: "block" })
|
|
76
74
|
*
|
|
77
|
-
* @param {
|
|
75
|
+
* @param {Function} cb Callback fn
|
|
78
76
|
* @param {any} [style] Temp style
|
|
79
77
|
* @returns {any} Callback result
|
|
80
78
|
*/
|
|
@@ -125,14 +123,5 @@ export class PicoDomAttributeInstance {
|
|
|
125
123
|
* @returns {PicoDom} Current instance
|
|
126
124
|
*/
|
|
127
125
|
stateClass(cls: any, state?: boolean): PicoDom;
|
|
128
|
-
/**
|
|
129
|
-
* @see PicoDom.style
|
|
130
|
-
*/
|
|
131
|
-
css(...args: any[]): any;
|
|
132
|
-
/**
|
|
133
|
-
* @see PicoDom.remClass
|
|
134
|
-
*/
|
|
135
|
-
removeClass(...args: any[]): PicoDom;
|
|
136
126
|
}
|
|
137
|
-
export
|
|
138
|
-
import { PicoDom } from "../utils/Dom.js";
|
|
127
|
+
export default PicoDomAttribute;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { PicoDom, PicoDomInterface } from "../utils/Dom.ts";
|
|
2
|
+
import PicoDomFinder from "./DomFinder.js";
|
|
3
|
+
export interface PicoDomBuilder extends PicoDomInterface, PicoDomFinder {
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* @memberof PicoDom
|
|
3
7
|
*/
|
|
4
|
-
export class
|
|
8
|
+
export declare class PicoDomBuilder {
|
|
5
9
|
/**
|
|
6
10
|
* Create element from tag
|
|
7
11
|
*
|
|
@@ -12,12 +16,6 @@ export class PicoDomBuilderStatic {
|
|
|
12
16
|
* @returns {PicoDom} Dom instance
|
|
13
17
|
*/
|
|
14
18
|
static make(el: any, options?: any): PicoDom;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @memberof PicoDom
|
|
18
|
-
* @extends {PicoDom}
|
|
19
|
-
*/
|
|
20
|
-
export class PicoDomBuilderInstance {
|
|
21
19
|
/**
|
|
22
20
|
* Prepend value to element
|
|
23
21
|
*
|
|
@@ -64,5 +62,4 @@ export class PicoDomBuilderInstance {
|
|
|
64
62
|
*/
|
|
65
63
|
replace(value: any): PicoDom;
|
|
66
64
|
}
|
|
67
|
-
export
|
|
68
|
-
import { PicoDom } from "../utils/Dom.js";
|
|
65
|
+
export default PicoDomBuilder;
|