@sharadox/web-library 0.4.0 → 0.5.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/README.md +40 -28
- 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 +18 -46
- 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
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface StyleState {
|
|
2
|
-
/** What the visitor picked: "system" or a style name. */
|
|
3
|
-
choice: string;
|
|
4
|
-
/** The style in use right now. Before hydration (and on the server) it is the fallback default. */
|
|
5
|
-
style: string;
|
|
6
|
-
/** Picks a style (or "system"), remembers it and applies it at once. */
|
|
7
|
-
choose: (choice: string) => void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/style/use-style/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/style/use-style/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Page } from "@playwright/test";
|
|
2
|
-
import type { VisualSnapshotOptions } from "@sharadox/web-library/test/visual-snapshot/type";
|
|
3
|
-
/**
|
|
4
|
-
* Prepares a page for a deterministic full-page screenshot: freezes the clock, opens the url, waits for fonts,
|
|
5
|
-
* scrolls through so every reveal-on-scroll fires, then returns to the top and lets animations finish.
|
|
6
|
-
*/
|
|
7
|
-
export declare function prepareVisualSnapshot(page: Page, url: string, { time, step }?: VisualSnapshotOptions): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/test/visual-snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAE7F;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,EAAE,IAAuC,EAAE,IAAU,EAAE,GAAE,qBAA0B,GAClF,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prepares a page for a deterministic full-page screenshot: freezes the clock, opens the url, waits for fonts,
|
|
3
|
-
* scrolls through so every reveal-on-scroll fires, then returns to the top and lets animations finish.
|
|
4
|
-
*/
|
|
5
|
-
export async function prepareVisualSnapshot(page, url, { time = new Date("2026-11-08T12:00:00Z"), step = 400 } = {}) {
|
|
6
|
-
await page.clock.install({ time });
|
|
7
|
-
await page.clock.pauseAt(new Date(time.getTime() + 1000));
|
|
8
|
-
await page.goto(url);
|
|
9
|
-
await page.evaluate(() => document.fonts.ready);
|
|
10
|
-
const height = await page.evaluate(() => document.documentElement.scrollHeight);
|
|
11
|
-
for (let y = 0; y <= height; y += step) {
|
|
12
|
-
await page.evaluate((top) => window.scrollTo(0, top), y);
|
|
13
|
-
await page.waitForTimeout(60);
|
|
14
|
-
await page.clock.runFor(400);
|
|
15
|
-
}
|
|
16
|
-
await page.evaluate(() => window.scrollTo(0, 0));
|
|
17
|
-
await page.waitForTimeout(60);
|
|
18
|
-
await page.clock.runFor(4000);
|
|
19
|
-
}
|
|
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AE,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface VisualSnapshotOptions {
|
|
2
|
-
/** The moment the page believes it is; animations and timers only move when the test advances the clock. */
|
|
3
|
-
time?: Date;
|
|
4
|
-
/** Pixels per scroll step while settling. Defaults to 400. */
|
|
5
|
-
step?: number;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/test/visual-snapshot/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,4GAA4G;IAC5G,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/test/visual-snapshot/type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/format-time/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI/D"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** "HH:MM" on a 24-hour clock in a time zone, for example "17:28". */
|
|
2
|
-
export function formatTime(date, timeZone) {
|
|
3
|
-
return new Intl.DateTimeFormat("en-GB", { timeZone, hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).format(date);
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/format-time/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,QAAgB;IACrD,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAChH,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { OpenState, TimeOfDay } from "@sharadox/web-library/time/open-state/type";
|
|
2
|
-
/** Whether a place with daily hours `from`–`to` is open at `now`, in the place's time zone. */
|
|
3
|
-
export declare function openState(now: Date, from: TimeOfDay, to: TimeOfDay, timeZone: string): OpenState;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/open-state/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAGvF,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAKhG"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { minutesInZone } from "@sharadox/web-library/time/zone-minute";
|
|
2
|
-
/** Whether a place with daily hours `from`–`to` is open at `now`, in the place's time zone. */
|
|
3
|
-
export function openState(now, from, to, timeZone) {
|
|
4
|
-
const minutes = minutesInZone(now, timeZone);
|
|
5
|
-
if (minutes < from[0] * 60 + from[1])
|
|
6
|
-
return "before";
|
|
7
|
-
if (minutes >= to[0] * 60 + to[1])
|
|
8
|
-
return "after";
|
|
9
|
-
return "open";
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/open-state/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,GAAS,EAAE,IAAe,EAAE,EAAa,EAAE,QAAgB;IACnF,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7C,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACtD,IAAI,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/open-state/type.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,yCAAyC;AACzC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/open-state/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SunTimes } from "@sharadox/web-library/time/sun-time/type";
|
|
2
|
-
/** Sunrise and sunset for a date and place (NOAA solar position approximation, ±1–2 minutes). */
|
|
3
|
-
export declare function sunTimes(date: Date, latitude: number, longitude: number): SunTimes;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/sun-time/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAIzE,iGAAiG;AACjG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,CA4BlF"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const RADIANS_PER_DEGREE = Math.PI / 180;
|
|
2
|
-
/** Sunrise and sunset for a date and place (NOAA solar position approximation, ±1–2 minutes). */
|
|
3
|
-
export function sunTimes(date, latitude, longitude) {
|
|
4
|
-
const year = date.getUTCFullYear();
|
|
5
|
-
const midnight = Date.UTC(year, date.getUTCMonth(), date.getUTCDate());
|
|
6
|
-
const day = Math.floor((midnight - Date.UTC(year, 0, 0)) / 864e5);
|
|
7
|
-
const yearAngle = ((2 * Math.PI) / 365) * (day - 1 + 0.5);
|
|
8
|
-
const equationOfTime = 229.18 *
|
|
9
|
-
(0.000075 +
|
|
10
|
-
0.001868 * Math.cos(yearAngle) -
|
|
11
|
-
0.032077 * Math.sin(yearAngle) -
|
|
12
|
-
0.014615 * Math.cos(2 * yearAngle) -
|
|
13
|
-
0.040849 * Math.sin(2 * yearAngle));
|
|
14
|
-
const declination = 0.006918 -
|
|
15
|
-
0.399912 * Math.cos(yearAngle) +
|
|
16
|
-
0.070257 * Math.sin(yearAngle) -
|
|
17
|
-
0.006758 * Math.cos(2 * yearAngle) +
|
|
18
|
-
0.000907 * Math.sin(2 * yearAngle) -
|
|
19
|
-
0.002697 * Math.cos(3 * yearAngle) +
|
|
20
|
-
0.00148 * Math.sin(3 * yearAngle);
|
|
21
|
-
const hourAngle = Math.acos(Math.cos(90.833 * RADIANS_PER_DEGREE) / (Math.cos(latitude * RADIANS_PER_DEGREE) * Math.cos(declination)) -
|
|
22
|
-
Math.tan(latitude * RADIANS_PER_DEGREE) * Math.tan(declination)) / RADIANS_PER_DEGREE;
|
|
23
|
-
const riseMinutes = 720 - 4 * (longitude + hourAngle) - equationOfTime;
|
|
24
|
-
const setMinutes = 720 - 4 * (longitude - hourAngle) - equationOfTime;
|
|
25
|
-
return { rise: new Date(midnight + riseMinutes * 6e4), set: new Date(midnight + setMinutes * 6e4) };
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/sun-time/index.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEzC,iGAAiG;AACjG,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,QAAgB,EAAE,SAAiB;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAC1D,MAAM,cAAc,GAClB,MAAM;QACN,CAAC,QAAQ;YACP,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAC9B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAC9B,QAAQ,GAAG,IAAI,CAAC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ACtG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/sun-time/type.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,IAAI,CAAC;CACX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/sun-time/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SunToday } from "@sharadox/web-library/time/sun-today/type";
|
|
2
|
-
/** Today's sunrise and sunset at a place (tomorrow's once the sun has set), refreshed every minute. Null until mounted. */
|
|
3
|
-
export declare function useSunToday(latitude: number, longitude: number): SunToday | null;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/sun-today/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAE1E,2HAA2H;AAC3H,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAkB9D"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { sunTimes } from "@sharadox/web-library/time/sun-time";
|
|
4
|
-
/** Today's sunrise and sunset at a place (tomorrow's once the sun has set), refreshed every minute. Null until mounted. */
|
|
5
|
-
export function useSunToday(latitude, longitude) {
|
|
6
|
-
const [sun, setSun] = useState(null);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const tick = () => {
|
|
9
|
-
const now = new Date();
|
|
10
|
-
let times = sunTimes(now, latitude, longitude);
|
|
11
|
-
const tomorrow = now > times.set;
|
|
12
|
-
if (tomorrow)
|
|
13
|
-
times = sunTimes(new Date(now.getTime() + 864e5), latitude, longitude);
|
|
14
|
-
setSun({ ...times, now, tomorrow });
|
|
15
|
-
};
|
|
16
|
-
const first = setTimeout(tick, 0);
|
|
17
|
-
const timer = setInterval(tick, 60_000);
|
|
18
|
-
return () => {
|
|
19
|
-
clearTimeout(first);
|
|
20
|
-
clearInterval(timer);
|
|
21
|
-
};
|
|
22
|
-
}, [latitude, longitude]);
|
|
23
|
-
return sun;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/sun-today/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAG/D,2HAA2H;AAC3H,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,SAAiB;IAC7D,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;YACjC,IAAI,QAAQ;gBAAE,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YACrF,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Sun times for the relevant evening, plus the moment they were computed for. */
|
|
2
|
-
export interface SunToday {
|
|
3
|
-
rise: Date;
|
|
4
|
-
set: Date;
|
|
5
|
-
now: Date;
|
|
6
|
-
/** After today's sunset these are tomorrow's times. */
|
|
7
|
-
tomorrow: boolean;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/sun-today/type.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,IAAI,CAAC;IACV,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/sun-today/type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/zone-minute/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUlE"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Minutes since midnight in a time zone for an instant, whatever the visitor's own time zone. */
|
|
2
|
-
export function minutesInZone(date, timeZone) {
|
|
3
|
-
const parts = new Intl.DateTimeFormat("en-GB", {
|
|
4
|
-
timeZone,
|
|
5
|
-
hour: "2-digit",
|
|
6
|
-
minute: "2-digit",
|
|
7
|
-
hourCycle: "h23",
|
|
8
|
-
}).formatToParts(date);
|
|
9
|
-
const hours = Number(parts.find((part) => part.type === "hour")?.value ?? 0);
|
|
10
|
-
const minutes = Number(parts.find((part) => part.type === "minute")?.value ?? 0);
|
|
11
|
-
return hours * 60 + minutes;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/zone-minute/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,QAAgB;IACxD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC7C,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IACjF,OAAO,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC;AAC9B,CAAC"}
|