@selfhelp/shared 1.21.3 → 1.21.6

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 (53) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +2 -1
  3. package/dist/index.d.mts +519 -24
  4. package/dist/index.d.ts +519 -24
  5. package/dist/index.js +723 -18
  6. package/dist/index.mjs +674 -18
  7. package/dist/plugin-sdk/index.d.mts +1 -1
  8. package/dist/plugin-sdk/index.d.ts +1 -1
  9. package/dist/plugin-sdk/index.js +2 -1
  10. package/dist/plugin-sdk/index.mjs +2 -1
  11. package/dist/registry/index.d.mts +2 -2
  12. package/dist/registry/index.d.ts +2 -2
  13. package/dist/registry/index.js +2 -1
  14. package/dist/registry/index.mjs +2 -1
  15. package/dist/{styles.registry-DEDEZ8l3.d.ts → styles.registry-DX79oirw.d.ts} +93 -16
  16. package/dist/{styles.registry-DHM4M77N.d.mts → styles.registry-ffw0MH3r.d.mts} +93 -16
  17. package/package.json +1 -1
  18. package/src/api/__tests__/endpoints.test.ts +37 -12
  19. package/src/api/endpoints.ts +5 -5
  20. package/src/api/index.ts +1 -0
  21. package/src/api/pagesResolve.ts +78 -0
  22. package/src/content/__tests__/fieldsMapLabels.test.ts +55 -0
  23. package/src/content/__tests__/formRecordPrefill.test.ts +104 -0
  24. package/src/content/__tests__/optionLabels.test.ts +100 -0
  25. package/src/content/fieldsMapLabels.ts +103 -0
  26. package/src/content/formRecordPrefill.ts +191 -0
  27. package/src/content/index.ts +3 -0
  28. package/src/content/optionLabels.ts +200 -0
  29. package/src/navigation/__tests__/navigation.test.ts +296 -6
  30. package/src/navigation/activeTrail.ts +99 -0
  31. package/src/navigation/branchNav.ts +155 -6
  32. package/src/navigation/footerPreset.ts +109 -0
  33. package/src/navigation/headerLayers.ts +56 -0
  34. package/src/navigation/headerPreset.ts +9 -2
  35. package/src/navigation/index.ts +4 -0
  36. package/src/navigation/menuDepth.ts +73 -37
  37. package/src/navigation/mobileRoute.ts +25 -0
  38. package/src/navigation/navLinks.ts +0 -4
  39. package/src/navigation/navigationBundle.ts +81 -0
  40. package/src/navigation/navigationPayload.ts +96 -17
  41. package/src/registry/__tests__/platform.test.ts +11 -10
  42. package/src/registry/styles.registry.ts +2 -1
  43. package/src/types/__tests__/preview-bridge.test.ts +7 -0
  44. package/src/types/auth.ts +4 -0
  45. package/src/types/cms-app.ts +74 -0
  46. package/src/types/index.ts +1 -0
  47. package/src/types/mobile-adapters.ts +1 -0
  48. package/src/types/pages.ts +6 -0
  49. package/src/types/preview-bridge.ts +22 -2
  50. package/src/types/styles/composite.ts +21 -0
  51. package/src/types/styles/forms.ts +57 -10
  52. package/src/types/styles/interactive.ts +1 -1
  53. package/src/types/styles/unknown.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -9,6 +9,112 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
9
9
 
10
10
  This project follows semantic versioning.
11
11
 
