@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.
Files changed (125) hide show
  1. package/README.md +27 -7
  2. package/dist/pico-js.browser.js +2 -0
  3. package/dist/pico-js.browser.js.map +1 -0
  4. package/dist/pico-js.esm.js +2 -0
  5. package/dist/pico-js.esm.js.map +1 -0
  6. package/package.json +20 -7
  7. package/src/dom/DomAttribute.js +374 -0
  8. package/src/dom/DomBuilder.js +152 -0
  9. package/src/dom/DomEvent.js +253 -0
  10. package/src/dom/DomFinder.js +669 -0
  11. package/src/dom/DomForm.js +57 -0
  12. package/src/dom/DomGlobal.js +193 -0
  13. package/src/dom/DomInview.js +332 -0
  14. package/src/dom/DomMeta.js +66 -0
  15. package/src/dom/DomObserver.js +57 -0
  16. package/src/dom/DomRectangle.js +657 -0
  17. package/src/format/FormatFile.js +54 -0
  18. package/src/format/FormatOption.js +108 -0
  19. package/src/format/FormatParam.js +107 -0
  20. package/src/format/FormatParser.js +156 -0
  21. package/src/format/FormatUrl.js +75 -0
  22. package/src/index.browser.js +10 -0
  23. package/src/index.esm.js +138 -0
  24. package/src/now/NowDefault.js +533 -0
  25. package/src/now/NowFormat.js +196 -0
  26. package/src/now/NowGrid.js +251 -0
  27. package/src/now/NowHuman.js +118 -0
  28. package/src/now/NowMatch.js +175 -0
  29. package/src/now/NowRange.js +70 -0
  30. package/src/now/NowWalker.js +544 -0
  31. package/src/tool/scope.js +103 -0
  32. package/src/utils/Array.js +986 -0
  33. package/src/utils/Cookie.js +184 -0
  34. package/src/utils/Data.js +200 -0
  35. package/src/utils/Dom.js +208 -0
  36. package/src/utils/Event.js +140 -0
  37. package/src/utils/Format.js +62 -0
  38. package/src/utils/Hash.js +164 -0
  39. package/src/utils/Locale.js +229 -0
  40. package/src/utils/Mixed.js +887 -0
  41. package/src/utils/Now.js +234 -0
  42. package/src/utils/Number.js +238 -0
  43. package/src/utils/Object.js +655 -0
  44. package/src/utils/Route.js +67 -0
  45. package/src/utils/Runner.js +327 -0
  46. package/src/utils/String.js +618 -0
  47. package/src/{library/element.js → wip/Element.js} +90 -16
  48. package/src/{library/map.js → wip/Map.js} +256 -40
  49. package/types/dom/DomAttribute.d.ts +137 -0
  50. package/types/dom/DomBuilder.d.ts +67 -0
  51. package/types/dom/DomEvent.d.ts +103 -0
  52. package/types/dom/DomFinder.d.ts +321 -0
  53. package/types/dom/DomForm.d.ts +21 -0
  54. package/types/dom/DomGlobal.d.ts +79 -0
  55. package/types/dom/DomInview.d.ts +114 -0
  56. package/types/dom/DomMeta.d.ts +29 -0
  57. package/types/dom/DomObserver.d.ts +21 -0
  58. package/types/dom/DomRectangle.d.ts +270 -0
  59. package/types/format/FormatFile.d.ts +18 -0
  60. package/types/format/FormatOption.d.ts +40 -0
  61. package/types/format/FormatParam.d.ts +39 -0
  62. package/types/format/FormatParser.d.ts +46 -0
  63. package/types/format/FormatUrl.d.ts +17 -0
  64. package/types/index.browser.d.ts +1 -0
  65. package/types/index.esm.d.ts +52 -0
  66. package/types/now/NowDefault.d.ts +183 -0
  67. package/types/now/NowFormat.d.ts +70 -0
  68. package/types/now/NowGrid.d.ts +107 -0
  69. package/types/now/NowHuman.d.ts +37 -0
  70. package/types/now/NowMatch.d.ts +108 -0
  71. package/types/now/NowRange.d.ts +21 -0
  72. package/types/now/NowWalker.d.ts +301 -0
  73. package/types/tool/scope.d.ts +24 -0
  74. package/types/utils/Array.d.ts +480 -0
  75. package/types/utils/Cookie.d.ts +60 -0
  76. package/types/utils/Data.d.ts +91 -0
  77. package/types/utils/Dom.d.ts +138 -0
  78. package/types/utils/Event.d.ts +58 -0
  79. package/types/utils/Format.d.ts +37 -0
  80. package/types/utils/Hash.d.ts +81 -0
  81. package/types/utils/Locale.d.ts +115 -0
  82. package/types/utils/Mixed.d.ts +469 -0
  83. package/types/utils/Now.d.ts +125 -0
  84. package/types/utils/Number.d.ts +127 -0
  85. package/types/utils/Object.d.ts +255 -0
  86. package/types/utils/Route.d.ts +37 -0
  87. package/types/utils/Runner.d.ts +139 -0
  88. package/types/utils/String.d.ts +330 -0
  89. package/types/wip/Element.d.ts +119 -0
  90. package/types/wip/Map.d.ts +254 -0
  91. package/dist/.ignore.js +0 -0
  92. package/dist/pico-js.js +0 -2
  93. package/dist/pico-js.js.map +0 -1
  94. package/src/element/default.js +0 -46
  95. package/src/element/example.js +0 -58
  96. package/src/index.js +0 -90
  97. package/src/library/cookie.js +0 -123
  98. package/src/library/data.js +0 -111
  99. package/src/library/event.js +0 -91
  100. package/src/library/locale.js +0 -84
  101. package/src/library/queue.js +0 -64
  102. package/src/library/route.js +0 -28
  103. package/src/utility/any.js +0 -369
  104. package/src/utility/array.js +0 -410
  105. package/src/utility/dom.js +0 -1425
  106. package/src/utility/now.js +0 -544
  107. package/src/utility/number.js +0 -128
  108. package/src/utility/object.js +0 -429
  109. package/src/utility/string.js +0 -328
  110. package/types/index.d.ts +0 -77
  111. package/types/library/cookie.d.ts +0 -10
  112. package/types/library/data.d.ts +0 -15
  113. package/types/library/element.d.ts +0 -22
  114. package/types/library/event.d.ts +0 -13
  115. package/types/library/locale.d.ts +0 -14
  116. package/types/library/map.d.ts +0 -43
  117. package/types/library/queue.d.ts +0 -18
  118. package/types/library/route.d.ts +0 -11
  119. package/types/utility/any.d.ts +0 -35
  120. package/types/utility/array.d.ts +0 -46
  121. package/types/utility/dom.d.ts +0 -101
  122. package/types/utility/now.d.ts +0 -79
  123. package/types/utility/number.d.ts +0 -17
  124. package/types/utility/object.d.ts +0 -29
  125. package/types/utility/string.d.ts +0 -26
