Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
71a47fb
TASK: Introduce api to use global state for global registry
mhsdesign Oct 13, 2025
95b3b25
TASK: Introduce dedicated package `@neos-project/neos-ui-registry` to…
mhsdesign Oct 13, 2025
cb1c020
TASK: Move `SynchronousRegistry` and `SynchronousMetaRegistry` to new…
mhsdesign Oct 13, 2025
74faaf1
TASK: Add correct typescript typing to `manifest()` function
mhsdesign Oct 13, 2025
ff0f61a
TASK: Move `GlobalRegistry` type to `neos-ui-registry` and use ts mod…
mhsdesign Oct 13, 2025
4695e4d
TASK: Move `GlobalRegistry` "i18n" overload to i18n package
mhsdesign Oct 13, 2025
0ef0146
TASK: Move `GlobalRegistry` "validators" overload to validators package
mhsdesign Oct 13, 2025
4bfc77a
TASK: Also re-export `SynchronousMetaRegistry` as its used in the neo…
mhsdesign Oct 13, 2025
e235199
TASK: Solve `SynchronousMetaRegistry` vs `GlobalRegistry` type riddle
mhsdesign Oct 13, 2025
7995f3e
TASK: Move `NodeTypesRegistry` type to `@neos-project/neos-ui-content…
mhsdesign Oct 13, 2025
29163a8
PATCH: Fix typescript type for `referenceGrandParentNodeType` to allo…
mhsdesign Oct 13, 2025
e82c678
PATCH: Fix dangerous ! double quotes
mhsdesign Oct 13, 2025
c5daebe
TASK: Dont expose ui-internal createConsumerApi and readFromConsumerA…
mhsdesign Oct 17, 2025
bbb3419
PATCH: Fix NMP build of `@neos-project/neos-ui-extensibility` by sepa…
mhsdesign Oct 15, 2025
d4bd548
PATCH: Remove dependency to `@neos-project/positional-array-sorter` i…
mhsdesign Oct 28, 2025
ab14d04
TASK: Document plugin-api.js
mhsdesign Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions packages/neos-ts-interfaces/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type {I18nRegistry} from '@neos-project/neos-ui-i18n';

export type NodeContextPath = string;
export type FusionPath = string;
export type NodeTypeName = string;
Expand Down Expand Up @@ -252,27 +250,3 @@ export interface Change extends Readonly<{
value: any;
};
}> {}

// TODO: move to nodetypesregistry itself
export interface NodeTypesRegistry {
get: (nodeType: NodeTypeName) => NodeType | null;
getRole: (roleName: string) => NodeTypeName | null;
getSubTypesOf: (nodeType: NodeTypeName) => NodeTypeName[];
getAllowedNodeTypesTakingAutoCreatedIntoAccount: (isSubjectNodeAutocreated: boolean, referenceParentName: string, referenceParentNodeType: NodeTypeName, referenceGrandParentNodeType: NodeTypeName | null, role: string) => NodeTypeName[];
}

// TODO: move to validatorsregistry itself
type Validator = (
values: {},
elementConfigurations: any
) => null | {} | string;
export interface ValidatorRegistry {
get: (validatorName: string) => Validator | null;
set: (validatorName: string, validator: Validator) => void;
}
export interface GlobalRegistry {
get: <K extends string>(key: K) => K extends 'i18n' ? I18nRegistry :
K extends 'validators' ? ValidatorRegistry : null;
}

export type {I18nRegistry} from '@neos-project/neos-ui-i18n';
2 changes: 1 addition & 1 deletion packages/neos-ui-ckeditor5-bindings/src/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import manifest from '@neos-project/neos-ui-extensibility';

import InlineEditorToolbar from './EditorToolbar';
import {bootstrap, createEditor} from './ckEditorApi';
import {SynchronousMetaRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousMetaRegistry} from '@neos-project/neos-ui-registry';

import initializeRichtextToolbarRegistry from './manifest.richtextToolbar';
import initializeConfigRegistry from './manifest.config';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

export default class CkEditorConfigRegistry extends SynchronousRegistry {
getCkeditorConfig(additionalInformation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

export default class RichTextToolbarRegistry extends SynchronousRegistry {
}
2 changes: 1 addition & 1 deletion packages/neos-ui-ckeditor5-bindings/tests/manual/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import initializeConfigRegistry from '../../src/manifest.config';
import {bootstrap, createEditor} from '../../src/ckEditorApi';

import { SynchronousRegistry, SynchronousMetaRegistry } from '@neos-project/neos-ui-extensibility';
import {SynchronousRegistry, SynchronousMetaRegistry} from '@neos-project/neos-ui-registry';

const fakeGlobalRegistry = new SynchronousMetaRegistry();

Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui-contentrepository/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "",
"description": "Bindings for the Neos ContentRepository",
"private": true,
"main": "./src/manifest.js",
"main": "./src/index.ts",
"devDependencies": {
"@neos-project/jest-preset-neos-ui": "workspace:*",
"typescript": "^4.6.4"
Expand Down
2 changes: 2 additions & 0 deletions packages/neos-ui-contentrepository/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export type {NodeTypesRegistry} from './registry';
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ manifest('@neos-project/neos-ui-contentrepository', {}, globalRegistry => {
`)
);
});