12
+
13
+ ## v1.21.6
14
+
15
+ Unreleased wave cleanup (pairs with core `0.1.36`, frontend `0.1.63`, mobile
16
+ `supports.core >=0.1.36`).
17
+
18
+ ### Canonical public page resolve helper
19
+
20
+ - `buildPagesResolveUrl` / `buildPagesResolvePath` / `buildPagesResolveQuery` /
21
+ `normalizePagesResolvePath` — single encoding for `path`, `language_id`, and
22
+ `preview` used by frontend SSR, frontend browser client, and mobile.
23
+ - `ENDPOINTS.PAGES.RESOLVE_ROUTE` is the static `/cms-api/v1/pages/resolve`
24
+ path; the old `ENDPOINTS.PAGES.RESOLVE(path)` builder is removed (no alias).
25
+
26
+ ### Form-record prefill
27
+
28
+ - `parseFormRecordPrefill` + `flattenFormRecordPrefillValues` — shared
29
+ `section_data` → form prefill map (web + mobile).
30
+
31
+ ### Preview bridge
32
+
33
+ - `IPreviewNavigatedMessage.path` — optional public CMS path so the shell can
34
+ re-resolve parameterized routes via `/pages/resolve`.
35
+
36
+ ## v1.21.5
37
+
38
+ Single publish of the DB-routing / CMS-apps / navigation / entry-binding wave
39
+ (previously staged as v2.0.0–v3.0.1 on this branch). Pairs with core `0.1.36`,
40
+ frontend `0.1.63`, and mobile consumers of this package.
41
+
42
+ ### Entry table rename (breaking)
43
+
44
+ **`show-user-input` renamed to `entry-table`.**
45
+
46
+ The built-in admin CRUD grid style is now `entry-table` (backend migration
47
+ renames the `styles` row in lockstep; sections keep their `id_styles` FK, so
48
+ no content migration is needed).
49
+
50
+ - `IShowUserInputStyle` -> `IEntryTableStyle` (`style_name: 'entry-table'`),
51
+ `IShowUserInputEntry` -> `IEntryTableEntry`. No aliases are kept — consumers
52
+ must update imports and dispatcher keys.
53
+ - `IEntryTableEntry` gains `_can_edit?: boolean` (server-computed per-row edit
54
+ permission, mirroring `_can_delete`; same rule as `updateForm`: own record
55
+ always editable, foreign records need the table UPDATE permission on a
56
+ shared section).
57
+ - `STYLE_REGISTRY`: key `show-user-input` -> `entry-table`.
58
+ - `fields_map` / `fields_map_labels` helpers: `parseFieldsMapCatalog`,
59
+ `parseFieldsMapLabels`, `serializeFieldsMapCatalog`, `serializeFieldsMapLabels`,
60
+ and `FIELDS_MAP_STYLE_CONFIG`.
61
+
62
+ ### Entry list / record / form binding
63
+
64
+ - `IEntryListStyle` / `IEntryRecordStyle` gain field-based binding:
65
+ `data_table`, `own_entries_only`, `filter`, `scope`; plus `load_as_table` /
66
+ `selected_columns` (list).
67
+ - `IEntryRecordStyle` uses `load_record_from` (route-param name, same contract
68
+ as `IEntryRecordFormStyle`) — not author `filter` / `url_param`.
69
+ - New `IEntryRecordFormStyle` (`style_name: 'entry-record-form'`) with
70
+ `load_record_from` for dual-route create/edit.
71
+ - `IFormRecordStyle` gains optional `load_record_from` + `own_entries_only`.
72
+
73
+ ### CMS apps contract
74
+
75
+ - New `ICmsApp` / `ICmsAppDetail` / `ICmsAppSummary`, `ICmsAppPage`
76
+ (`ICmsAppAssignedPage` alias), and `TCmsAppRole` plus
77
+ `CMS_APP_ROLES` / `CMS_APP_PRIMARY_ROLES` for Host Admin CMS app shells.
78
+ - `PERMISSIONS` gains `ADMIN_CMS_APP_READ|CREATE|UPDATE|DELETE`
79
+ (`admin.cms_app.*`) — separate from `admin.page.*`.
80
+
81
+ ### User-owned option labels
82
+
83
+ - New option catalog/label types and `parseOptionCatalog`,
84
+ `parseOptionLabels`, `resolveOptions`, `resolveOptionLabel`,
85
+ `parseOptionCodes`, and `resolveOptionValueLabels` helpers.
86
+ - Legacy `{value,text}` / `{value,label}` catalogs retain their display labels;
87
+ resolution follows active language, fallback language, legacy label, then code.
88
+ - `OPTION_STYLE_CONFIGS` is the shared select/radio/combobox/segmented-control
89
+ registry used by web/mobile renderers and the multilingual admin editor.
90
+ - Form style contracts gain translatable `option_labels`.
91
+ - Mobile adapter types support disabled select options.
92
+
93
+ ### Navigation (strict contract)
94
+
95
+ - Strict `INavigationMenuItem` (every key always present). Items gain
96
+ `description`, `aria_label`, and `layer` (`'top' | null`).
97
+ - `INavigationMenu` drops free-form `config`; footer layout is a preset
98
+ (`columns` / `inline`) on `preset` (`TWebFooterPreset`).
99
+ - Modules: `headerLayers`, `footerPreset`, `activeTrail`, `navigationBundle`
100
+ (`selfhelp/navigation-bundle` **v2.0**), `branchNav` /
101
+ `resolveWebBranchNavContext`, `TNavigationChildrenNavMode`.
102
+ - `INavigationMenu.show_pager` / item override; `IBranchNavContext.showPager`.
103
+ - `INavigationBranding` on `INavigationPayload.branding` (`logo_url`,
104
+ `logo_alt`, `link_url`) plus `logo_size` / `logo_variant` and
105
+ `resolveBrandingPresentation` / `NAVIGATION_BRANDING_LOGO_HEIGHTS`.
106
+ - Path-based mobile preview navigation commands; DB-driven public routing
107
+ types (`GET /pages/resolve` metadata).
108
+
109
+ ## v1.21.4
110
+
111
+ **Menu-builder payload slimming (patch)** — align shared navigation types with the
112
+ backend menu-builder contract. `INavigationMenuItem` drops virtual/exclusion
113
+ fields (`is_virtual`, `child_source`, `description`, `aria_label`) and keeps
114
+ item-level `icon` / `mobile_icon`; page refs no longer carry icons.
115
+ `getNavigationItemAriaLabel` falls back to the visible label only.
116
+ `TNavigationChildSource` is removed. Menu item ids are numeric only.
117
+
12
118
  ## v1.21.3
13
119
 
14
120
  **Publish fix (patch)** — rebuild `dist/` so the published tarball includes the
package/README.md CHANGED
@@ -11,6 +11,7 @@ The shared TypeScript foundation for the SelfHelp ecosystem. It is the single so
11
11
  - API request/response contracts
12
12
  - shared theme tokens and a Tailwind preset
13
13
  - condition and interpolation helpers that mirror backend behavior
14
+ - user-owned option catalog parsing and translated-label resolution
14
15
  - CMS class allow-listing and asset URL utilities
15
16
 
16
17
  ## Install
@@ -28,7 +29,7 @@ For local development against sibling repositories you can use a file dependency
28
29
  ## Quick usage
29
30
 
30
31
  ```ts
31
- import { ENDPOINTS, replaceCalcedValues, resolveAssetUrl } from '@selfhelp/shared';
32
+ import { ENDPOINTS, replaceCalcedValues, resolveAssetUrl, resolveOptions } from '@selfhelp/shared';
32
33
  import type { IPageContent, IUserDataResponse } from '@selfhelp/shared';
33
34
 
34
35
  import { STYLE_REGISTRY } from '@selfhelp/shared/registry';