mark-3 0.0.4 → 0.0.5

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 (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/components/index.js +1 -0
  3. package/components/scroll-aware-content.vue +162 -0
  4. package/composables/index.js +2 -0
  5. package/composables/use-intersection-observer.js +67 -0
  6. package/composables/use-scroll-event.js +97 -0
  7. package/helpers/array/index.js +1 -0
  8. package/helpers/array/pick-random.js +24 -0
  9. package/helpers/array/tests/pick-random.test.js +39 -0
  10. package/helpers/date/index.js +1 -1
  11. package/helpers/date/{from-timestamp/index.test.js → tests/format-timestamp.test.js} +1 -1
  12. package/helpers/date/tests/format.test.js +97 -0
  13. package/helpers/date/{is-on-same-day/index.test.js → tests/is-on-same-day.test.js} +1 -1
  14. package/helpers/date/{is-on-same-year/index.test.js → tests/is-on-same-year.test.js} +1 -1
  15. package/helpers/number/clamp.js +17 -0
  16. package/helpers/number/index.js +2 -0
  17. package/helpers/number/random.js +24 -0
  18. package/helpers/number/tests/clamp.test.js +37 -0
  19. package/helpers/number/tests/random.test.js +51 -0
  20. package/helpers/string/{camel-to-dash/index.js → camel-to-dash.js} +2 -2
  21. package/helpers/string/encode-subscript.js +45 -0
  22. package/helpers/string/{escape-regex/index.js → escape-regex.js} +1 -1
  23. package/helpers/string/index.js +1 -0
  24. package/helpers/string/{camel-to-dash/index.test.js → tests/camel-to-dash.test.js} +1 -1
  25. package/helpers/string/tests/encode-subscript.test.js +41 -0
  26. package/helpers/string/{escape-regex/index.test.js → tests/escape-regex.test.js} +1 -1
  27. package/helpers/string/{trim/index.test.js → tests/trim.test.js} +1 -1
  28. package/helpers/string/{trim/index.js → trim.js} +2 -2
  29. package/helpers/time/debounce.js +29 -0
  30. package/helpers/time/index.js +1 -0
  31. package/helpers/time/tests/debounce.test.js +58 -0
  32. package/helpers/types/index.js +1 -0
  33. package/helpers/types/{is-empty/index.js → is-empty.js} +1 -1
  34. package/helpers/types/{is-map/index.js → is-map.js} +1 -1
  35. package/helpers/types/is-numeric.js +22 -0
  36. package/helpers/types/{is-set/index.js → is-set.js} +1 -1
  37. package/helpers/types/{get-type-name/index.test.js → tests/get-type-name.test.js} +2 -2
  38. package/helpers/types/{is-array/index.test.js → tests/is-array.test.js} +1 -1
  39. package/helpers/types/{is-empty/index.test.js → tests/is-empty.test.js} +1 -1
  40. package/helpers/types/{is-map/index.test.js → tests/is-map.test.js} +1 -1
  41. package/helpers/types/tests/is-numeric.test.js +51 -0
  42. package/helpers/types/{is-plain-object/index.test.js → tests/is-plain-object.test.js} +1 -1
  43. package/helpers/types/{is-set/index.test.js → tests/is-set.test.js} +1 -1
  44. package/helpers/types/{is-string/index.test.js → tests/is-string.test.js} +1 -1
  45. package/package.json +1 -1
  46. package/helpers/date/format/README.md +0 -33
  47. package/helpers/date/format/index.test.js +0 -97
  48. package/helpers/date/from-timestamp/README.md +0 -14
  49. package/helpers/date/is-on-same-day/README.md +0 -12
  50. package/helpers/date/is-on-same-year/README.md +0 -13
  51. package/helpers/string/camel-to-dash/README.md +0 -24
  52. package/helpers/string/escape-regex/README.md +0 -12
  53. package/helpers/string/trim/README.md +0 -66
  54. package/helpers/types/get-type-name/README.md +0 -11
  55. package/helpers/types/is-array/README.md +0 -11
  56. package/helpers/types/is-empty/README.md +0 -35
  57. package/helpers/types/is-map/README.md +0 -15
  58. package/helpers/types/is-plain-object/README.md +0 -17
  59. package/helpers/types/is-set/README.md +0 -15
  60. package/helpers/types/is-string/README.md +0 -12
  61. /package/helpers/date/{from-timestamp/index.js → format-timestamp.js} +0 -0
  62. /package/helpers/date/{format/index.js → format.js} +0 -0
  63. /package/helpers/date/{is-on-same-day/index.js → is-on-same-day.js} +0 -0
  64. /package/helpers/date/{is-on-same-year/index.js → is-on-same-year.js} +0 -0
  65. /package/helpers/types/{get-type-name/index.js → get-type-name.js} +0 -0
  66. /package/helpers/types/{is-array/index.js → is-array.js} +0 -0
  67. /package/helpers/types/{is-plain-object/index.js → is-plain-object.js} +0 -0
  68. /package/helpers/types/{is-string/index.js → is-string.js} +0 -0
@@ -1,66 +0,0 @@
1
- # trim
2
- A small utility function to trim specific characters from both ends of a string.
3
-
4
- Unlike the native `String.prototype.trim()` which only removes whitespace, this function lets you specify exactly which characters to trim — including special characters or a list of them.
5
-
6
- ---
7
-
8
- ## Features
9
- - Trim custom characters from the **start and end** of a string
10
- - Accepts either a **single character string** or an **array of characters**
11
- - Automatically escapes special regex characters
12
- - Ignores non-string input safely
13
-
14
- ---
15
-
16
- ## Usage
17
- ```js
18
- import { trim } from "mark-3/helpers/string";
19
-
20
- // Default whitespace trim
21
- trim(" Hello world ");
22
- // => "Hello world"
23
-
24
- // Trim specific character
25
- trim("---Hello---", "-");
26
- // => "Hello"
27
-
28
- // Trim multiple characters
29
- trim("..//Hello//..", [".", "/"]);
30
- // => "Hello"
31
-
32
- // No trim if input is not a string
33
- trim(42, "-");
34
- // => 42
35
-
36
- // Empty trim characters (returns input as-is)
37
- trim("text", "");
38
- // => "text"
39
-
40
- // trim characters as a pattern
41
- trim(":::text:::_", ":::" );
42
- // => "text:::_"
43
- ```
44
-
45
- ---
46
-
47
- ## Parameters
48
- ```ts
49
- trim(input: string, chars?: string | string[]): string
50
- ```
51
-
52
- | Name | Type | Default | Description |
53
- | ----- | -------------------- | ------- | --------------------------------------- |
54
- | input | `string` | — | The string to be trimmed |
55
- | chars | `string \| string[]` | `" "` | The character(s) to trim from both ends |
56
-
57
- If chars is a string of multiple characters, each character will be treated individually and removed if present at the start or end.
58
-
59
- **Behavior Details**
60
- If chars is an array: All characters in the array will be treated as individual characters to trim.
61
-
62
- If chars is a string:
63
- * A single-character string: trimmed directly like a single items array.
64
- * A multi-character string: each character as a whole.
65
-
66
- All special characters like ., *, +, ^ are automatically escaped — no need to handle them manually.
@@ -1,11 +0,0 @@
1
- # getTypeName
2
- Returns the name of a variable's type.
3
-
4
- ---
5
-
6
- ## Usage
7
- ```js
8
- import { getTypeName } from "mark-3/helpers/types";
9
-
10
- getTypeName({}); // 'Object'
11
- ```
@@ -1,11 +0,0 @@
1
- # isArray
2
- Checks if a value is an array.
3
-
4
- ---
5
-
6
- ## Usage
7
- ```js
8
- import { isArray } from "mark-3/helpers/types";
9
-
10
- isArray([ 1, 2, 3 ]); // true
11
- ```
@@ -1,35 +0,0 @@
1
- # isEmpty
2
- Checks if the given variable is empty.
3
-
4
- If the variable is an object, it is considered empty if it has no keys.
5
- If the variable is an array, it is considered empty if it has no elements.
6
- If the variable is a map or a set, it is considered empty if it has no size.
7
- If the variable is a string, it is considered empty if it is trimmed to be an empty string.
8
- If the variable is undefined or null, it is considered empty.
9
-
10
- Otherwise, it is not considered empty.
11
-
12
- ---
13
-
14
- ## Usage
15
-
16
- ```js
17
- import { isEmpty } from 'mark-3/helpers/types/isEmpty';
18
-
19
- isEmpty( '' ); // true
20
- isEmpty( ' ' ); // true
21
- isEmpty([]); // true
22
- isEmpty({}); // true
23
- isEmpty( new Map()); // true
24
- isEmpty( new Set()); // true
25
- isEmpty( null ); // true
26
- isEmpty( undefined ); // true
27
-
28
- isEmpty( 'foo' ); // false
29
- isEmpty([ 'foo' ]); // false
30
- isEmpty({ foo: 'bar' }); // false
31
- isEmpty( new Map([ 'foo', 'bar' ])); // false
32
- isEmpty( new Set([ 'foo' ])); // false
33
- isEmpty({ foo: 'bar' }); // false
34
- isEmpty(() => {}); // false
35
- ```
@@ -1,15 +0,0 @@
1
- # isMap
2
- Utility function to check if a value is a native `Map` object in JavaScript.
3
-
4
- ---
5
-
6
- ## Usage
7
- ```js
8
- import { isMap } from "@mark-3/helpers/types";
9
-
10
- isMap(new Map()); // true
11
- isMap(new WeakMap()); // false
12
- isMap({}); // false
13
- isMap([]); // false
14
- isMap(null); // false
15
- ```
@@ -1,17 +0,0 @@
1
- # isPlainObject
2
- A utility function to check if a value is a plain object.
3
-
4
- ## Usage
5
- ```js
6
- import { isPlainObject } from "mark-3/helpers/types";
7
-
8
- isPlainObject({}); // true
9
- isPlainObject({ a: 1 }); // true
10
- isPlainObject(Object.create(null)); // true
11
- isPlainObject([]); // false
12
- isPlainObject(null); // false
13
- isPlainObject(new Date()); // false
14
- isPlainObject(function(){}); // false
15
- isPlainObject(new Map()); // false
16
- isPlainObject(new ( class MyClass{})()); // false
17
- ```
@@ -1,15 +0,0 @@
1
- # isSet
2
- Utility function to check if a value is a native `Set` object in JavaScript.
3
-
4
- ---
5
-
6
- ## Usage
7
- ```js
8
- import { isSet } from "mark-3/helpers/types";
9
-
10
- isSet(new Set()); // true
11
- isSet(new WeakSet()); // false
12
- isSet({}); // false
13
- isSet([]); // false
14
- isSet(null); // false
15
- ```
@@ -1,12 +0,0 @@
1
- # isString
2
- Checks if a value is a string.
3
-
4
- ---
5
-
6
- ## Usage
7
- ```js
8
- import { isString } from "mark-3/helpers/types";
9
-
10
- isString( "foo" ); // true
11
- isString(1); // false
12
- ```
File without changes