@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/types/utils/String.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { Str } from "../index.esm.ts";
|
|
2
|
+
export declare class PicoString {
|
|
2
3
|
/**
|
|
3
4
|
* Get character at index
|
|
4
5
|
*
|
|
5
6
|
* @example Str.get("abc", 1) // => "b"
|
|
6
7
|
*
|
|
7
8
|
* @param {any} value Input string
|
|
8
|
-
* @param {
|
|
9
|
+
* @param {number} index Char index
|
|
9
10
|
* @returns {string} Single char
|
|
10
11
|
*/
|
|
11
|
-
static get(value: any, index:
|
|
12
|
+
static get(value: any, index: number): string;
|
|
12
13
|
/**
|
|
13
14
|
* Replace substring at index
|
|
14
15
|
*
|
|
@@ -41,7 +42,7 @@ export class PicoString {
|
|
|
41
42
|
* @param {any} [search] Match source
|
|
42
43
|
* @returns {string|null} Extracted string
|
|
43
44
|
*/
|
|
44
|
-
static extract(value: any, replace: string, search?: any): string
|
|
45
|
+
static extract(value: any, replace: string, search?: any): string;
|
|
45
46
|
/**
|
|
46
47
|
* Match pattern in string
|
|
47
48
|
*
|
|
@@ -49,19 +50,19 @@ export class PicoString {
|
|
|
49
50
|
*
|
|
50
51
|
* @param {any} value Input string
|
|
51
52
|
* @param {RegExp|string} pattern Match pattern
|
|
52
|
-
* @param {
|
|
53
|
+
* @param {Function} [cb] Callback fn
|
|
53
54
|
* @returns {any} Match result
|
|
54
55
|
*/
|
|
55
|
-
static match(value: any, pattern: RegExp | string, cb?:
|
|
56
|
+
static match(value: any, pattern: RegExp | string, cb?: Function): any;
|
|
56
57
|
/**
|
|
57
58
|
* Escape regex characters
|
|
58
59
|
*
|
|
59
60
|
* @example Str.regex("a.b") // => "a\\.b"
|
|
60
61
|
*
|
|
61
|
-
* @param {any}
|
|
62
|
+
* @param {any} value Input string
|
|
62
63
|
* @returns {string} Escaped string
|
|
63
64
|
*/
|
|
64
|
-
static regex(
|
|
65
|
+
static regex(value: any): string;
|
|
65
66
|
/**
|
|
66
67
|
* Convert to uppercase
|
|
67
68
|
*
|
|
@@ -80,10 +81,10 @@ export class PicoString {
|
|
|
80
81
|
*
|
|
81
82
|
* @example Str.ucfirst("abc") // => "Abc"
|
|
82
83
|
*
|
|
83
|
-
* @param {
|
|
84
|
+
* @param {any} value Input string
|
|
84
85
|
* @returns {string} Updated string
|
|
85
86
|
*/
|
|
86
|
-
static ucfirst(value:
|
|
87
|
+
static ucfirst(value: any): string;
|
|
87
88
|
/**
|
|
88
89
|
* Convert to lowercase
|
|
89
90
|
*
|
|
@@ -102,19 +103,19 @@ export class PicoString {
|
|
|
102
103
|
*
|
|
103
104
|
* @example Str.lcfirst("ABC") // => "aBC"
|
|
104
105
|
*
|
|
105
|
-
* @param {
|
|
106
|
+
* @param {any} value Input string
|
|
106
107
|
* @returns {string} Updated string
|
|
107
108
|
*/
|
|
108
|
-
static lcfirst(value:
|
|
109
|
+
static lcfirst(value: any): string;
|
|
109
110
|
/**
|
|
110
111
|
* Convert to camelCase
|
|
111
112
|
*
|
|
112
113
|
* @example Str.cc("hello-world") // => "helloWorld"
|
|
113
114
|
*
|
|
114
|
-
* @param {
|
|
115
|
+
* @param {any} value Input string
|
|
115
116
|
* @returns {string} camelCase string
|
|
116
117
|
*/
|
|
117
|
-
static cc(value:
|
|
118
|
+
static cc(value: any): string;
|
|
118
119
|
/**
|
|
119
120
|
* @see PicoString.cc
|
|
120
121
|
*/
|
|
@@ -124,10 +125,10 @@ export class PicoString {
|
|
|
124
125
|
*
|
|
125
126
|
* @example Str.kc("helloWorld") // => "hello-world"
|
|
126
127
|
*
|
|
127
|
-
* @param {
|
|
128
|
+
* @param {any} value Input string
|
|
128
129
|
* @returns {string} kebab-case string
|
|
129
130
|
*/
|
|
130
|
-
static kc(value:
|
|
131
|
+
static kc(value: any): string;
|
|
131
132
|
/**
|
|
132
133
|
* @see PicoString.kc
|
|
133
134
|
*/
|
|
@@ -137,10 +138,10 @@ export class PicoString {
|
|
|
137
138
|
*
|
|
138
139
|
* @example Str.sc("helloWorld") // => "hello_world"
|
|
139
140
|
*
|
|
140
|
-
* @param {
|
|
141
|
+
* @param {any} value Input string
|
|
141
142
|
* @returns {string} snake_case string
|
|
142
143
|
*/
|
|
143
|
-
static sc(value:
|
|
144
|
+
static sc(value: any): string;
|
|
144
145
|
/**
|
|
145
146
|
* @see PicoString.sc
|
|
146
147
|
*/
|
|
@@ -150,10 +151,10 @@ export class PicoString {
|
|
|
150
151
|
*
|
|
151
152
|
* @example Str.pc("hello-world") // => "HelloWorld"
|
|
152
153
|
*
|
|
153
|
-
* @param {
|
|
154
|
+
* @param {any} value Input string
|
|
154
155
|
* @returns {string} PascalCase string
|
|
155
156
|
*/
|
|
156
|
-
static pc(value:
|
|
157
|
+
static pc(value: any): string;
|
|
157
158
|
/**
|
|
158
159
|
* @see PicoString.pc
|
|
159
160
|
*/
|
|
@@ -163,11 +164,11 @@ export class PicoString {
|
|
|
163
164
|
*
|
|
164
165
|
* @example Str.has("abc", "b") // => true
|
|
165
166
|
*
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {
|
|
167
|
+
* @param {any} value Input string
|
|
168
|
+
* @param {any} search Search string
|
|
168
169
|
* @returns {boolean} True if found
|
|
169
170
|
*/
|
|
170
|
-
static has(value:
|
|
171
|
+
static has(value: any, search: any): boolean;
|
|
171
172
|
/**
|
|
172
173
|
* Get index range of search
|
|
173
174
|
*
|
|
@@ -176,9 +177,9 @@ export class PicoString {
|
|
|
176
177
|
* @param {any} value Input string
|
|
177
178
|
* @param {string} search Search string
|
|
178
179
|
* @param {any} [fallback] Fallback value
|
|
179
|
-
* @returns {
|
|
180
|
+
* @returns {number[]|any} Index range
|
|
180
181
|
*/
|
|
181
|
-
static range(value: any, search: string, fallback?: any):
|
|
182
|
+
static range(value: any, search: string, fallback?: any): number[] | any;
|
|
182
183
|
/**
|
|
183
184
|
* Extract substring by range
|
|
184
185
|
*
|
|
@@ -196,11 +197,11 @@ export class PicoString {
|
|
|
196
197
|
* @example Str.string("<b>a</b>") // => "a"
|
|
197
198
|
*
|
|
198
199
|
* @param {any} value Input value
|
|
199
|
-
* @param {
|
|
200
|
+
* @param {string} [empty] Empty fallback
|
|
200
201
|
* @param {boolean} [html] Keep HTML
|
|
201
202
|
* @returns {string} String value
|
|
202
203
|
*/
|
|
203
|
-
static string(value: any, empty?:
|
|
204
|
+
static string(value: any, empty?: string, html?: boolean): string;
|
|
204
205
|
/**
|
|
205
206
|
* Get boolean representation
|
|
206
207
|
*
|
|
@@ -209,10 +210,10 @@ export class PicoString {
|
|
|
209
210
|
* @param {any} value Input value
|
|
210
211
|
* @param {string} [yes] True string
|
|
211
212
|
* @param {string} [no] False string
|
|
212
|
-
* @param {
|
|
213
|
-
* @returns {string
|
|
213
|
+
* @param {string} [empty] Empty fallback
|
|
214
|
+
* @returns {string} Boolean string
|
|
214
215
|
*/
|
|
215
|
-
static boolean(value: any, yes?: string, no?: string, empty?:
|
|
216
|
+
static boolean(value: any, yes?: string, no?: string, empty?: string): string;
|
|
216
217
|
/**
|
|
217
218
|
* Get formatted number
|
|
218
219
|
*
|
|
@@ -222,9 +223,9 @@ export class PicoString {
|
|
|
222
223
|
* @param {number} [fixed] Decimal points
|
|
223
224
|
* @param {string} [locale] Locale code
|
|
224
225
|
* @param {any} [config] Format config
|
|
225
|
-
* @returns {string
|
|
226
|
+
* @returns {string} Formatted string
|
|
226
227
|
*/
|
|
227
|
-
static number(value: any, fixed?: number, locale?: string, config?: any): string
|
|
228
|
+
static number(value: any, fixed?: number, locale?: string, config?: any): string;
|
|
228
229
|
/**
|
|
229
230
|
* Get formatted integer
|
|
230
231
|
*
|
|
@@ -235,7 +236,7 @@ export class PicoString {
|
|
|
235
236
|
* @param {string} [padding] Padding char
|
|
236
237
|
* @returns {string|any} Formatted string
|
|
237
238
|
*/
|
|
238
|
-
static integer(value: any, leading?: number, padding?: string): string
|
|
239
|
+
static integer(value: any, leading?: number, padding?: string): string;
|
|
239
240
|
/**
|
|
240
241
|
* Get formatted datetime
|
|
241
242
|
*
|
|
@@ -243,10 +244,10 @@ export class PicoString {
|
|
|
243
244
|
*
|
|
244
245
|
* @param {any} value Input value
|
|
245
246
|
* @param {string} [format] Output format
|
|
246
|
-
* @param {
|
|
247
|
+
* @param {string} [empty] Empty fallback
|
|
247
248
|
* @returns {string} Formatted string
|
|
248
249
|
*/
|
|
249
|
-
static datetime(value: any, format?: string, empty?:
|
|
250
|
+
static datetime(value: any, format?: string, empty?: string): string;
|
|
250
251
|
/**
|
|
251
252
|
* Get formatted date
|
|
252
253
|
*
|
|
@@ -254,10 +255,10 @@ export class PicoString {
|
|
|
254
255
|
*
|
|
255
256
|
* @param {any} value Input value
|
|
256
257
|
* @param {string} [format] Output format
|
|
257
|
-
* @param {
|
|
258
|
+
* @param {string} [empty] Empty fallback
|
|
258
259
|
* @returns {string} Formatted string
|
|
259
260
|
*/
|
|
260
|
-
static date(value: any, format?: string, empty?:
|
|
261
|
+
static date(value: any, format?: string, empty?: string): string;
|
|
261
262
|
/**
|
|
262
263
|
* Get formatted time
|
|
263
264
|
*
|
|
@@ -268,7 +269,7 @@ export class PicoString {
|
|
|
268
269
|
* @param {any} [empty] Empty fallback
|
|
269
270
|
* @returns {string} Formatted string
|
|
270
271
|
*/
|
|
271
|
-
static time(value: any, format?: string, empty?:
|
|
272
|
+
static time(value: any, format?: string, empty?: string): string;
|
|
272
273
|
/**
|
|
273
274
|
* Parse string to object
|
|
274
275
|
*
|
|
@@ -291,41 +292,4 @@ export class PicoString {
|
|
|
291
292
|
*/
|
|
292
293
|
static stringify(value: any, mode?: string): string;
|
|
293
294
|
}
|
|
294
|
-
export
|
|
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 Str;
|
|
331
|
-
import { Str } from "../index.esm.js";
|
|
295
|
+
export default PicoString;
|
package/src/dom/DomForm.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Mix, Obj } from "../index.esm.js";
|
|
2
|
-
import { PicoDom } from "../utils/Dom.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @memberof PicoDom
|
|
6
|
-
*/
|
|
7
|
-
export class PicoDomFormStatic
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @memberof PicoDom
|
|
14
|
-
* @extends {PicoDom}
|
|
15
|
-
*/
|
|
16
|
-
export class PicoDomFormInstance
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get or set input value
|
|
21
|
-
*
|
|
22
|
-
* @example Dom.find("input").value("hello")
|
|
23
|
-
*
|
|
24
|
-
* @param {any} [value] Input value
|
|
25
|
-
* @returns {any|PicoDom} Value or instance
|
|
26
|
-
*/
|
|
27
|
-
value(value = undefined)
|
|
28
|
-
{
|
|
29
|
-
if ( value === undefined ) {
|
|
30
|
-
return this.el.value;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
this.each((el) => {
|
|
34
|
-
el.value = value;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param {typeof PicoDom} self
|
|
44
|
-
* @returns {typeof PicoDom}
|
|
45
|
-
*/
|
|
46
|
-
export const PicoDomFormPlugin = function (self) {
|
|
47
|
-
|
|
48
|
-
Obj.each(Mix.class(PicoDomFormStatic), (fn, id) => {
|
|
49
|
-
self[id] = fn;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
Obj.each(Mix.proto(PicoDomFormInstance), (fn, id) => {
|
|
53
|
-
self.prototype[id] = fn;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// self.init.push(PicoDomFormInstance.constructor);
|
|
57
|
-
|
|
58
|
-
return self;
|
|
59
|
-
}
|
package/src/dom/DomMeta.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Arr, Mix, Obj, Dom, Locale } from "../index.esm.js";
|
|
2
|
-
import { PicoDom } from "../utils/Dom.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @memberof PicoDom
|
|
6
|
-
*/
|
|
7
|
-
export class PicoDomMetaStatic
|
|
8
|
-
{
|
|
9
|
-
static $meta = {};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Set document title
|
|
13
|
-
*
|
|
14
|
-
* @example Dom.setMetaTitle("Home")
|
|
15
|
-
*
|
|
16
|
-
* @param {string} value New title
|
|
17
|
-
* @param {string} [glue] Title glue
|
|
18
|
-
* @returns {PicoDom} Static class
|
|
19
|
-
*/
|
|
20
|
-
static setMetaTitle(value, glue = ':value - :title')
|
|
21
|
-
{
|
|
22
|
-
if ( ! this.$meta.title ) {
|
|
23
|
-
this.$meta.title = Dom.doc().title;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
document.title = Locale.replace(glue, {
|
|
27
|
-
value, title: this.$meta.title
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @see PicoDom.setMetaTitle
|
|
36
|
-
*/
|
|
37
|
-
PicoDomMetaStatic.title = (value) => {
|
|
38
|
-
console.warn('Dom.title() is deprecated, use Dom.setMetaTitle() instead.');
|
|
39
|
-
return Dom.setMetaTitle(value);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @memberof PicoDom
|
|
44
|
-
* @extends {PicoDom}
|
|
45
|
-
*/
|
|
46
|
-
export class PicoDomMetaInstance
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @param {typeof PicoDom} self
|
|
53
|
-
* @returns {typeof PicoDom}
|
|
54
|
-
*/
|
|
55
|
-
export const PicoDomMetaPlugin = function (self) {
|
|
56
|
-
|
|
57
|
-
Obj.each(Mix.class(PicoDomMetaStatic), (fn, id) => {
|
|
58
|
-
self[id] = fn;
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
Obj.each(Mix.proto(PicoDomMetaInstance), (fn, id) => {
|
|
62
|
-
self.prototype[id] = fn;
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// self.init.push(PicoDomMetaInstance.constructor);
|
|
66
|
-
|
|
67
|
-
return self;
|
|
68
|
-
}
|
package/src/dom/DomObserver.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Arr, Mix, Obj, Dom } from "../index.esm.js";
|
|
2
|
-
import { PicoDom } from "../utils/Dom.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @memberof PicoDom
|
|
6
|
-
*/
|
|
7
|
-
export class PicoDomObserverStatic
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @memberof PicoDom
|
|
14
|
-
* @extends {PicoDom}
|
|
15
|
-
*/
|
|
16
|
-
export class PicoDomObserverInstance
|
|
17
|
-
{
|
|
18
|
-
//
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {typeof PicoDom} self
|
|
23
|
-
* @returns {typeof PicoDom}
|
|
24
|
-
*/
|
|
25
|
-
export const PicoDomObserverPlugin = function (self) {
|
|
26
|
-
|
|
27
|
-
Obj.each(Mix.class(PicoDomObserverStatic), (fn, id) => {
|
|
28
|
-
self[id] = fn;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
Obj.each(Mix.proto(PicoDomObserverInstance), (fn, id) => {
|
|
32
|
-
self.prototype[id] = fn;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// self.init.push(PicoDomObserverInstance.constructor);
|
|
36
|
-
|
|
37
|
-
return self;
|
|
38
|
-
}
|
package/src/index.browser.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as pi from "./index.esm.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} PicoLibrary
|
|
5
|
-
* @property {function(): *} [go]
|
|
6
|
-
* @property {function(): void} [browser]
|
|
7
|
-
* @property {function(): void} [device]
|
|
8
|
-
* @property {PicoDom} [Dom]
|
|
9
|
-
* @property {PicoNow} [Now]
|
|
10
|
-
* @property {PicoFormat} [For]
|
|
11
|
-
* @property {PicoArray} [Arr]
|
|
12
|
-
* @property {PicoMixed} [Mix]
|
|
13
|
-
* @property {PicoNumber} [Num]
|
|
14
|
-
* @property {PicoObject} [Obj]
|
|
15
|
-
* @property {PicoRunner} [Run]
|
|
16
|
-
* @property {PicoString} [Str]
|
|
17
|
-
* @property {PicoHash} [Hash]
|
|
18
|
-
* @property {PicoEvent} [Event]
|
|
19
|
-
* @property {PicoLocale} [Locale]
|
|
20
|
-
* @property {PicoCookie} [Cookie]
|
|
21
|
-
* @property {PicoData} [Data]
|
|
22
|
-
* @property {PicoRoute} [Route]
|
|
23
|
-
* @property {PicoMap} [Map]
|
|
24
|
-
* @property {PicoElement} [Element]
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @type {PicoLibrary}
|
|
29
|
-
*/
|
|
30
|
-
globalThis.pi = pi;
|
|
31
|
-
|
|
32
|
-
globalThis.addEventListener && globalThis.addEventListener('beforeunload', (e) => {
|
|
33
|
-
pi.Arr.map(pi.Dom.$events, ({ el, cb, event }) => {
|
|
34
|
-
return (el.removeEventListener(event, cb), null);
|
|
35
|
-
});
|
|
36
|
-
});
|
package/src/index.esm.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { PicoRunner, default as Run } from "./utils/Runner.js";
|
|
2
|
-
import { PicoString, default as Str } from "./utils/String.js";
|
|
3
|
-
import { PicoNumber, default as Num } from "./utils/Number.js";
|
|
4
|
-
import { PicoArray, default as Arr } from "./utils/Array.js";
|
|
5
|
-
import { PicoObject, default as Obj } from "./utils/Object.js";
|
|
6
|
-
import { PicoMixed, default as Mix } from "./utils/Mixed.js";
|
|
7
|
-
import { PicoHash, default as Hash } from "./utils/Hash.js";
|
|
8
|
-
import { PicoSignal, default as Signal } from "./utils/Signal.js";
|
|
9
|
-
import { PicoLocale, default as Locale } from "./utils/Locale.js";
|
|
10
|
-
import { PicoCookie, default as Cookie } from "./utils/Cookie.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @type {typeof PicoDom}
|
|
14
|
-
*/
|
|
15
|
-
const Dom = DomBuilder();
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @type {typeof PicoNow}
|
|
19
|
-
*/
|
|
20
|
-
const Now = NowBuilder();
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @type {typeof PicoFormat}
|
|
24
|
-
*/
|
|
25
|
-
const For = ForBuilder();
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
Dom, Now, For, Run, Str, Num, Arr, Obj, Mix, Hash, Signal, Locale, Cookie
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
import { PicoDom, default as DomBuilder } from "./utils/Dom.js";
|
|
32
|
-
import { PicoNow, default as NowBuilder } from "./utils/Now.js";
|
|
33
|
-
import { PicoFormat, default as ForBuilder } from "./utils/Format.js";
|
|
34
|
-
|
|
35
|
-
import { go, browser, device } from "./tool/scope.js";
|
|
36
|
-
export { go, browser, device };
|
|
37
|
-
|
|
38
|
-
// You will be removed soon
|
|
39
|
-
import { default as Data } from "./utils/Data.js";
|
|
40
|
-
import { default as Route } from "./utils/Route.js";
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
Map, Data
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Work in progress (not started yet)
|
|
47
|
-
import { default as Map } from "./wip/Map.js";
|
|
48
|
-
import { default as Element } from "./wip/Element.js";
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
Route, Element
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @type {typeof PicoMixed}
|
|
56
|
-
*/
|
|
57
|
-
export const Any = new Proxy({}, {
|
|
58
|
-
get: function (target, prop) {
|
|
59
|
-
console.warn(`Any.${prop} is deprecated, use Mix.${prop}() instead.`);
|
|
60
|
-
return (...args) => Mix[prop](...args);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @type {typeof PicoMixed}
|
|
66
|
-
*/
|
|
67
|
-
export const Event = new Proxy({}, {
|
|
68
|
-
get: function (target, prop) {
|
|
69
|
-
console.warn(`Event.${prop} is deprecated, use Signal.${prop}() instead.`);
|
|
70
|
-
return (...args) => Signal[prop](...args);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @returns {string}
|
|
76
|
-
*/
|
|
77
|
-
export const UUID = function () {
|
|
78
|
-
console.warn('UUID() is deprecated, use Hash.make() instead.');
|
|
79
|
-
return Hash.make();
|
|
80
|
-
};
|