@selfhelp/shared 1.21.2 → 1.21.5
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/CHANGELOG.md +92 -0
- package/README.md +2 -1
- package/dist/index.d.mts +427 -20
- package/dist/index.d.ts +427 -20
- package/dist/index.js +560 -13
- package/dist/index.mjs +518 -13
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/plugin-sdk/index.js +2 -1
- package/dist/plugin-sdk/index.mjs +2 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +2 -1
- package/dist/registry/index.mjs +2 -1
- package/dist/{styles.registry-DEDEZ8l3.d.ts → styles.registry-DX79oirw.d.ts} +93 -16
- package/dist/{styles.registry-DHM4M77N.d.mts → styles.registry-ffw0MH3r.d.mts} +93 -16
- package/package.json +1 -1
- package/src/content/__tests__/fieldsMapLabels.test.ts +55 -0
- package/src/content/__tests__/optionLabels.test.ts +100 -0
- package/src/content/fieldsMapLabels.ts +103 -0
- package/src/content/index.ts +2 -0
- package/src/content/optionLabels.ts +200 -0
- package/src/navigation/__tests__/navigation.test.ts +296 -6
- package/src/navigation/activeTrail.ts +99 -0
- package/src/navigation/branchNav.ts +155 -6
- package/src/navigation/footerPreset.ts +109 -0
- package/src/navigation/headerLayers.ts +56 -0
- package/src/navigation/headerPreset.ts +9 -2
- package/src/navigation/index.ts +4 -0
- package/src/navigation/menuDepth.ts +73 -37
- package/src/navigation/mobileRoute.ts +25 -0
- package/src/navigation/navLinks.ts +0 -4
- package/src/navigation/navigationBundle.ts +81 -0
- package/src/navigation/navigationPayload.ts +96 -17
- package/src/registry/__tests__/platform.test.ts +11 -10
- package/src/registry/styles.registry.ts +2 -1
- package/src/types/__tests__/preview-bridge.test.ts +7 -0
- package/src/types/auth.ts +4 -0
- package/src/types/cms-app.ts +74 -0
- package/src/types/index.ts +1 -0
- package/src/types/mobile-adapters.ts +1 -0
- package/src/types/pages.ts +6 -0
- package/src/types/preview-bridge.ts +12 -1
- package/src/types/styles/composite.ts +21 -0
- package/src/types/styles/forms.ts +57 -10
- package/src/types/styles/interactive.ts +1 -1
- package/src/types/styles/unknown.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,98 @@ 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.5
|
|
14
|
+
|
|
15
|
+
Single publish of the DB-routing / CMS-apps / navigation / entry-binding wave
|
|
16
|
+
(previously staged as v2.0.0–v3.0.1 on this branch). Pairs with core `0.1.36`,
|
|
17
|
+
frontend `0.1.63`, and mobile consumers of this package.
|
|
18
|
+
|
|
19
|
+
### Entry table rename (breaking)
|
|
20
|
+
|
|
21
|
+
**`show-user-input` renamed to `entry-table`.**
|
|
22
|
+
|
|
23
|
+
The built-in admin CRUD grid style is now `entry-table` (backend migration
|
|
24
|
+
renames the `styles` row in lockstep; sections keep their `id_styles` FK, so
|
|
25
|
+
no content migration is needed).
|
|
26
|
+
|
|
27
|
+
- `IShowUserInputStyle` -> `IEntryTableStyle` (`style_name: 'entry-table'`),
|
|
28
|
+
`IShowUserInputEntry` -> `IEntryTableEntry`. No aliases are kept — consumers
|
|
29
|
+
must update imports and dispatcher keys.
|
|
30
|
+
- `IEntryTableEntry` gains `_can_edit?: boolean` (server-computed per-row edit
|
|
31
|
+
permission, mirroring `_can_delete`; same rule as `updateForm`: own record
|
|
32
|
+
always editable, foreign records need the table UPDATE permission on a
|
|
33
|
+
shared section).
|
|
34
|
+
- `STYLE_REGISTRY`: key `show-user-input` -> `entry-table`.
|
|
35
|
+
- `fields_map` / `fields_map_labels` helpers: `parseFieldsMapCatalog`,
|
|
36
|
+
`parseFieldsMapLabels`, `serializeFieldsMapCatalog`, `serializeFieldsMapLabels`,
|
|
37
|
+
and `FIELDS_MAP_STYLE_CONFIG`.
|
|
38
|
+
|
|
39
|
+
### Entry list / record / form binding
|
|
40
|
+
|
|
41
|
+
- `IEntryListStyle` / `IEntryRecordStyle` gain field-based binding:
|
|
42
|
+
`data_table`, `own_entries_only`, `filter`, `scope`; plus `load_as_table` /
|
|
43
|
+
`selected_columns` (list).
|
|
44
|
+
- `IEntryRecordStyle` uses `load_record_from` (route-param name, same contract
|
|
45
|
+
as `IEntryRecordFormStyle`) — not author `filter` / `url_param`.
|
|
46
|
+
- New `IEntryRecordFormStyle` (`style_name: 'entry-record-form'`) with
|
|
47
|
+
`load_record_from` for dual-route create/edit.
|
|
48
|
+
- `IFormRecordStyle` gains optional `load_record_from` + `own_entries_only`.
|
|
49
|
+
|
|
50
|
+
### CMS apps contract
|
|
51
|
+
|
|
52
|
+
- New `ICmsApp` / `ICmsAppDetail` / `ICmsAppSummary`, `ICmsAppPage`
|
|
53
|
+
(`ICmsAppAssignedPage` alias), and `TCmsAppRole` plus
|
|
54
|
+
`CMS_APP_ROLES` / `CMS_APP_PRIMARY_ROLES` for Host Admin CMS app shells.
|
|
55
|
+
- `PERMISSIONS` gains `ADMIN_CMS_APP_READ|CREATE|UPDATE|DELETE`
|
|
56
|
+
(`admin.cms_app.*`) — separate from `admin.page.*`.
|
|
57
|
+
|
|
58
|
+
### User-owned option labels
|
|
59
|
+
|
|
60
|
+
- New option catalog/label types and `parseOptionCatalog`,
|
|
61
|
+
`parseOptionLabels`, `resolveOptions`, `resolveOptionLabel`,
|
|
62
|
+
`parseOptionCodes`, and `resolveOptionValueLabels` helpers.
|
|
63
|
+
- Legacy `{value,text}` / `{value,label}` catalogs retain their display labels;
|
|
64
|
+
resolution follows active language, fallback language, legacy label, then code.
|
|
65
|
+
- `OPTION_STYLE_CONFIGS` is the shared select/radio/combobox/segmented-control
|
|
66
|
+
registry used by web/mobile renderers and the multilingual admin editor.
|
|
67
|
+
- Form style contracts gain translatable `option_labels`.
|
|
68
|
+
- Mobile adapter types support disabled select options.
|
|
69
|
+
|
|
70
|
+
### Navigation (strict contract)
|
|
71
|
+
|
|
72
|
+
- Strict `INavigationMenuItem` (every key always present). Items gain
|
|
73
|
+
`description`, `aria_label`, and `layer` (`'top' | null`).
|
|
74
|
+
- `INavigationMenu` drops free-form `config`; footer layout is a preset
|
|
75
|
+
(`columns` / `inline`) on `preset` (`TWebFooterPreset`).
|
|
76
|
+
- Modules: `headerLayers`, `footerPreset`, `activeTrail`, `navigationBundle`
|
|
77
|
+
(`selfhelp/navigation-bundle` **v2.0**), `branchNav` /
|
|
78
|
+
`resolveWebBranchNavContext`, `TNavigationChildrenNavMode`.
|
|
79
|
+
- `INavigationMenu.show_pager` / item override; `IBranchNavContext.showPager`.
|
|
80
|
+
- `INavigationBranding` on `INavigationPayload.branding` (`logo_url`,
|
|
81
|
+
`logo_alt`, `link_url`) plus `logo_size` / `logo_variant` and
|
|
82
|
+
`resolveBrandingPresentation` / `NAVIGATION_BRANDING_LOGO_HEIGHTS`.
|
|
83
|
+
- Path-based mobile preview navigation commands; DB-driven public routing
|
|
84
|
+
types (`GET /pages/resolve` metadata).
|
|
85
|
+
|
|
86
|
+
## v1.21.4
|
|
87
|
+
|
|
88
|
+
**Menu-builder payload slimming (patch)** — align shared navigation types with the
|
|
89
|
+
backend menu-builder contract. `INavigationMenuItem` drops virtual/exclusion
|
|
90
|
+
fields (`is_virtual`, `child_source`, `description`, `aria_label`) and keeps
|
|
91
|
+
item-level `icon` / `mobile_icon`; page refs no longer carry icons.
|
|
92
|
+
`getNavigationItemAriaLabel` falls back to the visible label only.
|
|
93
|
+
`TNavigationChildSource` is removed. Menu item ids are numeric only.
|
|
94
|
+
|
|
95
|
+
## v1.21.3
|
|
96
|
+
|
|
97
|
+
**Publish fix (patch)** — rebuild `dist/` so the published tarball includes the
|
|
98
|
+
root exports consumers already import from `@selfhelp/shared`: `ENDPOINTS`,
|
|
99
|
+
`API_VERSION_PREFIX`, `transformPageData`, navigation menu helpers
|
|
100
|
+
(`getNavigationItemHref`, `resolveWebBranchNavGroup`, `resolveHolderRedirectPath`,
|
|
101
|
+
…), and related types. The v1.21.2 npm artifact shipped a stale build missing
|
|
102
|
+
those symbols even though the source and changelog were already present.
|
|
103
|
+
|
|
12
104
|
## v1.21.2
|
|
13
105
|
|
|
14
106
|
**Menu-builder navigation depth and accessibility (patch)** — additive helpers for
|
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';
|