Skip to content

Commit

Permalink
chore: align to main and fix left in tree conflict from merge, fix ne…
Browse files Browse the repository at this point in the history
…w linting issues after main alignment
  • Loading branch information
deodorhunter committed Dec 9, 2024
2 parents a89608b + 6384312 commit 60b9aa2
Show file tree
Hide file tree
Showing 416 changed files with 1,650 additions and 1,109 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ packages/volto-guillotina
dist
packages/registry/lib
packages/registry/docs
apps/rr7/.react-router
45 changes: 33 additions & 12 deletions PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@

This document describes the packages that come with Volto, the default frontend for Plone 6.

These packages are part of Plone's API-first story.
Most of them are experimental and are marked in their respective `README` files.
Plone 6.1.x (Volto 18) depends on:
- `@plone/registry`
- `@plone/scripts`
- `@plone/volto-slate`

and as a development dependency:
- `@plone/types`

Plone 6.0.x (Volto 17 and below) does not use any of them.

These packages are expected to be used and become part of Plone 7.
Some of them might become part of Plone 6.1.x minor versions.

The packages are divided into three categories or types:

- core
- utilities
- add-ons


## `@plone/types`

Plone types is a special development package.
It contains the Plone typings for TypeScript.
It's considered a core package, and it's the only package that the other core packages can rely on as
a `devDependency` in your project configuration.
It's considered a core package, and it's the only package that the other core packages can rely on as a `devDependency` in your project configuration.

This package contains `.d.ts` typing definitions, curated by hand.
Due to the nature of this package, it does not need bundling.
It's published "as is", so you can import the type definitions from anywhere in your code.
Due to the nature of this package, it does not need to be built nor bundled.
It is published "as is", so you can import the type definitions from anywhere in your code.


## Core packages
Expand All @@ -29,12 +49,10 @@ They must be published and bundled in a traditional (transpiled) way.
The bundle of these packages must work on both CommonJS and ECMAScript Module (ESM) environments.


## Utility packages
## Utilities packages

- `@plone/drivers`
- `@plone/helpers`
- `@plone/providers`
- `@plone/rsc`
- `@plone/helpers`


### Rules
Expand All @@ -44,19 +62,22 @@ They must be published in the traditional way, as a bundle.
This bundle must work on both CommonJS and ESM environments.


## Feature packages
## Add-on packages

- `@plone/blocks`
- `@plone/contents`
- `@plone/slots`
- `@plone/theming`
- `@plone/contents`


### Rules

Feature packages, or add-on packages, can depend on any other package.
Add-on or feature packages, can depend on any other package.
You must distribute them as source code, and not transpile them.
They must provide a default configuration registry loader as the default main entry point export.
They must be loadable as any other add-on.
Unlike Volto add-ons, do *NOT* place the code in the `src` folder.
If you do not transpile the package, the direct resolution must work out of the box, where both the bundler and TypeScript resolution are direct.
They must be loadable as any other add-on, and contain an add-on registry compatible `install`-able default export.


## Development utility packages
Expand Down
17 changes: 17 additions & 0 deletions docs/source/release-notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ myst:

<!-- towncrier release notes start -->

## 18.2.1 (2024-12-09)

### Bugfix

- Fixes ICS download in non-public event content. @sneridagh [#6515](https://github.com/plone/volto/issues/6515)
- Fixed circular import error in dev with HMR in `App` component when imported in the main default config. @sneridagh [#6524](https://github.com/plone/volto/issues/6524)

### Internal

- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520)

## 18.2.0 (2024-12-08)

### Internal

- Removed all imports from barrel files for components, actions, helpers, hooks and lodash. @pnicolli [#6509](https://github.com/plone/volto/issues/6509)

## 18.1.2 (2024-12-05)

### Bugfix
Expand Down
9 changes: 8 additions & 1 deletion docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,18 @@ Modern bundlers, such as Vite, rely upon the import path to determine whether to

The barrel imports must be removed to increase the natural number of chunks that Volto divides on—especially on routes—resulting in code splitting done the right and natural way.
This forces us to rewrite all the imports everywhere—including core, projects, and add-ons—once we implement it.
The barrel imports files include the following.
The barrel imports files include the following in Volto.

- {file}`src/components/index.js`
- {file}`src/helpers/index.js`
- {file}`src/actions/index.js`
- {file}`src/hooks/index.js`

They also include the following in the `@plone/volto-slate` package.

- {file}`src/actions/index.js`
- {file}`src/editor/ui/index.js`
- {file}`src/utils/index.js`

##### Alternative

Expand Down
4 changes: 2 additions & 2 deletions packages/coresandbox/src/components/Blocks/FormBlock/Edit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SidebarPortal } from '@plone/volto/components';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
import Data from './Data';
import type { BlockEditProps } from '@plone/types';
import { Helmet } from '@plone/volto/helpers';
import { Helmet } from '@plone/volto/helpers/Helmet/Helmet';

import { defineMessages, useIntl } from 'react-intl';
import { Container } from 'semantic-ui-react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect } from 'react';
import { SidebarPortal } from '@plone/volto/components';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
import Data from './Data';
import type { BlockEditProps } from '@plone/types';
import { Input, Button } from 'semantic-ui-react';
import { Icon } from '@plone/volto/components';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import aheadSVG from '@plone/volto/icons/ahead.svg';

const InputBlockEdit = (props: BlockEditProps) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SidebarPortal } from '@plone/volto/components';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
import Data from './Data';
import type { BlockEditProps } from '@plone/types';

