@object-ui/react 17.3.0 → 17.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +908 -0
  2. package/README.md +39 -13
  3. package/dist/SchemaRenderer.d.ts +78 -5
  4. package/dist/SchemaRenderer.js +139 -13
  5. package/dist/context/AppShellContext.d.ts +21 -2
  6. package/dist/context/RecordContext.d.ts +0 -4
  7. package/dist/context/RecordContext.js +0 -2
  8. package/dist/context/RelatedRecordActionsContext.d.ts +29 -0
  9. package/dist/context/RelatedRecordActionsContext.js +6 -0
  10. package/dist/element-data-source/ElementDataSourceGate.d.ts +199 -0
  11. package/dist/element-data-source/ElementDataSourceGate.js +195 -0
  12. package/dist/hooks/index.d.ts +3 -0
  13. package/dist/hooks/index.js +10 -0
  14. package/dist/hooks/useActionTextLocalizer.d.ts +69 -0
  15. package/dist/hooks/useActionTextLocalizer.js +91 -0
  16. package/dist/hooks/useDatasetDimensionLabels.d.ts +104 -0
  17. package/dist/hooks/useDatasetDimensionLabels.js +154 -0
  18. package/dist/hooks/useElementDataSource.d.ts +68 -0
  19. package/dist/hooks/useElementDataSource.js +138 -0
  20. package/dist/hooks/useExpression.d.ts +58 -0
  21. package/dist/hooks/useExpression.js +65 -0
  22. package/dist/hooks/useNavigationOverlay.d.ts +58 -10
  23. package/dist/hooks/useOffline.d.ts +62 -36
  24. package/dist/hooks/useOffline.js +2 -2
  25. package/dist/hooks/usePageAssignment.js +4 -4
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.js +5 -1
  28. package/dist/schema-input.d.ts +31 -0
  29. package/dist/schema-input.js +31 -0
  30. package/dist/spec-bridge/SpecBridge.d.ts +11 -5
  31. package/dist/spec-bridge/SpecBridge.js +7 -1
  32. package/dist/spec-bridge/bridges/list-view.js +106 -14
  33. package/dist/spec-bridge/types.d.ts +24 -3
  34. package/dist/utils/i18n.d.ts +43 -8
  35. package/dist/utils/i18n.js +42 -4
  36. package/package.json +8 -8
@@ -1,9 +1,47 @@
1
1
  /**
2
- * Resolves an I18nLabel to a plain string.
3
- * I18nLabel can be either a string or an object { key, defaultValue?, params? }.
4
- * When it's an object, we return the defaultValue or the key as fallback.
2
+ * Resolves objectui's KEYED i18n label to a plain string.
3
+ *
4
+ * The keyed form is `{ key, defaultValue?, params? }` — a reference INTO a
5
+ * translation bundle. This package has no `t()`, so it resolves the reference
6
+ * as far as it can without one: `defaultValue`, else the key itself. (The
7
+ * app-shell twin of this function takes a `t` and resolves the key properly.)
8
+ *
9
+ * ## Why this is not called `resolveI18nLabel` (objectui#4167)
10
+ *
11
+ * `@objectstack/spec` 17.0.0-rc.6 publishes a function of that exact name from
12
+ * `@objectstack/spec/ui`, over a DIFFERENT vocabulary: the INLINE LOCALE MAP
13
+ * (`{ en: 'Owner', 'zh-CN': '负责人' }`), resolved against a BCP-47 locale
14
+ * (`resolveI18nLabel(label, locale)`). Two resolvers, one name, and neither
15
+ * accepts the other's shape — which objectstack#4115 calls a planted premise
16
+ * rather than a naming nit, because the next agent reads the name and builds
17
+ * on it.
18
+ *
19
+ * rc.6 is also what made the clash dangerous rather than merely untidy. It
20
+ * widened the spec's `I18nLabel` from `string` to
21
+ * `string | Record< string, string >`, so the SAME authored value can now reach
22
+ * either function — and each answers wrongly for the other's input, silently:
23
+ *
24
+ * this one, given `{ en: 'Owner' }` → `undefined` (no `key`, no
25
+ * `defaultValue`) → renders empty;
26
+ * the spec's, given `{ key: 'nav.home' }` → treats `key`/`defaultValue`/
27
+ * `params` as locale tags and picks
28
+ * one of them as the display text.
29
+ *
30
+ * Neither is a type error at the call site that matters, and both look like a
31
+ * working render until someone reads the output. PR #4169 met this head-on and
32
+ * aliased the spec's import as `resolveInlineI18nLabel` in five files, with
33
+ * hand-written comments explaining the clash at two of them — a review
34
+ * convention, which is exactly what objectstack#4115 exists to replace with a
35
+ * rule. `Keyed` is the counterpart of that `Inline`: the name now says which
36
+ * vocabulary it resolves, at every call site, with no comment required.
37
+ *
38
+ * The keyed shape itself is now named too — `KeyedI18nLabel` in
39
+ * `@object-ui/types` (#4581) — so `BaseSchema.ariaLabel`, this parameter and
40
+ * the layout twin all state one type instead of three copies of one object
41
+ * literal. The `Inline`/`Keyed` split above is the naming half of #4167; the
42
+ * named shape is the declaration half.
5
43
  */
6
- export function resolveI18nLabel(label) {
44
+ export function resolveKeyedI18nLabel(label) {
7
45
  if (label === undefined || label === null)
8
46
  return undefined;
9
47
  if (typeof label === 'string')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/react",
3
- "version": "17.3.0",
3
+ "version": "17.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "React bindings and SchemaRenderer component for Object UI",
@@ -24,12 +24,12 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@objectstack/spec": "^17.0.0-rc.2",
28
- "react-hook-form": "^7.83.0",
29
- "@object-ui/core": "17.3.0",
30
- "@object-ui/data-objectstack": "17.3.0",
31
- "@object-ui/i18n": "17.3.0",
32
- "@object-ui/types": "17.3.0"
27
+ "@objectstack/spec": "^17.0.0-rc.6",
28
+ "react-hook-form": "^7.84.0",
29
+ "@object-ui/core": "17.5.0",
30
+ "@object-ui/data-objectstack": "17.5.0",
31
+ "@object-ui/i18n": "17.5.0",
32
+ "@object-ui/types": "17.5.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0 || ^19.0.0",
@@ -65,7 +65,7 @@
65
65
  "scripts": {
66
66
  "build": "tsc",
67
67
  "test": "vitest run",
68
- "type-check": "tsc --noEmit && tsc -p tsconfig.typetests.json",
68
+ "type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
69
69
  "lint": "eslint ."
70
70
  }
71
71
  }