declare module '@neos-project/neos-ui-registry' {
interface GlobalRegistry {
get(key: '@neos-project/neos-ui-contentrepository'): NodeTypesRegistry;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import merge from 'lodash.merge';
import mapValues from 'lodash.mapvalues';

import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';
import positionalArraySorter from '@neos-project/positional-array-sorter/src/positionalArraySorter';
import {NodeTypeName, NodeType} from '@neos-project/neos-ts-interfaces';

Expand Down Expand Up @@ -105,7 +105,7 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
return [];
}

public getAllowedNodeTypesTakingAutoCreatedIntoAccount(isSubjectNodeAutocreated: boolean, referenceParentName: string, referenceParentNodeType: string, referenceGrandParentNodeType: string, role: string): NodeTypeName[] {
public getAllowedNodeTypesTakingAutoCreatedIntoAccount(isSubjectNodeAutocreated: boolean, referenceParentName: string, referenceParentNodeType: string, referenceGrandParentNodeType: string | null, role: string): NodeTypeName[] {
let result;
if (isSubjectNodeAutocreated) {
if (!referenceGrandParentNodeType) {
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion packages/neos-ui-decorators/src/neos.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {defaultMemoize} from 'reselect';
import {GlobalRegistry} from '@neos-project/neos-ts-interfaces';
import {GlobalRegistry} from '@neos-project/neos-ui-registry';

// We need to memoize configuration and global registry; otherwise a new object is created at every render; leading to
// LOADS of unnecessary re-draws.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {processSelectBoxOptions} from './selectBoxHelpers';
import {I18nRegistry} from '@neos-project/neos-ts-interfaces';
import type {I18nRegistry} from '@neos-project/neos-ui-i18n';

const fakeI18NRegistry = {
translate: (id) => id ?? ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {I18nRegistry} from '@neos-project/neos-ts-interfaces';
import type {I18nRegistry} from '@neos-project/neos-ui-i18n';
import {isNil} from '@neos-project/utils-helpers';
import {
createSelectBoxValueStringFromPossiblyStrangeNodePropertyValue
Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui-editors/src/_lib/testUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {PureComponent, Children} from 'react';
import PropTypes from 'prop-types';
import {SynchronousRegistry, SynchronousMetaRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry, SynchronousMetaRegistry} from '@neos-project/neos-ui-registry';
import {NeosContext} from '@neos-project/neos-ui-decorators';

const globalRegistry = new SynchronousMetaRegistry();
Expand Down
1 change: 1 addition & 0 deletions packages/neos-ui-extensibility/extensibilityMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"@neos-project/neos-ui-redux-store": "@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-redux-store",
"@neos-project/neos-ui-views": "@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-views",
"@neos-project/neos-ui-guest-frame": "@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-guest-frame",
"@neos-project/neos-ui-registry": "@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-registry",
"@neos-project/utils-redux": "@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/utils-redux"
}
10 changes: 2 additions & 8 deletions packages/neos-ui-extensibility/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@
"homepage": "https://github.com/neos/neos-ui/blob/master/README.md",
"main": "./src/index.ts",
"publishConfig": {
"main": "./dist/index.js"
"main": "./plugin-api.js"
},
"files": [
"dist",
"plugin-api.js",
"extensibilityMap.json"
],
"scripts": {
"build": "yarn tsc --declaration"
},
"devDependencies": {
"@neos-project/jest-preset-neos-ui": "workspace:*",
"typescript": "^4.6.4"
},
"dependencies": {
"@neos-project/positional-array-sorter": "workspace:*"
}
}
29 changes: 29 additions & 0 deletions packages/neos-ui-extensibility/plugin-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* This file is the entry point for neos ui plugins.
* Require it via import '@neos-project/neos-ui-extensibility'
*
* **Internals**
* This file wired via the "publishConfig.main" but not used for building the Neos.Ui itself.
* The internal methods createConsumerApi() and readFromConsumerApi() are this way not exposed to plugins.
* Also, the readFromConsumerApi() call below to expose the "SynchronousRegistry" does not work in our host code.
*/

import readFromConsumerApi from './dist/readFromConsumerApi';

/**
* Central function exposed to register a JavaScript package.
*
* import manifest from '@neos-project/neos-ui-extensibility'
*
* manifest('@my-vendor/my-plugin', {}, (globalRegistry, {store}) => {
* // ...
* })
*/
const manifest = readFromConsumerApi('manifest');
export default manifest;

/**
* @deprecated legacy code to support `import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility'` please use `import {SynchronousRegistry} from '@neos-project/neos-ui-registry'` instead!
*/
const {SynchronousRegistry, SynchronousMetaRegistry} = readFromConsumerApi('NeosProjectPackages')().NeosUiRegistry;
export { SynchronousRegistry, SynchronousMetaRegistry };
8 changes: 1 addition & 7 deletions packages/neos-ui-extensibility/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import createConsumerApi from './createConsumerApi';
import readFromConsumerApi from './readFromConsumerApi';
import {
SynchronousRegistry,
SynchronousMetaRegistry
} from './registry/index';

export default readFromConsumerApi('manifest');

export {
createConsumerApi,
readFromConsumerApi,
SynchronousRegistry,
SynchronousMetaRegistry
readFromConsumerApi
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import readFromConsumerApi from '../../../readFromConsumerApi';

module.exports = readFromConsumerApi('NeosProjectPackages')().NeosUiRegistry;
29 changes: 29 additions & 0 deletions packages/neos-ui-extensibility/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/**
* Dedicated types declaration as we cannot bundle the types GlobalRegistry, Configuration correctly for distributing "neos-ui-extensibility" via NMP
* This file is not published.
*/
declare module '@neos-project/neos-ui-extensibility' {
import type {GlobalRegistry} from '@neos-project/neos-ui-registry';

type BootstrapDependencies = {
// correct store type depends on https://github.com/neos/neos-ui/pull/4010
store: any;
/** @deprecated use `import {getFrontendConfigurationForPackage} from '@neos-project/neos-ui-configuration'` instead */
frontendConfiguration: Record<string, any>;
configuration: Record<string, any>;
routes: Record<string, unknown>;
};

type Bootstrap = (
globalRegistry: GlobalRegistry,
bootstrapDependencies: BootstrapDependencies
) => void;

export default function manifest(
identifier: string,
// the age-old commit a2dae5b78a649ad75643f48b02b6df67f5915a58 introduced this parameter "options" though we not make use of it
options: {},
bootstrap: Bootstrap
): void;
}
2 changes: 1 addition & 1 deletion packages/neos-ui-guest-frame/src/manifest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import manifest from '@neos-project/neos-ui-extensibility';
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

import makeInitializeGuestFrame from './initializeGuestFrame';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import manifest from '@neos-project/neos-ui-extensibility';

import type {I18nRegistry} from './registry';
import {i18nRegistry} from './registry';

manifest('@neos-project/neos-ui-i18n', {}, globalRegistry => {
globalRegistry.set('i18n', i18nRegistry);
});

declare module '@neos-project/neos-ui-registry' {
interface GlobalRegistry {
get(key: 'i18n'): I18nRegistry;
}
}
2 changes: 1 addition & 1 deletion packages/neos-ui-i18n/src/registry/I18nRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* information, please view the LICENSE file which was distributed with this
* source code.
*/
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

import logger from '@neos-project/utils-logger';

Expand Down Expand Up @@ -180,7 +180,7 @@
quantity: number
): string;

translate(

Check warning on line 183 in packages/neos-ui-i18n/src/registry/I18nRegistry.ts

View workflow job for this annotation

GitHub Actions / Code style

Method 'translate' has too many parameters (6). Maximum allowed is 5
transUnitIdOrFullyQualifiedTranslationAddress?: string,
explicitlyProvidedFallback?: string,
parameters?: LegacyParameters,
Expand Down
3 changes: 2 additions & 1 deletion packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {createSelector, defaultMemoize} from 'reselect';
import {GlobalState} from '../../..';
import {NodeContextPath, NodeMap, Node, NodeTypeName, ClipboardMode, NodeTypesRegistry} from '@neos-project/neos-ts-interfaces';
import {NodeContextPath, NodeMap, Node, NodeTypeName, ClipboardMode} from '@neos-project/neos-ts-interfaces';
import {NodeTypesRegistry} from '@neos-project/neos-ui-contentrepository';

export const inlineValidationErrorsSelector = (state: GlobalState) => state?.cr?.nodes?.inlineValidationErrors;
export const nodesByContextPathSelector = (state: GlobalState) => state?.cr?.nodes?.byContextPath;
Expand Down
3 changes: 2 additions & 1 deletion packages/neos-ui-redux-store/src/UI/Inspector/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {createSelector, defaultMemoize} from 'reselect';

import validate from '@neos-project/neos-ui-validators';
import type {ValidatorRegistry} from '@neos-project/neos-ui-validators';
import {selectors as nodes} from '../../CR/Nodes';
import {GlobalState} from '../../..';
import {NodeTypesRegistry, ValidatorRegistry} from '@neos-project/neos-ts-interfaces';
import {NodeTypesRegistry} from '@neos-project/neos-ui-contentrepository';

/**
* Transient values and everything which depends on this
Expand Down
8 changes: 8 additions & 0 deletions packages/neos-ui-registry/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@neos-project/neos-ui-registry",
"version": "",
"description": "Global registry for the Neos UI",
"private": true,
"main": "./src/index.ts",
"license": "GNU GPLv3"
}
19 changes: 19 additions & 0 deletions packages/neos-ui-registry/src/globalRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {SynchronousMetaRegistry, SynchronousRegistry} from './registry';

export interface GlobalRegistry extends SynchronousMetaRegistry<SynchronousRegistry<unknown>> {
}

/**
* Access to the global registry.
*
* FIXME
* Note that we often pass the global registry around instead and inject it via the react context -> this should be simplified in favour of this global state.
*/
const globalRegistry = new SynchronousMetaRegistry(`The global registry`) as GlobalRegistry;

export const getRegistryById: GlobalRegistry['get'] = (key) => {
// @ts-ignore
return globalRegistry.get(key);
}

export const getGlobalRegistry = () => globalRegistry;
4 changes: 4 additions & 0 deletions packages/neos-ui-registry/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export {getRegistryById, getGlobalRegistry} from './globalRegistry';
export {SynchronousRegistry, SynchronousMetaRegistry} from './registry';
export type {GlobalRegistry} from './globalRegistry';
2 changes: 1 addition & 1 deletion packages/neos-ui-sagas/src/manifest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import manifest from '@neos-project/neos-ui-extensibility';
import {SynchronousRegistry} from '@neos-project/neos-ui-extensibility/src/registry';
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

import {
browser,
Expand Down
6 changes: 5 additions & 1 deletion packages/neos-ui-validators/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ValidatorRegistry, PropertyConfiguration, ValidatorConfiguration} from '@neos-project/neos-ts-interfaces';
import {PropertyConfiguration, ValidatorConfiguration} from '@neos-project/neos-ts-interfaces';
import type {ValidatorRegistry} from './registry';

interface ValuesMap {
[itemProp: string]: any;
Expand Down Expand Up @@ -61,3 +62,6 @@ const validate = (values: ValuesMap, elementConfigurations: ElementConfiguarions
};

export default validate;

export type {ValidatorRegistry};

14 changes: 10 additions & 4 deletions packages/neos-ui-validators/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import StringLength from './StringLength';
import Text from './Text';
import Uuid from './Uuid';

import manifest from '@neos-project/neos-ui-extensibility/src';
import {GlobalRegistry} from '@neos-project/neos-ts-interfaces';
import manifest from '@neos-project/neos-ui-extensibility';
import {ValidatorRegistry, validatorRegistry} from './registry';

manifest('validators', {}, (globalRegistry: GlobalRegistry) => {
const validatorRegistry = globalRegistry.get('validators');
manifest('validators', {}, (globalRegistry) => {
globalRegistry.set('validators', validatorRegistry);

validatorRegistry.set('Neos.Neos/Validation/AlphanumericValidator', Alphanumeric);
validatorRegistry.set('Neos.Neos/Validation/CountValidator', Count);
Expand All @@ -34,3 +34,9 @@ manifest('validators', {}, (globalRegistry: GlobalRegistry) => {
validatorRegistry.set('Neos.Neos/Validation/TextValidator', Text);
validatorRegistry.set('Neos.Neos/Validation/UuidValidator', Uuid);
});

declare module '@neos-project/neos-ui-registry' {
interface GlobalRegistry {
get(key: 'validators'): ValidatorRegistry;
}
}
15 changes: 15 additions & 0 deletions packages/neos-ui-validators/src/registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {SynchronousRegistry} from '@neos-project/neos-ui-registry';

type Validator = (
values: {},
elementConfigurations: any
) => null | {} | string;

export const validatorRegistry = new SynchronousRegistry<Validator>(`
Contains all validators.

The key is a validator name (such as Neos.Neos/Validation/NotEmptyValidator) and the values
are validator options.
`);

export type ValidatorRegistry = typeof validatorRegistry;
Loading
Loading