Expand Down
2 changes: 1 addition & 1 deletion packages/coresandbox/src/components/TestForm.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Helmet } from '@plone/volto/helpers';
import { Helmet } from '@plone/volto/helpers/Helmet/Helmet';

import { defineMessages, useIntl } from 'react-intl';
import { Container } from 'semantic-ui-react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { searchContent } from '@plone/volto/actions';
import { searchContent } from '@plone/volto/actions/search/search';
import { useDispatch, useSelector } from 'react-redux';
import { Container } from 'semantic-ui-react';

Expand Down
6 changes: 3 additions & 3 deletions packages/coresandbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TestBlockView from './components/Blocks/TestBlock/View';
import TestBlockEdit from './components/Blocks/TestBlock/Edit';
import InputBlockView from './components/Blocks/InputBlock/View';
import InputBlockEdit from './components/Blocks/InputBlock/Edit';
import { flattenToAppURL } from '@plone/volto/helpers';
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
import { SliderSchema as TestBlockSchema } from './components/Blocks/TestBlock/schema';
import { inputBlockSchema } from './components/Blocks/InputBlock/schema';
import { multipleFieldsetsSchema } from './components/Blocks/TestBlock/schema';
Expand All @@ -13,13 +13,13 @@ import codeSVG from '@plone/volto/icons/code.svg';
import type { BlockConfigBase } from '@plone/types';
import type { ConfigType } from '@plone/registry';
import SlotComponentTest from './components/Slots/SlotTest';
import { ContentTypeCondition } from '@plone/volto/helpers';
import { ContentTypeCondition } from '@plone/volto/helpers/Slots';
import { RouteCondition } from '@plone/volto/helpers/Slots';
import TestForm from './components/TestForm';
import FormBlockView from './components/Blocks/FormBlock/View';
import FormBlockEdit from './components/Blocks/FormBlock/Edit';
import { formBlockSchema } from './components/Blocks/FormBlock/schema';
import { Login } from '@plone/volto/components';
import Login from '@plone/volto/components/theme/Login/Login';

