@sharadox/web-library 0.0.0-stage → 0.2.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.
- package/LICENCA.md +76 -0
- package/LICENSE.md +76 -0
- package/NOTICE.md +3 -0
- package/README.md +37 -2
- package/distribution/animation/count-up/index.d.ts +6 -0
- package/distribution/animation/count-up/index.d.ts.map +1 -0
- package/distribution/animation/count-up/index.js +29 -0
- package/distribution/animation/count-up/index.js.map +1 -0
- package/distribution/animation/in-view/index.d.ts +3 -0
- package/distribution/animation/in-view/index.d.ts.map +1 -0
- package/distribution/animation/in-view/index.js +15 -0
- package/distribution/animation/in-view/index.js.map +1 -0
- package/distribution/animation/reveal/index.d.ts +4 -0
- package/distribution/animation/reveal/index.d.ts.map +1 -0
- package/distribution/animation/reveal/index.js +9 -0
- package/distribution/animation/reveal/index.js.map +1 -0
- package/distribution/animation/reveal/type.d.ts +14 -0
- package/distribution/animation/reveal/type.d.ts.map +1 -0
- package/distribution/animation/reveal/type.js +2 -0
- package/distribution/animation/reveal/type.js.map +1 -0
- package/distribution/animation/scroll-word/index.d.ts +4 -0
- package/distribution/animation/scroll-word/index.d.ts.map +1 -0
- package/distribution/animation/scroll-word/index.js +16 -0
- package/distribution/animation/scroll-word/index.js.map +1 -0
- package/distribution/animation/scroll-word/type.d.ts +11 -0
- package/distribution/animation/scroll-word/type.d.ts.map +1 -0
- package/distribution/animation/scroll-word/type.js +2 -0
- package/distribution/animation/scroll-word/type.js.map +1 -0
- package/distribution/animation/scroll-word/word/index.d.ts +4 -0
- package/distribution/animation/scroll-word/word/index.d.ts.map +1 -0
- package/distribution/animation/scroll-word/word/index.js +10 -0
- package/distribution/animation/scroll-word/word/index.js.map +1 -0
- package/distribution/animation/scroll-word/word/type.d.ts +14 -0
- package/distribution/animation/scroll-word/word/type.d.ts.map +1 -0
- package/distribution/animation/scroll-word/word/type.js +2 -0
- package/distribution/animation/scroll-word/word/type.js.map +1 -0
- package/distribution/animation/smooth-scroll/index.d.ts +4 -0
- package/distribution/animation/smooth-scroll/index.d.ts.map +1 -0
- package/distribution/animation/smooth-scroll/index.js +33 -0
- package/distribution/animation/smooth-scroll/index.js.map +1 -0
- package/distribution/animation/smooth-scroll/type.d.ts +7 -0
- package/distribution/animation/smooth-scroll/type.d.ts.map +1 -0
- package/distribution/animation/smooth-scroll/type.js +2 -0
- package/distribution/animation/smooth-scroll/type.js.map +1 -0
- package/distribution/class-name/index.d.ts +3 -0
- package/distribution/class-name/index.d.ts.map +1 -0
- package/distribution/class-name/index.js +5 -0
- package/distribution/class-name/index.js.map +1 -0
- package/distribution/form/bot-check/index.d.ts +4 -0
- package/distribution/form/bot-check/index.d.ts.map +1 -0
- package/distribution/form/bot-check/index.js +6 -0
- package/distribution/form/bot-check/index.js.map +1 -0
- package/distribution/form/bot-check/type.d.ts +11 -0
- package/distribution/form/bot-check/type.d.ts.map +1 -0
- package/distribution/form/bot-check/type.js +2 -0
- package/distribution/form/bot-check/type.js.map +1 -0
- package/distribution/form/field/index.d.ts +3 -0
- package/distribution/form/field/index.d.ts.map +1 -0
- package/distribution/form/field/index.js +7 -0
- package/distribution/form/field/index.js.map +1 -0
- package/distribution/form/rate-limit/index.d.ts +4 -0
- package/distribution/form/rate-limit/index.d.ts.map +1 -0
- package/distribution/form/rate-limit/index.js +14 -0
- package/distribution/form/rate-limit/index.js.map +1 -0
- package/distribution/form/rate-limit/type.d.ts +9 -0
- package/distribution/form/rate-limit/type.d.ts.map +1 -0
- package/distribution/form/rate-limit/type.js +2 -0
- package/distribution/form/rate-limit/type.js.map +1 -0
- package/distribution/html/escape/index.d.ts +3 -0
- package/distribution/html/escape/index.d.ts.map +1 -0
- package/distribution/html/escape/index.js +6 -0
- package/distribution/html/escape/index.js.map +1 -0
- package/distribution/internationalization/locale/index.d.ts +7 -0
- package/distribution/internationalization/locale/index.d.ts.map +1 -0
- package/distribution/internationalization/locale/index.js +17 -0
- package/distribution/internationalization/locale/index.js.map +1 -0
- package/distribution/internationalization/locale/type.d.ts +3 -0
- package/distribution/internationalization/locale/type.d.ts.map +1 -0
- package/distribution/internationalization/locale/type.js +2 -0
- package/distribution/internationalization/locale/type.js.map +1 -0
- package/distribution/internationalization/locale-preference/index.d.ts +5 -0
- package/distribution/internationalization/locale-preference/index.d.ts.map +1 -0
- package/distribution/internationalization/locale-preference/index.js +9 -0
- package/distribution/internationalization/locale-preference/index.js.map +1 -0
- package/distribution/internationalization/locale-redirect/index.d.ts +8 -0
- package/distribution/internationalization/locale-redirect/index.d.ts.map +1 -0
- package/distribution/internationalization/locale-redirect/index.js +24 -0
- package/distribution/internationalization/locale-redirect/index.js.map +1 -0
- package/distribution/internationalization/locale-redirect/type.d.ts +12 -0
- package/distribution/internationalization/locale-redirect/type.d.ts.map +1 -0
- package/distribution/internationalization/locale-redirect/type.js +2 -0
- package/distribution/internationalization/locale-redirect/type.js.map +1 -0
- package/distribution/internationalization/translate/index.d.ts +4 -0
- package/distribution/internationalization/translate/index.d.ts.map +1 -0
- package/distribution/internationalization/translate/index.js +5 -0
- package/distribution/internationalization/translate/index.js.map +1 -0
- package/distribution/math/clamp/index.d.ts +3 -0
- package/distribution/math/clamp/index.d.ts.map +1 -0
- package/distribution/math/clamp/index.js +5 -0
- package/distribution/math/clamp/index.js.map +1 -0
- package/distribution/math/pseudo-random/index.d.ts +3 -0
- package/distribution/math/pseudo-random/index.d.ts.map +1 -0
- package/distribution/math/pseudo-random/index.js +6 -0
- package/distribution/math/pseudo-random/index.js.map +1 -0
- package/distribution/math/radians/index.d.ts +3 -0
- package/distribution/math/radians/index.d.ts.map +1 -0
- package/distribution/math/radians/index.js +5 -0
- package/distribution/math/radians/index.js.map +1 -0
- package/distribution/pointer/spotlight/index.d.ts +3 -0
- package/distribution/pointer/spotlight/index.d.ts.map +1 -0
- package/distribution/pointer/spotlight/index.js +20 -0
- package/distribution/pointer/spotlight/index.js.map +1 -0
- package/distribution/pointer/tilt/index.d.ts +7 -0
- package/distribution/pointer/tilt/index.d.ts.map +1 -0
- package/distribution/pointer/tilt/index.js +34 -0
- package/distribution/pointer/tilt/index.js.map +1 -0
- package/distribution/search-engine/robots/index.d.ts +4 -0
- package/distribution/search-engine/robots/index.d.ts.map +1 -0
- package/distribution/search-engine/robots/index.js +7 -0
- package/distribution/search-engine/robots/index.js.map +1 -0
- package/distribution/search-engine/robots/type.d.ts +17 -0
- package/distribution/search-engine/robots/type.d.ts.map +1 -0
- package/distribution/search-engine/robots/type.js +2 -0
- package/distribution/search-engine/robots/type.js.map +1 -0
- package/distribution/search-engine/sitemap/index.d.ts +4 -0
- package/distribution/search-engine/sitemap/index.d.ts.map +1 -0
- package/distribution/search-engine/sitemap/index.js +12 -0
- package/distribution/search-engine/sitemap/index.js.map +1 -0
- package/distribution/search-engine/sitemap/type.d.ts +22 -0
- package/distribution/search-engine/sitemap/type.d.ts.map +1 -0
- package/distribution/search-engine/sitemap/type.js +2 -0
- package/distribution/search-engine/sitemap/type.js.map +1 -0
- package/distribution/search-engine/structured-data/index.d.ts +4 -0
- package/distribution/search-engine/structured-data/index.d.ts.map +1 -0
- package/distribution/search-engine/structured-data/index.js +6 -0
- package/distribution/search-engine/structured-data/index.js.map +1 -0
- package/distribution/search-engine/structured-data/type.d.ts +5 -0
- package/distribution/search-engine/structured-data/type.d.ts.map +1 -0
- package/distribution/search-engine/structured-data/type.js +2 -0
- package/distribution/search-engine/structured-data/type.js.map +1 -0
- package/distribution/style/apply/index.d.ts +11 -0
- package/distribution/style/apply/index.d.ts.map +1 -0
- package/distribution/style/apply/index.js +46 -0
- package/distribution/style/apply/index.js.map +1 -0
- package/distribution/style/apply/type.d.ts +10 -0
- package/distribution/style/apply/type.d.ts.map +1 -0
- package/distribution/style/apply/type.js +2 -0
- package/distribution/style/apply/type.js.map +1 -0
- package/distribution/style/definition/index.d.ts +12 -0
- package/distribution/style/definition/index.d.ts.map +1 -0
- package/distribution/style/definition/index.js +21 -0
- package/distribution/style/definition/index.js.map +1 -0
- package/distribution/style/definition/type.d.ts +24 -0
- package/distribution/style/definition/type.d.ts.map +1 -0
- package/distribution/style/definition/type.js +2 -0
- package/distribution/style/definition/type.js.map +1 -0
- package/distribution/style/style-script/index.d.ts +10 -0
- package/distribution/style/style-script/index.d.ts.map +1 -0
- package/distribution/style/style-script/index.js +16 -0
- package/distribution/style/style-script/index.js.map +1 -0
- package/distribution/style/style-script/type.d.ts +5 -0
- package/distribution/style/style-script/type.d.ts.map +1 -0
- package/distribution/style/style-script/type.js +2 -0
- package/distribution/style/style-script/type.js.map +1 -0
- package/distribution/style/style-sheet/index.d.ts +7 -0
- package/distribution/style/style-sheet/index.d.ts.map +1 -0
- package/distribution/style/style-sheet/index.js +19 -0
- package/distribution/style/style-sheet/index.js.map +1 -0
- package/distribution/style/use-style/index.d.ts +5 -0
- package/distribution/style/use-style/index.d.ts.map +1 -0
- package/distribution/style/use-style/index.js +34 -0
- package/distribution/style/use-style/index.js.map +1 -0
- package/distribution/style/use-style/type.d.ts +9 -0
- package/distribution/style/use-style/type.d.ts.map +1 -0
- package/distribution/style/use-style/type.js +2 -0
- package/distribution/style/use-style/type.js.map +1 -0
- package/distribution/test/visual-snapshot/index.d.ts +8 -0
- package/distribution/test/visual-snapshot/index.d.ts.map +1 -0
- package/distribution/test/visual-snapshot/index.js +20 -0
- package/distribution/test/visual-snapshot/index.js.map +1 -0
- package/distribution/test/visual-snapshot/type.d.ts +7 -0
- package/distribution/test/visual-snapshot/type.d.ts.map +1 -0
- package/distribution/test/visual-snapshot/type.js +2 -0
- package/distribution/test/visual-snapshot/type.js.map +1 -0
- package/distribution/time/format-time/index.d.ts +3 -0
- package/distribution/time/format-time/index.d.ts.map +1 -0
- package/distribution/time/format-time/index.js +5 -0
- package/distribution/time/format-time/index.js.map +1 -0
- package/distribution/time/open-state/index.d.ts +4 -0
- package/distribution/time/open-state/index.d.ts.map +1 -0
- package/distribution/time/open-state/index.js +11 -0
- package/distribution/time/open-state/index.js.map +1 -0
- package/distribution/time/open-state/type.d.ts +5 -0
- package/distribution/time/open-state/type.d.ts.map +1 -0
- package/distribution/time/open-state/type.js +2 -0
- package/distribution/time/open-state/type.js.map +1 -0
- package/distribution/time/sun-time/index.d.ts +4 -0
- package/distribution/time/sun-time/index.d.ts.map +1 -0
- package/distribution/time/sun-time/index.js +27 -0
- package/distribution/time/sun-time/index.js.map +1 -0
- package/distribution/time/sun-time/type.d.ts +6 -0
- package/distribution/time/sun-time/type.d.ts.map +1 -0
- package/distribution/time/sun-time/type.js +2 -0
- package/distribution/time/sun-time/type.js.map +1 -0
- package/distribution/time/sun-today/index.d.ts +4 -0
- package/distribution/time/sun-today/index.d.ts.map +1 -0
- package/distribution/time/sun-today/index.js +25 -0
- package/distribution/time/sun-today/index.js.map +1 -0
- package/distribution/time/sun-today/type.d.ts +9 -0
- package/distribution/time/sun-today/type.d.ts.map +1 -0
- package/distribution/time/sun-today/type.js +2 -0
- package/distribution/time/sun-today/type.js.map +1 -0
- package/distribution/time/zone-minute/index.d.ts +3 -0
- package/distribution/time/zone-minute/index.d.ts.map +1 -0
- package/distribution/time/zone-minute/index.js +13 -0
- package/distribution/time/zone-minute/index.js.map +1 -0
- package/package.json +99 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A text field from submitted form data, trimmed and cut to `maximumLength` characters ("" when missing). */
|
|
2
|
+
export function readField(form, name, maximumLength) {
|
|
3
|
+
return String(form.get(name) ?? "")
|
|
4
|
+
.trim()
|
|
5
|
+
.slice(0, maximumLength);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/field/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,IAAY,EAAE,aAAqB;IAC3E,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAChC,IAAI,EAAE;SACN,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RateLimiter, RateLimitOptions } from "@sharadox/web-library/form/rate-limit/type";
|
|
2
|
+
/** In-memory sliding-window rate limiter. Best effort: each server instance keeps its own memory. */
|
|
3
|
+
export declare function createRateLimiter({ window, maximum }: RateLimitOptions): RateLimiter;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/form/rate-limit/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAEhG,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,gBAAgB,GAAG,WAAW,CAWpF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** In-memory sliding-window rate limiter. Best effort: each server instance keeps its own memory. */
|
|
2
|
+
export function createRateLimiter({ window, maximum }) {
|
|
3
|
+
const hits = new Map();
|
|
4
|
+
return (key, now = Date.now()) => {
|
|
5
|
+
const recent = (hits.get(key) ?? []).filter((time) => now - time < window);
|
|
6
|
+
if (recent.length >= maximum) {
|
|
7
|
+
hits.set(key, recent);
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
hits.set(key, [...recent, now]);
|
|
11
|
+
return true;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/rate-limit/index.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,UAAU,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAoB;IACrE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;QAC3E,IAAI,MAAM,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACtB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RateLimitOptions {
|
|
2
|
+
/** Window length in milliseconds. */
|
|
3
|
+
window: number;
|
|
4
|
+
/** Allowed hits per key inside the window. */
|
|
5
|
+
maximum: number;
|
|
6
|
+
}
|
|
7
|
+
/** Records a hit for a key; returns false when the key is over its limit. */
|
|
8
|
+
export type RateLimiter = (key: string, now?: number) => boolean;
|
|
9
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/form/rate-limit/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/form/rate-limit/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const ENTITIES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
2
|
+
/** Escapes text for safe use inside html (for example in email bodies). */
|
|
3
|
+
export function escapeHtml(text) {
|
|
4
|
+
return text.replace(/[&<>"']/g, (character) => ENTITIES[character] ?? character);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAEjH,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Narrows an untrusted value (a route segment, a form field) to one of the published locales. */
|
|
2
|
+
export declare function isLocale<Locale extends string>(value: string, locales: readonly Locale[]): value is Locale;
|
|
3
|
+
/** The BCP 47 tag for `<html lang>`: European Portuguese is `pt-PT`; other languages keep their code. */
|
|
4
|
+
export declare function languageTag(locale: string): string;
|
|
5
|
+
/** The Open Graph locale (`og:locale`), for example `pt_PT` or `en_GB`. */
|
|
6
|
+
export declare function openGraphLocale(locale: string): string;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale/index.ts"],"names":[],"mappings":"AAKA,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,IAAI,MAAM,CAE1G;AAED,yGAAyG;AACzG,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Language tags for `<html lang>` and structured data's `inLanguage`, where the region matters. */
|
|
2
|
+
const LANGUAGE_TAG = { pt: "pt-PT", en: "en" };
|
|
3
|
+
/** Open Graph locales (`og:locale`). */
|
|
4
|
+
const OPEN_GRAPH_LOCALE = { pt: "pt_PT", en: "en_GB", es: "es_ES", fr: "fr_FR", de: "de_DE" };
|
|
5
|
+
/** Narrows an untrusted value (a route segment, a form field) to one of the published locales. */
|
|
6
|
+
export function isLocale(value, locales) {
|
|
7
|
+
return locales.includes(value);
|
|
8
|
+
}
|
|
9
|
+
/** The BCP 47 tag for `<html lang>`: European Portuguese is `pt-PT`; other languages keep their code. */
|
|
10
|
+
export function languageTag(locale) {
|
|
11
|
+
return LANGUAGE_TAG[locale] ?? locale;
|
|
12
|
+
}
|
|
13
|
+
/** The Open Graph locale (`og:locale`), for example `pt_PT` or `en_GB`. */
|
|
14
|
+
export function openGraphLocale(locale) {
|
|
15
|
+
return OPEN_GRAPH_LOCALE[locale] ?? locale;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/locale/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,YAAY,GAA2B,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACvE,wCAAwC;AACxC,MAAM,iBAAiB,GAA2B,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AAEtH,kGAAkG;AAClG,MAAM,UAAU,QAAQ,CAAwB,KAAa,EAAE,OAA0B;IACvF,OAAQ,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;AACxC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale/type.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/internationalization/locale/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Cookie that remembers the language a visitor picked by hand; `localeRedirects` sends `/` to it. */
|
|
2
|
+
export declare const LOCALE_COOKIE = "locale";
|
|
3
|
+
/** Remembers a manual language choice for a year. Call it when the visitor switches language. */
|
|
4
|
+
export declare function rememberLocale(locale: string, cookie?: string): void;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale-preference/index.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,eAAO,MAAM,aAAa,WAAW,CAAC;AAGtC,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAsB,GAAG,IAAI,CAGnF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Cookie that remembers the language a visitor picked by hand; `localeRedirects` sends `/` to it. */
|
|
2
|
+
export const LOCALE_COOKIE = "locale";
|
|
3
|
+
const ONE_YEAR = 60 * 60 * 24 * 365;
|
|
4
|
+
/** Remembers a manual language choice for a year. Call it when the visitor switches language. */
|
|
5
|
+
export function rememberLocale(locale, cookie = LOCALE_COOKIE) {
|
|
6
|
+
const secure = location.protocol === "https:" ? "; secure" : "";
|
|
7
|
+
document.cookie = `${cookie}=${encodeURIComponent(locale)}; path=/; max-age=${ONE_YEAR}; samesite=lax${secure}`;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/locale-preference/index.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AACtC,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAEpC,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,SAAiB,aAAa;IAC3E,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,QAAQ,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,qBAAqB,QAAQ,iBAAiB,MAAM,EAAE,CAAC;AAClH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LocaleRedirect } from "@sharadox/web-library/internationalization/locale-redirect/type";
|
|
2
|
+
/**
|
|
3
|
+
* Redirects for next.config `redirects()`. `/` goes to, in order: the language the visitor picked before (the
|
|
4
|
+
* `locale` cookie set by `rememberLocale`), the language their browser asks for first (Accept-Language) when it is
|
|
5
|
+
* published, and otherwise `/<defaultLocale>`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function localeRedirects(locales: readonly string[], defaultLocale: string, cookie?: string): LocaleRedirect[];
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iEAAiE,CAAC;AAEtG;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAAsB,GAC7B,cAAc,EAAE,CAgBlB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LOCALE_COOKIE } from "@sharadox/web-library/internationalization/locale-preference";
|
|
2
|
+
/**
|
|
3
|
+
* Redirects for next.config `redirects()`. `/` goes to, in order: the language the visitor picked before (the
|
|
4
|
+
* `locale` cookie set by `rememberLocale`), the language their browser asks for first (Accept-Language) when it is
|
|
5
|
+
* published, and otherwise `/<defaultLocale>`.
|
|
6
|
+
*/
|
|
7
|
+
export function localeRedirects(locales, defaultLocale, cookie = LOCALE_COOKIE) {
|
|
8
|
+
const remembered = locales.map((locale) => ({
|
|
9
|
+
source: "/",
|
|
10
|
+
has: [{ type: "cookie", key: cookie, value: locale }],
|
|
11
|
+
destination: `/${locale}`,
|
|
12
|
+
permanent: false,
|
|
13
|
+
}));
|
|
14
|
+
const preferred = locales
|
|
15
|
+
.filter((locale) => locale !== defaultLocale)
|
|
16
|
+
.map((locale) => ({
|
|
17
|
+
source: "/",
|
|
18
|
+
has: [{ type: "header", key: "accept-language", value: `${locale}.*` }],
|
|
19
|
+
destination: `/${locale}`,
|
|
20
|
+
permanent: false,
|
|
21
|
+
}));
|
|
22
|
+
return [...remembered, ...preferred, { source: "/", destination: `/${defaultLocale}`, permanent: false }];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAG7F;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA0B,EAC1B,aAAqB,EACrB,SAAiB,aAAa;IAE9B,MAAM,UAAU,GAAqB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5D,MAAM,EAAE,GAAG;QACX,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACrD,WAAW,EAAE,IAAI,MAAM,EAAE;QACzB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,CAAC;IACJ,MAAM,SAAS,GAAqB,OAAO;SACxC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC;SAC5C,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChB,MAAM,EAAE,GAAG;QACX,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACvE,WAAW,EAAE,IAAI,MAAM,EAAE;QACzB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,CAAC;IACN,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,aAAa,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** One Next.js redirect, as returned from `redirects()` in next.config. */
|
|
2
|
+
export interface LocaleRedirect {
|
|
3
|
+
source: string;
|
|
4
|
+
destination: string;
|
|
5
|
+
permanent: false;
|
|
6
|
+
has?: {
|
|
7
|
+
type: "header" | "cookie";
|
|
8
|
+
key: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/type.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;IACjB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Translated } from "@sharadox/web-library/internationalization/locale/type";
|
|
2
|
+
/** Picks the copy for a locale. */
|
|
3
|
+
export declare function translate<Locale extends string>(value: Translated<Locale>, locale: NoInfer<Locale>): string;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/translate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;AAEzF,mCAAmC;AACnC,wBAAgB,SAAS,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAE3G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/translate/index.ts"],"names":[],"mappings":"AAEA,mCAAmC;AACnC,MAAM,UAAU,SAAS,CAAwB,KAAyB,EAAE,MAAuB;IACjG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** A deterministic number in [0, 1) for a seed: the same seed always gives the same value (stable renders). */
|
|
2
|
+
export function pseudoRandom(seed) {
|
|
3
|
+
const value = Math.sin(seed * 12.9898) * 43758.5453;
|
|
4
|
+
return value - Math.floor(value);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,UAAU,CAAC;IACpD,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/pointer/spotlight/index.ts"],"names":[],"mappings":"AAGA,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,MAAM,SAAS,WAAW,8CActD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
/** Tracks the pointer inside an element as `--pointer-x`/`--pointer-y`, for lights that follow the cursor. */
|
|
4
|
+
export function useSpotlight() {
|
|
5
|
+
const reference = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const element = reference.current;
|
|
8
|
+
if (!element)
|
|
9
|
+
return;
|
|
10
|
+
const move = (event) => {
|
|
11
|
+
const bounds = element.getBoundingClientRect();
|
|
12
|
+
element.style.setProperty("--pointer-x", `${event.clientX - bounds.left}px`);
|
|
13
|
+
element.style.setProperty("--pointer-y", `${event.clientY - bounds.top}px`);
|
|
14
|
+
};
|
|
15
|
+
element.addEventListener("pointermove", move);
|
|
16
|
+
return () => element.removeEventListener("pointermove", move);
|
|
17
|
+
}, []);
|
|
18
|
+
return reference;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/pointer/spotlight/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,8GAA8G;AAC9G,MAAM,UAAU,YAAY;IAC1B,MAAM,SAAS,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,MAAM,IAAI,GAAG,CAAC,KAAmB,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;YAC7E,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9E,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tilts an element towards the pointer: sets `--tilt-x` and `--tilt-y` (degrees, up to `maximum`) while the pointer
|
|
3
|
+
* is over it and eases back to 0 when it leaves. Use them in CSS, for example
|
|
4
|
+
* `transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y))`. Off on touch screens.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTilt<Target extends HTMLElement>(maximum?: number): import("react").RefObject<Target | null>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/pointer/tilt/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,MAAM,SAAS,WAAW,EAAE,OAAO,SAAI,4CAwB9D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Tilts an element towards the pointer: sets `--tilt-x` and `--tilt-y` (degrees, up to `maximum`) while the pointer
|
|
5
|
+
* is over it and eases back to 0 when it leaves. Use them in CSS, for example
|
|
6
|
+
* `transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y))`. Off on touch screens.
|
|
7
|
+
*/
|
|
8
|
+
export function useTilt(maximum = 8) {
|
|
9
|
+
const reference = useRef(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const element = reference.current;
|
|
12
|
+
if (!element || !window.matchMedia("(pointer: fine)").matches)
|
|
13
|
+
return;
|
|
14
|
+
const move = (event) => {
|
|
15
|
+
const bounds = element.getBoundingClientRect();
|
|
16
|
+
const x = (event.clientX - bounds.left) / bounds.width - 0.5;
|
|
17
|
+
const y = (event.clientY - bounds.top) / bounds.height - 0.5;
|
|
18
|
+
element.style.setProperty("--tilt-x", `${(-y * maximum * 2).toFixed(2)}deg`);
|
|
19
|
+
element.style.setProperty("--tilt-y", `${(x * maximum * 2).toFixed(2)}deg`);
|
|
20
|
+
};
|
|
21
|
+
const leave = () => {
|
|
22
|
+
element.style.setProperty("--tilt-x", "0deg");
|
|
23
|
+
element.style.setProperty("--tilt-y", "0deg");
|
|
24
|
+
};
|
|
25
|
+
element.addEventListener("pointermove", move);
|
|
26
|
+
element.addEventListener("pointerleave", leave);
|
|
27
|
+
return () => {
|
|
28
|
+
element.removeEventListener("pointermove", move);
|
|
29
|
+
element.removeEventListener("pointerleave", leave);
|
|
30
|
+
};
|
|
31
|
+
}, [maximum]);
|
|
32
|
+
return reference;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/pointer/tilt/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAA6B,OAAO,GAAG,CAAC;IAC7D,MAAM,SAAS,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO;YAAE,OAAO;QACtE,MAAM,IAAI,GAAG,CAAC,KAAmB,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC;YAC7D,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;YAC7D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC7E,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9E,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YAC9C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RobotsOptions, RobotsRules } from "@sharadox/web-library/search-engine/robots/type";
|
|
2
|
+
/** robots.txt rules: everything allowed with the sitemap and host, or everything disallowed while not indexable. */
|
|
3
|
+
export declare function robots({ url, indexable }: RobotsOptions): RobotsRules;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/robots/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAElG,oHAAoH;AACpH,wBAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAa,GAAG,WAAW,CAIrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** robots.txt rules: everything allowed with the sitemap and host, or everything disallowed while not indexable. */
|
|
2
|
+
export function robots({ url, indexable }) {
|
|
3
|
+
return indexable
|
|
4
|
+
? { rules: { userAgent: "*", allow: "/" }, sitemap: `${url}/sitemap.xml`, host: url }
|
|
5
|
+
: { rules: { userAgent: "*", disallow: "/" } };
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/robots/index.ts"],"names":[],"mappings":"AAEA,oHAAoH;AACpH,MAAM,UAAU,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAiB;IACtD,OAAO,SAAS;QACd,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,GAAG,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;QACrF,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RobotsOptions {
|
|
2
|
+
/** The site's public url without a trailing slash. */
|
|
3
|
+
url: string;
|
|
4
|
+
/** False keeps the whole site out of search engines (previews before a client launches). */
|
|
5
|
+
indexable: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** The rules Next.js's `robots()` returns. */
|
|
8
|
+
export interface RobotsRules {
|
|
9
|
+
rules: {
|
|
10
|
+
userAgent: string;
|
|
11
|
+
allow?: string;
|
|
12
|
+
disallow?: string;
|
|
13
|
+
};
|
|
14
|
+
sitemap?: string;
|
|
15
|
+
host?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/robots/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,4FAA4F;IAC5F,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/robots/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LocalizedSitemapOptions, SitemapEntry } from "@sharadox/web-library/search-engine/sitemap/type";
|
|
2
|
+
/** A sitemap with one entry per locale (`/<locale>`), each listing every language version as an alternate. */
|
|
3
|
+
export declare function localizedSitemap({ url, locales, primaryLocale, otherPriority, changeFrequency, lastModified, }: LocalizedSitemapOptions): SitemapEntry[];
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAE9G,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,aAA0B,EAC1B,aAAiB,EACjB,eAA2B,EAC3B,YAAyB,GAC1B,EAAE,uBAAuB,GAAG,YAAY,EAAE,CAS1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A sitemap with one entry per locale (`/<locale>`), each listing every language version as an alternate. */
|
|
2
|
+
export function localizedSitemap({ url, locales, primaryLocale = locales[0], otherPriority = 1, changeFrequency = "monthly", lastModified = new Date(), }) {
|
|
3
|
+
const languages = Object.fromEntries(locales.map((locale) => [locale, `${url}/${locale}`]));
|
|
4
|
+
return locales.map((locale) => ({
|
|
5
|
+
url: `${url}/${locale}`,
|
|
6
|
+
lastModified,
|
|
7
|
+
changeFrequency,
|
|
8
|
+
priority: locale === primaryLocale ? 1 : otherPriority,
|
|
9
|
+
alternates: { languages },
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/sitemap/index.ts"],"names":[],"mappings":"AAEA,8GAA8G;AAC9G,MAAM,UAAU,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,EAC1B,aAAa,GAAG,CAAC,EACjB,eAAe,GAAG,SAAS,EAC3B,YAAY,GAAG,IAAI,IAAI,EAAE,GACD;IACxB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,GAAG,GAAG,IAAI,MAAM,EAAE;QACvB,YAAY;QACZ,eAAe;QACf,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;QACtD,UAAU,EAAE,EAAE,SAAS,EAAE;KAC1B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface LocalizedSitemapOptions {
|
|
2
|
+
/** The site's public url without a trailing slash, for example "https://sharadox.com". */
|
|
3
|
+
url: string;
|
|
4
|
+
locales: readonly string[];
|
|
5
|
+
/** Gets priority 1; the other locales get `otherPriority`. Defaults to the first locale. */
|
|
6
|
+
primaryLocale?: string;
|
|
7
|
+
otherPriority?: number;
|
|
8
|
+
changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
9
|
+
/** Defaults to now. */
|
|
10
|
+
lastModified?: Date;
|
|
11
|
+
}
|
|
12
|
+
/** One sitemap entry, in the shape Next.js's `sitemap()` returns. */
|
|
13
|
+
export interface SitemapEntry {
|
|
14
|
+
url: string;
|
|
15
|
+
lastModified: Date;
|
|
16
|
+
changeFrequency: NonNullable<LocalizedSitemapOptions["changeFrequency"]>;
|
|
17
|
+
priority: number;
|
|
18
|
+
alternates: {
|
|
19
|
+
languages: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/sitemap/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,0FAA0F;IAC1F,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5F,uBAAuB;IACvB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,IAAI,CAAC;IACnB,eAAe,EAAE,WAAW,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/sitemap/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StructuredDataProperties } from "@sharadox/web-library/search-engine/structured-data/type";
|
|
2
|
+
/** Renders JSON-LD for search engines. `<` is escaped so the data can never close the script tag early. */
|
|
3
|
+
export declare function StructuredData({ data }: StructuredDataProperties): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/structured-data/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AAEzG,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,+BAOhE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Renders JSON-LD for search engines. `<` is escaped so the data can never close the script tag early. */
|
|
3
|
+
export function StructuredData({ data }) {
|
|
4
|
+
return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(data).replace(/</g, "\\u003c") } }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/structured-data/index.tsx"],"names":[],"mappings":";AAEA,2GAA2G;AAC3G,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAA4B;IAC/D,OAAO,CACL,iBACE,IAAI,EAAC,qBAAqB,EAC1B,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAClF,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/structured-data/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,iHAAiH;IACjH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/structured-data/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StyleConfiguration } from "@sharadox/web-library/style/definition/type";
|
|
2
|
+
import type { StyleApplyData } from "@sharadox/web-library/style/apply/type";
|
|
3
|
+
/** The configuration reduced to what `applyStyle` needs. */
|
|
4
|
+
export declare function styleApplyData(configuration: StyleConfiguration): StyleApplyData;
|
|
5
|
+
/**
|
|
6
|
+
* Writes the style to `<html>`: `data-style` (the style in use), `data-style-choice` and `color-scheme`.
|
|
7
|
+
* Without a `choice` it reads the remembered one (or "system"). It is self-contained on purpose: the inline
|
|
8
|
+
* script in `<head>` embeds its source, so the page never shows the wrong style before React loads.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyStyle(data: StyleApplyData, choice?: string): void;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/style/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,aAAa,EAAE,kBAAkB,GAAG,cAAc,CAOhF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAyBtE"}
|