@@ -0,0 +1,138 @@
1
+ /**
2
+ * @returns {typeof PicoDom}
3
+ */
4
+ export function PicoDomBuilder(): typeof PicoDom;
5
+ export const PicoDomPlugins: ((self: any) => typeof import("./Dom.js").PicoDom)[];
6
+ /**
7
+ * @class PicoDom
8
+ *
9
+ * @typedef {import('#src/dom/DomFinder.js').PicoDomFinderInstance} PicoDomFinderInstance
10
+ * @typedef {import('#src/dom/DomGlobal.js').PicoDomGlobalStatic} PicoDomGlobalStatic
11
+ * @typedef {import('#src/dom/DomGlobal.js').PicoDomGlobalInstance} PicoDomGlobalInstance
12
+ * @typedef {import('#src/dom/DomEvent.js').PicoDomEventStatic} PicoDomEventStatic
13
+ * @typedef {import('#src/dom/DomEvent.js').PicoDomEventInstance} PicoDomEventInstance
14
+ * @typedef {import('#src/dom/DomBuilder.js').PicoDomBuilderStatic} PicoDomBuilderStatic
15
+ * @typedef {import('#src/dom/DomBuilder.js').PicoDomBuilderInstance} PicoDomBuilderInstance
16
+ * @typedef {import('#src/dom/DomRectangle.js').PicoDomRectangleStatic} PicoDomRectangleStatic
17
+ * @typedef {import('#src/dom/DomRectangle.js').PicoDomRectangleInstance} PicoDomRectangleInstance
18
+ * @typedef {import('#src/dom/DomAttribute.js').PicoDomAttributeStatic} PicoDomAttributeStatic
19
+ * @typedef {import('#src/dom/DomAttribute.js').PicoDomAttributeInstance} PicoDomAttributeInstance
20
+ * @typedef {import('#src/dom/DomInview.js').PicoDomInviewStatic} PicoDomInviewStatic
21
+ * @typedef {import('#src/dom/DomInview.js').PicoDomInviewInstance} PicoDomInviewInstance
22
+ * @typedef {import('#src/dom/DomMeta.js').PicoDomMetaStatic} PicoDomMetaStatic
23
+ * @typedef {import('#src/dom/DomMeta.js').PicoDomMetaInstance} PicoDomMetaInstance
24
+ * @typedef {import('#src/dom/DomObserver.js').PicoDomObserverStatic} PicoDomObserverStatic
25
+ * @typedef {import('#src/dom/DomObserver.js').PicoDomObserverInstance} PicoDomObserverInstance
26
+ *
27
+ * @mixes PicoDomFinderStatic
28
+ * @mixes PicoDomGlobalStatic
29
+ * @mixes PicoDomFormStatic
30
+ * @mixes PicoDomEventStatic
31
+ * @mixes PicoDomBuilderStatic
32
+ * @mixes PicoDomRectangleStatic
33
+ * @mixes PicoDomAttributeStatic
34
+ * @mixes PicoDomInviewStatic
35
+ * @mixes PicoDomMetaStatic
36
+ * @mixes PicoDomObserverStatic
37
+ *
38
+ * @extends PicoDomFinderInstance
39
+ * @extends PicoDomGlobalInstance
40
+ * @extends PicoDomFormInstance
41
+ * @extends PicoDomEventInstance
42
+ * @extends PicoDomBuilderInstance
43
+ * @extends PicoDomRectangleInstance
44
+ * @extends PicoDomAttributeInstance
45
+ * @extends PicoDomInviewInstance
46
+ * @extends PicoDomMetaInstance
47
+ * @extends PicoDomObserverInstance
48
+ */
49
+ export class PicoDom {
50
+ /**
51
+ * Init hooks for constructor
52
+ *
53
+ * @type {Array<function>}
54
+ */
55
+ static init: Array<Function>;
56
+ /**
57
+ * Create new Dom wrapper
58
+ *
59
+ * @example Dom.find("body") // => Dom
60
+ *
61
+ * @param {any} el Element or selector
62
+ * @param {...any} args Plugin args
63
+ * @returns {PicoDom} Dom wrapper
64
+ */
65
+ static find(el: any, ...args: any[]): PicoDom;
66
+ /**
67
+ * Extend Dom with a plugin
68
+ *
69
+ * @example Dom.extend(fn)
70
+ *
71
+ * @param {function} plugin Plugin function
72
+ * @returns {void} No return value
73
+ */
74
+ static extend(plugin: Function): void;
75
+ /**
76
+ * Get window or empty object
77
+ *
78
+ * @example Dom.win().innerWidth // => number|undefined
79
+ *
80
+ * @returns {any} Window or {}
81
+ */
82
+ static win(): any;
83
+ /**
84
+ * Get document or empty object
85
+ *
86
+ * @example Dom.doc().body // => HTMLElement|undefined
87
+ *
88
+ * @returns {any} Document or {}
89
+ */
90
+ static doc(): any;
91
+ /**
92
+ * Get document.body or empty
93
+ *
94
+ * @example Dom.body().nodeType // => 1|undefined
95
+ *
96
+ * @returns {any} Body or {}
97
+ */
98
+ static body(): any;
99
+ /**
100
+ * Create Dom wrapper from input
101
+ *
102
+ * @example new Dom("body").get(0) // => HTMLElement
103
+ *
104
+ * @param {any} el Element or selector
105
+ * @param {...any} args Plugin args
106
+ */
107
+ constructor(el: any, ...args: any[]);
108
+ /**
109
+ * First selected element
110
+ *
111
+ * @type {HTMLElement}
112
+ */
113
+ el: HTMLElement;
114
+ /**
115
+ * All selected elements
116
+ *
117
+ * @type {Array<HTMLElement>}
118
+ */
119
+ els: Array<HTMLElement>;
120
+ }
121
+ export default PicoDomBuilder;
122
+ export type PicoDomFinderInstance = import("#src/dom/DomFinder.js").PicoDomFinderInstance;
123
+ export type PicoDomGlobalStatic = import("#src/dom/DomGlobal.js").PicoDomGlobalStatic;
124
+ export type PicoDomGlobalInstance = import("#src/dom/DomGlobal.js").PicoDomGlobalInstance;
125
+ export type PicoDomEventStatic = import("#src/dom/DomEvent.js").PicoDomEventStatic;
126
+ export type PicoDomEventInstance = import("#src/dom/DomEvent.js").PicoDomEventInstance;
127
+ export type PicoDomBuilderStatic = import("#src/dom/DomBuilder.js").PicoDomBuilderStatic;
128
+ export type PicoDomBuilderInstance = import("#src/dom/DomBuilder.js").PicoDomBuilderInstance;
129
+ export type PicoDomRectangleStatic = import("#src/dom/DomRectangle.js").PicoDomRectangleStatic;
130
+ export type PicoDomRectangleInstance = import("#src/dom/DomRectangle.js").PicoDomRectangleInstance;
131
+ export type PicoDomAttributeStatic = import("#src/dom/DomAttribute.js").PicoDomAttributeStatic;
132
+ export type PicoDomAttributeInstance = import("#src/dom/DomAttribute.js").PicoDomAttributeInstance;
133
+ export type PicoDomInviewStatic = import("#src/dom/DomInview.js").PicoDomInviewStatic;
134
+ export type PicoDomInviewInstance = import("#src/dom/DomInview.js").PicoDomInviewInstance;
135
+ export type PicoDomMetaStatic = import("#src/dom/DomMeta.js").PicoDomMetaStatic;
136
+ export type PicoDomMetaInstance = import("#src/dom/DomMeta.js").PicoDomMetaInstance;
137
+ export type PicoDomObserverStatic = import("#src/dom/DomObserver.js").PicoDomObserverStatic;
138
+ export type PicoDomObserverInstance = import("#src/dom/DomObserver.js").PicoDomObserverInstance;
@@ -0,0 +1,58 @@
1
+ export class PicoEvent {
2
+ static $events: any[];
3
+ /**
4
+ * Bind callback to event name
5
+ *
6
+ * @example Event.bind("x", cb) // => Event
7
+ * @example Event.bind(["a","b"], cb) // => Event
8
+ *
9
+ * @param {any} event Event name(s)
10
+ * @param {function} cb Event callback
11
+ * @param {any} [options] Listener options
12
+ * @param {boolean} [paused] Start paused
13
+ * @returns {typeof PicoEvent} Event class
14
+ */
15
+ static bind(event: any, cb: Function, options?: any, paused?: boolean): typeof PicoEvent;
16
+ /**
17
+ * Unbind callback(s) from event
18
+ *
19
+ * @example Event.unbind("x") // => Event
20
+ * @example Event.unbind(["a","b"]) // => Event
21
+ *
22
+ * @param {any} event Event name(s)
23
+ * @param {any} [options] Listener options
24
+ * @returns {typeof PicoEvent} Event class
25
+ */
26
+ static unbind(event: any, options?: any): typeof PicoEvent;
27
+ /**
28
+ * Fire event with arguments
29
+ *
30
+ * @example Event.fire("x", 1) // => Event
31
+ *
32
+ * @param {string} event Event name
33
+ * @param {...any} [args] Event args
34
+ * @returns {typeof PicoEvent} Event class
35
+ */
36
+ static fire(event: string, ...args?: any[]): typeof PicoEvent;
37
+ /**
38
+ * Pause listeners for event
39
+ *
40
+ * @example Event.pause("x") // => Event
41
+ *
42
+ * @param {any} event Event name(s)
43
+ * @param {any} [options] Listener options
44
+ * @returns {typeof PicoEvent} Event class
45
+ */
46
+ static pause(event: any, options?: any): typeof PicoEvent;
47
+ /**
48
+ * Unpause listeners for event
49
+ *
50
+ * @example Event.unpause("x") // => Event
51
+ *
52
+ * @param {any} event Event name(s)
53
+ * @param {any} [options] Listener options
54
+ * @returns {typeof PicoEvent} Event class
55
+ */
56
+ static unpause(event: any, options?: any): typeof PicoEvent;
57
+ }
58
+ export default PicoEvent;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @returns {typeof PicoFormat}
3
+ */
4
+ export function PicoFormatBuilder(): typeof PicoFormat;
5
+ export const PicoFormatPlugins: ((self: any) => typeof import("./Format.js").PicoFormat)[];
6
+ /**
7
+ * @class PicoFormat
8
+ *
9
+ * @typedef {import('#src/format/FormatParser.js').PicoFormatParserStatic} PicoFormatParserStatic
10
+ * @typedef {import('#src/format/FormatParam.js').PicoFormatParamStatic} PicoFormatParamStatic
11
+ * @typedef {import('#src/format/FormatOption.js').PicoFormatOptionStatic} PicoFormatOptionStatic
12
+ * @typedef {import('#src/format/FormatUrl.js').PicoFormatUrlStatic} PicoFormatUrlStatic
13
+ * @typedef {import('#src/format/FormatFile.js').PicoFormatFileStatic} PicoFormatFileStatic
14
+ *
15
+ * @mixes PicoFormatParserStatic
16
+ * @mixes PicoFormatParamStatic
17
+ * @mixes PicoFormatOptionStatic
18
+ * @mixes PicoFormatUrlStatic
19
+ * @mixes PicoFormatFileStatic
20
+ */
21
+ export class PicoFormat {
22
+ /**
23
+ * Extend format with a plugin
24
+ *
25
+ * @example For.extend(fn)
26
+ *
27
+ * @param {function} plugin Plugin function
28
+ * @returns {void} No return value
29
+ */
30
+ static extend(plugin: Function): void;
31
+ }
32
+ export default PicoFormatBuilder;
33
+ export type PicoFormatParserStatic = import("#src/format/FormatParser.js").PicoFormatParserStatic;
34
+ export type PicoFormatParamStatic = import("#src/format/FormatParam.js").PicoFormatParamStatic;
35
+ export type PicoFormatOptionStatic = import("#src/format/FormatOption.js").PicoFormatOptionStatic;
36
+ export type PicoFormatUrlStatic = import("#src/format/FormatUrl.js").PicoFormatUrlStatic;
37
+ export type PicoFormatFileStatic = import("#src/format/FormatFile.js").PicoFormatFileStatic;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @var {Array<string>} RADIX_NUMBER Radix from 0 to 9
3
+ */
4
+ export const RADIX_NUMBER: string[];
5
+ /**
6
+ * @var {Array<string>} RADIX_LETTER_LC Radix from a to z
7
+ */
8
+ export const RADIX_LETTER_LC: string[];
9
+ /**
10
+ * @var {Array<string>} RADIX_LETTER_UC Radix from A to Z
11
+ */
12
+ export const RADIX_LETTER_UC: string[];
13
+ /**
14
+ * @var {Array<string>} RADIX_UUID Radix from 0-9, a-f and A-F
15
+ */
16
+ export const RADIX_UUID: string[];
17
+ /**
18
+ * @var {Array<string>} RADIX_UP19 Radix with 8, 9, a and b
19
+ */
20
+ export const RADIX_UP19: string[];
21
+ /**
22
+ * @var {Array<string>} radix_symbol_pass Radix for passwords
23
+ */
24
+ export const radix_symbol_pass: string[];
25
+ export class PicoHash {
26
+ /**
27
+ * @var {Array<string>} RADIX
28
+ */
29
+ static RADIX: string[];
30
+ /**
31
+ * Get random char from radix
32
+ *
33
+ * @example Hash.radix(2, ['R', 'f']) // => 'R' or 'f'
34
+ *
35
+ * @param {number} [limit=60] Maximum radix char index
36
+ * @param {Array<string>} [radix=null] A defined radix or null for default
37
+ * @returns {string} Returns random char from radix
38
+ */
39
+ static radix(limit?: number, radix?: Array<string>): string;
40
+ /**
41
+ * Get random number
42
+ *
43
+ * @example Hash.number(20, 18) // => 18, 19 or 20
44
+ *
45
+ * @param {number} [limit=1024] Maximum value
46
+ * @param {number} [start=0] Minimum value
47
+ * @returns {number} Returns a random number between start and limit
48
+ */
49
+ static number(limit?: number, start?: number): number;
50
+ /**
51
+ * Get a random hash with given options
52
+ *
53
+ * @example Hash.make(4, 32, { 0: '?' }) // => '?8Wj'
54
+ *
55
+ * @param {number} [length] Length of generated hash
56
+ * @param {number} [radix] Maximum radix char index (10 for 0-9, 36 incl. a-z, 62 incl. A-Z)
57
+ * @param {Record<number, string>} [map] Remap for generated string
58
+ * @returns {string} Returns a random hash with fixed length
59
+ */
60
+ static make(length?: number, radix?: number, map?: Record<number, string>): string;
61
+ /**
62
+ * Get a valid v4 UUID
63
+ *
64
+ * @example Hash.uuid() // => 'FBbA001F-0a01-4bE8-b29C-A9c47fA090f'
65
+ *
66
+ * @param {string|number} [version] UUID version number
67
+ * @returns {string} Returns a valid UUID
68
+ */
69
+ static uuid(version?: string | number): string;
70
+ /**
71
+ * Generate a password with or without symbols
72
+ *
73
+ * @example Hash.password(12, ['%', '&']) // => '0unJ%VDi2RJX'
74
+ *
75
+ * @param {number} [length=24] Length of password
76
+ * @param {Array<string>} [symbols=null] Defined symbols or null for default
77
+ * @returns {string} A random password with fixed length
78
+ */
79
+ static password(length?: number, symbols?: Array<string>): string;
80
+ }
81
+ export default PicoHash;
@@ -0,0 +1,115 @@
1
+ export class PicoLocale {
2
+ /**
3
+ * Translation dictionary
4
+ *
5
+ * @type {Record<any, any>}
6
+ */
7
+ static $text: Record<any, any>;
8
+ /**
9
+ * Cached collator instance
10
+ *
11
+ * @type {Intl.Collator|null}
12
+ */
13
+ static $sort: Intl.Collator | null;
14
+ /**
15
+ * Active locale code
16
+ *
17
+ * @type {string}
18
+ */
19
+ static $code: string;
20
+ /**
21
+ * Check if translation key exists
22
+ *
23
+ * @example Locale.has("known.key") // => true
24
+ * @example Locale.has("unknown.key") // => false
25
+ *
26
+ * @param {any} [key] Translation key
27
+ * @returns {boolean} True if exists
28
+ */
29
+ static has(key?: any): boolean;
30
+ /**
31
+ * Get translation value or map
32
+ *
33
+ * @example Locale.get("known.key") // => "value"
34
+ * @example Locale.get() // => object
35
+ *
36
+ * @param {any} [key] Translation key
37
+ * @param {any} [fallback] Fallback value
38
+ * @returns {any} Translation value
39
+ */
40
+ static get(key?: any, fallback?: any): any;
41
+ /**
42
+ * Set translation key or map
43
+ *
44
+ * @example Locale.set({foo:"bar"})
45
+ * @example Locale.set("unknown", "nix")
46
+ *
47
+ * @param {any} [key] Key or map
48
+ * @param {any} [value] Value to set
49
+ * @returns {any} Updated map
50
+ */
51
+ static set(key?: any, value?: any): any;
52
+ /**
53
+ * Get or set locale code
54
+ *
55
+ * @example Locale.code() // => "en"
56
+ * @example Locale.code("de") // => "de"
57
+ *
58
+ * @param {string|null} [code] Locale code
59
+ * @returns {string} Active code
60
+ */
61
+ static code(code?: string | null): string;
62
+ /**
63
+ * Get Intl.Collator for sorting
64
+ *
65
+ * @example Locale.collator().compare("a","b")
66
+ *
67
+ * @returns {Intl.Collator} Collator instance
68
+ */
69
+ static collator(): Intl.Collator;
70
+ /**
71
+ * Replace :tokens in text
72
+ *
73
+ * @example Locale.replace("Hi :x", {x:"Bob"}) // => "Hi Bob"
74
+ * @example Locale.replace("Hi", null) // => "Hi"
75
+ *
76
+ * @param {string} text Input text
77
+ * @param {any} [replace] Replace map
78
+ * @returns {string} Replaced text
79
+ */
80
+ static replace(text: string, replace?: any): string;
81
+ /**
82
+ * Translate key with replace map
83
+ *
84
+ * @example Locale.trans("known.key") // => "..."
85
+ * @example Locale.trans("Hi :x", {x:"Bob"}) // => "Hi Bob"
86
+ *
87
+ * @param {string} text Key or text
88
+ * @param {any} [replace] Replace map
89
+ * @returns {string} Translated text
90
+ */
91
+ static trans(text: string, replace?: any): string;
92
+ /**
93
+ * Translate plural choice by count
94
+ *
95
+ * @example Locale.choice("items", 2) // => "..."
96
+ * @example Locale.choice("items", 1, {x:"y"}) // => "..."
97
+ *
98
+ * @param {string} text Key or text
99
+ * @param {number} [count] Choice count
100
+ * @param {any} [replace] Replace map
101
+ * @returns {string} Chosen text
102
+ */
103
+ static choice(text: string, count?: number, replace?: any): string;
104
+ /**
105
+ * Pick plural variant from list
106
+ *
107
+ * @example Locale.countpick(["a","b"], 2) // => "b"
108
+ *
109
+ * @param {Array<string>} splits Variant list
110
+ * @param {number} count Choice count
111
+ * @returns {string} Picked text
112
+ */
113
+ static countpick(splits: Array<string>, count: number): string;
114
+ }
115
+ export default PicoLocale;