diff --git a/.github/workflows/docs-rtd-pr-preview.yml b/.github/workflows/docs-rtd-pr-preview.yml new file mode 100644 index 00000000..7ea4a840 --- /dev/null +++ b/.github/workflows/docs-rtd-pr-preview.yml @@ -0,0 +1,24 @@ +# .github/workflows/docs-rtd-pr-preview.yml +name: readthedocs/actions +on: + pull_request_target: + types: + - opened + # Execute this action only on PRs that touch + # documentation files. + paths: + - "docs/**" + - .readthedocs.yaml + - requirements-docs.txt + +permissions: + pull-requests: write + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "volto-light-theme" + single-version: "true" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..73b3212d --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,43 @@ +name: Documentation +on: + push: + branches: + - main + paths: + - 'docs/**' + # Build pull requests + pull_request: + paths: + - 'docs/**' + - 'styles/**' + - '.github/workflows/docs.yml' + - 'requirements-docs.txt' + +jobs: + docs: + name: Documentation + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.12'] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: 'requirements-docs.txt' + + - name: Create Python virtual environment + run: pip install virtualenv + + - name: pip install requirements + run: pip install -r requirements-docs.txt + + - name: Check for broken links + run: make docs-linkcheckbroken + + - name: Build HTML documentation + run: make docs-html diff --git a/.gitignore b/.gitignore index 01fd008a..c923072a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,8 @@ core build .DS_Store public + +/bin +/lib +pyvenv.cfg +docs/_build diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..823aec29 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,32 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.12" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: requirements-docs.txt diff --git a/Makefile b/Makefile index aa7a3cb5..b3ccae05 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,18 @@ MAKEFLAGS+=--no-builtin-rules CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +# Sphinx variables +# You can set these variables from the command line. +SPHINXOPTS ?= +VALEOPTS ?= +# Internal variables. +SPHINXBUILD = "$(realpath bin/sphinx-build)" +SPHINXAUTOBUILD = "$(realpath bin/sphinx-autobuild)" +DOCS_DIR = ./docs/ +BUILDDIR = ./_build/ +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) . +VALEFILES := $(shell find $(DOCS_DIR) -type f -name "*.md" -print) + # Recipe snippets for reuse # We like colors @@ -32,6 +44,60 @@ ADDON_NAME='@kitconcept/volto-light-theme' help: ## Show this help @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" +## Docs + +bin/python: ## Create a Python virtual environment with the latest pip, and install documentation requirements + python3 -m venv . || virtualenv --clear --python=python3 . + bin/python -m pip install --upgrade pip + @echo "Python environment created." + bin/pip install -r requirements-docs.txt + @echo "Requirements installed." + +.PHONY: docs-clean +docs-clean: ## Clean current and legacy docs build directories, and Python virtual environment + rm -rf bin include lib + rm -rf docs/_build + cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/ + +.PHONY: docs-html +docs-html: bin/python ## Build html + cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: docs-livehtml +docs-livehtml: bin/python ## Rebuild Sphinx documentation on changes, with live-reload in the browser + cd "$(DOCS_DIR)" && ${SPHINXAUTOBUILD} \ + --ignore "*.swp" \ + -b html . "$(BUILDDIR)/html" $(SPHINXOPTS) + +.PHONY: docs-linkcheck +docs-linkcheck: bin/python ## Run linkcheck + cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/ ." + +.PHONY: docs-linkcheckbroken +docs-linkcheckbroken: bin/python ## Run linkcheck and show only broken links + cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? -eq 0; then exit 1; fi || test $$? -ne 0 + +.PHONY: docs-vale +docs-vale: bin/python ## Install (once) and run Vale style, grammar, and spell checks + bin/vale sync + bin/vale --no-wrap $(VALEOPTS) $(VALEFILES) + @echo + @echo "Vale is finished; look for any errors in the above output." + +.PHONY: docs-rtd-pr-preview +docs-rtd-pr-preview: ## Build previews of pull requests that have documentation changes on Read the Docs via CI + pip install -r requirements-docs.txt + cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/ + +.PHONY: docs-rtd-registry +docs-rtd-registry: ## Build Plone Registry docs on RTD + pip install -r ../../requirements-docs.txt && cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/ + # Dev Helpers .PHONY: install diff --git a/README.md b/README.md index 37091597..ba4dfc81 100644 --- a/README.md +++ b/README.md @@ -5,380 +5,20 @@ [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/unit.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions) [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/acceptance.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions) -![kitconcept GmbH](https://github.com/kitconcept/volto-blocks/raw/master/kitconcept.png) +![kitconcept GmbH](https://raw.githubusercontent.com/kitconcept/volto-blocks/master/kitconcept.png) ## Vision -The main vision of the Volto Light Theme is to serve as a foundation for kitconcept's future projects, following the release of Plone 6. - -It contains the feedback from the company's last years projects and the success stories in the UI/UX side. - -It aims to be future proof, so it has to be aligned with the upcoming Volto vision in terms of theming strategy decided by the Plone community. +The main vision of the Volto Light Theme (VLT) is to serve as a foundation for kitconcept's future projects, following the release of Plone 6. +It incorporates feedback from the company's clients and Plone community from the last few years of projects and the success stories in the UI/UX side. +It aims to be future-proof, keeping it aligned with the upcoming Volto and Plone 7 vision in terms of theming strategy decided by the Plone community. ![Volto-Light-Theme](https://github.com/kitconcept/volto-light-theme/raw/main/volto-light-theme.png) -## Requirements and specs - -### It should not use any SemanticUI component or styling - -Volto will abandon SemanticUI as default design component system in the mid term, and we should be prepared for it. - -We will achieve that by not using any SemanticUI component, nor any related styling (`.ui.XXX`) in our upcoming themes. - -The Volto strategy is: - -- Provide a very basic and structural Vanilla components to build upon theming and CMSUI as well (`@plone/components`) -- These components will be based in a headless component system [React Aria Components](https://react-spectrum.adobe.com/react-aria/components.html) -- Volto projects can be themed using `@plone/components` as baseline or use a complete different design or component system of the developer/integrator choice. The presence of Volto's component registry system could help for adapting, if required. - -#### Volto components `customizations` use case - -If possible, we will switch to SemanticUI-less components when `@plone/components` is ready. -Specially if the elements that we are customizing are clearly "theme" (eg. header/footer, etc). -In the case of other Volto customizations that are not clear part of the theme (eg. Search block), it's fine to stick using what the original is using (SemanticUI). -When Volto will make the switch in the future, we should then adapt all the customizations to match the one in the Volto core. -The approach used is to use a proxy to a component of the `components` folder. This way it's easier to keep track of changes, and another add-on can customize again the light theme component, not the original Volto customization. - -### It should use kitconcept's layout used in FZJ/DLR projects - -Since FZJ/DLR projects we've been trying a new concept in layout for Volto. This new layout uses three widths for the content elements: - -- Narrow (text) -- Default (blocks) -- Layout (main screen elements like Header, Footer) - -The Layout sized elements snap to 1440px. The breakpoints are also different than default Volto. - -This new layout uses mixin's and CSS that can be found in `layout.less` in the theme folder. - -Since the new container queries spec is out, we will be introducing it to the current CSS in order to implement the complexities that the "inner container" (the one between the toolbar and the sidebar) width presents. Until now, we did complex calculations given into account if the size of the inner container depending if the toolbar, the sidebar, or both were presents. With container queries we can do that in a more sensible and easy way. - -### Organization of the files - -We will start organising the files in the root of `theme` folder, to differentiate from a normal "SemanticUI" theme. Take a look at the current state. We will follow this convention: - -- One file per component/block -- Use the Volto theme facility using the SCSS scape hatch provided so other add-ons can hook to it. -- The styling is centralized in `main.scss`, the rest of the files are loaded from there. - -## Why a headless component system? - -https://medium.com/@nirbenyair/headless-components-in-react-and-why-i-stopped-using-ui-libraries-a8208197c268 - -## Vertical spacing block model - -This theme has the concept of block "grouping" given two consecutive blocks with the same styling block wrapper property `backgroundColor`. You have to add this property to your blocks in your blocks code. This add-on customizes `RenderBlocks.jsx` component in order to do so. - -The wrappers have the classnames `blocks-group-wrapper` and the name of the background color, eg. `grey`, defaulting to `transparent` if no `backgroundColor` property is set in the styling block wrapper in the block. - -**Disclaimer**: This might change in the near future, since we are developing a new integral Block Model for VLT and Volto. - -### Vertical spacing rules - -These main rules spec applies to the theme: - -- On each change of color, a vertical padding (both `padding-bottom` and `padding-top`) of `80px` defined with the main variable `$color-block-change-vertical-spacing`. -- The default bottom margin is defined with the main variable `$block-vertical-space` and set by default to `25px`. -- [grid] Vertical spacing for grids should be `80px` for both top and bottom, even if the previous and next blocks are of the same color. -- [grid+grid] When two grids happen side by side and are of the same color. It should be equal to the grid gap, so it's set to `@gutterWidth` and currently `1rem`. It has to be adjusted with a bit of negative margin to cancel the current inner padding in grid cells. -- [grid+grid] Grids columns belonging to the same grid and same color in small mobile viewports. They should be closer to match the other adjacent ones, so they seem to belong to the same grid set. -- [footer] The footer has a top vertical spacing of `80px`. -- [teasers] The last teaser, except if the following is a button, does NOT have a line at the bottom. -- [listing] The last listing, except if the following is a button, does NOT have a line at the bottom. -- [listing] After two consecutive listings, the vertical spacing should be `200px`. -- [text+button] If there's a text and a button, then the vertical spacing betweeen them is `60px`. -- [image+separator-block] If after image comes a separator block, the vertical spacing between them is `40px`. - -### Media queries vs container queries - -We use media queries when the styling it's generic enough to apply only to the View. - -We use container queries when do care explicitly about how the styling is being applied in edit mode as well and we want the content area to behave 1:1 with the view mode. - -Reason: The container queries allow us to abstract the width from the sidebar and toolbar in edit mode, showing the content area as it will be in that size, in view mode. - -**Remember**: The margins in responsive are being taken care with container queries in `layout.scss`. So everything related to that, goes like it works in there, with container queries. See implementations for details in case you need it. - -## Specification - -`@kitconcept/volto-light-theme` works with the following Plone Blocks: - -- Grid-Block (https://www.npmjs.com/package/@kitconcept/volto-blocks-grid) -- Teaser-Block (https://www.npmjs.com/package/@kitconcept/volto-blocks-grid) -- Slider-Block (https://www.npmjs.com/package/@kitconcept/volto-slider-block) -- Button-Block (https://www.npmjs.com/package/@kitconcept/volto-button-block) -- Separator-Block (https://www.npmjs.com/package/@kitconcept/volto-separator-block) -- Heading-Block (https://www.npmjs.com/package/@kitconcept/volto-heading-block) -- Introduction-Block (https://www.npmjs.com/package/@kitconcept/volto-introduction-block) -- Accordion-Block (https://www.npmjs.com/package/@eeacms/volto-accordion-block) - -and the following add-ons: - -- DSGVO-Banner (https://www.npmjs.com/package/@kitconcept/volto-dsgvo-banner) - -## Installation - -It is recommended that your project or policy add-on `package.json` include the aforementioned add-ons. - -```json - "dependencies": { - "@eeacms/volto-accordion-block": "^10.4.0", - "@kitconcept/volto-button-block": "^2.3.1", - "@kitconcept/volto-dsgvo-banner": "^1.3.0", - "@kitconcept/volto-heading-block": "^2.4.0", - "@kitconcept/volto-highlight-block": "^3.0.0", - "@kitconcept/volto-introduction-block": "^1.0.0", - "@kitconcept/volto-separator-block": "^4.0.0", - "@kitconcept/volto-slider-block": "^6.0.0", - "@kitconcept/volto-light-theme": "^2.0.0", - } -``` - -This theme won't install them for you, as they are declared as `peerDependencies`. -This is because the theme won't have to force you to use any specific add-on version, and avoids package hoisting issues. - -In your project or policy add-on `package.json` you should declare all of them as Volto add-ons - -```json - "addons": [ - "@eeacms/volto-accordion-block", - "@kitconcept/volto-button-block", - "@kitconcept/volto-heading-block", - "@kitconcept/volto-introduction-block", - "@kitconcept/volto-highlight-block", - "@kitconcept/volto-separator-block", - "@kitconcept/volto-light-theme", - "your_policy_addon_here" - ], -``` - -Make sure your policy add-on is the last one, as you would want that its configuration has priority over all the others. Make sure also that `@kitconcept/volto-light-theme` is the one before your policy add-on. - -Then, declare the theme in your project `package.json`: - -```json - "theme": "@kitconcept/volto-light-theme", -``` - -Alternatively, you can also declare it in your project's `volto.config.js`: - -```js -const addons = []; -const theme = '@kitconcept/volto-light-theme'; - -module.exports = { - addons, - theme, -}; -``` - -You can specify your project add-ons in `volto.config.js`, but sometimes is better to have them all in one place (in your policy add-on) for portability. - -## Feature Flags - -### Enable Fat Menu - -Since 2.0.0, the light theme has a fat menu (below the main site sections) triggered clickin on one of them. -It's behind a feature flag, as opt-out: - -```js -config.settings.enableFatMenu = true; -``` - -### Show Site Label - -If you want to show a label on top of site you can pass label name to `siteLabel` property. +## Documentation -```js -config.settings.siteLabel = 'Plone Intranet'; -``` - -If you wanted a translated label then you have to define a translation object in `defineMessages` function provided by react-intl. - -Here is the code snippets you have to add in your addon index.js file. -If you don't have addon, you can also add in your config.js file in root of your frontend folder. - -```js -import { defineMessages } from 'react-intl'; - -defineMessages({ - siteLabel: { - id: 'siteLabel', - defaultMessage: ' ', - }, -}); - -``` -Then add the translation you want in your `locale` file. - -### Show intranetHeader - -We have totally different header for intranet sites. If you want that, you can enable it by passing `intranetHeader` property. - -```js -config.settings.intranetHeader = true; -``` -## Releases - -The releases follow a semantic versioning model. - -### Definition of breaking change - -In general, the same rules as Volto releases applies. -However, in VLT we add an extra exception: The vertical spacing is carefully curated and considered an important feature of the theme and because of that, changes and improvements in the vertical spacing are **NOT** considered breaking changes. -They will be noted properly in the changelog. +You can find the documentation of this package at https://volto-light-theme.readthedocs.io. ## Upgrade Guide -See a detailed upgrade guide in: https://github.com/kitconcept/volto-light-theme/blob/main/UPGRADE-GUIDE.md - -## Compatibility - -| VLT version | Volto version | -|-------------|---------------| -| 3.x.x | >= Volto 17.0.0-alpha.16 | -| 4.x.x | < Volto 17.18.0 | -| 5.x.x | >= Volto 17.18.0 or >=Volto 18.0.0-alpha.36 | - -Compatibility with Volto 16 might be achieved, but it has to be at customization level in the specific project add-on. -This is mainly due to the `RenderBlocks` customization that is based in the one in 17 because of the Grid block in core and the autogrouping feature. -See more information about the other dependencies in `peerDependencies` in `package.json`. - -## Development - -The development of this add-on is done in isolation using a new approach using pnpm workspaces and latest `mrs-developer` and other Volto core improvements. -For this reason, it only works with pnpm and Volto 18 (currently in alpha) but it does not mean that the add-on will only work in 18. - -### Development requisites - -- Volto 18 (2024-03-21: currently in alpha) -- pnpm as package manager - -### Make convenience commands - -Run `make help` to list the available commands. - -```text -help Show this help -install Installs the add-on in a development environment -start Starts Volto, allowing reloading of the add-on during development -build Build a production bundle for distribution of the project with the add-on -build-deps Build dependencies -i18n Sync i18n -ci-i18n Check if i18n is not synced -format Format codebase -lint Lint, or catch and remove problems, in code base -release Release the add-on on npmjs.org -release-dry-run Dry-run the release of the add-on on npmjs.org -test Run unit tests -ci-test Run unit tests in CI -backend-docker-start Starts a Docker-based backend for development -storybook-start Start Storybook server on port 6006 -storybook-build Build Storybook -acceptance-frontend-dev-start Start acceptance frontend in development mode -acceptance-frontend-prod-start Start acceptance frontend in production mode -acceptance-backend-start Start backend acceptance server -ci-acceptance-backend-start Start backend acceptance server in headless mode for CI -acceptance-test Start Cypress in interactive mode -ci-acceptance-test Run cypress tests in headless mode for CI -acceptance-a11y-frontend-prod-start Start a11y acceptance frontend in prod mode -ci-acceptance-a11y-backend-start Start acceptance a11y server in CI mode (no terminal attached) -acceptance-a11y-test Start a11y Cypress in interactive mode -ci-acceptance-a11y-test Run a11y cypress tests in headless mode for CI -``` - -### Development Environment Setup - -Install package requirements - -```shell -pnpm i -make install -pnpm i -``` - -### Start developing - -Run (in separate terminal sessions) - -Start backend server - -```shell -make start-backend-docker -``` - -Start frontend - -```shell -pnpm start -``` - -### Linting - -Run ESlint, Prettier and Stylelint - -```shell -make lint -``` - -### Formatting - -Run ESlint, Prettier and Stylelint in fix mode - -```shell -make format -``` - -### i18n - -Extract the i18n messages to locales - -```shell -make i18n -``` - -### Unit tests - -Run unit tests - -```shell -make test -``` - -### Run Cypress tests - -Run (in separate terminal sessions) - -Start the frontend in dev mode - -```shell -make start-test-acceptance-frontend-dev -``` - -Start the backend acceptance server - -```shell -make start-test-acceptance-server -``` - -Start the Cypress interactive test runner - -```shell -make test-acceptance -``` - -### Release - -Run - -```shell -make release -``` - -For releasing a RC version - -Run - -```shell -make release-rc -``` +See a detailed upgrade guide at https://volto-light-theme.readthedocs.io/latest/upgrade-guide.html. diff --git a/UPGRADE-GUIDE.md b/UPGRADE-GUIDE.md deleted file mode 100644 index 88e83943..00000000 --- a/UPGRADE-GUIDE.md +++ /dev/null @@ -1,57 +0,0 @@ -# Upgrade Guide - -## volto-light-theme 5.0.0 - -The requirements for VLT have changed: - -| VLT version | Volto version | -|-------------|---------------| -| 3.x.x | >= Volto 17.0.0-alpha.16 | -| 4.x.x | < Volto 17.18.0 | -| 5.x.x | >= Volto 17.18.0 or >=Volto 18.0.0-alpha.36 | - -## volto-light-theme 4.0.0 - -The tabbing order in the top header was fixed for accessibility concerns. -It modifies the underlying HTML to move the top header to the bottom, and modifies CSS to adjust. - -The MobileNavigation component was updated to be more easily customizable. -The component can now handle infinite navigation depth instead of only three levels, if configured to do so. -The Burger Menu can now be easily customized by overriding the new MobileNavigationToggler.jsx file. - -## volto-light-theme 3.0.0 - -### Blocks background colors go full width - -The background colors previously used to snap to 1440px. -From 3.0.0-alpha.0 this changed to be unconstrained by default, and expand to the end of the horizontal viewport. - -### Upgraded support for volto-slider-block 6.0.0 - -VLT upgraded the dependency on `@kitconcept/volto-slider-block` to use `6.0.0`. - -This is a drop-in replacement, so no action is required for the existing slider blocks you may have already in your sites. -However, the CSS classes of the structural slider block elements changed in this version. -The inner (visible objects) CSS classes remain unchanged. -If you have customized them in your project, you may have to update them, although the structural class names are rarely customized aside from vertical spacing properties. -They are mapped 1:1 with the previous ones, following this table correspondence: - -| Old className | New className | -| --------------- | ---------------- | -| slick-slider | slider-wrapper | -| slick-list | slider-viewport | -| slick-track | slider-container | -| slick-slide | slider-slide | -| slick-arrow | slider-button | -| slick-prev | slider-button-prev | -| slick-next | slider-slide-next | -| slick-next | slider-slide-next | -| slick-dots | slider-dots | -| slick-dot | slider-dot | - -For more information, please check the https://github.com/kitconcept/volto-slider-block/blob/main/README.md [#288](https://github.com/kitconcept/volto-light-theme/pull/288) - -### Language switcher shows the two letters abbreviation of the languages - -Volto default is to show the full name of the language in the language switcher. -VLT now shows only the two letters abbreviation of the language. diff --git a/docs/_static/Plone_logo_square.png b/docs/_static/Plone_logo_square.png new file mode 100644 index 00000000..f42a1220 Binary files /dev/null and b/docs/_static/Plone_logo_square.png differ diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico new file mode 100644 index 00000000..ae7bb0cd Binary files /dev/null and b/docs/_static/favicon.ico differ diff --git a/docs/_static/logo.svg b/docs/_static/logo.svg new file mode 100644 index 00000000..6bfdc1ee --- /dev/null +++ b/docs/_static/logo.svg @@ -0,0 +1,48 @@ + + + + diff --git a/docs/_static/print.css b/docs/_static/print.css new file mode 100644 index 00000000..8dbc2d57 --- /dev/null +++ b/docs/_static/print.css @@ -0,0 +1,3 @@ +.tooltip { + display: none; +} diff --git a/docs/_static/volto-light-theme.png b/docs/_static/volto-light-theme.png new file mode 100644 index 00000000..aa487310 Binary files /dev/null and b/docs/_static/volto-light-theme.png differ diff --git a/docs/block-model-v3.md b/docs/block-model-v3.md new file mode 100644 index 00000000..09dcabb0 --- /dev/null +++ b/docs/block-model-v3.md @@ -0,0 +1,120 @@ +--- +myst: + html_meta: + "description": "Block model version 3" + "property=og:description": "Block model version 3" + "property=og:title": "Block model version 3" + "keywords": "Volto Light Theme, Block model version 3" +--- + +# Block model version 3 + +## Introduction and history + +### DLR Block model (v1) + +The block has all the information needed for rendering itself, but the rules are exhaustive, cumbersome, and prone to error if they are not exhaustive enough. + + +### VLT Block model (v2) + +After the DLR experience, we tried the approach of using a block wrapper in view mode that would arrange the blocks grouped by a property, background color, and wrapped in a container. +This container is the one with the vertical spacing and the color. +This proved to dramatically simplify the CSS, with the drawback that the wrapper and the arrangement logic should be present in the view mode. +This made it very difficult to do the same in edit mode, because of the existing drag-and-drop wrappers, so the edit mode renders "ugly" without them. + + +## Block Model version 3 + +### View/Edit containers + +The block should have the same containers in both View and Edit components, so we can write CSS once that applies to both. + +These containers will conform the following two-level wrappers definitions. + + +#### Main/Outer container + +This is the container that receives the injected block classNames and styles from the StyleWrapper. +It's the (familiar) `div` that has the `block ${type}` className. +In View mode it should be provided by the block developer. +In Edit mode it's part of the edit wrappers, `block-editor-${type}` wrapper, and automatically receives the StyleWrapper injected properties. + +The principal responsibility of the Main/Outer container, other than giving the block its background color, is to fit the block into the layout of the page by stacking itself above or below its siblings. +It _must_ be full width, and go from the left edge to the right edge of the page. +It _must not_ have any margin or padding. +The only exception to this is the extra padding that is added for visual coherence when the block's background color is different from the previous or next sibling's background color. + + +#### Secondary/Inner container + +The Secondary/Inner container takes care of the horizontal (block's content width) and vertical (vertical spacing between siblings) offsets. +For example, for a block such as the Slider, you might want to have a horizontal offset of zero, and have the content fill the width of the page. +On the other hand, for a Slate with a paragraph of text, you might want space offsetting both sides to facilitate readability and create a cleaner look. + +The vertical spatial relationships between contiguous blocks will be defined by the blocks' categories. +For example, if a Slate (which has category inline) comes after a Slider (which has category full-width), the latter should add an extra bottom padding to improve the readability of the following paragraph. + +To avoid background color inconsistencies, the vertical offset given by the Secondary/Inner container must be implemented using the padding property. +As a general rule—and to establish a convention—the vertical space between two blocks should be provided by the upper block. +This means that, for most cases, the top of the block's content must be flush with the top of the container. + + +### Block category + +A block should be able to be categorized given its nature and visual characteristics. +This nature determines how they relate with the other siblings. + +This category will help to determine the default behavior of the block by injecting it as a className. + + +### Improve the edit mode wrappers + +We can improve the current edit wrappers, but we have to do it in a non-breaking way. + +Current Edit mode wrappers: + +```text +.block-editor-$type $StyleWrapperClassNames $StyleWrapperStyles + div.[style="position: relative"] (the relative container) + div.drag.handle.wrapper (the one of the drag icon) + div.ui.drag.block.inner.$type (this is superfluous, but the block classname can't be removed) + div.[role="presentation"].block.$type.selected (the state-wrapper, controls the blue border) + {Edit component} + button.ui.basic.button.delete-button +``` + +Proposed wrappers: + +Edit + +```text +.block-editor-$type $StyleWrapperClassNames $StyleWrapperStyles + div.[style="position: relative"] (the relative container) + div.drag.handle.wrapper (the one of the drag icon) + div.ui.drag.block.inner.$type (this is superfluous, but the block classname can't be removed) + div.[role="presentation"].block.$type.selected category-action +
The text and illustrations in this website are licensed by the Plone Foundation under a Creative Commons Attribution 4.0 International license. Plone and the Plone® logo are registered trademarks of the Plone Foundation, registered in the United States and other countries. For guidelines on the permitted uses of the Plone trademarks, see https://plone.org/foundation/logo. All other trademarks are owned by their respective owners.
+Pull request previews by Read the Docs.
""", + "footer_end": ["version.html"], + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/plone/volto", + "icon": "fa-brands fa-square-github", + "type": "fontawesome", + "attributes": { + "target": "_blank", + "rel": "noopener me", + "class": "nav-link custom-fancy-css", + }, + }, + { + "name": "Mastodon", + "url": "https://plone.social/@plone", + "icon": "fa-brands fa-mastodon", + "type": "fontawesome", + "attributes": { + "target": "_blank", + "rel": "noopener me", + "class": "nav-link custom-fancy-css", + }, + }, + { + "name": "Twitter", + "url": "https://twitter.com/plone", + "icon": "fa-brands fa-square-twitter", + "type": "fontawesome", + "attributes": { + "target": "_blank", + "rel": "noopener me", + "class": "nav-link custom-fancy-css", + }, + }, + ], + "logo": { + "text": "@kitconcept/volto-light-theme Documentation", + }, + "navigation_with_keys": True, + "path_to_docs": "docs", + "repository_branch": "main", + "repository_url": "https://github.com/kitconcept/volto-light-theme/tree/main/", + "search_bar_text": "Search", # TODO: Confirm usage of search_bar_text in plone-sphinx-theme + "use_edit_page_button": True, + "use_issues_button": True, + "use_repository_button": True, +} + +# Announce that we have an opensearch plugin +# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_use_opensearch +html_use_opensearch = "https://volto-light-theme.readthedocs.io/" # TODO: Confirm usage of opensearch in theme + +# The name for this set of Sphinx documents. If None, it defaults to +# "