@chelone/core 0.6.0 → 0.7.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/dist/assistant/assistant-session.d.ts +6 -0
- package/dist/assistant/assistant-session.js +204 -181
- package/dist/assistant/echo-transport.js +26 -29
- package/dist/assistant/http-transport.d.ts +10 -0
- package/dist/assistant/http-transport.js +98 -0
- package/dist/assistant/types.d.ts +1 -7
- package/dist/auth/access-control.d.ts +13 -5
- package/dist/auth/access-control.js +25 -21
- package/dist/auth/auth-options.d.ts +21 -17
- package/dist/auth/auth-options.js +80 -48
- package/dist/auth/permission-matrix.d.ts +12 -0
- package/dist/auth/permission-matrix.js +67 -0
- package/dist/auth/types.d.ts +14 -4
- package/dist/block-editor/block-document.d.ts +60 -0
- package/dist/block-editor/block-document.js +143 -0
- package/dist/block-editor/data-blocks.d.ts +63 -0
- package/dist/block-editor/data-blocks.js +117 -0
- package/dist/chart/chart-data.js +46 -44
- package/dist/command-menu/hotkey.js +58 -47
- package/dist/command-menu/recents.js +8 -11
- package/dist/command-menu/registry.d.ts +9 -5
- package/dist/command-menu/registry.js +36 -46
- package/dist/controller/calendar-dates.js +82 -113
- package/dist/controller/calendar-events.js +93 -88
- package/dist/controller/client-list-controller.d.ts +2 -2
- package/dist/controller/client-list-controller.js +251 -254
- package/dist/controller/data-table-columns.d.ts +2 -0
- package/dist/controller/data-table-columns.js +50 -56
- package/dist/controller/deep-equal.d.ts +1 -0
- package/dist/controller/deep-equal.js +14 -0
- package/dist/controller/filter-toggle.js +36 -44
- package/dist/controller/in-place-editor.d.ts +42 -0
- package/dist/controller/in-place-editor.js +42 -0
- package/dist/controller/infinite-list-controller.js +219 -189
- package/dist/controller/inspector.d.ts +49 -0
- package/dist/controller/inspector.js +64 -0
- package/dist/controller/job-monitor.d.ts +3 -4
- package/dist/controller/job-monitor.js +37 -47
- package/dist/controller/kanban-board.d.ts +2 -3
- package/dist/controller/kanban-board.js +43 -24
- package/dist/controller/list-controller.d.ts +5 -5
- package/dist/controller/list-controller.js +444 -400
- package/dist/controller/list-params.js +96 -87
- package/dist/controller/pivot-grid.js +89 -95
- package/dist/controller/prev-next.d.ts +2 -2
- package/dist/controller/prev-next.js +74 -54
- package/dist/controller/record-controllers.d.ts +14 -6
- package/dist/controller/record-controllers.js +288 -257
- package/dist/controller/record-diff.d.ts +21 -0
- package/dist/controller/record-diff.js +50 -0
- package/dist/controller/record-timeline.js +42 -30
- package/dist/controller/record-tree.js +57 -47
- package/dist/controller/record-workflow.d.ts +38 -16
- package/dist/controller/record-workflow.js +85 -64
- package/dist/controller/reference-many-controller.js +198 -192
- package/dist/controller/reference-one-controller.d.ts +1 -1
- package/dist/controller/reference-one-controller.js +63 -56
- package/dist/controller/saved-queries.js +104 -91
- package/dist/controller/translate-fallback.js +10 -6
- package/dist/csv/export.d.ts +2 -1
- package/dist/csv/export.js +43 -40
- package/dist/csv/import-controller.js +185 -169
- package/dist/csv/match-headers.js +29 -22
- package/dist/csv/parse-with.js +60 -54
- package/dist/csv/run-import.js +69 -72
- package/dist/csv/validate-rows.d.ts +1 -1
- package/dist/csv/validate-rows.js +65 -52
- package/dist/data/cache-ops.d.ts +5 -4
- package/dist/data/cache-ops.js +208 -188
- package/dist/data/combine-data-providers.js +25 -23
- package/dist/data/data-provider-log.d.ts +45 -0
- package/dist/data/data-provider-log.js +93 -0
- package/dist/data/errors.js +14 -10
- package/dist/data/fake-provider.d.ts +6 -3
- package/dist/data/fake-provider.js +129 -114
- package/dist/data/fetch-utils.js +61 -44
- package/dist/data/filter-branch.d.ts +5 -0
- package/dist/data/filter-branch.js +10 -0
- package/dist/data/get-many-aggregate.js +84 -76
- package/dist/data/http-error.js +17 -12
- package/dist/data/keys.js +50 -36
- package/dist/data/mutation-options.d.ts +14 -9
- package/dist/data/mutation-options.js +93 -109
- package/dist/data/query-options.js +73 -68
- package/dist/data/remove-empty.d.ts +3 -0
- package/dist/data/remove-empty.js +11 -0
- package/dist/data/undoable.d.ts +2 -2
- package/dist/data/undoable.js +190 -174
- package/dist/data/with-lifecycle-callbacks.d.ts +45 -17
- package/dist/data/with-lifecycle-callbacks.js +66 -52
- package/dist/environment/application-update-store.js +58 -55
- package/dist/environment/offline-store.js +21 -21
- package/dist/form/array-binding.d.ts +30 -11
- package/dist/form/array-binding.js +184 -166
- package/dist/form/choice-ids.d.ts +7 -0
- package/dist/form/choice-ids.js +11 -0
- package/dist/form/choices-controller.d.ts +3 -2
- package/dist/form/choices-controller.js +302 -275
- package/dist/form/date-format.d.ts +38 -0
- package/dist/form/date-format.js +89 -0
- package/dist/form/dirty-values.d.ts +2 -2
- package/dist/form/dirty-values.js +22 -11
- package/dist/form/duration.d.ts +22 -0
- package/dist/form/duration.js +49 -0
- package/dist/form/edit-create-form.d.ts +12 -5
- package/dist/form/edit-create-form.js +243 -188
- package/dist/form/event-value.d.ts +6 -0
- package/dist/form/event-value.js +17 -0
- package/dist/form/field-error.d.ts +14 -0
- package/dist/form/field-error.js +28 -0
- package/dist/form/field-name.d.ts +20 -0
- package/dist/form/field-name.js +6 -0
- package/dist/form/filter-form-values.js +63 -49
- package/dist/form/form-controller.d.ts +9 -1
- package/dist/form/form-controller.js +165 -160
- package/dist/form/form-groups.d.ts +4 -3
- package/dist/form/form-groups.js +79 -79
- package/dist/form/form-handle.d.ts +175 -0
- package/dist/form/form-handle.js +68 -0
- package/dist/form/input-binding.d.ts +56 -31
- package/dist/form/input-binding.js +169 -118
- package/dist/form/input-values.d.ts +130 -0
- package/dist/form/input-values.js +177 -0
- package/dist/form/json-text.js +51 -37
- package/dist/form/save-pipeline.d.ts +6 -8
- package/dist/form/save-pipeline.js +91 -82
- package/dist/form/set-form-values.d.ts +6 -0
- package/dist/form/set-form-values.js +10 -0
- package/dist/form/source.js +97 -65
- package/dist/form/text-of.d.ts +2 -0
- package/dist/form/text-of.js +7 -0
- package/dist/form/validators.d.ts +58 -19
- package/dist/form/validators.js +97 -71
- package/dist/geo/bbox.d.ts +5 -4
- package/dist/geo/bbox.js +69 -48
- package/dist/geo/bounds.d.ts +14 -3
- package/dist/geo/bounds.js +98 -68
- package/dist/geo/constraints.js +88 -93
- package/dist/geo/coordinates.js +31 -23
- package/dist/geo/editor.d.ts +13 -13
- package/dist/geo/editor.js +176 -153
- package/dist/geo/geocoding.d.ts +4 -4
- package/dist/geo/geocoding.js +38 -41
- package/dist/geo/geojson.d.ts +12 -74
- package/dist/geo/geojson.js +52 -40
- package/dist/geo/geometry-math.d.ts +4 -4
- package/dist/geo/geometry-math.js +100 -93
- package/dist/geo/index.d.ts +7 -6
- package/dist/geo/map-layers.d.ts +42 -7
- package/dist/geo/map-layers.js +88 -62
- package/dist/geo/map-style.js +31 -32
- package/dist/geo/messages.js +48 -45
- package/dist/geo/nominatim.js +88 -80
- package/dist/geo/osm-presets.d.ts +4 -3
- package/dist/geo/osm-presets.js +108 -86
- package/dist/geo/osm-tags.js +14 -12
- package/dist/geo/overpass.d.ts +14 -2
- package/dist/geo/overpass.js +83 -90
- package/dist/geo/shape-value.d.ts +9 -5
- package/dist/geo/shape-value.js +169 -146
- package/dist/geo/snap-to-roads.d.ts +3 -3
- package/dist/geo/snap-to-roads.js +55 -50
- package/dist/geo/throttle.js +36 -39
- package/dist/guards.d.ts +37 -0
- package/dist/guards.js +62 -0
- package/dist/i18n/default-messages.js +34 -29
- package/dist/i18n/english-messages.js +187 -189
- package/dist/i18n/i18n.d.ts +2 -2
- package/dist/i18n/i18n.js +47 -60
- package/dist/i18n/inflection.d.ts +34 -0
- package/dist/i18n/inflection.js +82 -0
- package/dist/i18n/messages.d.ts +10 -2
- package/dist/i18n/messages.js +17 -4
- package/dist/i18n/missing-keys.js +66 -62
- package/dist/i18n/translatable.d.ts +16 -1
- package/dist/i18n/translatable.js +40 -47
- package/dist/index.d.ts +71 -24
- package/dist/index.js +40 -288
- package/dist/json/deep-equal.d.ts +8 -0
- package/dist/json/deep-equal.js +24 -0
- package/dist/json/strip-json-comments.js +38 -42
- package/dist/noop.d.ts +2 -0
- package/dist/noop.js +4 -0
- package/dist/notification/error-message.d.ts +2 -0
- package/dist/notification/error-message.js +10 -0
- package/dist/notification/notification-store.d.ts +3 -2
- package/dist/notification/notification-store.js +41 -45
- package/dist/onboarding-tour/placement.js +63 -78
- package/dist/onboarding-tour/tour-controller.js +46 -54
- package/dist/realtime/add-events-for-mutations.js +75 -81
- package/dist/realtime/announce-lock.js +16 -13
- package/dist/realtime/broadcast-channel-transport.js +65 -59
- package/dist/realtime/copy-members.js +22 -14
- package/dist/realtime/in-memory-lock-provider.js +40 -48
- package/dist/realtime/live.js +95 -101
- package/dist/realtime/lock-options.js +16 -16
- package/dist/realtime/lock-session.js +91 -78
- package/dist/realtime/memory-transport.js +25 -25
- package/dist/realtime/presence.js +120 -122
- package/dist/realtime/realtime-data-provider.d.ts +10 -0
- package/dist/realtime/realtime-data-provider.js +45 -42
- package/dist/realtime/reconnect-backoff.js +17 -0
- package/dist/realtime/sse-transport.d.ts +31 -0
- package/dist/realtime/sse-transport.js +235 -0
- package/dist/realtime/status-store.js +23 -28
- package/dist/realtime/topic-hub.js +62 -71
- package/dist/realtime/topics.js +10 -12
- package/dist/realtime/types.js +10 -12
- package/dist/realtime/unread-count.js +21 -21
- package/dist/realtime/websocket-transport.d.ts +32 -0
- package/dist/realtime/websocket-transport.js +306 -0
- package/dist/resource/describe-resource.d.ts +2 -0
- package/dist/resource/describe-resource.js +232 -219
- package/dist/resource/get-at-path.js +29 -14
- package/dist/resource/identifier.d.ts +18 -0
- package/dist/resource/identifier.js +27 -0
- package/dist/resource/record.d.ts +4 -0
- package/dist/resource/record.js +10 -0
- package/dist/resource/register.d.ts +7 -0
- package/dist/resource/registry-store.d.ts +45 -15
- package/dist/resource/registry-store.js +67 -60
- package/dist/resource/registry.d.ts +10 -0
- package/dist/resource/registry.js +8 -4
- package/dist/resource/source-path.d.ts +16 -1
- package/dist/rich-text/rich-text-extras.d.ts +132 -0
- package/dist/rich-text/rich-text-extras.js +179 -0
- package/dist/rich-text/rich-text-image.d.ts +124 -0
- package/dist/rich-text/rich-text-image.js +163 -0
- package/dist/rich-text/rich-text.d.ts +6 -0
- package/dist/rich-text/rich-text.js +125 -88
- package/dist/router/location.d.ts +22 -4
- package/dist/router/location.js +41 -18
- package/dist/router/match.js +47 -39
- package/dist/router/paths.js +40 -34
- package/dist/router/record-from-location.d.ts +1 -1
- package/dist/router/record-from-location.js +25 -17
- package/dist/store/adapters.js +51 -55
- package/dist/store/micro-store.js +57 -59
- package/dist/store/shallow-equal.d.ts +12 -0
- package/dist/store/shallow-equal.js +20 -0
- package/dist/store/store.js +54 -57
- package/package.json +13 -11
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/i18n/inflection.ts
|
|
2
|
+
/**
|
|
3
|
+
* Clean-room reimplementation of the SUBSET of the `inflection` package the
|
|
4
|
+
* ra-core label helpers rely on. Chelone carries no `inflection` dependency, so
|
|
5
|
+
* these three small helpers cover exactly what `useGetResourceLabel` /
|
|
6
|
+
* `useTranslateLabel` need:
|
|
7
|
+
*
|
|
8
|
+
* - `humanize(text)` — ra-core `humanize`: strip a trailing `_id`, replace
|
|
9
|
+
* underscores with spaces, lowercase, and capitalize the first letter. Does
|
|
10
|
+
* NOT split camelCase (parity: `humanize('authorName') === 'Authorname'`).
|
|
11
|
+
* - `humanizeField(source)` — ra-core `transform(['underscore','humanize'])`:
|
|
12
|
+
* camelCase-aware, so `firstName` → `First name`. Used for field labels.
|
|
13
|
+
* - `pluralize(word, count)` — ra-core `inflect(word, count)`: singular for
|
|
14
|
+
* `count === 1`, plural otherwise. Covers the regular English rules plus a
|
|
15
|
+
* small irregular set. Full parity with `inflection`'s complete irregular
|
|
16
|
+
* table is a documented non-goal (the fallback only fires when a translation
|
|
17
|
+
* key AND an `options.label` are both absent).
|
|
18
|
+
*/
|
|
19
|
+
/** Capitalize the first character; leave the rest untouched. */
|
|
20
|
+
function capitalizeFirst(text) {
|
|
21
|
+
return text.length === 0 ? text : text.charAt(0).toUpperCase() + text.slice(1);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert a camelCase / snake_case identifier to lowercase underscore form:
|
|
25
|
+
* `firstName` → `first_name`, `full_name` → `full_name`.
|
|
26
|
+
*/
|
|
27
|
+
function underscore(text) {
|
|
28
|
+
return text.replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* ra-core `humanize`: strip a trailing `_id`, underscores → spaces, lowercase,
|
|
32
|
+
* capitalize the first letter. Deliberately does NOT split camelCase.
|
|
33
|
+
*/
|
|
34
|
+
function humanize(text) {
|
|
35
|
+
return capitalizeFirst(text.replace(/_id$/, "").replace(/_+/g, " ").trim().toLowerCase());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* ra-core `transform(source, ['underscore','humanize'])`: camelCase-aware
|
|
39
|
+
* humanization for field labels. `firstName` → `First name`, `full_name` →
|
|
40
|
+
* `Full name`, `author name` → `Author name`.
|
|
41
|
+
*/
|
|
42
|
+
function humanizeField(source) {
|
|
43
|
+
return humanize(underscore(source));
|
|
44
|
+
}
|
|
45
|
+
var IRREGULARS = [
|
|
46
|
+
["person", "people"],
|
|
47
|
+
["child", "children"],
|
|
48
|
+
["man", "men"],
|
|
49
|
+
["woman", "women"],
|
|
50
|
+
["mouse", "mice"],
|
|
51
|
+
["foot", "feet"],
|
|
52
|
+
["tooth", "teeth"],
|
|
53
|
+
["goose", "geese"]
|
|
54
|
+
];
|
|
55
|
+
/** Regular English plural of a lowercase word (idempotent on plurals). */
|
|
56
|
+
function toPlural(word) {
|
|
57
|
+
for (const [singular, plural] of IRREGULARS) if (word === singular || word === plural) return plural;
|
|
58
|
+
const singular = toSingular(word);
|
|
59
|
+
if (/[^aeiou]y$/.test(singular)) return `${singular.slice(0, -1)}ies`;
|
|
60
|
+
if (/(s|x|z|ch|sh)$/.test(singular)) return `${singular}es`;
|
|
61
|
+
return `${singular}s`;
|
|
62
|
+
}
|
|
63
|
+
/** Regular English singular of a lowercase word. */
|
|
64
|
+
function toSingular(word) {
|
|
65
|
+
for (const [singular, plural] of IRREGULARS) {
|
|
66
|
+
if (word === plural) return singular;
|
|
67
|
+
if (word === singular) return singular;
|
|
68
|
+
}
|
|
69
|
+
if (/ies$/.test(word)) return `${word.slice(0, -3)}y`;
|
|
70
|
+
if (/(ss|x|z|ch|sh)es$/.test(word)) return word.slice(0, -2);
|
|
71
|
+
if (/s$/.test(word) && !/ss$/.test(word)) return word.slice(0, -1);
|
|
72
|
+
return word;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* ra-core `inflect(word, count)`: singularize when `count === 1`, pluralize
|
|
76
|
+
* otherwise. Case-preserving only for the first letter (the caller humanizes
|
|
77
|
+
* afterward, so casing beyond that does not matter here).
|
|
78
|
+
*/
|
|
79
|
+
function pluralize(word, count = 2) {
|
|
80
|
+
return count === 1 ? toSingular(word) : toPlural(word);
|
|
81
|
+
}
|
|
82
|
+
export { humanize, humanizeField, pluralize };
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export type PluralMessage = Partial<Record<Intl.LDMLPluralRule, string>> & {
|
|
|
4
4
|
};
|
|
5
5
|
export type MessageValue = string | PluralMessage;
|
|
6
6
|
export type MessageCatalog = Record<string, MessageValue>;
|
|
7
|
+
/** The values a message placeholder takes; one type for typed catalogs and the erased view. */
|
|
8
|
+
export type TranslateParamValues = Record<string, string | number>;
|
|
9
|
+
/** Boundary narrowing for `unknown` input: keeps the string and number entries of a plain object, `undefined` for anything else. */
|
|
10
|
+
export declare function pickTranslateParamValues(value: unknown): TranslateParamValues | undefined;
|
|
11
|
+
/** Drops absent values: an `undefined` param would otherwise render as the text "undefined". */
|
|
12
|
+
export declare function definedParams(params: Record<string, string | number | undefined>): TranslateParamValues;
|
|
7
13
|
/** Identity helper pinning literal keys AND literal template strings (for param inference). */
|
|
8
14
|
export declare function defineMessages<const T extends MessageCatalog>(catalog: T): T;
|
|
9
15
|
export type MessageKey<TCatalog extends MessageCatalog> = keyof TCatalog & string;
|
|
@@ -16,9 +22,11 @@ type ParamsObject<T extends string> = [ExtractParams<T>] extends [never] ? undef
|
|
|
16
22
|
* Required params for a message value: placeholder names for plain strings;
|
|
17
23
|
* plural messages additionally require `count` (drives Intl.PluralRules).
|
|
18
24
|
*/
|
|
19
|
-
export type TranslateParams<TValue extends MessageValue> = TValue extends string ? ParamsObject<TValue> : TValue extends PluralMessage ?
|
|
25
|
+
export type TranslateParams<TValue extends MessageValue> = TValue extends string ? ParamsObject<TValue> : TValue extends PluralMessage ? [ExtractParams<TValue["other"]>] extends [never] ? {
|
|
26
|
+
count: number;
|
|
27
|
+
} : {
|
|
20
28
|
[K in ExtractParams<TValue["other"]>]: string | number;
|
|
21
|
-
}
|
|
29
|
+
} & {
|
|
22
30
|
count: number;
|
|
23
31
|
} : never;
|
|
24
32
|
export {};
|
package/dist/i18n/messages.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
// src/i18n/messages.ts
|
|
2
|
+
/** Boundary narrowing for `unknown` input: keeps the string and number entries of a plain object, `undefined` for anything else. */
|
|
3
|
+
function pickTranslateParamValues(value) {
|
|
4
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return;
|
|
5
|
+
const picked = {};
|
|
6
|
+
for (const [name, entry] of Object.entries(value)) if (typeof entry === "string" || typeof entry === "number") picked[name] = entry;
|
|
7
|
+
return picked;
|
|
8
|
+
}
|
|
9
|
+
/** Drops absent values: an `undefined` param would otherwise render as the text "undefined". */
|
|
10
|
+
function definedParams(params) {
|
|
11
|
+
const defined = {};
|
|
12
|
+
for (const [name, value] of Object.entries(params)) if (value !== void 0) defined[name] = value;
|
|
13
|
+
return defined;
|
|
14
|
+
}
|
|
15
|
+
/** Identity helper pinning literal keys AND literal template strings (for param inference). */
|
|
1
16
|
function defineMessages(catalog) {
|
|
2
|
-
|
|
17
|
+
return catalog;
|
|
3
18
|
}
|
|
4
|
-
export {
|
|
5
|
-
defineMessages
|
|
6
|
-
};
|
|
19
|
+
export { defineMessages, definedParams, pickTranslateParamValues };
|
|
@@ -1,64 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
// src/i18n/missing-keys.ts
|
|
2
|
+
var NO_ENTRIES = [];
|
|
2
3
|
function createMissingKeyStore() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
4
|
+
const byLocale = /* @__PURE__ */ new Map();
|
|
5
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
6
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
7
|
+
let scheduled = false;
|
|
8
|
+
const changed = (locale) => {
|
|
9
|
+
snapshots.delete(locale);
|
|
10
|
+
if (scheduled) return;
|
|
11
|
+
scheduled = true;
|
|
12
|
+
queueMicrotask(() => {
|
|
13
|
+
scheduled = false;
|
|
14
|
+
for (const cb of [...subscribers]) cb();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const getEntries = (locale) => {
|
|
18
|
+
const cached = snapshots.get(locale);
|
|
19
|
+
if (cached) return cached;
|
|
20
|
+
const entries = byLocale.get(locale);
|
|
21
|
+
if (!entries?.size) return NO_ENTRIES;
|
|
22
|
+
const snapshot = [...entries.values()];
|
|
23
|
+
snapshots.set(locale, snapshot);
|
|
24
|
+
return snapshot;
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
record(key, locale, fallback) {
|
|
28
|
+
let entries = byLocale.get(locale);
|
|
29
|
+
if (!entries) {
|
|
30
|
+
entries = /* @__PURE__ */ new Map();
|
|
31
|
+
byLocale.set(locale, entries);
|
|
32
|
+
}
|
|
33
|
+
if (entries.has(key)) return;
|
|
34
|
+
entries.set(key, {
|
|
35
|
+
key,
|
|
36
|
+
fallback,
|
|
37
|
+
translation: ""
|
|
38
|
+
});
|
|
39
|
+
changed(locale);
|
|
40
|
+
},
|
|
41
|
+
getEntries,
|
|
42
|
+
setTranslation(locale, key, text) {
|
|
43
|
+
const entries = byLocale.get(locale);
|
|
44
|
+
const entry = entries?.get(key);
|
|
45
|
+
if (!entries || !entry || entry.translation === text) return;
|
|
46
|
+
entries.set(key, {
|
|
47
|
+
...entry,
|
|
48
|
+
translation: text
|
|
49
|
+
});
|
|
50
|
+
changed(locale);
|
|
51
|
+
},
|
|
52
|
+
clear(locale) {
|
|
53
|
+
if (!byLocale.get(locale)?.size) return;
|
|
54
|
+
byLocale.delete(locale);
|
|
55
|
+
changed(locale);
|
|
56
|
+
},
|
|
57
|
+
toJson(locale) {
|
|
58
|
+
const out = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const { key, translation } of getEntries(locale)) if (translation.trim() !== "") out.set(key, translation);
|
|
60
|
+
return JSON.stringify(Object.fromEntries(out), null, 2);
|
|
61
|
+
},
|
|
62
|
+
subscribe(callback) {
|
|
63
|
+
subscribers.add(callback);
|
|
64
|
+
return () => void subscribers.delete(callback);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
61
67
|
}
|
|
62
|
-
export {
|
|
63
|
-
createMissingKeyStore
|
|
64
|
-
};
|
|
68
|
+
export { createMissingKeyStore };
|
|
@@ -19,6 +19,20 @@ export interface TranslatableController {
|
|
|
19
19
|
* form values themselves stay in the form; this only tracks the selection.
|
|
20
20
|
*/
|
|
21
21
|
export declare function createTranslatableController(options: TranslatableOptions): TranslatableController;
|
|
22
|
+
type LocalizedField<V> = V extends (...args: never[]) => unknown ? V : V extends Date ? V : V extends readonly (infer Item)[] ? LocalizedField<Item>[] : V extends Record<string, string> ? string : V extends object ? RecordForLocale<V> : V;
|
|
23
|
+
/**
|
|
24
|
+
* What `getRecordForLocale` makes of `T`: a field typed `Record<string, string>`
|
|
25
|
+
* becomes `string`, an array maps its items, any other object maps its fields,
|
|
26
|
+
* and every other type stays. The root is never replaced.
|
|
27
|
+
*
|
|
28
|
+
* A nested `{ a: string; b: string }` field reads as a translation map here,
|
|
29
|
+
* though at run time only `locales` tells the two apart. A map without the
|
|
30
|
+
* selected locale is also left as it is at run time, so its type is the
|
|
31
|
+
* translated one only for a locale the data covers.
|
|
32
|
+
*/
|
|
33
|
+
export type RecordForLocale<T> = {
|
|
34
|
+
[K in keyof T]: LocalizedField<T[K]>;
|
|
35
|
+
};
|
|
22
36
|
/**
|
|
23
37
|
* A copy of `record` where every object holding `locale` as an own key is
|
|
24
38
|
* replaced by its value at that key, at any depth and inside arrays. Nodes
|
|
@@ -29,4 +43,5 @@ export declare function createTranslatableController(options: TranslatableOption
|
|
|
29
43
|
* (`id` is Indonesian), so pass `locales` to also keep objects that have other
|
|
30
44
|
* keys, such as a nested `{ id, name }` reference, from being read as a map.
|
|
31
45
|
*/
|
|
32
|
-
export declare function getRecordForLocale<T extends object | null | undefined>(record: T, locale: string, locales?: readonly string[]): T extends object ?
|
|
46
|
+
export declare function getRecordForLocale<T extends object | null | undefined>(record: T, locale: string, locales?: readonly string[]): T extends object ? RecordForLocale<T> : T;
|
|
47
|
+
export {};
|
|
@@ -1,56 +1,49 @@
|
|
|
1
|
+
import { isPlainObject } from "../guards.js";
|
|
1
2
|
import { createMicroStore } from "../store/micro-store.js";
|
|
3
|
+
// src/i18n/translatable.ts
|
|
4
|
+
/**
|
|
5
|
+
* The state behind a multi-locale editor: which locale is on screen. The
|
|
6
|
+
* form values themselves stay in the form; this only tracks the selection.
|
|
7
|
+
*/
|
|
2
8
|
function createTranslatableController(options) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`Locale "${locale}" is not one of: ${locales.join(", ")}`
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
store.setState({ selectedLocale: locale });
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function isPlainObject(value) {
|
|
27
|
-
if (typeof value !== "object" || value === null) return false;
|
|
28
|
-
const proto = Object.getPrototypeOf(value);
|
|
29
|
-
return proto === Object.prototype || proto === null;
|
|
9
|
+
const { locales, defaultLocale } = options;
|
|
10
|
+
const first = locales[0];
|
|
11
|
+
if (first === void 0) throw new Error("A translatable controller needs at least one locale");
|
|
12
|
+
const store = createMicroStore({
|
|
13
|
+
locales,
|
|
14
|
+
selectedLocale: defaultLocale !== void 0 && locales.includes(defaultLocale) ? defaultLocale : first
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
getSnapshot: store.getSnapshot,
|
|
18
|
+
subscribe: store.subscribe,
|
|
19
|
+
destroy: store.destroy,
|
|
20
|
+
selectLocale(locale) {
|
|
21
|
+
if (!locales.includes(locale)) throw new Error(`Locale "${locale}" is not one of: ${locales.join(", ")}`);
|
|
22
|
+
store.setState({ selectedLocale: locale });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
30
25
|
}
|
|
31
26
|
function pick(node, locale, locales, isRoot) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (!isRoot && isTranslationMap(node, locale, locales)) {
|
|
37
|
-
return pick(node[locale], locale, locales, false);
|
|
38
|
-
}
|
|
39
|
-
return Object.fromEntries(
|
|
40
|
-
Object.entries(node).map(([key, value]) => [
|
|
41
|
-
key,
|
|
42
|
-
pick(value, locale, locales, false)
|
|
43
|
-
])
|
|
44
|
-
);
|
|
27
|
+
if (Array.isArray(node)) return node.map((item) => pick(item, locale, locales, false));
|
|
28
|
+
if (!isPlainObject(node)) return node;
|
|
29
|
+
if (!isRoot && isTranslationMap(node, locale, locales)) return pick(node[locale], locale, locales, false);
|
|
30
|
+
return Object.fromEntries(Object.entries(node).map(([key, value]) => [key, pick(value, locale, locales, false)]));
|
|
45
31
|
}
|
|
46
32
|
function isTranslationMap(node, locale, locales) {
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
if (!Object.hasOwn(node, locale)) return false;
|
|
34
|
+
return !locales || Object.keys(node).every((key) => locales.includes(key));
|
|
49
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A copy of `record` where every object holding `locale` as an own key is
|
|
38
|
+
* replaced by its value at that key, at any depth and inside arrays. Nodes
|
|
39
|
+
* without the key are kept as they are, so a record missing the locale still
|
|
40
|
+
* shows the translatable object.
|
|
41
|
+
*
|
|
42
|
+
* The record itself is never replaced. A locale code can equal a field name
|
|
43
|
+
* (`id` is Indonesian), so pass `locales` to also keep objects that have other
|
|
44
|
+
* keys, such as a nested `{ id, name }` reference, from being read as a map.
|
|
45
|
+
*/
|
|
50
46
|
function getRecordForLocale(record, locale, locales) {
|
|
51
|
-
|
|
47
|
+
return pick(record, locale, locales, true);
|
|
52
48
|
}
|
|
53
|
-
export {
|
|
54
|
-
createTranslatableController,
|
|
55
|
-
getRecordForLocale
|
|
56
|
-
};
|
|
49
|
+
export { createTranslatableController, getRecordForLocale };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
export type { ValidationErrorMap } from "@tanstack/form-core";
|
|
1
2
|
export { revalidateLogic } from "@tanstack/form-core";
|
|
2
3
|
export type { AssistantSession, AssistantSessionState, CreateAssistantSessionOptions, } from "./assistant/assistant-session.js";
|
|
3
4
|
export { createAssistantSession } from "./assistant/assistant-session.js";
|
|
4
5
|
export type { EchoAssistantTransportOptions } from "./assistant/echo-transport.js";
|
|
5
6
|
export { echoAssistantTransport } from "./assistant/echo-transport.js";
|
|
6
|
-
export type {
|
|
7
|
+
export type { HttpAssistantTransportOptions } from "./assistant/http-transport.js";
|
|
8
|
+
export { httpAssistantTransport } from "./assistant/http-transport.js";
|
|
9
|
+
export type { AssistantChunk, AssistantMessage, AssistantTool, AssistantToolCall, AssistantToolDeclaration, AssistantTransport, } from "./assistant/types.js";
|
|
7
10
|
export type { Permission } from "./auth/access-control.js";
|
|
8
11
|
export { canAccessWithPermissions } from "./auth/access-control.js";
|
|
9
12
|
export type { CheckErrorOutcome } from "./auth/auth-options.js";
|
|
10
13
|
export { authStateQueryOptions, canAccessQueryOptions, checkError, identityQueryOptions, permissionsQueryOptions, } from "./auth/auth-options.js";
|
|
14
|
+
export type { PermissionCellState, PermissionMatrixValue, } from "./auth/permission-matrix.js";
|
|
15
|
+
export { getPermissionCell, isPermissionRowGranted, setPermissionRow, togglePermission, } from "./auth/permission-matrix.js";
|
|
11
16
|
export type { AuthProvider, CanAccessParams, UserIdentity } from "./auth/types.js";
|
|
17
|
+
export type { Attrs as BlockAttrs, BlockDocNode, BlockRegistry, BlockSpec, } from "./block-editor/block-document.js";
|
|
18
|
+
export { createBlockRegistry, describeBlockAttrs, emptyBlockDocument, getBlockDefaultAttrs, isBlockDoc, isEmptyBlockDocument, matchBlocks, toEmbedSrc, unknownBlockType, unwrapUnknownBlocks, wrapUnknownBlocks, } from "./block-editor/block-document.js";
|
|
19
|
+
export type { ChartAggregateOptions, ChartAggregatePoint, DataBlockName, DataBlockSpec, } from "./block-editor/data-blocks.js";
|
|
20
|
+
export { aggregateChartData, chartBlockSpec, dataBlockNames, formatDataBlockValue, pickDataBlockFields, readDataBlockValue, recordListBlockSpec, referenceRecordBlockSpec, } from "./block-editor/data-blocks.js";
|
|
12
21
|
export type { CartesianRow, DonutSlice, MetricDelta, } from "./chart/chart-data.js";
|
|
13
22
|
export { chartColor, DEFAULT_CHART_COLORS, getMetricDelta, hasChartValues, toCartesianRows, toDonutSlices, } from "./chart/chart-data.js";
|
|
14
23
|
export type { HotkeyEvent, HotkeyTarget } from "./command-menu/hotkey.js";
|
|
@@ -24,10 +33,14 @@ export { calendarEventsInHour, calendarEventsOnDay, calendarRangeFilter, groupCa
|
|
|
24
33
|
export type { ClientListController, ClientListControllerOptions, ClientListLoadingState, } from "./controller/client-list-controller.js";
|
|
25
34
|
export { createClientListController } from "./controller/client-list-controller.js";
|
|
26
35
|
export type { DataTableColumnInfo } from "./controller/data-table-columns.js";
|
|
27
|
-
export { arrangeColumns, columnLabelMatches, dataTableColumnKeys, defaultDataTableStoreKey, getDataTableColumnId, moveColumn, toggleHiddenColumn, } from "./controller/data-table-columns.js";
|
|
36
|
+
export { arrangeColumns, columnLabelMatches, dataTableColumnKeys, defaultDataTableStoreKey, getDataTableColumnId, moveColumn, moveColumnTo, toggleHiddenColumn, } from "./controller/data-table-columns.js";
|
|
28
37
|
export { isFilterSelected, toggleFilterValue, } from "./controller/filter-toggle.js";
|
|
38
|
+
export type { InPlaceEditorEvent, InPlaceEditorState, InPlaceSave, } from "./controller/in-place-editor.js";
|
|
39
|
+
export { nextInPlaceEditorState, planInPlaceSave, } from "./controller/in-place-editor.js";
|
|
29
40
|
export type { InfiniteListController, InfiniteListControllerState, } from "./controller/infinite-list-controller.js";
|
|
30
41
|
export { createInfiniteListController } from "./controller/infinite-list-controller.js";
|
|
42
|
+
export type { Inspector, InspectorPosition, InspectorSelection, InspectorState, InspectorViewport, } from "./controller/inspector.js";
|
|
43
|
+
export { clampInspectorPosition, configurableInputColumns, createInspector, defaultConfigurableInputsStoreKey, inspectorPositionKey, } from "./controller/inspector.js";
|
|
31
44
|
export type { JobActionOptions, JobActions, JobPlan, } from "./controller/job-monitor.js";
|
|
32
45
|
export { DEFAULT_JOB_TABS, getJobActions, planJobCancel, planJobRetry, } from "./controller/job-monitor.js";
|
|
33
46
|
export type { KanbanBucket, KanbanColumnDef, KanbanMove, } from "./controller/kanban-board.js";
|
|
@@ -42,12 +55,14 @@ export type { PrevNextOptions, PrevNextPage, PrevNextParams, PrevNextResolution,
|
|
|
42
55
|
export { canUseCachedPage, getPrevNextParams, resolvePrevNext, } from "./controller/prev-next.js";
|
|
43
56
|
export type { CreateController, CreateControllerOptions, CreateControllerState, DeleteController, DeleteControllerOptions, DeleteControllerState, DeleteOneOptions, EditController, EditControllerOptions, EditControllerState, RecordControllerContext, RedirectRequest, RedirectTarget, SaveOptions, SaveTransform, ShowController, ShowControllerOptions, ShowControllerState, } from "./controller/record-controllers.js";
|
|
44
57
|
export { createCreateController, createDeleteController, createEditController, createShowController, } from "./controller/record-controllers.js";
|
|
58
|
+
export type { DiffStatus, RecordDiffRow, } from "./controller/record-diff.js";
|
|
59
|
+
export { diffRecords, formatDiffValue } from "./controller/record-diff.js";
|
|
45
60
|
export type { RecordTimelineEntry, ToTimelineEntriesOptions, } from "./controller/record-timeline.js";
|
|
46
61
|
export { formatRelativeTime, toTimelineEntries, } from "./controller/record-timeline.js";
|
|
47
62
|
export type { RecordTreeNode } from "./controller/record-tree.js";
|
|
48
63
|
export { buildRecordTree } from "./controller/record-tree.js";
|
|
49
|
-
export type { AllowedTransitions, ApprovalOptions, ApprovalState, TransitionOptions, } from "./controller/record-workflow.js";
|
|
50
|
-
export { buildApprovalUpdate, getAllowedTransitions, getApprovalState, } from "./controller/record-workflow.js";
|
|
64
|
+
export type { AllowedTransitions, ApprovalOptions, ApprovalState, RejectionOptions, TransitionOptions, } from "./controller/record-workflow.js";
|
|
65
|
+
export { buildApprovalUpdate, buildRejectionUpdate, getAllowedTransitions, getApprovalState, } from "./controller/record-workflow.js";
|
|
51
66
|
export type { ReferenceManyController, ReferenceManyControllerOptions, } from "./controller/reference-many-controller.js";
|
|
52
67
|
export { createReferenceManyController } from "./controller/reference-many-controller.js";
|
|
53
68
|
export type { ReferenceOneController, ReferenceOneControllerOptions, ReferenceOneControllerState, } from "./controller/reference-one-controller.js";
|
|
@@ -64,10 +79,13 @@ export type { CsvImportError, CsvImportOptions, CsvImportReport, CsvImportState,
|
|
|
64
79
|
export { applyCsvMapping, csvSchemaFields, validateCsvRows, } from "./csv/validate-rows.js";
|
|
65
80
|
export { removeRecordsFromCache, updateRecordsInCache, } from "./data/cache-ops.js";
|
|
66
81
|
export { combineDataProviders } from "./data/combine-data-providers.js";
|
|
82
|
+
export type { DataProviderLog, DataProviderLogEntry, DataProviderLogOptions, } from "./data/data-provider-log.js";
|
|
83
|
+
export { createDataProviderLog } from "./data/data-provider-log.js";
|
|
67
84
|
export { ValidationError } from "./data/errors.js";
|
|
68
85
|
export { fakeDataProvider } from "./data/fake-provider.js";
|
|
69
86
|
export type { FetchJsonOptions, FetchJsonResult, } from "./data/fetch-utils.js";
|
|
70
87
|
export { fetchUtils } from "./data/fetch-utils.js";
|
|
88
|
+
export { isFilterBranch } from "./data/filter-branch.js";
|
|
71
89
|
export { getManyAggregateOptions } from "./data/get-many-aggregate.js";
|
|
72
90
|
export { HttpError } from "./data/http-error.js";
|
|
73
91
|
export { infiniteListKey, listKey, lockKey, locksKey, manyKey, manyReferenceKey, oneKey, resourceKey, } from "./data/keys.js";
|
|
@@ -84,38 +102,51 @@ export type { ApplicationUpdateSnapshot, ApplicationUpdateStoreOptions, } from "
|
|
|
84
102
|
export { createApplicationUpdateStore } from "./environment/application-update-store.js";
|
|
85
103
|
export type { OfflineSnapshot } from "./environment/offline-store.js";
|
|
86
104
|
export { createOfflineStore } from "./environment/offline-store.js";
|
|
87
|
-
export type { ArrayBinding, ArrayBindingOptions, ArrayBindingUpdateOptions, ArrayRow, } from "./form/array-binding.js";
|
|
105
|
+
export type { ArrayBinding, ArrayBindingOptions, ArrayBindingUpdateOptions, ArrayItemOf, ArrayRow, ItemDefaultsOf, } from "./form/array-binding.js";
|
|
88
106
|
export { createArrayBinding } from "./form/array-binding.js";
|
|
107
|
+
export { toIdentifierList } from "./form/choice-ids.js";
|
|
89
108
|
export type { ChoicesController, ChoicesControllerContext, ChoicesControllerOptions, ChoicesControllerState, } from "./form/choices-controller.js";
|
|
90
109
|
export { createChoicesController } from "./form/choices-controller.js";
|
|
110
|
+
export { formatDate, formatDateTime, formatTime, isValidDate, isValidDateTime, isValidTime, parseDateTimeToISO, parseTimeToDate, } from "./form/date-format.js";
|
|
91
111
|
export { getDirtyFormValues } from "./form/dirty-values.js";
|
|
112
|
+
export type { ParsedDuration } from "./form/duration.js";
|
|
113
|
+
export { compactDuration, parseIsoDuration, relativeDuration, } from "./form/duration.js";
|
|
92
114
|
export type { CreateFormController, CreateFormControllerOptions, CreateFormControllerState, EditFormController, EditFormControllerOptions, EditFormControllerState, FormControllerContext, } from "./form/edit-create-form.js";
|
|
93
115
|
export { createCreateFormController, createEditFormController, } from "./form/edit-create-form.js";
|
|
116
|
+
export { extractEventValue } from "./form/event-value.js";
|
|
117
|
+
export { firstFieldError } from "./form/field-error.js";
|
|
94
118
|
export { filterFormReflectShape, getFilterFormValues, mergeFilterValues, } from "./form/filter-form-values.js";
|
|
95
119
|
export type { AsyncValidator, CheloneFormApi, CheloneFormOptions, CheloneFormState, FieldErrors, FormController, FormControllerOptions, FormLevelValidate, SyncValidator, TranslatableMessage, } from "./form/form-controller.js";
|
|
96
120
|
export { createFormController, normalizeFormError, } from "./form/form-controller.js";
|
|
97
121
|
export type { FormGroups, FormGroupsListener, GroupFieldMeta, GroupState, } from "./form/form-groups.js";
|
|
98
122
|
export { createFormGroups, reduceGroupState } from "./form/form-groups.js";
|
|
99
|
-
export type {
|
|
123
|
+
export type { AmbientFieldMeta, AmbientForm, AnyFormHandle, FormContextHandle, FormContextHandleOf, FormHandle, HandleName, RecordMap, ResourceFormHandle, UnboundFormHandle, } from "./form/form-handle.js";
|
|
124
|
+
export { createFormHandle, isResourceHandle, toFormContextHandle, toResourceFormHandle, } from "./form/form-handle.js";
|
|
125
|
+
export type { CheloneFieldApi, CheloneFieldState, CheloneFieldStore, FieldBinding, FieldBindingOptions, FieldBindingUpdateOptions, FormattedValue, } from "./form/input-binding.js";
|
|
100
126
|
export { createFieldBinding, defaultFormat, defaultParse, } from "./form/input-binding.js";
|
|
127
|
+
export type { ChoiceValueOf, CurrencyComposite, DateInputValue, FileEntry, FileInputValue, FileSelection, FileWithPreview, FormValue, StoredFile, TransformedFile, WebhookValue, } from "./form/input-values.js";
|
|
128
|
+
export { choiceIdOf, fileEntryKey, fileEntryPreview, isTransformedFile, resolveChoiceValue, toBooleanValue, toChoiceValue, toChoiceValues, toCurrencyComposite, toCurrencyValue, toDateInputValue, toFileEntries, toFileInputValue, toFileSelection, toNullableBooleanValue, toNumberValue, toTextList, toTextValue, toWebhookValue, } from "./form/input-values.js";
|
|
101
129
|
export type { JsonShape } from "./form/json-text.js";
|
|
102
130
|
export { detectJsonShape, formatJsonValue, fromJsonText, toJsonText, } from "./form/json-text.js";
|
|
131
|
+
export { setFormValues } from "./form/set-form-values.js";
|
|
103
132
|
export type { SourceScope } from "./form/source.js";
|
|
104
133
|
export { composeSource, createArraySourceScope, createLocaleSourceScope, createRowSourceScope, rootSourceScope, } from "./form/source.js";
|
|
105
|
-
export
|
|
134
|
+
export { textOf } from "./form/text-of.js";
|
|
135
|
+
export type { FieldValidatorMeta, MessageFactory, RequiredValidator, ValidationErrorMessage, ValidationMessage, ValidationMessageParams, Validator, ValidatorResult, } from "./form/validators.js";
|
|
106
136
|
export { choices, composeValidators, email, isEmpty, isRequired, maxLength, maxValue, minLength, minValue, number, regex, required, } from "./form/validators.js";
|
|
107
137
|
export { aspectLockedBBox, bboxToPolygon, polygonToBBox } from "./geo/bbox.js";
|
|
138
|
+
export type { LngLatBox } from "./geo/bounds.js";
|
|
108
139
|
export { geoBounds, isLngLatBox } from "./geo/bounds.js";
|
|
109
140
|
export { countVertices, maxVertices, minAreaM2, minVertices, noSelfIntersection, } from "./geo/constraints.js";
|
|
110
141
|
export { latitude, longitude, toCoordinate } from "./geo/coordinates.js";
|
|
111
|
-
export type { EditorSnapshotFeature, EditorStyles } from "./geo/editor.js";
|
|
142
|
+
export type { EditorFeature, EditorSnapshotFeature, EditorStyles, } from "./geo/editor.js";
|
|
112
143
|
export { editorStyles, fromEditorFeatures, toEditorFeatures, } from "./geo/editor.js";
|
|
113
144
|
export type { GeocodeQuery, GeocodeQueryOptions, GeocodeRequestOptions, GeocodeResult, GeocodeSearchOptions, GeocodingProvider, ReverseGeocodeQueryOptions, } from "./geo/geocoding.js";
|
|
114
145
|
export { geocodeQueryOptions, reverseGeocodeQueryOptions, } from "./geo/geocoding.js";
|
|
115
|
-
export type {
|
|
116
|
-
export { isGeoBBox, isGeoFeature, isGeoFeatureCollection, isGeoGeometry, isGeoJsonValue, } from "./geo/geojson.js";
|
|
146
|
+
export type { Feature, FeatureCollection, Geometry, } from "./geo/geojson.js";
|
|
147
|
+
export { isGeoArea, isGeoBBox, isGeoFeature, isGeoFeatureCollection, isGeoGeometry, isGeoJsonValue, placedFeatures, } from "./geo/geojson.js";
|
|
117
148
|
export { areaInTypeOf, geoAreaM2, hasSelfIntersection, } from "./geo/geometry-math.js";
|
|
118
|
-
export type { ShapeLayerSpec, ShapeStyle } from "./geo/map-layers.js";
|
|
149
|
+
export type { CircleLayerSpec, FillLayerSpec, LineLayerSpec, ShapeLayerSpec, ShapeStyle, } from "./geo/map-layers.js";
|
|
119
150
|
export { asFeatureCollection, DEFAULT_SHAPE_STYLE, shapeLayerSpecs, } from "./geo/map-layers.js";
|
|
120
151
|
export type { MapStyleInput, MapStyleSpec, RasterTileStyleOptions, } from "./geo/map-style.js";
|
|
121
152
|
export { expandTileUrl, latLngToLngLat, lngLatToLatLng, rasterTileStyle, } from "./geo/map-style.js";
|
|
@@ -126,23 +157,29 @@ export type { OsmElementType, OsmPreset, OsmPresetName, OverpassQuerySources, }
|
|
|
126
157
|
export { buildOverpassQuery, findPresetForTags, OSM_PRESETS, } from "./geo/osm-presets.js";
|
|
127
158
|
export type { OsmTagFilter, OsmTagInput } from "./geo/osm-tags.js";
|
|
128
159
|
export { tagToFilter } from "./geo/osm-tags.js";
|
|
129
|
-
export type { OverpassProvider, OverpassProviderOptions, OverpassQuery, OverpassQueryOptions, OverpassRequestOptions, } from "./geo/overpass.js";
|
|
130
|
-
export { createOverpassProvider, OverpassError, OverpassRateLimitError, OverpassTimeoutError, overpassQueryOptions, } from "./geo/overpass.js";
|
|
160
|
+
export type { OverpassAnswer, OverpassElement, OverpassProvider, OverpassProviderOptions, OverpassQuery, OverpassQueryOptions, OverpassRequestOptions, } from "./geo/overpass.js";
|
|
161
|
+
export { createOverpassProvider, isOverpassAnswer, OverpassError, OverpassRateLimitError, OverpassTimeoutError, overpassQueryOptions, } from "./geo/overpass.js";
|
|
131
162
|
export type { FeaturesToShapeOptions, ShapeValue, ShapeValueKind, } from "./geo/shape-value.js";
|
|
132
163
|
export { featuresToShape, heldFeatures, shapeToFeatures, } from "./geo/shape-value.js";
|
|
133
164
|
export type { OsrmProviderOptions, RoutingProvider } from "./geo/snap-to-roads.js";
|
|
134
165
|
export { createOsrmProvider } from "./geo/snap-to-roads.js";
|
|
166
|
+
export type { JsonObject, JsonValue } from "./guards.js";
|
|
167
|
+
export { isRecord, isThenable } from "./guards.js";
|
|
135
168
|
export { defaultMessages } from "./i18n/default-messages.js";
|
|
136
169
|
export { englishMessages } from "./i18n/english-messages.js";
|
|
137
170
|
export type { AnyCheloneI18n, CheloneI18n } from "./i18n/i18n.js";
|
|
138
171
|
export { createI18n } from "./i18n/i18n.js";
|
|
139
|
-
export
|
|
140
|
-
export {
|
|
172
|
+
export { humanize, humanizeField, pluralize } from "./i18n/inflection.js";
|
|
173
|
+
export type { ExtractParams, MessageCatalog, MessageKey, MessageValue, PluralMessage, TranslateParams, TranslateParamValues, } from "./i18n/messages.js";
|
|
174
|
+
export { definedParams, defineMessages, pickTranslateParamValues, } from "./i18n/messages.js";
|
|
141
175
|
export type { MissingKeyEntry, MissingKeyStore, } from "./i18n/missing-keys.js";
|
|
142
176
|
export { createMissingKeyStore } from "./i18n/missing-keys.js";
|
|
143
|
-
export type { TranslatableController, TranslatableOptions, TranslatableState, } from "./i18n/translatable.js";
|
|
177
|
+
export type { RecordForLocale, TranslatableController, TranslatableOptions, TranslatableState, } from "./i18n/translatable.js";
|
|
144
178
|
export { createTranslatableController, getRecordForLocale, } from "./i18n/translatable.js";
|
|
179
|
+
export { deepEqual } from "./json/deep-equal.js";
|
|
145
180
|
export { stripJsonComments } from "./json/strip-json-comments.js";
|
|
181
|
+
export { noop } from "./noop.js";
|
|
182
|
+
export { errorMessageOf } from "./notification/error-message.js";
|
|
146
183
|
export type { Notification, NotificationStore, NotifyOptions, } from "./notification/notification-store.js";
|
|
147
184
|
export { createNotificationStore } from "./notification/notification-store.js";
|
|
148
185
|
export type { PlaceTourCardOptions, TourCardPosition, TourPlacement, TourRect, } from "./onboarding-tour/placement.js";
|
|
@@ -165,8 +202,10 @@ export type { MemoryTransport, MemoryTransportOptions, } from "./realtime/memory
|
|
|
165
202
|
export { memoryTransport } from "./realtime/memory-transport.js";
|
|
166
203
|
export type { PresenceSession, PresenceSessionDataProvider, PresenceSessionOptions, PresenceSessionState, PresenceUser, } from "./realtime/presence.js";
|
|
167
204
|
export { createPresenceSession, getPresenceInitials, toPresenceUser, } from "./realtime/presence.js";
|
|
168
|
-
export { assertRealtimeDataProvider, isRealtimeDataProvider, realtimeDataProvider, } from "./realtime/realtime-data-provider.js";
|
|
205
|
+
export { assertRealtimeDataProvider, hasTransportMembers, isRealtimeDataProvider, realtimeDataProvider, type TransportMembers, } from "./realtime/realtime-data-provider.js";
|
|
169
206
|
export type { RealtimeReconnectConfig } from "./realtime/reconnect-backoff.js";
|
|
207
|
+
export type { SseTransport, SseTransportOptions, } from "./realtime/sse-transport.js";
|
|
208
|
+
export { sseTransport } from "./realtime/sse-transport.js";
|
|
170
209
|
export type { RealtimeStatusState } from "./realtime/status-store.js";
|
|
171
210
|
export { createRealtimeStatusStore } from "./realtime/status-store.js";
|
|
172
211
|
export type { TopicHub } from "./realtime/topic-hub.js";
|
|
@@ -176,21 +215,28 @@ export type { GetLockParams, GetLocksParams, Lock, LockParams, LockProvider, Rea
|
|
|
176
215
|
export { LockConflictError } from "./realtime/types.js";
|
|
177
216
|
export type { SubscribeUnreadCountOptions } from "./realtime/unread-count.js";
|
|
178
217
|
export { clearUnread, subscribeUnreadCount, unreadKey, } from "./realtime/unread-count.js";
|
|
218
|
+
export type { WebSocketTransport, WebSocketTransportOptions, } from "./realtime/websocket-transport.js";
|
|
219
|
+
export { webSocketTransport } from "./realtime/websocket-transport.js";
|
|
179
220
|
export type { FieldComponentName, FieldDescriptor, FieldKind, InputComponentName, ResourceDescriptor, } from "./resource/describe-resource.js";
|
|
180
221
|
export { describeResource } from "./resource/describe-resource.js";
|
|
181
222
|
export { getAtPath } from "./resource/get-at-path.js";
|
|
182
223
|
export type { Identifier } from "./resource/identifier.js";
|
|
224
|
+
export { identifiersOf, isIdentifier, isIdentifierArray, } from "./resource/identifier.js";
|
|
183
225
|
export type { LooseRecord, ResourceRecord } from "./resource/record.js";
|
|
184
|
-
export
|
|
185
|
-
export type {
|
|
226
|
+
export { isLooseRecord, isResourceRecord } from "./resource/record.js";
|
|
227
|
+
export type { Register, RegisteredPermissions, RegisteredRecord, RegisteredResourceName, RegisteredResources, } from "./resource/register.js";
|
|
228
|
+
export type { RecordOf, RecordResources, ResourceConfig, ResourceMap, } from "./resource/registry.js";
|
|
186
229
|
export { defineResources } from "./resource/registry.js";
|
|
187
|
-
export type { ComputeDefinitionProps, ResourceDefinition, ResourceDefinitionMap, ResourceRegistry, ResourceRegistryListener, } from "./resource/registry-store.js";
|
|
230
|
+
export type { ComputeDefinitionProps, ResourceComponent, ResourceDefinition, ResourceDefinitionMap, ResourceIcon, ResourceRegistry, ResourceRegistryListener, ResourceRepresentation, ResourceSlots, } from "./resource/registry-store.js";
|
|
188
231
|
export { computeDefinition, createResourceRegistry, } from "./resource/registry-store.js";
|
|
189
|
-
export type { AnySourcePath, AnySourcePathOf, FilterSourceKey, RowSourcePath, SourceKey, SourcePath, SourceProp, SourceValue, } from "./resource/source-path.js";
|
|
232
|
+
export type { AnySourcePath, AnySourcePathOf, FilterSourceKey, RowSourcePath, SourceKey, SourcePath, SourceProp, SourceTransformValue, SourceValue, } from "./resource/source-path.js";
|
|
190
233
|
export type { IsSafeImageSrcOptions, RichTextBlockType, RichTextHeadingLevel, RichTextToolbarGroup, RichTextToolbarItem, RichTextToolbarItemId, } from "./rich-text/rich-text.js";
|
|
191
|
-
export { isSafeImageSrc, isSafeLinkUrl, richTextBlockTypes, richTextSanitizeOptions, richTextStarterKitOptions, richTextToolbarItems, } from "./rich-text/rich-text.js";
|
|
192
|
-
export type {
|
|
193
|
-
export {
|
|
234
|
+
export { isSafeFileUrl, isSafeImageSrc, isSafeLinkUrl, richTextBlockTypes, richTextSanitizeOptions, richTextStarterKitOptions, richTextToolbarItems, } from "./rich-text/rich-text.js";
|
|
235
|
+
export type { RichTextColor, RichTextColorPalette, RichTextExtraToolbarItem, RichTextExtraToolbarItemId, RichTextImageAction, RichTextImageActionId, RichTextImageRules, RichTextUpload, } from "./rich-text/rich-text-extras.js";
|
|
236
|
+
export { checkRichTextImageFile, clampRichTextImageWidth, defaultRichTextImageRules, endColorOnEnter, normalizeRichTextUpload, richTextCodeBlockOptions, richTextColors, richTextExtraToolbarItems, richTextImageActions, richTextImageFileName, richTextStyledSanitizeOptions, sanitizeRichTextStyle, } from "./rich-text/rich-text-extras.js";
|
|
237
|
+
export { copyRichTextImage, downloadRichTextImage, isRichTextImageConfigSource, prepareRichTextImages, type RichTextImageConfig, type RichTextImageError, type RichTextImageInput, type RichTextImageOptions, type RichTextStoredImage, type RichTextUploadResult, resolveRichTextImageConfig, richTextImageAttributes, richTextImageUploadState, sanitizeRichTextImageElement, setRichTextImageUploading, storeRichTextImageFile, } from "./rich-text/rich-text-image.js";
|
|
238
|
+
export type { CheloneLocation, LocationState, NavigateOpts, } from "./router/location.js";
|
|
239
|
+
export { parseLocation, toLocationState } from "./router/location.js";
|
|
194
240
|
export type { PathMatch } from "./router/match.js";
|
|
195
241
|
export { matchPath } from "./router/match.js";
|
|
196
242
|
export type { CreatePathParams, CreatePathType } from "./router/paths.js";
|
|
@@ -201,5 +247,6 @@ export { getRecordFromLocation } from "./router/record-from-location.js";
|
|
|
201
247
|
export { localStorageAdapter, memoryStoreAdapter } from "./store/adapters.js";
|
|
202
248
|
export type { MicroStore, MicroStoreOptions } from "./store/micro-store.js";
|
|
203
249
|
export { createMicroStore } from "./store/micro-store.js";
|
|
250
|
+
export { shallowEqual } from "./store/shallow-equal.js";
|
|
204
251
|
export type { CheloneStore, StoreAdapter } from "./store/store.js";
|
|
205
252
|
export { createStore } from "./store/store.js";
|