@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
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kizmann/pico-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"author": "Eduard Kizmann <kizmann@protonmail.ch>",
|
|
8
8
|
"repository": "https://github.com/vankizmann/pico-js",
|
|
9
|
-
"main": "./
|
|
9
|
+
"main": "./dist/pico-js.esm.js",
|
|
10
10
|
"unpkg": "./dist/pico-js.browser.js",
|
|
11
|
-
"jsnext:main": "./
|
|
11
|
+
"jsnext:main": "./dist/pico-js.esm.js",
|
|
12
12
|
"typings": "./types/index.esm.d.ts",
|
|
13
|
-
"imports": {
|
|
14
|
-
"#src/*": "./src/*"
|
|
15
|
-
},
|
|
16
13
|
"files": [
|
|
17
14
|
"dist/",
|
|
18
15
|
"src/",
|
|
@@ -36,6 +33,7 @@
|
|
|
36
33
|
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
|
|
37
34
|
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
38
35
|
"@babel/preset-env": "^7.4.4",
|
|
36
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
39
37
|
"babel-loader": "^8.0.6",
|
|
40
38
|
"cross-env": "^5.1",
|
|
41
39
|
"css-loader": "^3.2.0",
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { Arr, Dom, For, Mix, Obj } from "../index.esm.
|
|
2
|
-
import { PicoDom } from "../utils/Dom.
|
|
1
|
+
import { Arr, Dom, For, Mix, Obj } from "../index.esm.ts";
|
|
2
|
+
import { PicoDom, PicoDomInterface } from "../utils/Dom.ts";
|
|
3
|
+
import PicoDomFinder from "./DomFinder.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export class PicoDomAttributeStatic
|
|
5
|
+
export interface PicoDomAttribute extends PicoDomInterface,
|
|
6
|
+
PicoDomFinder
|
|
8
7
|
{
|
|
9
8
|
//
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @memberof PicoDom
|
|
14
|
-
* @extends {PicoDom}
|
|
15
13
|
*/
|
|
16
|
-
export class
|
|
14
|
+
export class PicoDomAttribute
|
|
17
15
|
{
|
|
18
16
|
/**
|
|
19
17
|
* Get or set attribute
|
|
@@ -23,9 +21,9 @@ export class PicoDomAttributeInstance
|
|
|
23
21
|
* @param {string} key Attr key
|
|
24
22
|
* @param {any} [value] Attr value
|
|
25
23
|
* @param {any} [fallback] Fallback value
|
|
26
|
-
* @returns {any
|
|
24
|
+
* @returns {any} Attr value or instance
|
|
27
25
|
*/
|
|
28
|
-
attr(key, value = undefined, fallback = null)
|
|
26
|
+
attr(key : string, value : any = undefined, fallback : any = null) : any
|
|
29
27
|
{
|
|
30
28
|
if ( this.el == null ) {
|
|
31
29
|
return value ? this : fallback;
|
|
@@ -62,9 +60,9 @@ export class PicoDomAttributeInstance
|
|
|
62
60
|
* @param {string} key Data key
|
|
63
61
|
* @param {any} [value] Data value
|
|
64
62
|
* @param {any} [fallback] Fallback value
|
|
65
|
-
* @returns {any
|
|
63
|
+
* @returns {any} Data value or instance
|
|
66
64
|
*/
|
|
67
|
-
data(key, value = undefined, fallback = null)
|
|
65
|
+
data(key : string, value : any = undefined, fallback : any = null) : any
|
|
68
66
|
{
|
|
69
67
|
return this.attr('data-' + key, value, fallback);
|
|
70
68
|
}
|
|
@@ -78,7 +76,7 @@ export class PicoDomAttributeInstance
|
|
|
78
76
|
* @param {any} [fallback] Fallback value
|
|
79
77
|
* @returns {any} Computed style
|
|
80
78
|
*/
|
|
81
|
-
computed(key = null, fallback = null)
|
|
79
|
+
computed(key : any = null, fallback : any = null) : any
|
|
82
80
|
{
|
|
83
81
|
if ( this.el == null ) {
|
|
84
82
|
return fallback;
|
|
@@ -104,9 +102,9 @@ export class PicoDomAttributeInstance
|
|
|
104
102
|
*
|
|
105
103
|
* @param {any} [value] Style value
|
|
106
104
|
* @param {boolean} [combine] Combine style
|
|
107
|
-
* @returns {any
|
|
105
|
+
* @returns {any} Style or instance
|
|
108
106
|
*/
|
|
109
|
-
style(value = undefined, combine = true)
|
|
107
|
+
style(value : any = undefined, combine : boolean = true) : any
|
|
110
108
|
{
|
|
111
109
|
if ( this.el == null ) {
|
|
112
110
|
return this;
|
|
@@ -164,9 +162,9 @@ export class PicoDomAttributeInstance
|
|
|
164
162
|
*
|
|
165
163
|
* @param {any} [value] Class value
|
|
166
164
|
* @param {boolean} [combine] Combine classes
|
|
167
|
-
* @returns {any
|
|
165
|
+
* @returns {any} Classes or instance
|
|
168
166
|
*/
|
|
169
|
-
class(value = undefined, combine = false)
|
|
167
|
+
class(value : any = undefined, combine : boolean = false) : any
|
|
170
168
|
{
|
|
171
169
|
if ( this.el == null ) {
|
|
172
170
|
return this;
|
|
@@ -201,15 +199,15 @@ export class PicoDomAttributeInstance
|
|
|
201
199
|
* @example Dom.find("div").html("<span></span>")
|
|
202
200
|
*
|
|
203
201
|
* @param {any} [html] HTML content
|
|
204
|
-
* @returns {
|
|
202
|
+
* @returns {any} HTML or instance
|
|
205
203
|
*/
|
|
206
|
-
html(html = undefined)
|
|
204
|
+
html(html : any = undefined) : any
|
|
207
205
|
{
|
|
208
206
|
if ( html === undefined ) {
|
|
209
207
|
return this.el.innerHTML;
|
|
210
208
|
}
|
|
211
209
|
|
|
212
|
-
this.each((el) => {
|
|
210
|
+
this.each((el : any) => {
|
|
213
211
|
el.innerHTML = html;
|
|
214
212
|
});
|
|
215
213
|
|
|
@@ -221,11 +219,11 @@ export class PicoDomAttributeInstance
|
|
|
221
219
|
*
|
|
222
220
|
* @example Dom.find("div").actual((el) => el.offsetWidth, { display: "block" })
|
|
223
221
|
*
|
|
224
|
-
* @param {
|
|
222
|
+
* @param {Function} cb Callback fn
|
|
225
223
|
* @param {any} [style] Temp style
|
|
226
224
|
* @returns {any} Callback result
|
|
227
225
|
*/
|
|
228
|
-
actual(cb, style = null)
|
|
226
|
+
actual(cb : Function, style : any = null) : any
|
|
229
227
|
{
|
|
230
228
|
let backup = this.attr('style');
|
|
231
229
|
|
|
@@ -246,9 +244,9 @@ export class PicoDomAttributeInstance
|
|
|
246
244
|
* @param {any} cls Class name
|
|
247
245
|
* @returns {boolean} True if has class
|
|
248
246
|
*/
|
|
249
|
-
hasClass(cls)
|
|
247
|
+
hasClass(cls : any) : boolean
|
|
250
248
|
{
|
|
251
|
-
if ( !
|
|
249
|
+
if ( !Mix.isArr(cls) ) {
|
|
252
250
|
cls = [cls];
|
|
253
251
|
}
|
|
254
252
|
|
|
@@ -263,14 +261,14 @@ export class PicoDomAttributeInstance
|
|
|
263
261
|
* @param {any} cls Class name
|
|
264
262
|
* @returns {PicoDom} Current instance
|
|
265
263
|
*/
|
|
266
|
-
addClass(cls)
|
|
264
|
+
addClass(cls : any) : PicoDom
|
|
267
265
|
{
|
|
268
266
|
if ( this.el == null ) {
|
|
269
|
-
return this;
|
|
267
|
+
return <PicoDom> <unknown> this;
|
|
270
268
|
}
|
|
271
269
|
|
|
272
270
|
if ( this.els.length > 1 ) {
|
|
273
|
-
return this.each((el) => Dom.find(el).addClass(cls));
|
|
271
|
+
return this.each((el : any) => Dom.find(el).addClass(cls));
|
|
274
272
|
}
|
|
275
273
|
|
|
276
274
|
let result = this.el.className.split(' ');
|
|
@@ -283,7 +281,7 @@ export class PicoDomAttributeInstance
|
|
|
283
281
|
|
|
284
282
|
this.el.className = Arr.unique(result).join(' ');
|
|
285
283
|
|
|
286
|
-
return this;
|
|
284
|
+
return <PicoDom> <unknown> this;
|
|
287
285
|
}
|
|
288
286
|
|
|
289
287
|
/**
|
|
@@ -294,14 +292,14 @@ export class PicoDomAttributeInstance
|
|
|
294
292
|
* @param {any} cls Class name
|
|
295
293
|
* @returns {PicoDom} Current instance
|
|
296
294
|
*/
|
|
297
|
-
remClass(cls)
|
|
295
|
+
remClass(cls : any) : PicoDom
|
|
298
296
|
{
|
|
299
297
|
if ( this.el == null ) {
|
|
300
|
-
return this;
|
|
298
|
+
return <PicoDom> <unknown> this;
|
|
301
299
|
}
|
|
302
300
|
|
|
303
301
|
if ( this.els.length > 1 ) {
|
|
304
|
-
return this.each((el) => Dom.find(el).remClass(cls));
|
|
302
|
+
return this.each((el : any) => Dom.find(el).remClass(cls));
|
|
305
303
|
}
|
|
306
304
|
|
|
307
305
|
let result = this.el.className.split(' ');
|
|
@@ -314,7 +312,7 @@ export class PicoDomAttributeInstance
|
|
|
314
312
|
|
|
315
313
|
this.el.className = Arr.unique(result).join(' ');
|
|
316
314
|
|
|
317
|
-
return this;
|
|
315
|
+
return <PicoDom> <unknown> this;
|
|
318
316
|
}
|
|
319
317
|
|
|
320
318
|
/**
|
|
@@ -325,10 +323,10 @@ export class PicoDomAttributeInstance
|
|
|
325
323
|
* @param {any} cls Class name
|
|
326
324
|
* @returns {PicoDom} Current instance
|
|
327
325
|
*/
|
|
328
|
-
toggleClass(cls)
|
|
326
|
+
toggleClass(cls : any) : PicoDom
|
|
329
327
|
{
|
|
330
328
|
if ( this.els.length > 1 ) {
|
|
331
|
-
return this.each((el) => Dom.find(el).toggleClass(cls));
|
|
329
|
+
return this.each((el : any) => Dom.find(el).toggleClass(cls));
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
if ( this.hasClass(cls) ) {
|
|
@@ -347,13 +345,13 @@ export class PicoDomAttributeInstance
|
|
|
347
345
|
* @param {boolean} [state] Target state
|
|
348
346
|
* @returns {PicoDom} Current instance
|
|
349
347
|
*/
|
|
350
|
-
stateClass(cls, state = true)
|
|
348
|
+
stateClass(cls : any, state : boolean = true) : PicoDom
|
|
351
349
|
{
|
|
352
350
|
if ( this.els.length > 1 ) {
|
|
353
|
-
return this.each((el) => Dom.find(el).stateClass(cls));
|
|
351
|
+
return this.each((el : any) => Dom.find(el).stateClass(cls));
|
|
354
352
|
}
|
|
355
353
|
|
|
356
|
-
if ( !
|
|
354
|
+
if ( !state ) {
|
|
357
355
|
return this.remClass(cls);
|
|
358
356
|
}
|
|
359
357
|
|
|
@@ -362,37 +360,16 @@ export class PicoDomAttributeInstance
|
|
|
362
360
|
|
|
363
361
|
}
|
|
364
362
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
*/
|
|
368
|
-
PicoDomAttributeInstance.prototype.css = function (...args) {
|
|
363
|
+
// @ts-ignore
|
|
364
|
+
PicoDomAttribute.prototype.css = function (...args : Parameters<typeof PicoDomAttribute.style>) {
|
|
369
365
|
console.warn('Dom.css() is deprecated, use Dom.style() instead.');
|
|
370
366
|
return this.style(...args);
|
|
371
367
|
};
|
|
372
368
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
*/
|
|
376
|
-
PicoDomAttributeInstance.prototype.removeClass = function (...args) {
|
|
369
|
+
// @ts-ignore
|
|
370
|
+
PicoDomAttribute.prototype.removeClass = function (...args : Parameters<typeof PicoDomAttribute.remClass>) {
|
|
377
371
|
console.warn('Dom.removeClass() is deprecated, use Dom.remClass() instead.');
|
|
378
372
|
return this.remClass(...args);
|
|
379
373
|
};
|
|
380
374
|
|
|
381
|
-
|
|
382
|
-
* @param {typeof PicoDom} self
|
|
383
|
-
* @returns {typeof PicoDom}
|
|
384
|
-
*/
|
|
385
|
-
export const PicoDomAttributePlugin = function (self) {
|
|
386
|
-
|
|
387
|
-
Obj.each(Mix.class(PicoDomAttributeStatic), (fn, id) => {
|
|
388
|
-
self[id] = fn;
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
Obj.each(Mix.proto(PicoDomAttributeInstance), (fn, id) => {
|
|
392
|
-
self.prototype[id] = fn;
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// self.init.push(PicoDomAttributeInstance.constructor);
|
|
396
|
-
|
|
397
|
-
return self;
|
|
398
|
-
}
|
|
375
|
+
export default PicoDomAttribute;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PicoDom } from "../utils/Dom.
|
|
1
|
+
import { Dom, Mix, Obj } from "../index.esm.ts";
|
|
2
|
+
import { PicoDom, PicoDomInterface } from "../utils/Dom.ts";
|
|
3
|
+
import PicoDomFinder from "./DomFinder.js";
|
|
4
|
+
|
|
5
|
+
export interface PicoDomBuilder extends PicoDomInterface,
|
|
6
|
+
PicoDomFinder
|
|
7
|
+
{
|
|
8
|
+
//
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
/**
|
|
5
12
|
* @memberof PicoDom
|
|
6
13
|
*/
|
|
7
|
-
export class
|
|
14
|
+
export class PicoDomBuilder
|
|
8
15
|
{
|
|
9
16
|
/**
|
|
10
17
|
* Create element from tag
|
|
@@ -15,7 +22,7 @@ export class PicoDomBuilderStatic
|
|
|
15
22
|
* @param {any} [options] Attr options
|
|
16
23
|
* @returns {PicoDom} Dom instance
|
|
17
24
|
*/
|
|
18
|
-
static make(el, options = {})
|
|
25
|
+
static make(el : any, options : any = {}) : PicoDom
|
|
19
26
|
{
|
|
20
27
|
if ( el instanceof Dom ) {
|
|
21
28
|
el = el.el;
|
|
@@ -39,14 +46,7 @@ export class PicoDomBuilderStatic
|
|
|
39
46
|
|
|
40
47
|
return ini;
|
|
41
48
|
}
|
|
42
|
-
}
|
|
43
49
|
|
|
44
|
-
/**
|
|
45
|
-
* @memberof PicoDom
|
|
46
|
-
* @extends {PicoDom}
|
|
47
|
-
*/
|
|
48
|
-
export class PicoDomBuilderInstance
|
|
49
|
-
{
|
|
50
50
|
/**
|
|
51
51
|
* Prepend value to element
|
|
52
52
|
*
|
|
@@ -55,13 +55,13 @@ export class PicoDomBuilderInstance
|
|
|
55
55
|
* @param {any} value Prepend value
|
|
56
56
|
* @returns {PicoDom} Current instance
|
|
57
57
|
*/
|
|
58
|
-
prepend(value)
|
|
58
|
+
prepend(value : any) : PicoDom
|
|
59
59
|
{
|
|
60
|
-
this.each((el) => {
|
|
60
|
+
this.each((el : any) => {
|
|
61
61
|
if ( el.prepend != null ) el.prepend(value);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
return this;
|
|
64
|
+
return <PicoDom> <unknown> this;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -72,13 +72,13 @@ export class PicoDomBuilderInstance
|
|
|
72
72
|
* @param {any} value Target element
|
|
73
73
|
* @returns {PicoDom} Current instance
|
|
74
74
|
*/
|
|
75
|
-
prependTo(value)
|
|
75
|
+
prependTo(value : any) : PicoDom
|
|
76
76
|
{
|
|
77
|
-
Dom.find(value).each((el) => {
|
|
77
|
+
Dom.find(value).each((el : any) => {
|
|
78
78
|
if ( el.prepend != null ) el.prepend(this.el);
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
return this;
|
|
81
|
+
return <PicoDom> <unknown> this;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -89,13 +89,13 @@ export class PicoDomBuilderInstance
|
|
|
89
89
|
* @param {any} value Append value
|
|
90
90
|
* @returns {PicoDom} Current instance
|
|
91
91
|
*/
|
|
92
|
-
append(value)
|
|
92
|
+
append(value : any) : PicoDom
|
|
93
93
|
{
|
|
94
|
-
this.each((el) => {
|
|
94
|
+
this.each((el : any) => {
|
|
95
95
|
if ( el.append != null ) el.append(value);
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
return this;
|
|
98
|
+
return <PicoDom> <unknown> this;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -106,13 +106,13 @@ export class PicoDomBuilderInstance
|
|
|
106
106
|
* @param {any} value Target element
|
|
107
107
|
* @returns {PicoDom} Current instance
|
|
108
108
|
*/
|
|
109
|
-
appendTo(value)
|
|
109
|
+
appendTo(value : any) : PicoDom
|
|
110
110
|
{
|
|
111
|
-
Dom.find(value).each((el) => {
|
|
111
|
+
Dom.find(value).each((el : any) => {
|
|
112
112
|
if ( el.append != null ) el.append(this.el);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
return this;
|
|
115
|
+
return <PicoDom> <unknown> this;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -123,32 +123,15 @@ export class PicoDomBuilderInstance
|
|
|
123
123
|
* @param {any} value Replacement value
|
|
124
124
|
* @returns {PicoDom} Current instance
|
|
125
125
|
*/
|
|
126
|
-
replace(value)
|
|
126
|
+
replace(value : any) : PicoDom
|
|
127
127
|
{
|
|
128
|
-
this.parent().each(el
|
|
128
|
+
this.parent().each((el : any) => {
|
|
129
129
|
(el.insertBefore(value, el), el.removeChild(el));
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
-
return this;
|
|
132
|
+
return <PicoDom> <unknown> this;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
* @param {typeof PicoDom} self
|
|
139
|
-
* @returns {typeof PicoDom}
|
|
140
|
-
*/
|
|
141
|
-
export const PicoDomBuilderPlugin = function (self) {
|
|
142
|
-
|
|
143
|
-
Obj.each(Mix.class(PicoDomBuilderStatic), (fn, id) => {
|
|
144
|
-
self[id] = fn;
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
Obj.each(Mix.proto(PicoDomBuilderInstance), (fn, id) => {
|
|
148
|
-
self.prototype[id] = fn;
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// self.init.push(PicoDomBuilderInstance.constructor);
|
|
152
|
-
|
|
153
|
-
return self;
|
|
154
|
-
}
|
|
137
|
+
export default PicoDomBuilder;
|