const testBlock: BlockConfigBase = {
id: 'testBlock',
Expand Down
7 changes: 7 additions & 0 deletions packages/volto-slate/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ module.exports = {
rules: {
'import/no-unresolved': 0,
},
settings: {
'import/resolver': {
alias: {
map: [['@plone/volto-slate', './src']],
},
},
},
};
12 changes: 12 additions & 0 deletions packages/volto-slate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

<!-- towncrier release notes start -->

## 18.0.3 (2024-12-09)

### Internal

- Fix extension in files containing JSX. @sneridagh [#6520](https://github.com/plone/volto/issues/6520)

## 18.0.2 (2024-12-08)

### Internal

- Removed all imports from barrel files for components, actions, helpers, hooks and lodash. @pnicolli [#6509](https://github.com/plone/volto/issues/6509)

## 18.0.1 (2024-11-11)

### Feature
Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plone/volto-slate",
"version": "18.0.1",
"version": "18.0.3",
"description": "Slate.js integration with Volto",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/src/actions/content.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { nestContent } from '@plone/volto/helpers';
import { nestContent } from '@plone/volto/helpers/Content/Content';
import { UPLOAD_CONTENT } from '@plone/volto-slate/constants';

// TODO: the PR has been merged into Volto, so this should be cleaned up
Expand Down
7 changes: 5 additions & 2 deletions packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { isEmpty, map, remove } from 'lodash';
import isEmpty from 'lodash/isEmpty';
import map from 'lodash/map';
import remove from 'lodash/remove';
import { Button, Table } from 'semantic-ui-react';
import cx from 'classnames';
import { defineMessages, injectIntl } from 'react-intl';

import Cell from './Cell';
import { Icon, SidebarPortal } from '@plone/volto/components';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
import { BlockDataForm } from '@plone/volto/components/manage/Form';
import TableSchema from './schema';

Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/src/blocks/Table/TableBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React, { useState, useMemo } from 'react';
import PropTypes from 'prop-types';
import { Table } from 'semantic-ui-react';
import { map } from 'lodash';
import map from 'lodash/map';
import {
serializeNodes,
serializeNodesToText,
Expand Down
14 changes: 6 additions & 8 deletions packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ import { defineMessages, useIntl } from 'react-intl';
import { useInView } from 'react-intersection-observer';
import { Dimmer, Loader, Message, Segment } from 'semantic-ui-react';

import {
flattenToAppURL,
getBaseUrl,
validateFileUploadSize,
} from '@plone/volto/helpers';
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers/Url/Url';
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
import config from '@plone/volto/registry';
import { SidebarPortal, BlockChooserButton } from '@plone/volto/components';
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
import BlockChooserButton from '@plone/volto/components/manage/BlockChooser/BlockChooserButton';
import { BlockDataForm } from '@plone/volto/components/manage/Form';

import { SlateEditor } from '@plone/volto-slate/editor';
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
import {
createImageBlock,
parseDefaultSelection,
deconstructToVoltoBlocks,
} from '@plone/volto-slate/utils';
} from '@plone/volto-slate/utils/volto-blocks';
import { parseDefaultSelection } from '@plone/volto-slate/utils/selection';
import { Transforms } from 'slate';

import PersistentSlashMenu from './SlashMenu';
Expand Down
7 changes: 4 additions & 3 deletions packages/volto-slate/src/blocks/Text/SlashMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { filter, isEmpty } from 'lodash';
import filter from 'lodash/filter';
import isEmpty from 'lodash/isEmpty';
import { Menu } from 'semantic-ui-react';
import { useIntl, FormattedMessage } from 'react-intl';
import { Icon } from '@plone/volto/components';
import { useUser } from '@plone/volto/hooks';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import useUser from '@plone/volto/hooks/user/useUser';

const emptySlateBlock = () => ({
value: [
Expand Down
6 changes: 2 additions & 4 deletions packages/volto-slate/src/blocks/Text/TextBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import React from 'react';

import { connect } from 'react-redux';

import {
uploadContent,
saveSlateBlockSelection,
} from '@plone/volto-slate/actions';
import { uploadContent } from '@plone/volto-slate/actions/content';
import saveSlateBlockSelection from '@plone/volto-slate/actions/selection';

import DefaultTextBlockEditor from './DefaultTextBlockEditor';
import DetachedTextBlockEditor from './DetachedTextBlockEditor';
Expand Down
4 changes: 2 additions & 2 deletions packages/volto-slate/src/blocks/Text/TextBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
serializeNodesToText,
} from '@plone/volto-slate/editor/render';
import config from '@plone/volto/registry';
import { isEqual } from 'lodash';
import isEqual from 'lodash/isEqual';
import Slugger from 'github-slugger';
import { normalizeString } from '@plone/volto/helpers';
import { normalizeString } from '@plone/volto/helpers/Utils/Utils';

const TextBlockView = (props) => {
const { id, data, styling = {} } = props;
Expand Down
14 changes: 6 additions & 8 deletions packages/volto-slate/src/blocks/Text/extensions/breakList.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Editor, Range, Transforms } from 'slate';
import config from '@plone/volto/registry';
import {
isCursorAtBlockEnd,
splitEditorInTwoFragments,
setEditorContent,
createAndSelectNewBlockAfter,
getCurrentListItem,
createEmptyParagraph,
} from '@plone/volto-slate/utils';
import { isCursorAtBlockEnd } from '@plone/volto-slate/utils/selection';
import { splitEditorInTwoFragments } from '@plone/volto-slate/utils/ops';
import { setEditorContent } from '@plone/volto-slate/utils/editor';
import { createAndSelectNewBlockAfter } from '@plone/volto-slate/utils/volto-blocks';
import { getCurrentListItem } from '@plone/volto-slate/utils/lists';
import { createEmptyParagraph } from '@plone/volto-slate/utils/blocks';

/**
* Handles `Enter` key on empty and non-empty list items.
Expand Down
11 changes: 4 additions & 7 deletions packages/volto-slate/src/blocks/Text/extensions/insertBreak.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import ReactDOM from 'react-dom';
import { Editor } from 'slate';
// import { ReactEditor } from 'slate-react';
import {
splitEditorInTwoFragments,
setEditorContent,
createAndSelectNewBlockAfter,
rangeIsInSplittableNode,
// deconstructToVoltoBlocks,
} from '@plone/volto-slate/utils';
import { splitEditorInTwoFragments } from '@plone/volto-slate/utils/ops';
import { setEditorContent } from '@plone/volto-slate/utils/editor';
import { createAndSelectNewBlockAfter } from '@plone/volto-slate/utils/volto-blocks';
import { rangeIsInSplittableNode } from '@plone/volto-slate/utils/internals';

/**
* @param {Editor} editor The Slate editor object to extend.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import isUrl from 'is-url';
import imageExtensions from 'image-extensions';
import { blockTagDeserializer } from '@plone/volto-slate/editor/deserialize';
import { getBaseUrl, validateFileUploadSize } from '@plone/volto/helpers';
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
import { v4 as uuid } from 'uuid';
import { Transforms } from 'slate';

Expand Down
2 changes: 1 addition & 1 deletion packages/volto-slate/src/blocks/Text/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import TextBlockView from './TextBlockView';
import TextBlockEdit from './TextBlockEdit';
import TextBlockSchema from './TextBlockSchema';
import { cloneDeep } from 'lodash';
import cloneDeep from 'lodash/cloneDeep';

import {
goDown,
Expand Down
Loading

0 comments on commit 60b9aa2

Please sign in to comment.