@siteping/widget 0.10.5 → 0.10.7
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 +25 -222
- package/dist/chunk-7ZBKJ6NW.js +1796 -0
- package/dist/chunk-7ZBKJ6NW.js.map +1 -0
- package/dist/chunk-FDQWFGRR.js +1796 -0
- package/dist/chunk-FDQWFGRR.js.map +1 -0
- package/dist/chunk-GKRKCSID.cjs +1796 -0
- package/dist/chunk-GKRKCSID.cjs.map +1 -0
- package/dist/chunk-NVNA5AI2.cjs +1796 -0
- package/dist/chunk-NVNA5AI2.cjs.map +1 -0
- package/dist/filters.d.cts +3 -1
- package/dist/filters.d.ts +3 -1
- package/dist/i18n.d.cts +67 -0
- package/dist/i18n.d.ts +67 -0
- package/dist/index.cjs +40 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -6
- package/dist/index.d.ts +152 -6
- package/dist/index.global.js +46 -46
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/panel-7URHNKQH.js +2 -0
- package/dist/panel-7URHNKQH.js.map +1 -0
- package/dist/panel-FUPBUN6F.js +2 -0
- package/dist/panel-FUPBUN6F.js.map +1 -0
- package/dist/panel-M2QKMFYO.cjs +2 -0
- package/dist/panel-M2QKMFYO.cjs.map +1 -0
- package/dist/panel-XUTDVTAR.cjs +2 -0
- package/dist/panel-XUTDVTAR.cjs.map +1 -0
- package/dist/react.cjs +47 -47
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +41 -41
- package/dist/react.js.map +1 -1
- package/dist/screenshot-storage.d.cts +5 -0
- package/dist/screenshot-storage.d.ts +5 -0
- package/dist/siteping-core.d.cts +8 -3
- package/dist/siteping-core.d.ts +8 -3
- package/dist/store-helpers.d.cts +87 -0
- package/dist/store-helpers.d.ts +87 -0
- package/dist/type-utils.d.cts +13 -44
- package/dist/type-utils.d.ts +13 -44
- package/dist/types.d.cts +147 -110
- package/dist/types.d.ts +147 -110
- package/dist/wire.d.cts +35 -0
- package/dist/wire.d.ts +35 -0
- package/package.json +2 -1
- package/dist/chunk-D2AVRF24.js +0 -1796
- package/dist/chunk-D2AVRF24.js.map +0 -1
- package/dist/chunk-GRKBXAGP.cjs +0 -1796
- package/dist/chunk-GRKBXAGP.cjs.map +0 -1
- package/dist/panel-LMVRKAQH.cjs +0 -2
- package/dist/panel-LMVRKAQH.cjs.map +0 -1
- package/dist/panel-OXUE7PJY.js +0 -2
- package/dist/panel-OXUE7PJY.js.map +0 -1
package/dist/filters.d.cts
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* 6. search (lowercase substring match on `message`)
|
|
14
14
|
*
|
|
15
15
|
* Pagination clamps `limit` to a maximum of 100 and treats `page` as 1-based,
|
|
16
|
-
* matching the public API contract documented on `getFeedbacks`.
|
|
16
|
+
* matching the public API contract documented on `getFeedbacks`. A page or
|
|
17
|
+
* limit below 1 is clamped up to 1 rather than indexing backwards from the
|
|
18
|
+
* end of the match set.
|
|
17
19
|
*/
|
|
18
20
|
import type { FeedbackQuery, FeedbackRecord } from "./types.cjs";
|
|
19
21
|
export interface FilterResult {
|
package/dist/filters.d.ts
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* 6. search (lowercase substring match on `message`)
|
|
14
14
|
*
|
|
15
15
|
* Pagination clamps `limit` to a maximum of 100 and treats `page` as 1-based,
|
|
16
|
-
* matching the public API contract documented on `getFeedbacks`.
|
|
16
|
+
* matching the public API contract documented on `getFeedbacks`. A page or
|
|
17
|
+
* limit below 1 is clamped up to 1 rather than indexing backwards from the
|
|
18
|
+
* end of the match set.
|
|
17
19
|
*/
|
|
18
20
|
import type { FeedbackQuery, FeedbackRecord } from "./types.js";
|
|
19
21
|
export interface FilterResult {
|
package/dist/i18n.d.cts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic i18n machinery shared by the widget and the dashboard.
|
|
3
|
+
*
|
|
4
|
+
* Each package owns its `Translations` interface (their key sets differ) and
|
|
5
|
+
* its locale dictionaries; everything else — locale normalization, the
|
|
6
|
+
* custom-locale registry, lazy loading of built-ins, the translate-function
|
|
7
|
+
* factory, interpolation — is identical and lives here once.
|
|
8
|
+
*
|
|
9
|
+
* The `loaders` map is typed `Record<Exclude<BuiltinLocale, "en">, …>`: the
|
|
10
|
+
* moment a locale code is added to {@link BUILTIN_LOCALES}, every consuming
|
|
11
|
+
* package fails to compile until its loader entry (and therefore its
|
|
12
|
+
* dictionary file) exists. Adding a locale cannot silently fall back to
|
|
13
|
+
* English anymore.
|
|
14
|
+
*/
|
|
15
|
+
import { type BuiltinLocale } from "./types.cjs";
|
|
16
|
+
/**
|
|
17
|
+
* Lazy dictionary loaders for every non-English built-in locale. Use static
|
|
18
|
+
* `() => import("./xx.cjs").then((m) => m.xx)` thunks — bundlers keep
|
|
19
|
+
* emitting one chunk per locale, and only the requested one ships.
|
|
20
|
+
*/
|
|
21
|
+
export type LocaleLoaders<T> = Record<Exclude<BuiltinLocale, "en">, () => Promise<T>>;
|
|
22
|
+
/** Translate function over the message catalog `T`. */
|
|
23
|
+
export type TranslateFunction<T> = (key: keyof T & string) => string;
|
|
24
|
+
/** The i18n API returned by {@link createI18n}. */
|
|
25
|
+
export interface I18n<T> {
|
|
26
|
+
/**
|
|
27
|
+
* Create a translation function for the given locale.
|
|
28
|
+
*
|
|
29
|
+
* Locale resolution: exact language match > English fallback, per key.
|
|
30
|
+
* Non-English built-in locales are lazy-loaded via `loadLocale` — call
|
|
31
|
+
* `await loadLocale(locale)` at init if you want the UI to render in the
|
|
32
|
+
* target language immediately; until the dictionary lands, keys resolve
|
|
33
|
+
* to English.
|
|
34
|
+
*/
|
|
35
|
+
createT(locale: string): TranslateFunction<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Dynamically import a built-in locale and register it. Returns the
|
|
38
|
+
* loaded dictionary, or `null` if the locale isn't a known built-in.
|
|
39
|
+
* Custom locales registered via `registerLocale` bypass this loader —
|
|
40
|
+
* they are already in the registry (and are returned as registered, so a
|
|
41
|
+
* partial custom dictionary comes back partial).
|
|
42
|
+
*/
|
|
43
|
+
loadLocale(locale: string): Promise<Partial<T> | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Register a custom locale at runtime. Partial dictionaries are welcome —
|
|
46
|
+
* missing keys fall back to English per key, so overriding a single
|
|
47
|
+
* string never requires copying the whole catalog.
|
|
48
|
+
*/
|
|
49
|
+
registerLocale(code: string, translations: Partial<T>): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build the i18n machinery for one message catalog.
|
|
53
|
+
*
|
|
54
|
+
* @param en — the complete English catalog, bundled synchronously as the fallback.
|
|
55
|
+
* @param loaders — lazy import thunks for every other built-in locale.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createI18n<T extends Record<keyof T & string, string>>(en: T, loaders: LocaleLoaders<T>): I18n<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Interpolate `{paramName}` placeholders in a translated string with the
|
|
60
|
+
* values from `params`. Stringifies numbers and booleans inline so callers
|
|
61
|
+
* can pass `t("marker.count")` along with `{ count: 3 }` directly.
|
|
62
|
+
*
|
|
63
|
+
* Unknown placeholders are left as-is.
|
|
64
|
+
*/
|
|
65
|
+
export declare function interpolate(template: string, params: Readonly<Record<string, string | number | boolean>>): string;
|
|
66
|
+
/** Shorthand for `interpolate(t(key), params)` — key-checked against the catalog. */
|
|
67
|
+
export declare function tWithParams<K extends string>(t: (key: K) => string, key: K, params: Readonly<Record<string, string | number | boolean>>): string;
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic i18n machinery shared by the widget and the dashboard.
|
|
3
|
+
*
|
|
4
|
+
* Each package owns its `Translations` interface (their key sets differ) and
|
|
5
|
+
* its locale dictionaries; everything else — locale normalization, the
|
|
6
|
+
* custom-locale registry, lazy loading of built-ins, the translate-function
|
|
7
|
+
* factory, interpolation — is identical and lives here once.
|
|
8
|
+
*
|
|
9
|
+
* The `loaders` map is typed `Record<Exclude<BuiltinLocale, "en">, …>`: the
|
|
10
|
+
* moment a locale code is added to {@link BUILTIN_LOCALES}, every consuming
|
|
11
|
+
* package fails to compile until its loader entry (and therefore its
|
|
12
|
+
* dictionary file) exists. Adding a locale cannot silently fall back to
|
|
13
|
+
* English anymore.
|
|
14
|
+
*/
|
|
15
|
+
import { type BuiltinLocale } from "./types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Lazy dictionary loaders for every non-English built-in locale. Use static
|
|
18
|
+
* `() => import("./xx.js").then((m) => m.xx)` thunks — bundlers keep
|
|
19
|
+
* emitting one chunk per locale, and only the requested one ships.
|
|
20
|
+
*/
|
|
21
|
+
export type LocaleLoaders<T> = Record<Exclude<BuiltinLocale, "en">, () => Promise<T>>;
|
|
22
|
+
/** Translate function over the message catalog `T`. */
|
|
23
|
+
export type TranslateFunction<T> = (key: keyof T & string) => string;
|
|
24
|
+
/** The i18n API returned by {@link createI18n}. */
|
|
25
|
+
export interface I18n<T> {
|
|
26
|
+
/**
|
|
27
|
+
* Create a translation function for the given locale.
|
|
28
|
+
*
|
|
29
|
+
* Locale resolution: exact language match > English fallback, per key.
|
|
30
|
+
* Non-English built-in locales are lazy-loaded via `loadLocale` — call
|
|
31
|
+
* `await loadLocale(locale)` at init if you want the UI to render in the
|
|
32
|
+
* target language immediately; until the dictionary lands, keys resolve
|
|
33
|
+
* to English.
|
|
34
|
+
*/
|
|
35
|
+
createT(locale: string): TranslateFunction<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Dynamically import a built-in locale and register it. Returns the
|
|
38
|
+
* loaded dictionary, or `null` if the locale isn't a known built-in.
|
|
39
|
+
* Custom locales registered via `registerLocale` bypass this loader —
|
|
40
|
+
* they are already in the registry (and are returned as registered, so a
|
|
41
|
+
* partial custom dictionary comes back partial).
|
|
42
|
+
*/
|
|
43
|
+
loadLocale(locale: string): Promise<Partial<T> | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Register a custom locale at runtime. Partial dictionaries are welcome —
|
|
46
|
+
* missing keys fall back to English per key, so overriding a single
|
|
47
|
+
* string never requires copying the whole catalog.
|
|
48
|
+
*/
|
|
49
|
+
registerLocale(code: string, translations: Partial<T>): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build the i18n machinery for one message catalog.
|
|
53
|
+
*
|
|
54
|
+
* @param en — the complete English catalog, bundled synchronously as the fallback.
|
|
55
|
+
* @param loaders — lazy import thunks for every other built-in locale.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createI18n<T extends Record<keyof T & string, string>>(en: T, loaders: LocaleLoaders<T>): I18n<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Interpolate `{paramName}` placeholders in a translated string with the
|
|
60
|
+
* values from `params`. Stringifies numbers and booleans inline so callers
|
|
61
|
+
* can pass `t("marker.count")` along with `{ count: 3 }` directly.
|
|
62
|
+
*
|
|
63
|
+
* Unknown placeholders are left as-is.
|
|
64
|
+
*/
|
|
65
|
+
export declare function interpolate(template: string, params: Readonly<Record<string, string | number | boolean>>): string;
|
|
66
|
+
/** Shorthand for `interpolate(t(key), params)` — key-checked against the catalog. */
|
|
67
|
+
export declare function tWithParams<K extends string>(t: (key: K) => string, key: K, params: Readonly<Record<string, string | number | boolean>>): string;
|