-
-
Notifications
You must be signed in to change notification settings - Fork 144
TASK: Introduce api to use global-state for global registry #4011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mhsdesign
merged 16 commits into
neos:9.0
from
mhsdesign:task/use-functional-components-without-neos-decorator
Oct 28, 2025
Merged
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 95b3b25
TASK: Introduce dedicated package `@neos-project/neos-ui-registry` to…
mhsdesign cb1c020
TASK: Move `SynchronousRegistry` and `SynchronousMetaRegistry` to new…
mhsdesign 74faaf1
TASK: Add correct typescript typing to `manifest()` function
mhsdesign ff0f61a
TASK: Move `GlobalRegistry` type to `neos-ui-registry` and use ts mod…
mhsdesign 4695e4d
TASK: Move `GlobalRegistry` "i18n" overload to i18n package
mhsdesign 0ef0146
TASK: Move `GlobalRegistry` "validators" overload to validators package
mhsdesign 4bfc77a
TASK: Also re-export `SynchronousMetaRegistry` as its used in the neo…
mhsdesign e235199
TASK: Solve `SynchronousMetaRegistry` vs `GlobalRegistry` type riddle
mhsdesign 7995f3e
TASK: Move `NodeTypesRegistry` type to `@neos-project/neos-ui-content…
mhsdesign 29163a8
PATCH: Fix typescript type for `referenceGrandParentNodeType` to allo…
mhsdesign e82c678
PATCH: Fix dangerous ! double quotes
mhsdesign c5daebe
TASK: Dont expose ui-internal createConsumerApi and readFromConsumerA…
mhsdesign bbb3419
PATCH: Fix NMP build of `@neos-project/neos-ui-extensibility` by sepa…
mhsdesign d4bd548
PATCH: Remove dependency to `@neos-project/positional-array-sorter` i…
mhsdesign ab14d04
TASK: Document plugin-api.js
mhsdesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/neos-ui-ckeditor5-bindings/src/registry/CkEditorConfigRegistry.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/neos-ui-ckeditor5-bindings/src/registry/RichTextToolbarRegistry.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
| export type {NodeTypesRegistry} from './registry'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/neos-ui-editors/src/Editors/SelectBox/selectBoxHelpers.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/neos-ui-editors/src/Editors/SelectBox/selectBoxHelpers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| }; | ||
3 changes: 3 additions & 0 deletions
3
packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-registry/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import readFromConsumerApi from '../../../readFromConsumerApi'; | ||
|
|
||
| module.exports = readFromConsumerApi('NeosProjectPackages')().NeosUiRegistry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
packages/neos-ui-i18n/src/manifest.js → packages/neos-ui-i18n/src/manifest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.