@selfhelp/shared 1.0.5 → 1.1.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/CHANGELOG.md +15 -0
- package/dist/plugin-sdk/index.d.mts +53 -6
- package/dist/plugin-sdk/index.d.ts +53 -6
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/index.mjs +1 -1
- package/package.json +1 -1
- package/src/plugin-sdk/index.ts +2 -0
- package/src/plugin-sdk/registry.ts +3 -4
- package/src/plugin-sdk/types.ts +50 -0
- package/src/plugin-sdk/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning.
|
|
6
6
|
|
|
7
|
+
## [1.1.0] - 2026-05-25
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Plugin SDK field-renderer contracts:
|
|
12
|
+
`IFieldRendererDefinition`, `IPluginFieldRendererProps`, and
|
|
13
|
+
`fieldRenderers` on `IPluginRegistration`, so plugins can contribute
|
|
14
|
+
custom CMS section-field editor controls for plugin-owned field types.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Bumped `PLUGIN_API_VERSION` from `1.0` to `1.1` to reflect the new
|
|
19
|
+
additive plugin SDK surface.
|
|
20
|
+
- Re-exported the new field-renderer types from `@selfhelp/shared/plugin-sdk`.
|
|
21
|
+
|
|
7
22
|
## [1.0.4] - 2026-05-22
|
|
8
23
|
|
|
9
24
|
### Added
|
|
@@ -13,7 +13,7 @@ import '../common-B96dASgu.mjs';
|
|
|
13
13
|
*
|
|
14
14
|
* Independent from the npm `version` of `@selfhelp/shared`.
|
|
15
15
|
*/
|
|
16
|
-
declare const PLUGIN_API_VERSION: "1.
|
|
16
|
+
declare const PLUGIN_API_VERSION: "1.1";
|
|
17
17
|
interface ISemver {
|
|
18
18
|
major: number;
|
|
19
19
|
minor: number;
|
|
@@ -385,10 +385,9 @@ interface IPluginRegistryEntry {
|
|
|
385
385
|
/**
|
|
386
386
|
* Registry root document.
|
|
387
387
|
*
|
|
388
|
-
* Mirrors `plugin-registry.schema.json`. The
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* as a compatibility alias so existing consumers do not break.
|
|
388
|
+
* Mirrors `plugin-registry.schema.json`. The version field is named
|
|
389
|
+
* `registryVersion` (integer, bumped only on breaking registry-document
|
|
390
|
+
* changes).
|
|
392
391
|
*/
|
|
393
392
|
interface IPluginRegistry {
|
|
394
393
|
/** Registry schema generation. Bumped only on breaking registry-document changes. */
|
|
@@ -565,6 +564,47 @@ interface IStyleDefinition extends Omit<IStyleRegistryEntry, 'category'> {
|
|
|
565
564
|
/** Style implementation component (React or React Native). */
|
|
566
565
|
component: TPluginComponent;
|
|
567
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* Props passed by the host's section-field editor to a plugin-supplied
|
|
569
|
+
* field renderer. The host owns the surrounding label / help tooltip /
|
|
570
|
+
* type badge; the plugin only owns the actual input control.
|
|
571
|
+
*
|
|
572
|
+
* `field` is intentionally typed as a loose record because the host's
|
|
573
|
+
* `IFieldData` lives in the frontend repo and must not leak into the
|
|
574
|
+
* shared SDK contract — plugins read only what they need (id, name,
|
|
575
|
+
* config, default_value, etc.).
|
|
576
|
+
*/
|
|
577
|
+
interface IPluginFieldRendererProps {
|
|
578
|
+
/** Field id (database row id). */
|
|
579
|
+
fieldId: number;
|
|
580
|
+
/** Field name (DB `fields.name`). */
|
|
581
|
+
fieldName: string;
|
|
582
|
+
/** Field type (`fields.type`, e.g. `select-survey-js`). */
|
|
583
|
+
fieldType: string;
|
|
584
|
+
/** Current string value bound to the section_field translation. */
|
|
585
|
+
value: string;
|
|
586
|
+
/** Persist a new string value on the section_field translation. */
|
|
587
|
+
onChange: (value: string) => void;
|
|
588
|
+
/** Whether the input is disabled by the host. */
|
|
589
|
+
disabled?: boolean;
|
|
590
|
+
/** Loose pass-through of the host field row (config, default, help, ...). */
|
|
591
|
+
field?: Record<string, unknown>;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Field renderer contributed by a plugin. Replaces the host default
|
|
595
|
+
* editor control for the given `fieldType`. Used by the CMS
|
|
596
|
+
* section-field editor in the frontend repo so plugins can ship custom
|
|
597
|
+
* pickers (e.g. SurveyJS survey select) without the host having to
|
|
598
|
+
* hardcode plugin-specific UI in `FieldRenderer.tsx`.
|
|
599
|
+
*
|
|
600
|
+
* The component receives {@link IPluginFieldRendererProps}.
|
|
601
|
+
*/
|
|
602
|
+
interface IFieldRendererDefinition {
|
|
603
|
+
/** Field type discriminator (`fields.type`, e.g. `select-survey-js`). */
|
|
604
|
+
fieldType: string;
|
|
605
|
+
/** React component that renders the input control. */
|
|
606
|
+
component: TPluginComponent<IPluginFieldRendererProps>;
|
|
607
|
+
}
|
|
568
608
|
/**
|
|
569
609
|
* Admin page contributed by a plugin. Mounted under
|
|
570
610
|
* `/admin/plugins-host/{pluginId}/{slug}` in the frontend.
|
|
@@ -767,6 +807,13 @@ interface IPluginRegistration {
|
|
|
767
807
|
featureFlags?: IPluginFeatureFlag[];
|
|
768
808
|
/** Realtime topics the plugin publishes / subscribes to. */
|
|
769
809
|
realtimeTopics?: IPluginRealtimeTopic[];
|
|
810
|
+
/**
|
|
811
|
+
* CMS section-field editor renderers contributed by the plugin.
|
|
812
|
+
* Allows plugins to ship custom pickers for plugin-owned field types
|
|
813
|
+
* (declared in the plugin's Doctrine migration as new rows in
|
|
814
|
+
* `field_types`) without the host having to hardcode the renderer.
|
|
815
|
+
*/
|
|
816
|
+
fieldRenderers?: IFieldRendererDefinition[];
|
|
770
817
|
}
|
|
771
818
|
/**
|
|
772
819
|
* Returned by `defineMobilePlugin()` for the mobile side of a plugin.
|
|
@@ -903,4 +950,4 @@ interface IUsePluginRealtimeResult<TPayload = unknown> {
|
|
|
903
950
|
*/
|
|
904
951
|
declare function usePluginRealtime<TPayload = unknown>(options: IUsePluginRealtimeOptions<TPayload>): IUsePluginRealtimeResult<TPayload>;
|
|
905
952
|
|
|
906
|
-
export { type IAdminPageDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginManifest, type IPluginManifestAdminPage, type IPluginManifestApiRoute, type IPluginManifestAsset, type IPluginManifestCapability, type IPluginManifestCompatibility, type IPluginManifestConflict, type IPluginManifestDataAccess, type IPluginManifestDependency, type IPluginManifestExternalHost, type IPluginManifestFeatureFlag, type IPluginManifestHealth, type IPluginManifestLookupExtension, type IPluginManifestMobile, type IPluginManifestPermission, type IPluginManifestRealtimeTopic, type IPluginManifestScheduledJob, type IPluginManifestSecurity, type IPluginManifestStyle, type IPluginManifestTrustLevel, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRegistryEntry, type IPluginRegistryVersionEntry, type IRealtimeTransport, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, type TPluginRegistryChannel, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
|
953
|
+
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginManifest, type IPluginManifestAdminPage, type IPluginManifestApiRoute, type IPluginManifestAsset, type IPluginManifestCapability, type IPluginManifestCompatibility, type IPluginManifestConflict, type IPluginManifestDataAccess, type IPluginManifestDependency, type IPluginManifestExternalHost, type IPluginManifestFeatureFlag, type IPluginManifestHealth, type IPluginManifestLookupExtension, type IPluginManifestMobile, type IPluginManifestPermission, type IPluginManifestRealtimeTopic, type IPluginManifestScheduledJob, type IPluginManifestSecurity, type IPluginManifestStyle, type IPluginManifestTrustLevel, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRegistryEntry, type IPluginRegistryVersionEntry, type IRealtimeTransport, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, type TPluginRegistryChannel, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
|
@@ -13,7 +13,7 @@ import '../common-B96dASgu.js';
|
|
|
13
13
|
*
|
|
14
14
|
* Independent from the npm `version` of `@selfhelp/shared`.
|
|
15
15
|
*/
|
|
16
|
-
declare const PLUGIN_API_VERSION: "1.
|
|
16
|
+
declare const PLUGIN_API_VERSION: "1.1";
|
|
17
17
|
interface ISemver {
|
|
18
18
|
major: number;
|
|
19
19
|
minor: number;
|
|
@@ -385,10 +385,9 @@ interface IPluginRegistryEntry {
|
|
|
385
385
|
/**
|
|
386
386
|
* Registry root document.
|
|
387
387
|
*
|
|
388
|
-
* Mirrors `plugin-registry.schema.json`. The
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* as a compatibility alias so existing consumers do not break.
|
|
388
|
+
* Mirrors `plugin-registry.schema.json`. The version field is named
|
|
389
|
+
* `registryVersion` (integer, bumped only on breaking registry-document
|
|
390
|
+
* changes).
|
|
392
391
|
*/
|
|
393
392
|
interface IPluginRegistry {
|
|
394
393
|
/** Registry schema generation. Bumped only on breaking registry-document changes. */
|
|
@@ -565,6 +564,47 @@ interface IStyleDefinition extends Omit<IStyleRegistryEntry, 'category'> {
|
|
|
565
564
|
/** Style implementation component (React or React Native). */
|
|
566
565
|
component: TPluginComponent;
|
|
567
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* Props passed by the host's section-field editor to a plugin-supplied
|
|
569
|
+
* field renderer. The host owns the surrounding label / help tooltip /
|
|
570
|
+
* type badge; the plugin only owns the actual input control.
|
|
571
|
+
*
|
|
572
|
+
* `field` is intentionally typed as a loose record because the host's
|
|
573
|
+
* `IFieldData` lives in the frontend repo and must not leak into the
|
|
574
|
+
* shared SDK contract — plugins read only what they need (id, name,
|
|
575
|
+
* config, default_value, etc.).
|
|
576
|
+
*/
|
|
577
|
+
interface IPluginFieldRendererProps {
|
|
578
|
+
/** Field id (database row id). */
|
|
579
|
+
fieldId: number;
|
|
580
|
+
/** Field name (DB `fields.name`). */
|
|
581
|
+
fieldName: string;
|
|
582
|
+
/** Field type (`fields.type`, e.g. `select-survey-js`). */
|
|
583
|
+
fieldType: string;
|
|
584
|
+
/** Current string value bound to the section_field translation. */
|
|
585
|
+
value: string;
|
|
586
|
+
/** Persist a new string value on the section_field translation. */
|
|
587
|
+
onChange: (value: string) => void;
|
|
588
|
+
/** Whether the input is disabled by the host. */
|
|
589
|
+
disabled?: boolean;
|
|
590
|
+
/** Loose pass-through of the host field row (config, default, help, ...). */
|
|
591
|
+
field?: Record<string, unknown>;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Field renderer contributed by a plugin. Replaces the host default
|
|
595
|
+
* editor control for the given `fieldType`. Used by the CMS
|
|
596
|
+
* section-field editor in the frontend repo so plugins can ship custom
|
|
597
|
+
* pickers (e.g. SurveyJS survey select) without the host having to
|
|
598
|
+
* hardcode plugin-specific UI in `FieldRenderer.tsx`.
|
|
599
|
+
*
|
|
600
|
+
* The component receives {@link IPluginFieldRendererProps}.
|
|
601
|
+
*/
|
|
602
|
+
interface IFieldRendererDefinition {
|
|
603
|
+
/** Field type discriminator (`fields.type`, e.g. `select-survey-js`). */
|
|
604
|
+
fieldType: string;
|
|
605
|
+
/** React component that renders the input control. */
|
|
606
|
+
component: TPluginComponent<IPluginFieldRendererProps>;
|
|
607
|
+
}
|
|
568
608
|
/**
|
|
569
609
|
* Admin page contributed by a plugin. Mounted under
|
|
570
610
|
* `/admin/plugins-host/{pluginId}/{slug}` in the frontend.
|
|
@@ -767,6 +807,13 @@ interface IPluginRegistration {
|
|
|
767
807
|
featureFlags?: IPluginFeatureFlag[];
|
|
768
808
|
/** Realtime topics the plugin publishes / subscribes to. */
|
|
769
809
|
realtimeTopics?: IPluginRealtimeTopic[];
|
|
810
|
+
/**
|
|
811
|
+
* CMS section-field editor renderers contributed by the plugin.
|
|
812
|
+
* Allows plugins to ship custom pickers for plugin-owned field types
|
|
813
|
+
* (declared in the plugin's Doctrine migration as new rows in
|
|
814
|
+
* `field_types`) without the host having to hardcode the renderer.
|
|
815
|
+
*/
|
|
816
|
+
fieldRenderers?: IFieldRendererDefinition[];
|
|
770
817
|
}
|
|
771
818
|
/**
|
|
772
819
|
* Returned by `defineMobilePlugin()` for the mobile side of a plugin.
|
|
@@ -903,4 +950,4 @@ interface IUsePluginRealtimeResult<TPayload = unknown> {
|
|
|
903
950
|
*/
|
|
904
951
|
declare function usePluginRealtime<TPayload = unknown>(options: IUsePluginRealtimeOptions<TPayload>): IUsePluginRealtimeResult<TPayload>;
|
|
905
952
|
|
|
906
|
-
export { type IAdminPageDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginManifest, type IPluginManifestAdminPage, type IPluginManifestApiRoute, type IPluginManifestAsset, type IPluginManifestCapability, type IPluginManifestCompatibility, type IPluginManifestConflict, type IPluginManifestDataAccess, type IPluginManifestDependency, type IPluginManifestExternalHost, type IPluginManifestFeatureFlag, type IPluginManifestHealth, type IPluginManifestLookupExtension, type IPluginManifestMobile, type IPluginManifestPermission, type IPluginManifestRealtimeTopic, type IPluginManifestScheduledJob, type IPluginManifestSecurity, type IPluginManifestStyle, type IPluginManifestTrustLevel, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRegistryEntry, type IPluginRegistryVersionEntry, type IRealtimeTransport, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, type TPluginRegistryChannel, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
|
953
|
+
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginManifest, type IPluginManifestAdminPage, type IPluginManifestApiRoute, type IPluginManifestAsset, type IPluginManifestCapability, type IPluginManifestCompatibility, type IPluginManifestConflict, type IPluginManifestDataAccess, type IPluginManifestDependency, type IPluginManifestExternalHost, type IPluginManifestFeatureFlag, type IPluginManifestHealth, type IPluginManifestLookupExtension, type IPluginManifestMobile, type IPluginManifestPermission, type IPluginManifestRealtimeTopic, type IPluginManifestScheduledJob, type IPluginManifestSecurity, type IPluginManifestStyle, type IPluginManifestTrustLevel, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRegistryEntry, type IPluginRegistryVersionEntry, type IRealtimeTransport, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, type TPluginRegistryChannel, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
package/dist/plugin-sdk/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(plugin_sdk_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(plugin_sdk_exports);
|
|
37
37
|
|
|
38
38
|
// src/plugin-sdk/version.ts
|
|
39
|
-
var PLUGIN_API_VERSION = "1.
|
|
39
|
+
var PLUGIN_API_VERSION = "1.1";
|
|
40
40
|
var SEMVER_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
41
41
|
function parseSemver(version) {
|
|
42
42
|
const match = SEMVER_REGEX.exec(version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/src/plugin-sdk/index.ts
CHANGED
|
@@ -72,10 +72,9 @@ export interface IPluginRegistryEntry {
|
|
|
72
72
|
/**
|
|
73
73
|
* Registry root document.
|
|
74
74
|
*
|
|
75
|
-
* Mirrors `plugin-registry.schema.json`. The
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* as a compatibility alias so existing consumers do not break.
|
|
75
|
+
* Mirrors `plugin-registry.schema.json`. The version field is named
|
|
76
|
+
* `registryVersion` (integer, bumped only on breaking registry-document
|
|
77
|
+
* changes).
|
|
79
78
|
*/
|
|
80
79
|
export interface IPluginRegistry {
|
|
81
80
|
/** Registry schema generation. Bumped only on breaking registry-document changes. */
|
package/src/plugin-sdk/types.ts
CHANGED
|
@@ -40,6 +40,49 @@ export interface IStyleDefinition extends Omit<IStyleRegistryEntry, 'category'>
|
|
|
40
40
|
component: TPluginComponent;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Props passed by the host's section-field editor to a plugin-supplied
|
|
45
|
+
* field renderer. The host owns the surrounding label / help tooltip /
|
|
46
|
+
* type badge; the plugin only owns the actual input control.
|
|
47
|
+
*
|
|
48
|
+
* `field` is intentionally typed as a loose record because the host's
|
|
49
|
+
* `IFieldData` lives in the frontend repo and must not leak into the
|
|
50
|
+
* shared SDK contract — plugins read only what they need (id, name,
|
|
51
|
+
* config, default_value, etc.).
|
|
52
|
+
*/
|
|
53
|
+
export interface IPluginFieldRendererProps {
|
|
54
|
+
/** Field id (database row id). */
|
|
55
|
+
fieldId: number;
|
|
56
|
+
/** Field name (DB `fields.name`). */
|
|
57
|
+
fieldName: string;
|
|
58
|
+
/** Field type (`fields.type`, e.g. `select-survey-js`). */
|
|
59
|
+
fieldType: string;
|
|
60
|
+
/** Current string value bound to the section_field translation. */
|
|
61
|
+
value: string;
|
|
62
|
+
/** Persist a new string value on the section_field translation. */
|
|
63
|
+
onChange: (value: string) => void;
|
|
64
|
+
/** Whether the input is disabled by the host. */
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
/** Loose pass-through of the host field row (config, default, help, ...). */
|
|
67
|
+
field?: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Field renderer contributed by a plugin. Replaces the host default
|
|
72
|
+
* editor control for the given `fieldType`. Used by the CMS
|
|
73
|
+
* section-field editor in the frontend repo so plugins can ship custom
|
|
74
|
+
* pickers (e.g. SurveyJS survey select) without the host having to
|
|
75
|
+
* hardcode plugin-specific UI in `FieldRenderer.tsx`.
|
|
76
|
+
*
|
|
77
|
+
* The component receives {@link IPluginFieldRendererProps}.
|
|
78
|
+
*/
|
|
79
|
+
export interface IFieldRendererDefinition {
|
|
80
|
+
/** Field type discriminator (`fields.type`, e.g. `select-survey-js`). */
|
|
81
|
+
fieldType: string;
|
|
82
|
+
/** React component that renders the input control. */
|
|
83
|
+
component: TPluginComponent<IPluginFieldRendererProps>;
|
|
84
|
+
}
|
|
85
|
+
|
|
43
86
|
/**
|
|
44
87
|
* Admin page contributed by a plugin. Mounted under
|
|
45
88
|
* `/admin/plugins-host/{pluginId}/{slug}` in the frontend.
|
|
@@ -247,6 +290,13 @@ export interface IPluginRegistration {
|
|
|
247
290
|
featureFlags?: IPluginFeatureFlag[];
|
|
248
291
|
/** Realtime topics the plugin publishes / subscribes to. */
|
|
249
292
|
realtimeTopics?: IPluginRealtimeTopic[];
|
|
293
|
+
/**
|
|
294
|
+
* CMS section-field editor renderers contributed by the plugin.
|
|
295
|
+
* Allows plugins to ship custom pickers for plugin-owned field types
|
|
296
|
+
* (declared in the plugin's Doctrine migration as new rows in
|
|
297
|
+
* `field_types`) without the host having to hardcode the renderer.
|
|
298
|
+
*/
|
|
299
|
+
fieldRenderers?: IFieldRendererDefinition[];
|
|
250
300
|
}
|
|
251
301
|
|
|
252
302
|
/**
|
|
@@ -14,7 +14,7 @@ SPDX-License-Identifier: MPL-2.0
|
|
|
14
14
|
*
|
|
15
15
|
* Independent from the npm `version` of `@selfhelp/shared`.
|
|
16
16
|
*/
|
|
17
|
-
export const PLUGIN_API_VERSION = '1.
|
|
17
|
+
export const PLUGIN_API_VERSION = '1.1' as const;
|
|
18
18
|
|
|
19
19
|
export interface ISemver {
|
|
20
20
|
major: number;
|