@sharadox/web-library 0.4.1 → 0.5.1
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/LICENSE.md +22 -22
- package/README.md +41 -29
- package/distribution/assert/never/index.d.ts +13 -0
- package/distribution/assert/never/index.d.ts.map +1 -0
- package/distribution/assert/never/index.js +15 -0
- package/distribution/assert/never/index.js.map +1 -0
- package/distribution/class-name/index.d.ts +6 -1
- package/distribution/class-name/index.d.ts.map +1 -1
- package/distribution/class-name/index.js +6 -1
- package/distribution/class-name/index.js.map +1 -1
- package/distribution/html/escape/index.d.ts +6 -1
- package/distribution/html/escape/index.d.ts.map +1 -1
- package/distribution/html/escape/index.js +7 -2
- package/distribution/html/escape/index.js.map +1 -1
- package/distribution/math/clamp/index.d.ts +6 -1
- package/distribution/math/clamp/index.d.ts.map +1 -1
- package/distribution/math/clamp/index.js +6 -1
- package/distribution/math/clamp/index.js.map +1 -1
- package/distribution/math/pseudo-random/index.d.ts +6 -1
- package/distribution/math/pseudo-random/index.d.ts.map +1 -1
- package/distribution/math/pseudo-random/index.js +6 -1
- package/distribution/math/pseudo-random/index.js.map +1 -1
- package/distribution/math/radians/index.d.ts +6 -1
- package/distribution/math/radians/index.d.ts.map +1 -1
- package/distribution/math/radians/index.js +6 -1
- package/distribution/math/radians/index.js.map +1 -1
- package/distribution/text/separate/index.d.ts +9 -0
- package/distribution/text/separate/index.d.ts.map +1 -0
- package/distribution/text/separate/index.js +11 -0
- package/distribution/text/separate/index.js.map +1 -0
- package/distribution/type-guard/is-boolean/index.d.ts +8 -0
- package/distribution/type-guard/is-boolean/index.d.ts.map +1 -0
- package/distribution/type-guard/is-boolean/index.js +10 -0
- package/distribution/type-guard/is-boolean/index.js.map +1 -0
- package/distribution/type-guard/is-defined/index.d.ts +8 -0
- package/distribution/type-guard/is-defined/index.d.ts.map +1 -0
- package/distribution/type-guard/is-defined/index.js +10 -0
- package/distribution/type-guard/is-defined/index.js.map +1 -0
- package/distribution/type-guard/is-non-empty-string/index.d.ts +8 -0
- package/distribution/type-guard/is-non-empty-string/index.d.ts.map +1 -0
- package/distribution/type-guard/is-non-empty-string/index.js +11 -0
- package/distribution/type-guard/is-non-empty-string/index.js.map +1 -0
- package/distribution/type-guard/is-number/index.d.ts +9 -0
- package/distribution/type-guard/is-number/index.d.ts.map +1 -0
- package/distribution/type-guard/is-number/index.js +11 -0
- package/distribution/type-guard/is-number/index.js.map +1 -0
- package/distribution/type-guard/is-record/index.d.ts +9 -0
- package/distribution/type-guard/is-record/index.d.ts.map +1 -0
- package/distribution/type-guard/is-record/index.js +14 -0
- package/distribution/type-guard/is-record/index.js.map +1 -0
- package/distribution/type-guard/is-string/index.d.ts +9 -0
- package/distribution/type-guard/is-string/index.d.ts.map +1 -0
- package/distribution/type-guard/is-string/index.js +11 -0
- package/distribution/type-guard/is-string/index.js.map +1 -0
- package/llms.txt +17 -0
- package/package.json +17 -45
- package/distribution/animation/count-up/index.d.ts +0 -6
- package/distribution/animation/count-up/index.d.ts.map +0 -1
- package/distribution/animation/count-up/index.js +0 -29
- package/distribution/animation/count-up/index.js.map +0 -1
- package/distribution/animation/in-view/index.d.ts +0 -3
- package/distribution/animation/in-view/index.d.ts.map +0 -1
- package/distribution/animation/in-view/index.js +0 -15
- package/distribution/animation/in-view/index.js.map +0 -1
- package/distribution/animation/marquee/index.d.ts +0 -9
- package/distribution/animation/marquee/index.d.ts.map +0 -1
- package/distribution/animation/marquee/index.js +0 -78
- package/distribution/animation/marquee/index.js.map +0 -1
- package/distribution/animation/marquee/type.d.ts +0 -5
- package/distribution/animation/marquee/type.d.ts.map +0 -1
- package/distribution/animation/marquee/type.js +0 -2
- package/distribution/animation/marquee/type.js.map +0 -1
- package/distribution/animation/reveal/index.d.ts +0 -4
- package/distribution/animation/reveal/index.d.ts.map +0 -1
- package/distribution/animation/reveal/index.js +0 -9
- package/distribution/animation/reveal/index.js.map +0 -1
- package/distribution/animation/reveal/type.d.ts +0 -14
- package/distribution/animation/reveal/type.d.ts.map +0 -1
- package/distribution/animation/reveal/type.js +0 -2
- package/distribution/animation/reveal/type.js.map +0 -1
- package/distribution/animation/scroll-word/index.d.ts +0 -4
- package/distribution/animation/scroll-word/index.d.ts.map +0 -1
- package/distribution/animation/scroll-word/index.js +0 -16
- package/distribution/animation/scroll-word/index.js.map +0 -1
- package/distribution/animation/scroll-word/type.d.ts +0 -11
- package/distribution/animation/scroll-word/type.d.ts.map +0 -1
- package/distribution/animation/scroll-word/type.js +0 -2
- package/distribution/animation/scroll-word/type.js.map +0 -1
- package/distribution/animation/scroll-word/word/index.d.ts +0 -4
- package/distribution/animation/scroll-word/word/index.d.ts.map +0 -1
- package/distribution/animation/scroll-word/word/index.js +0 -10
- package/distribution/animation/scroll-word/word/index.js.map +0 -1
- package/distribution/animation/scroll-word/word/type.d.ts +0 -14
- package/distribution/animation/scroll-word/word/type.d.ts.map +0 -1
- package/distribution/animation/scroll-word/word/type.js +0 -2
- package/distribution/animation/scroll-word/word/type.js.map +0 -1
- package/distribution/animation/smooth-scroll/index.d.ts +0 -4
- package/distribution/animation/smooth-scroll/index.d.ts.map +0 -1
- package/distribution/animation/smooth-scroll/index.js +0 -33
- package/distribution/animation/smooth-scroll/index.js.map +0 -1
- package/distribution/animation/smooth-scroll/type.d.ts +0 -7
- package/distribution/animation/smooth-scroll/type.d.ts.map +0 -1
- package/distribution/animation/smooth-scroll/type.js +0 -2
- package/distribution/animation/smooth-scroll/type.js.map +0 -1
- package/distribution/form/bot-check/index.d.ts +0 -4
- package/distribution/form/bot-check/index.d.ts.map +0 -1
- package/distribution/form/bot-check/index.js +0 -6
- package/distribution/form/bot-check/index.js.map +0 -1
- package/distribution/form/bot-check/type.d.ts +0 -11
- package/distribution/form/bot-check/type.d.ts.map +0 -1
- package/distribution/form/bot-check/type.js +0 -2
- package/distribution/form/bot-check/type.js.map +0 -1
- package/distribution/form/field/index.d.ts +0 -3
- package/distribution/form/field/index.d.ts.map +0 -1
- package/distribution/form/field/index.js +0 -7
- package/distribution/form/field/index.js.map +0 -1
- package/distribution/form/rate-limit/index.d.ts +0 -4
- package/distribution/form/rate-limit/index.d.ts.map +0 -1
- package/distribution/form/rate-limit/index.js +0 -14
- package/distribution/form/rate-limit/index.js.map +0 -1
- package/distribution/form/rate-limit/type.d.ts +0 -9
- package/distribution/form/rate-limit/type.d.ts.map +0 -1
- package/distribution/form/rate-limit/type.js +0 -2
- package/distribution/form/rate-limit/type.js.map +0 -1
- package/distribution/internationalization/locale/index.d.ts +0 -7
- package/distribution/internationalization/locale/index.d.ts.map +0 -1
- package/distribution/internationalization/locale/index.js +0 -17
- package/distribution/internationalization/locale/index.js.map +0 -1
- package/distribution/internationalization/locale/type.d.ts +0 -3
- package/distribution/internationalization/locale/type.d.ts.map +0 -1
- package/distribution/internationalization/locale/type.js +0 -2
- package/distribution/internationalization/locale/type.js.map +0 -1
- package/distribution/internationalization/locale-preference/index.d.ts +0 -5
- package/distribution/internationalization/locale-preference/index.d.ts.map +0 -1
- package/distribution/internationalization/locale-preference/index.js +0 -9
- package/distribution/internationalization/locale-preference/index.js.map +0 -1
- package/distribution/internationalization/locale-redirect/index.d.ts +0 -8
- package/distribution/internationalization/locale-redirect/index.d.ts.map +0 -1
- package/distribution/internationalization/locale-redirect/index.js +0 -24
- package/distribution/internationalization/locale-redirect/index.js.map +0 -1
- package/distribution/internationalization/locale-redirect/type.d.ts +0 -12
- package/distribution/internationalization/locale-redirect/type.d.ts.map +0 -1
- package/distribution/internationalization/locale-redirect/type.js +0 -2
- package/distribution/internationalization/locale-redirect/type.js.map +0 -1
- package/distribution/internationalization/translate/index.d.ts +0 -4
- package/distribution/internationalization/translate/index.d.ts.map +0 -1
- package/distribution/internationalization/translate/index.js +0 -5
- package/distribution/internationalization/translate/index.js.map +0 -1
- package/distribution/pointer/spotlight/index.d.ts +0 -3
- package/distribution/pointer/spotlight/index.d.ts.map +0 -1
- package/distribution/pointer/spotlight/index.js +0 -20
- package/distribution/pointer/spotlight/index.js.map +0 -1
- package/distribution/pointer/tilt/index.d.ts +0 -7
- package/distribution/pointer/tilt/index.d.ts.map +0 -1
- package/distribution/pointer/tilt/index.js +0 -34
- package/distribution/pointer/tilt/index.js.map +0 -1
- package/distribution/privacy/consent/index.d.ts +0 -22
- package/distribution/privacy/consent/index.d.ts.map +0 -1
- package/distribution/privacy/consent/index.js +0 -75
- package/distribution/privacy/consent/index.js.map +0 -1
- package/distribution/privacy/consent/type.d.ts +0 -35
- package/distribution/privacy/consent/type.d.ts.map +0 -1
- package/distribution/privacy/consent/type.js +0 -2
- package/distribution/privacy/consent/type.js.map +0 -1
- package/distribution/privacy/use-consent/index.d.ts +0 -5
- package/distribution/privacy/use-consent/index.d.ts.map +0 -1
- package/distribution/privacy/use-consent/index.js +0 -22
- package/distribution/privacy/use-consent/index.js.map +0 -1
- package/distribution/privacy/use-consent/type.d.ts +0 -10
- package/distribution/privacy/use-consent/type.d.ts.map +0 -1
- package/distribution/privacy/use-consent/type.js +0 -2
- package/distribution/privacy/use-consent/type.js.map +0 -1
- package/distribution/scroll/active-section/index.d.ts +0 -7
- package/distribution/scroll/active-section/index.d.ts.map +0 -1
- package/distribution/scroll/active-section/index.js +0 -49
- package/distribution/scroll/active-section/index.js.map +0 -1
- package/distribution/scroll/active-section/type.d.ts +0 -9
- package/distribution/scroll/active-section/type.d.ts.map +0 -1
- package/distribution/scroll/active-section/type.js +0 -2
- package/distribution/scroll/active-section/type.js.map +0 -1
- package/distribution/search-engine/robots/index.d.ts +0 -4
- package/distribution/search-engine/robots/index.d.ts.map +0 -1
- package/distribution/search-engine/robots/index.js +0 -7
- package/distribution/search-engine/robots/index.js.map +0 -1
- package/distribution/search-engine/robots/type.d.ts +0 -17
- package/distribution/search-engine/robots/type.d.ts.map +0 -1
- package/distribution/search-engine/robots/type.js +0 -2
- package/distribution/search-engine/robots/type.js.map +0 -1
- package/distribution/search-engine/sitemap/index.d.ts +0 -4
- package/distribution/search-engine/sitemap/index.d.ts.map +0 -1
- package/distribution/search-engine/sitemap/index.js +0 -12
- package/distribution/search-engine/sitemap/index.js.map +0 -1
- package/distribution/search-engine/sitemap/type.d.ts +0 -22
- package/distribution/search-engine/sitemap/type.d.ts.map +0 -1
- package/distribution/search-engine/sitemap/type.js +0 -2
- package/distribution/search-engine/sitemap/type.js.map +0 -1
- package/distribution/search-engine/structured-data/index.d.ts +0 -4
- package/distribution/search-engine/structured-data/index.d.ts.map +0 -1
- package/distribution/search-engine/structured-data/index.js +0 -6
- package/distribution/search-engine/structured-data/index.js.map +0 -1
- package/distribution/search-engine/structured-data/type.d.ts +0 -5
- package/distribution/search-engine/structured-data/type.d.ts.map +0 -1
- package/distribution/search-engine/structured-data/type.js +0 -2
- package/distribution/search-engine/structured-data/type.js.map +0 -1
- package/distribution/style/apply/index.d.ts +0 -11
- package/distribution/style/apply/index.d.ts.map +0 -1
- package/distribution/style/apply/index.js +0 -50
- package/distribution/style/apply/index.js.map +0 -1
- package/distribution/style/apply/type.d.ts +0 -12
- package/distribution/style/apply/type.d.ts.map +0 -1
- package/distribution/style/apply/type.js +0 -2
- package/distribution/style/apply/type.js.map +0 -1
- package/distribution/style/definition/index.d.ts +0 -14
- package/distribution/style/definition/index.d.ts.map +0 -1
- package/distribution/style/definition/index.js +0 -26
- package/distribution/style/definition/index.js.map +0 -1
- package/distribution/style/definition/type.d.ts +0 -29
- package/distribution/style/definition/type.d.ts.map +0 -1
- package/distribution/style/definition/type.js +0 -2
- package/distribution/style/definition/type.js.map +0 -1
- package/distribution/style/style-script/index.d.ts +0 -10
- package/distribution/style/style-script/index.d.ts.map +0 -1
- package/distribution/style/style-script/index.js +0 -16
- package/distribution/style/style-script/index.js.map +0 -1
- package/distribution/style/style-script/type.d.ts +0 -5
- package/distribution/style/style-script/type.d.ts.map +0 -1
- package/distribution/style/style-script/type.js +0 -2
- package/distribution/style/style-script/type.js.map +0 -1
- package/distribution/style/style-sheet/index.d.ts +0 -8
- package/distribution/style/style-sheet/index.d.ts.map +0 -1
- package/distribution/style/style-sheet/index.js +0 -25
- package/distribution/style/style-sheet/index.js.map +0 -1
- package/distribution/style/use-style/index.d.ts +0 -5
- package/distribution/style/use-style/index.d.ts.map +0 -1
- package/distribution/style/use-style/index.js +0 -37
- package/distribution/style/use-style/index.js.map +0 -1
- package/distribution/style/use-style/type.d.ts +0 -9
- package/distribution/style/use-style/type.d.ts.map +0 -1
- package/distribution/style/use-style/type.js +0 -2
- package/distribution/style/use-style/type.js.map +0 -1
- package/distribution/test/visual-snapshot/index.d.ts +0 -8
- package/distribution/test/visual-snapshot/index.d.ts.map +0 -1
- package/distribution/test/visual-snapshot/index.js +0 -20
- package/distribution/test/visual-snapshot/index.js.map +0 -1
- package/distribution/test/visual-snapshot/type.d.ts +0 -7
- package/distribution/test/visual-snapshot/type.d.ts.map +0 -1
- package/distribution/test/visual-snapshot/type.js +0 -2
- package/distribution/test/visual-snapshot/type.js.map +0 -1
- package/distribution/time/format-time/index.d.ts +0 -3
- package/distribution/time/format-time/index.d.ts.map +0 -1
- package/distribution/time/format-time/index.js +0 -5
- package/distribution/time/format-time/index.js.map +0 -1
- package/distribution/time/open-state/index.d.ts +0 -4
- package/distribution/time/open-state/index.d.ts.map +0 -1
- package/distribution/time/open-state/index.js +0 -11
- package/distribution/time/open-state/index.js.map +0 -1
- package/distribution/time/open-state/type.d.ts +0 -5
- package/distribution/time/open-state/type.d.ts.map +0 -1
- package/distribution/time/open-state/type.js +0 -2
- package/distribution/time/open-state/type.js.map +0 -1
- package/distribution/time/sun-time/index.d.ts +0 -4
- package/distribution/time/sun-time/index.d.ts.map +0 -1
- package/distribution/time/sun-time/index.js +0 -27
- package/distribution/time/sun-time/index.js.map +0 -1
- package/distribution/time/sun-time/type.d.ts +0 -6
- package/distribution/time/sun-time/type.d.ts.map +0 -1
- package/distribution/time/sun-time/type.js +0 -2
- package/distribution/time/sun-time/type.js.map +0 -1
- package/distribution/time/sun-today/index.d.ts +0 -4
- package/distribution/time/sun-today/index.d.ts.map +0 -1
- package/distribution/time/sun-today/index.js +0 -25
- package/distribution/time/sun-today/index.js.map +0 -1
- package/distribution/time/sun-today/type.d.ts +0 -9
- package/distribution/time/sun-today/type.d.ts.map +0 -1
- package/distribution/time/sun-today/type.js +0 -2
- package/distribution/time/sun-today/type.js.map +0 -1
- package/distribution/time/zone-minute/index.d.ts +0 -3
- package/distribution/time/zone-minute/index.d.ts.map +0 -1
- package/distribution/time/zone-minute/index.js +0 -13
- package/distribution/time/zone-minute/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-string/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @sharadox/web-library
|
|
2
|
+
|
|
3
|
+
> General TypeScript utilities shared by every Sharadox library (no dependencies). Topic code moved to *-web-library topic packages (internationalization, metadata, style, consent, animation, scroll, pointer, form, time, test).
|
|
4
|
+
|
|
5
|
+
- type-guard/is-string → isString(value): value is string
|
|
6
|
+
- type-guard/is-non-empty-string → isNonEmptyString(value)
|
|
7
|
+
- type-guard/is-number → isNumber(value): finite numbers
|
|
8
|
+
- type-guard/is-boolean → isBoolean(value)
|
|
9
|
+
- type-guard/is-record → isRecord(value): plain objects
|
|
10
|
+
- type-guard/is-defined → isDefined(value): not null/undefined
|
|
11
|
+
- class-name → classNames(...names): joins truthy names
|
|
12
|
+
- html/escape → escapeHtml(text)
|
|
13
|
+
- text/separate → separate(separator, ...parts): "a • b", skipping empty parts
|
|
14
|
+
- math/clamp, math/radians, math/pseudo-random
|
|
15
|
+
- assert/never → assertNever(value): throws; for exhaustive switches
|
|
16
|
+
- Import by path: `import { isString } from "@sharadox/web-library/type-guard/is-string";`
|
|
17
|
+
- License: Sharadox Open Source License 0.1.0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/web-library",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "General TypeScript utilities shared by every Sharadox library and application: type guards, class names, HTML escaping, text joining, math helpers and exhaustiveness checks.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|
|
7
7
|
"author": "Sharadox <contact@sharadox.com>",
|
|
@@ -12,10 +12,7 @@
|
|
|
12
12
|
"types": "./distribution/*/type.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"./*": {
|
|
15
|
-
"sharadox-source":
|
|
16
|
-
"./source/*/index.ts",
|
|
17
|
-
"./source/*/index.tsx"
|
|
18
|
-
],
|
|
15
|
+
"sharadox-source": "./source/*/index.ts",
|
|
19
16
|
"types": "./distribution/*/index.d.ts",
|
|
20
17
|
"default": "./distribution/*/index.js"
|
|
21
18
|
}
|
|
@@ -24,29 +21,16 @@
|
|
|
24
21
|
"distribution",
|
|
25
22
|
"LICENCA.md",
|
|
26
23
|
"LICENSE.md",
|
|
27
|
-
"NOTICE.md"
|
|
28
|
-
|
|
29
|
-
"sideEffects": [
|
|
30
|
-
"**/*.css"
|
|
24
|
+
"NOTICE.md",
|
|
25
|
+
"llms.txt"
|
|
31
26
|
],
|
|
27
|
+
"sideEffects": false,
|
|
32
28
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
29
|
+
"node": ">=26"
|
|
34
30
|
},
|
|
35
31
|
"publishConfig": {
|
|
36
32
|
"access": "public"
|
|
37
33
|
},
|
|
38
|
-
"peerDependencies": {
|
|
39
|
-
"react": ">=19",
|
|
40
|
-
"@playwright/test": ">=1.50"
|
|
41
|
-
},
|
|
42
|
-
"peerDependenciesMeta": {
|
|
43
|
-
"react": {
|
|
44
|
-
"optional": true
|
|
45
|
-
},
|
|
46
|
-
"@playwright/test": {
|
|
47
|
-
"optional": true
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
34
|
"lint-staged": {
|
|
51
35
|
"*.{ts,tsx,js,mjs,cjs}": [
|
|
52
36
|
"prettier --write",
|
|
@@ -55,28 +39,20 @@
|
|
|
55
39
|
"*.{json,md,yml,yaml,scss}": "prettier --write"
|
|
56
40
|
},
|
|
57
41
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
42
|
+
"@sharadox/es-lint-configuration-web-library": "^0.1.1",
|
|
43
|
+
"@sharadox/prettier-configuration-web-library": "^0.1.0",
|
|
44
|
+
"@sharadox/turborepo-configuration-web-library": "^0.1.0",
|
|
45
|
+
"@sharadox/type-script-configuration-web-library": "^0.1.1",
|
|
46
|
+
"@sharadox/vitest-configuration-web-library": "^0.1.1",
|
|
62
47
|
"@types/node": "^24.19.2",
|
|
63
|
-
"@
|
|
64
|
-
"@vitejs/plugin-react": "^6.3.0",
|
|
48
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
65
49
|
"eslint": "9.39.5",
|
|
66
|
-
"eslint-config-prettier": "^10.1.8",
|
|
67
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
68
|
-
"happy-dom": "^21.0.4",
|
|
69
50
|
"husky": "^9.1.7",
|
|
70
51
|
"lint-staged": "^17.6.0",
|
|
71
|
-
"
|
|
72
|
-
"prettier": "^3.9.10",
|
|
73
|
-
"react": "^19.3.1",
|
|
74
|
-
"react-dom": "^19.3.1",
|
|
75
|
-
"sass": "^1.108.1",
|
|
52
|
+
"prettier": "^3.10.0",
|
|
76
53
|
"turbo": "^2.11.10",
|
|
77
54
|
"typedoc": "^0.28.20",
|
|
78
55
|
"typescript": "6.0.3",
|
|
79
|
-
"typescript-eslint": "^8.72.2",
|
|
80
56
|
"vitest": "^5.1.0"
|
|
81
57
|
},
|
|
82
58
|
"repository": {
|
|
@@ -84,19 +60,15 @@
|
|
|
84
60
|
"url": "git+https://github.com/Sharadox/web-library.git"
|
|
85
61
|
},
|
|
86
62
|
"homepage": "https://github.com/Sharadox/web-library#readme",
|
|
87
|
-
"dependencies": {
|
|
88
|
-
"lenis": "^1.3.27",
|
|
89
|
-
"motion": "^12.43.0"
|
|
90
|
-
},
|
|
91
63
|
"scripts": {
|
|
92
|
-
"build": "rm -rf distribution && tsc -p tsconfig.build.json
|
|
64
|
+
"build": "rm -rf distribution && tsc -p tsconfig.build.json",
|
|
93
65
|
"lint": "eslint --max-warnings=0 .",
|
|
94
66
|
"format": "prettier --write .",
|
|
95
67
|
"format:check": "prettier --check .",
|
|
96
68
|
"type-check": "tsc --noEmit",
|
|
97
|
-
"test:unit": "vitest run",
|
|
69
|
+
"test:unit": "vitest run --coverage",
|
|
98
70
|
"test:benchmark": "vitest bench --run --passWithNoTests",
|
|
99
71
|
"documentation": "typedoc",
|
|
100
|
-
"verify": "turbo run format:check lint type-check test:unit
|
|
72
|
+
"verify": "turbo run format:check lint type-check test:unit build"
|
|
101
73
|
}
|
|
102
74
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Counts from 0 to `target` with an ease-out once `start` is true (for example from `useInView`). Jumps straight to
|
|
3
|
-
* the target when the visitor prefers reduced motion.
|
|
4
|
-
*/
|
|
5
|
-
export declare function useCountUp(target: number, start: boolean, durationMilliseconds?: number): number;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/count-up/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,SAAO,GAAG,MAAM,CAmB9F"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
/**
|
|
4
|
-
* Counts from 0 to `target` with an ease-out once `start` is true (for example from `useInView`). Jumps straight to
|
|
5
|
-
* the target when the visitor prefers reduced motion.
|
|
6
|
-
*/
|
|
7
|
-
export function useCountUp(target, start, durationMilliseconds = 1600) {
|
|
8
|
-
const [value, setValue] = useState(0);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!start)
|
|
11
|
-
return;
|
|
12
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
13
|
-
const frame = requestAnimationFrame(() => setValue(target));
|
|
14
|
-
return () => cancelAnimationFrame(frame);
|
|
15
|
-
}
|
|
16
|
-
const begin = performance.now();
|
|
17
|
-
let frame = 0;
|
|
18
|
-
const tick = (now) => {
|
|
19
|
-
const progress = Math.min(1, (now - begin) / durationMilliseconds);
|
|
20
|
-
setValue(Math.round(target * (1 - Math.pow(1 - progress, 3))));
|
|
21
|
-
if (progress < 1)
|
|
22
|
-
frame = requestAnimationFrame(tick);
|
|
23
|
-
};
|
|
24
|
-
frame = requestAnimationFrame(tick);
|
|
25
|
-
return () => cancelAnimationFrame(frame);
|
|
26
|
-
}, [target, start, durationMilliseconds]);
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/count-up/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,KAAc,EAAE,oBAAoB,GAAG,IAAI;IACpF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,EAAE,CAAC;YAClE,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5D,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,oBAAoB,CAAC,CAAC;YACnE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,IAAI,QAAQ,GAAG,CAAC;gBAAE,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/in-view/index.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,MAAM,SAAS,WAAW,EAAE,SAAS,SAAO,gEASrE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
/** True once the element has been at least `threshold` visible. Stays true. */
|
|
4
|
-
export function useInView(threshold = 0.35) {
|
|
5
|
-
const element = useRef(null);
|
|
6
|
-
const [inView, setInView] = useState(false);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const observer = new IntersectionObserver(([entry]) => entry?.isIntersecting && setInView(true), { threshold });
|
|
9
|
-
if (element.current)
|
|
10
|
-
observer.observe(element.current);
|
|
11
|
-
return () => observer.disconnect();
|
|
12
|
-
}, [threshold]);
|
|
13
|
-
return [element, inView];
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/in-view/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAA6B,SAAS,GAAG,IAAI;IACpE,MAAM,OAAO,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,cAAc,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAChH,IAAI,OAAO,CAAC,OAAO;YAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAChB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AACpC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { MarqueeOptions } from "@sharadox/web-library/animation/marquee/type";
|
|
2
|
-
/**
|
|
3
|
-
* An endless strip that slides on its own and can be grabbed and flung by hand (mouse or touch), with inertia.
|
|
4
|
-
* Attach the returned reference to the track: an element holding two identical groups side by side, so moving it by
|
|
5
|
-
* one group's width (half the track) looks the same. It does not move by itself when the visitor prefers reduced
|
|
6
|
-
* motion, but can still be dragged.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useMarquee<Track extends HTMLElement>({ speed }?: MarqueeOptions): import("react").RefObject<Track | null>;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/marquee/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAEnF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS,WAAW,EAAE,EAAE,KAAU,EAAE,GAAE,cAAmB,2CAgExF"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
/**
|
|
4
|
-
* An endless strip that slides on its own and can be grabbed and flung by hand (mouse or touch), with inertia.
|
|
5
|
-
* Attach the returned reference to the track: an element holding two identical groups side by side, so moving it by
|
|
6
|
-
* one group's width (half the track) looks the same. It does not move by itself when the visitor prefers reduced
|
|
7
|
-
* motion, but can still be dragged.
|
|
8
|
-
*/
|
|
9
|
-
export function useMarquee({ speed = 40 } = {}) {
|
|
10
|
-
const reference = useRef(null);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const track = reference.current;
|
|
13
|
-
if (!track)
|
|
14
|
-
return;
|
|
15
|
-
const automatic = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : speed;
|
|
16
|
-
let offset = 0;
|
|
17
|
-
let velocity = 0;
|
|
18
|
-
let dragging = false;
|
|
19
|
-
let lastX = 0;
|
|
20
|
-
let lastTime = 0;
|
|
21
|
-
let previous = performance.now();
|
|
22
|
-
let frame = 0;
|
|
23
|
-
const wrap = () => {
|
|
24
|
-
const half = track.scrollWidth / 2;
|
|
25
|
-
if (half > 0)
|
|
26
|
-
offset = ((offset % half) - half) % half || 0;
|
|
27
|
-
};
|
|
28
|
-
const tick = (now) => {
|
|
29
|
-
const seconds = Math.min(0.05, (now - previous) / 1000);
|
|
30
|
-
previous = now;
|
|
31
|
-
if (!dragging) {
|
|
32
|
-
// Inertia from a fling eases back into the automatic speed.
|
|
33
|
-
velocity += (-automatic - velocity) * Math.min(1, seconds * 2.5);
|
|
34
|
-
offset += velocity * seconds;
|
|
35
|
-
}
|
|
36
|
-
wrap();
|
|
37
|
-
track.style.transform = `translate3d(${offset}px, 0, 0)`;
|
|
38
|
-
frame = requestAnimationFrame(tick);
|
|
39
|
-
};
|
|
40
|
-
const down = (event) => {
|
|
41
|
-
dragging = true;
|
|
42
|
-
lastX = event.clientX;
|
|
43
|
-
lastTime = event.timeStamp;
|
|
44
|
-
velocity = 0;
|
|
45
|
-
track.setPointerCapture(event.pointerId);
|
|
46
|
-
};
|
|
47
|
-
const move = (event) => {
|
|
48
|
-
if (!dragging)
|
|
49
|
-
return;
|
|
50
|
-
const delta = event.clientX - lastX;
|
|
51
|
-
const elapsed = Math.max(1, event.timeStamp - lastTime) / 1000;
|
|
52
|
-
offset += delta;
|
|
53
|
-
velocity = delta / elapsed;
|
|
54
|
-
lastX = event.clientX;
|
|
55
|
-
lastTime = event.timeStamp;
|
|
56
|
-
};
|
|
57
|
-
const up = (event) => {
|
|
58
|
-
dragging = false;
|
|
59
|
-
if (track.hasPointerCapture(event.pointerId))
|
|
60
|
-
track.releasePointerCapture(event.pointerId);
|
|
61
|
-
};
|
|
62
|
-
velocity = -automatic;
|
|
63
|
-
track.addEventListener("pointerdown", down);
|
|
64
|
-
track.addEventListener("pointermove", move);
|
|
65
|
-
track.addEventListener("pointerup", up);
|
|
66
|
-
track.addEventListener("pointercancel", up);
|
|
67
|
-
frame = requestAnimationFrame(tick);
|
|
68
|
-
return () => {
|
|
69
|
-
cancelAnimationFrame(frame);
|
|
70
|
-
track.removeEventListener("pointerdown", down);
|
|
71
|
-
track.removeEventListener("pointermove", move);
|
|
72
|
-
track.removeEventListener("pointerup", up);
|
|
73
|
-
track.removeEventListener("pointercancel", up);
|
|
74
|
-
};
|
|
75
|
-
}, [speed]);
|
|
76
|
-
return reference;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/marquee/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAA4B,EAAE,KAAK,GAAG,EAAE,KAAqB,EAAE;IACvF,MAAM,SAAS,GAAG,MAAM,CAAQ,IAAI,CAAC,CAAC;IACtC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5F,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QACjC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QAC9D,CAAC,CAAC;QACF,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YACxD,QAAQ,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,4DAA4D;gBAC5D,QAAQ,IAAI,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,GAAG,CAAC,CAAC;gBACjE,MAAM,IAAI,QAAQ,GAAG,OAAO,CAAC;YAC/B,CAAC;YACD,IAAI,EAAE,CAAC;YACP,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,MAAM,WAAW,CAAC;YACzD,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC;QACF,MAAM,IAAI,GAAG,CAAC,KAAmB,EAAE,EAAE;YACnC,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;YACtB,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;YAC3B,QAAQ,GAAG,CAAC,CAAC;YACb,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC,CAAC;QACF,MAAM,IAAI,GAAG,CAAC,KAAmB,EAAE,EAAE;YACnC,IAAI,CAAC,QAAQ;gBAAE,OAAO;YACtB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC;YAChB,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;YAC3B,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;YACtB,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;QAC7B,CAAC,CAAC;QACF,MAAM,EAAE,GAAG,CAAC,KAAmB,EAAE,EAAE;YACjC,QAAQ,GAAG,KAAK,CAAC;YACjB,IAAI,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC;gBAAE,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC7F,CAAC,CAAC;QACF,QAAQ,GAAG,CAAC,SAAS,CAAC;QACtB,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC5C,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC5C,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,KAAK,CAAC,gBAAgB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAC5C,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC5B,KAAK,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAC/C,KAAK,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAC/C,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC3C,KAAK,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/marquee/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/marquee/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { RevealProperties } from "@sharadox/web-library/animation/reveal/type";
|
|
2
|
-
/** Fades, lifts and (optionally) unblurs its children into place the first time they scroll into view. */
|
|
3
|
-
export declare function Reveal({ children, delay, y, blur, margin, className }: RevealProperties): import("react").JSX.Element;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/reveal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAIpF,0GAA0G;AAC1G,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAS,EAAE,CAAM,EAAE,IAAQ,EAAE,MAAmB,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAYjH"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { motion } from "motion/react";
|
|
4
|
-
const EASE = [0.22, 1, 0.36, 1];
|
|
5
|
-
/** Fades, lifts and (optionally) unblurs its children into place the first time they scroll into view. */
|
|
6
|
-
export function Reveal({ children, delay = 0, y = 24, blur = 6, margin = "-12% 0px", className }) {
|
|
7
|
-
return (_jsx(motion.div, { className: className, initial: blur ? { opacity: 0, y, filter: `blur(${blur}px)` } : { opacity: 0, y }, whileInView: blur ? { opacity: 1, y: 0, filter: "blur(0px)" } : { opacity: 1, y: 0 }, viewport: { once: true, margin: margin }, transition: { duration: 0.9, delay, ease: EASE }, children: children }));
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/reveal/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAU,CAAC;AAEzC,0GAA0G;AAC1G,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,SAAS,EAAoB;IAChH,OAAO,CACL,KAAC,MAAM,CAAC,GAAG,IACT,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAChF,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EACpF,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAuB,EAAE,EACzD,UAAU,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAE/C,QAAQ,GACE,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export interface RevealProperties {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
/** Seconds to wait before animating in. */
|
|
5
|
-
delay?: number;
|
|
6
|
-
/** Starting vertical offset in pixels. Defaults to 24. */
|
|
7
|
-
y?: number;
|
|
8
|
-
/** Starting blur in pixels; 0 turns the blur off. Defaults to 6. */
|
|
9
|
-
blur?: number;
|
|
10
|
-
/** How far inside the viewport the element must be before it reveals (a CSS margin). Defaults to "-12% 0px". */
|
|
11
|
-
margin?: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/reveal/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/reveal/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ScrollWordsProperties } from "@sharadox/web-library/animation/scroll-word/type";
|
|
2
|
-
/** A paragraph that lights up word by word as it scrolls through the viewport. */
|
|
3
|
-
export declare function ScrollWords({ text, className, offset, opacity, span, }: ScrollWordsProperties): import("react").JSX.Element;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/scroll-word/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AAE9F,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAS,EACT,MAAiC,EACjC,OAAmB,EACnB,IAAU,GACX,EAAE,qBAAqB,+BAsBvB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useScroll } from "motion/react";
|
|
4
|
-
import { useRef } from "react";
|
|
5
|
-
import { ScrollWord } from "@sharadox/web-library/animation/scroll-word/word";
|
|
6
|
-
/** A paragraph that lights up word by word as it scrolls through the viewport. */
|
|
7
|
-
export function ScrollWords({ text, className, offset = ["start 80%", "end 40%"], opacity = [0.12, 1], span = 1.5, }) {
|
|
8
|
-
const paragraph = useRef(null);
|
|
9
|
-
const { scrollYProgress } = useScroll({
|
|
10
|
-
target: paragraph,
|
|
11
|
-
offset: offset,
|
|
12
|
-
});
|
|
13
|
-
const words = text.split(" ");
|
|
14
|
-
return (_jsx("p", { ref: paragraph, className: className, children: words.map((word, index) => (_jsx(ScrollWord, { word: word, index: index, count: words.length, progress: scrollYProgress, opacity: opacity, span: span }, index))) }));
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/scroll-word/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAG9E,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAS,EACT,MAAM,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,EACjC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EACnB,IAAI,GAAG,GAAG,GACY;IACtB,MAAM,SAAS,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;QACpC,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,MAA2E;KACpF,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,CACL,YAAG,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,YACpC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,KAAC,UAAU,IAET,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,CAAC,MAAM,EACnB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,IANL,KAAK,CAOV,CACH,CAAC,GACA,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface ScrollWordsProperties {
|
|
2
|
-
text: string;
|
|
3
|
-
className?: string;
|
|
4
|
-
/** When lighting starts and ends, as Motion scroll offsets. Defaults to ["start 80%", "end 40%"]. */
|
|
5
|
-
offset?: readonly [string, string];
|
|
6
|
-
/** Opacity before and after each word lights up. Defaults to [0.12, 1]. */
|
|
7
|
-
opacity?: readonly [number, number];
|
|
8
|
-
/** How many words' worth of scroll each word takes to light up. Defaults to 1.5. */
|
|
9
|
-
span?: number;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/scroll-word/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/scroll-word/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ScrollWordProperties } from "@sharadox/web-library/animation/scroll-word/word/type";
|
|
2
|
-
/** One word that brightens when scroll progress reaches its place in the sentence. */
|
|
3
|
-
export declare function ScrollWord({ word, index, count, progress, opacity, span }: ScrollWordProperties): import("react").JSX.Element;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAElG,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,oBAAoB,+BAI/F"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { motion, useTransform } from "motion/react";
|
|
4
|
-
/** One word that brightens when scroll progress reaches its place in the sentence. */
|
|
5
|
-
export function ScrollWord({ word, index, count, progress, opacity, span }) {
|
|
6
|
-
const start = index / count;
|
|
7
|
-
const value = useTransform(progress, [start, start + span / count], [...opacity]);
|
|
8
|
-
return _jsxs(motion.span, { style: { opacity: value }, children: [word, " "] });
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGpD,sFAAsF;AACtF,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAwB;IAC9F,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAClF,OAAO,MAAC,MAAM,CAAC,IAAI,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,aAAG,IAAI,SAAgB,CAAC;AACvE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { MotionValue } from "motion/react";
|
|
2
|
-
export interface ScrollWordProperties {
|
|
3
|
-
word: string;
|
|
4
|
-
/** Position of the word in the sentence. */
|
|
5
|
-
index: number;
|
|
6
|
-
/** Number of words in the sentence. */
|
|
7
|
-
count: number;
|
|
8
|
-
progress: MotionValue<number>;
|
|
9
|
-
/** Opacity before and after the word lights up. */
|
|
10
|
-
opacity: readonly [number, number];
|
|
11
|
-
/** How many words' worth of scroll each word takes to light up. */
|
|
12
|
-
span: number;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,mDAAmD;IACnD,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SmoothScrollProperties } from "@sharadox/web-library/animation/smooth-scroll/type";
|
|
2
|
-
/** Smooth, inertial page scrolling, including in-page anchor links. Off when the visitor prefers reduced motion. */
|
|
3
|
-
export declare function SmoothScroll({ duration, anchorOffset }: SmoothScrollProperties): null;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAEjG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,EAAE,QAAe,EAAE,YAAkB,EAAE,EAAE,sBAAsB,QA0B3F"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import Lenis from "lenis";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
/** Smooth, inertial page scrolling, including in-page anchor links. Off when the visitor prefers reduced motion. */
|
|
5
|
-
export function SmoothScroll({ duration = 1.15, anchorOffset = -60 }) {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches)
|
|
8
|
-
return;
|
|
9
|
-
const lenis = new Lenis({ duration, smoothWheel: true });
|
|
10
|
-
let frame = 0;
|
|
11
|
-
const animate = (time) => {
|
|
12
|
-
lenis.raf(time);
|
|
13
|
-
frame = requestAnimationFrame(animate);
|
|
14
|
-
};
|
|
15
|
-
frame = requestAnimationFrame(animate);
|
|
16
|
-
const onClick = (event) => {
|
|
17
|
-
const link = event.target.closest('a[href^="#"]');
|
|
18
|
-
const target = link && document.querySelector(link.getAttribute("href"));
|
|
19
|
-
if (target) {
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
lenis.scrollTo(target, { offset: anchorOffset });
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
document.addEventListener("click", onClick);
|
|
25
|
-
return () => {
|
|
26
|
-
cancelAnimationFrame(frame);
|
|
27
|
-
document.removeEventListener("click", onClick);
|
|
28
|
-
lenis.destroy();
|
|
29
|
-
};
|
|
30
|
-
}, [duration, anchorOffset]);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,oHAAoH;AACpH,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,EAA0B;IAC1F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO;YAAE,OAAO;QAC1E,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;YAC/B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChB,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;YACpC,MAAM,IAAI,GAAI,KAAK,CAAC,MAAsB,CAAC,OAAO,CAAoB,cAAc,CAAC,CAAC;YACtF,MAAM,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,aAAa,CAAc,IAAI,CAAC,YAAY,CAAC,MAAM,CAAE,CAAC,CAAC;YACvF,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface SmoothScrollProperties {
|
|
2
|
-
/** Seconds a scroll gesture takes to settle. Defaults to 1.15. */
|
|
3
|
-
duration?: number;
|
|
4
|
-
/** Pixels to stop above an in-page anchor target (for a fixed header). Defaults to -60. */
|
|
5
|
-
anchorOffset?: number;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { BotCheckOptions } from "@sharadox/web-library/form/bot-check/type";
|
|
2
|
-
/** Whether a form submission looks automated: the honeypot is filled, or it was submitted faster than people can. */
|
|
3
|
-
export declare function isLikelyBot(form: FormData, { honeypotField, startedAtField, minimumFillTime, now, }?: BotCheckOptions): boolean;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/form/bot-check/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjF,qHAAqH;AACrH,wBAAgB,WAAW,CACzB,IAAI,EAAE,QAAQ,EACd,EACE,aAAyB,EACzB,cAA6B,EAC7B,eAAsB,EACtB,GAAgB,GACjB,GAAE,eAAoB,GACtB,OAAO,CAGT"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Whether a form submission looks automated: the honeypot is filled, or it was submitted faster than people can. */
|
|
2
|
-
export function isLikelyBot(form, { honeypotField = "website", startedAtField = "started-at", minimumFillTime = 2500, now = Date.now(), } = {}) {
|
|
3
|
-
const started = Number(form.get(startedAtField) ?? 0);
|
|
4
|
-
return Boolean(form.get(honeypotField)) || Boolean(started && now - started < minimumFillTime);
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/bot-check/index.ts"],"names":[],"mappings":"AAEA,qHAAqH;AACrH,MAAM,UAAU,WAAW,CACzB,IAAc,EACd,EACE,aAAa,GAAG,SAAS,EACzB,cAAc,GAAG,YAAY,EAC7B,eAAe,GAAG,IAAI,EACtB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,MACG,EAAE;IAEvB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,IAAI,GAAG,GAAG,OAAO,GAAG,eAAe,CAAC,CAAC;AACjG,CAAC"}
|