Skip to content
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

Component: @phase2/outline-core-styled-text #432

Draft
wants to merge 25 commits into
base: next
Choose a base branch
from

Conversation

JSchreff
Copy link

@JSchreff JSchreff commented Jan 30, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Visual Testing
  • Automated Testing
  • Accessibility Testing

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Introduced the OutlineCoreStyledText component for enhanced text styling and manipulation, including headings, paragraphs, block quotes, lists, tables, and links.
    • Added new CSS files for styling WYSIWYG content, tables, and specific text elements like tooltips and external links.
    • Implemented utilities for checking file types, adding external link indicators, creating tooltips, and wrapping the last word of links for improved accessibility and user experience.

Copy link

changeset-bot bot commented Jan 30, 2024

⚠️ No Changeset found

Latest commit: b3cf30a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Jan 30, 2024

Deploy Preview for outlinejs failed.

Name Link
🔨 Latest commit b3cf30a
🔍 Latest deploy log https://app.netlify.com/sites/outlinejs/deploys/65de064cba503c0008d33ef9

@JSchreff JSchreff marked this pull request as draft January 30, 2024 15:00
Copy link

coderabbitai bot commented Jan 30, 2024

Important

Auto Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The update introduces the outline-core-styled-text component, enhancing text styling across applications. It covers a broad spectrum of text elements, including headings, paragraphs, lists, and more, with a focus on WYSIWYG content. The component, alongside its styles and utilities, aims to standardize text appearance, improve accessibility, and facilitate content management, particularly for external links and tooltips. This change integrates seamlessly with existing design systems and extends functionality for a better user experience.

Changes

File(s) Change Summary
.../outline-core-styled-text/docs/outline-core-styled-text.mdx Introduces the outline-core-styled-text component documentation, covering usage and settings.
.../outline-core-styled-text/index.ts Exports the OutlineCoreStyledText component and its associated sub-components, variables, and methods.
.../outline-core-styled-text/src/.ck.ck-content.global.css Adds CSS for WYSIWYG elements scoped to .ck.ck-content, including tooltip style overrides.
.../outline-core-styled-text/src/outline-core-styled-text.css Sets up basic styles for the outline-core-styled-text component.
.../outline-core-styled-text/src/outline-core-styled-text.lightdom.css Styles for WYSIWYG content within <outline-core-styled-text>, including fonts and colors.
.../outline-core-styled-text/src/outline-core-styled-text.shared.css Defines typography, spacing, list, link styles, and styles for specific elements like headings, paragraphs, and inline text elements.
.../outline-core-styled-text/src/outline-core-styled-text.ts Implements the OutlineCoreStyledText component with functionality for styling text elements, handling tooltip links, and wrapping the last word of links in a span.
.../outline-core-styled-text/src/sic-table.css Introduces styles for tables, including font sizes, colors, and scrollbar styles.
.../outline-core-styled-text/src/utilities/... Introduces utilities for checking file types (check-file-type.ts), adding external link messages (external-link-text.ts), creating tooltips (tooltip.ts), and wrapping the last word in links (wrap-last-word.ts).

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a37a2af and e2406ef.
Files ignored due to path filters (2)
  • packages/components/outline-core-styled-text/packages.json is excluded by: !**/*.json
  • packages/components/outline-core-styled-text/tsconfig.build.json is excluded by: !**/*.json
Files selected for processing (12)
  • packages/components/outline-core-styled-text/docs/outline-core-styled-text.mdx (1 hunks)
  • packages/components/outline-core-styled-text/index.ts (1 hunks)
  • packages/components/outline-core-styled-text/src/.ck.ck-content.global.css (1 hunks)
  • packages/components/outline-core-styled-text/src/outline-core-styled-text.css (1 hunks)
  • packages/components/outline-core-styled-text/src/outline-core-styled-text.lightdom.css (1 hunks)
  • packages/components/outline-core-styled-text/src/outline-core-styled-text.shared.css (1 hunks)
  • packages/components/outline-core-styled-text/src/outline-core-styled-text.ts (1 hunks)
  • packages/components/outline-core-styled-text/src/sic-table.css (1 hunks)
  • packages/components/outline-core-styled-text/src/utilities/check-file-type.ts (1 hunks)
  • packages/components/outline-core-styled-text/src/utilities/external-link-text.ts (1 hunks)
  • packages/components/outline-core-styled-text/src/utilities/tooltip.ts (1 hunks)
  • packages/components/outline-core-styled-text/src/utilities/wrap-last-word.ts (1 hunks)
Additional comments: 13
packages/components/outline-core-styled-text/docs/outline-core-styled-text.mdx (13)
  • 1-3: Imports are correctly defined at the top of the file, ensuring that necessary dependencies for the documentation are loaded. This includes the html function from lit and various Storybook components, as well as the OutlineCoreStyledText component itself.
  • 5-14: The <Meta> tag is correctly configured with a title and parameters to hide the canvas view in the Storybook docs. This is a standard practice for Storybook documentation to control how the stories are displayed.
  • 40-57: The "Headings" story is well-constructed, demonstrating the use of various heading levels within the OutlineCoreStyledText component. This section effectively showcases how headings are styled when wrapped in the component.
  • 61-135: The "Basic Text" story provides a comprehensive demonstration of how different types of text and links are styled within the OutlineCoreStyledText component. It includes examples of paragraphs, links to different file types, and various text styles such as strong and italic paragraphs. This section is thorough and showcases the component's capabilities effectively.
  • 140-210: The "Disclaimer Text" story showcases the styling of disclaimer paragraphs within the OutlineCoreStyledText component. It includes examples of different paragraph styles and links, both internal and external. This section is well-detailed, providing clear examples of how disclaimer text can be styled.
  • 215-241: The "Block Quote" story demonstrates the styling of block quotes within the OutlineCoreStyledText component, including an icon for quotes. This section effectively showcases how block quotes are styled and includes an author attribution, providing a complete example of a styled block quote.
  • 245-263: The "Horizontal Rule" story demonstrates the use of a horizontal rule (<hr />) to separate content within the OutlineCoreStyledText component. This is a simple yet effective demonstration of how horizontal rules can be styled and used within the component.
  • 267-317: The "Unordered List" story provides a detailed example of how unordered lists, including nested lists, are styled within the OutlineCoreStyledText component. This section effectively demonstrates the component's capability to style complex list structures.
  • 356-397: The "Ordered List" story demonstrates the styling of ordered lists, including nested lists with multiple levels, within the OutlineCoreStyledText component. This section is comprehensive and showcases the component's ability to handle complex list structures effectively.
  • 399-453: The "Table" story provides a detailed example of how tables are styled within the OutlineCoreStyledText component. This includes table headings, nested paragraph tags within table cells, and links. This section effectively demonstrates the component's capability to style tables in a consistent and accessible manner.
  • 455-482: The "Button and Link" story showcases the styling of buttons and links within the OutlineCoreStyledText component. It includes examples of standard links, external links, primary and secondary buttons, and call-to-action links. This section is comprehensive and effectively demonstrates the component's styling capabilities for interactive elements.
  • 484-505: The "Tooltip" story demonstrates the use of tooltips within the OutlineCoreStyledText component. It provides a clear example of how to create a tooltip using a link with a title attribute. This section effectively showcases the component's capability to enhance links with additional information in a user-friendly manner.
  • 507-652: The "Base Styled Text" story provides a comprehensive example of various text elements styled within the OutlineCoreStyledText component. It includes headings, paragraphs, lists, and links, showcasing the component's versatility in handling different types of content. This section is well-detailed and effectively demonstrates the component's styling capabilities.

Comment on lines 17 to 27
# Overview

These are the basic styles provided by the outline-core-styled-text component.
`<outline-core-styled-text>` should wrap wysiwyg content.

## Use In Components

`<outline-core-styled-text>` will not inherit any css styles set on parent element.
Components that contain slots that may use `<outline-core-styled-text>` will need to set
css variables in component different values are needed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overview section provides a clear introduction to the OutlineCoreStyledText component, explaining its purpose and how it should be used. However, it mentions that the component will not inherit CSS styles from parent elements and advises on setting CSS variables if different values are needed. This is crucial information for developers but could benefit from an example or further clarification on how to set these variables.

Consider adding a code snippet or a more detailed explanation on how to set CSS variables for components containing OutlineCoreStyledText.

Comment on lines 32 to 36
### CSS Variables

- `--outline-core-body-text--font-size`: defaults to `--body-01-font-size`
- `--outline-core-body-text--line-height`: defaults to `--body-01-font-size`
- `--outline-core-body-text--margin-bottom`: defaults to `1em`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation correctly lists the CSS variables that can be used to customize the OutlineCoreStyledText component. However, there's a typo in the description of --outline-core-body-text--line-height, which incorrectly defaults to --body-01-font-size instead of a line-height value.

- - `--outline-core-body-text--line-height`: defaults to `--body-01-font-size`
+ - `--outline-core-body-text--line-height`: defaults to `--body-01-line-height`

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### CSS Variables
- `--outline-core-body-text--font-size`: defaults to `--body-01-font-size`
- `--outline-core-body-text--line-height`: defaults to `--body-01-font-size`
- `--outline-core-body-text--margin-bottom`: defaults to `1em`
### CSS Variables
- `--outline-core-body-text--font-size`: defaults to `--body-01-font-size`
- `--outline-core-body-text--line-height`: defaults to `--body-01-line-height`
- `--outline-core-body-text--margin-bottom`: defaults to `1em`

Comment on lines 321 to 354
## Two columns List (UL)

<Canvas>
<Story name="Two columns List">
{html`
<outline-core-styled-text>
<p>
Sed fringilla mauris sit amet nibh. Ut varius tincidunt libero. Sed
hendrerit. Proin magna. Nullam nulla eros, ultricies sit amet, nonummy
id, imperdiet feugiat, pede.
</p>
<ul class="columns-2">
<li>This is the first item</li>
<li>This is the second item</li>
<li>This is the first child item</li>
<li>This is the second child item</li>
<li>This is the third item</li>
<li>This is the first item</li>
<li>This is the second item</li>
<li>This is the first child item</li>
<li>This is the second child item</li>
<li>This is the third item</li>
<li>This is the second child item</li>
<li>This is the third item</li>
</ul>
<p>
Sed fringilla mauris sit amet nibh. Ut varius tincidunt libero. Sed
hendrerit. Proin magna. Nullam nulla eros, ultricies sit amet, nonummy
id, imperdiet feugiat, pede.
</p>
</outline-core-styled-text>
`}
</Story>
</Canvas>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Two columns List" story showcases how to create a two-column list using the OutlineCoreStyledText component. This example is particularly useful for demonstrating more advanced styling capabilities within the component. However, it would benefit from a brief explanation or comment on how the columns-2 class is defined and used.

Consider adding a comment or documentation snippet explaining the columns-2 class and how it achieves the two-column layout.

@JSchreff
Copy link
Author

Todos:

  • Set up vars that actually work, and a vars file that can be passed in.
  • Ensure the necessary bits for a tooltip are implemented (or stripped out)
  • Ensure baseline styles specific for ckeditor functionality are split out into a separate file and labeled as such.
  • Split css between directories so it is clear and comprehensible how it all works and can be maintained.
  • Enhanced documentation for usage/extension/copypasta.
  • Give everything a good final once-over to ensure everything present is load bearing, clean, clear, and performant.

@himerus himerus changed the title Issue/nt outline core styled text Component: @phase2/outline-core-styled-text Feb 6, 2024
@himerus himerus added Type: Component Suggestion Use this label for any issue that is a recommendation for a specific type of component. Why: Increase standardization NEW PACKAGE A Pull Request that creates a new NPM package to be released. labels Feb 6, 2024
Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@babel/helper-create-class-features-plugin@7.23.10 Transitive: environment, filesystem, unsafe +35 10.2 MB nicolo-ribaudo
npm/@babel/helper-create-regexp-features-plugin@7.22.15 Transitive: environment, filesystem, unsafe +31 9.81 MB nicolo-ribaudo
npm/@babel/helper-member-expression-to-functions@7.23.0 Transitive: environment +2 2.5 MB nicolo-ribaudo
npm/@babel/plugin-transform-class-properties@7.23.3 Transitive: environment, filesystem, unsafe +37 10.2 MB nicolo-ribaudo
npm/@babel/plugin-transform-modules-commonjs@7.23.3 Transitive: environment, filesystem, unsafe +31 9.84 MB nicolo-ribaudo
npm/@babel/plugin-transform-nullish-coalescing-operator@7.23.4 Transitive: environment, filesystem, unsafe +32 9.8 MB nicolo-ribaudo
npm/@babel/plugin-transform-optional-chaining@7.23.4 Transitive: environment, filesystem, unsafe +33 9.84 MB nicolo-ribaudo
npm/@babel/plugin-transform-private-methods@7.23.3 Transitive: environment, filesystem, unsafe +37 10.2 MB nicolo-ribaudo
npm/@csstools/postcss-progressive-custom-properties@1.3.0 None 0 43.9 kB alaguna
npm/@csstools/selector-specificity@2.2.0 None 0 16.7 kB alaguna
npm/@types/unist@2.0.10 None 0 8.56 kB types
npm/@yarnpkg/libzip@2.3.0 filesystem +1 784 kB arcanis
npm/bl@4.1.0 None +2 157 kB matteo.collina
npm/commander@6.2.1 filesystem, shell 0 113 kB abetomo
npm/core-js-compat@3.36.0 Transitive: environment, filesystem +3 2.74 MB zloirock
npm/css-tree@1.1.3 None +1 1.79 MB lahmatiy
npm/domelementtype@2.3.0 None 0 11.4 kB feedic
npm/domhandler@4.3.1 None +1 55.9 kB feedic
npm/duplexify@3.7.1 None +2 28.3 kB mafintosh
npm/end-of-stream@1.4.4 None 0 6.23 kB mafintosh
npm/esprima@4.0.1 None 0 314 kB ariya
npm/extend-shallow@3.0.2 None +2 21.4 kB phated
npm/get-caller-file@2.0.5 None 0 4.72 kB stefanpenner
npm/get-value@2.0.6 None 0 3.71 kB jonschlinkert
npm/graceful-fs@4.2.10 environment, filesystem 0 32.5 kB isaacs
npm/rollup-plugin-dts@6.1.0 environment, unsafe Transitive: filesystem +30 68.8 MB swatinem
npm/style-dictionary@3.7.1 filesystem Transitive: environment, shell +42 7.14 MB dbanksdesign
npm/tslib@2.4.0 None 0 50 kB typescript-bot
npm/vite@5.1.4 Transitive: environment, filesystem, network, shell +44 263 MB antfu, patak, soda, ...2 more

🚮 Removed packages: npm/@phase2/outline-config@0.0.14, npm/glob-parent@5.1.2, npm/globby@11.1.0, npm/graceful-fs@4.2.11, npm/has-property-descriptors@1.0.2, npm/has-symbols@1.0.3, npm/has-tostringtag@1.0.2, npm/hasown@2.0.1, npm/iconv-lite@0.4.24, npm/import-fresh@3.3.0, npm/internal-slot@1.0.7, npm/is-callable@1.2.7, npm/is-core-module@2.13.1, npm/is-date-object@1.0.5, npm/is-extglob@2.1.1, npm/is-glob@4.0.3, npm/is-string@1.0.7, npm/is-symbol@1.0.4, npm/is-typed-array@1.1.13, npm/is-windows@1.0.2, npm/istanbul-lib-coverage@3.2.2, npm/istanbul-lib-report@3.0.1, npm/js-yaml@3.14.1, npm/json5@2.2.3, npm/koa-send@5.0.1, npm/lefthook@1.6.1, npm/lint-staged@10.5.4, npm/lit-analyzer@1.2.1, npm/lit-html@2.8.0, npm/make-dir@3.1.0, npm/merge2@1.4.1, npm/micromatch@4.0.5, npm/mime-db@1.52.0, npm/mime-types@2.1.35, npm/minimist-options@4.1.0, npm/minimist@1.2.8, npm/mkdirp@1.0.4, npm/neo-async@2.6.2, npm/normalize-path@3.0.0, npm/npm-run-all@4.1.5, npm/npm-run-path@4.0.1, npm/object.assign@4.1.5, npm/object.fromentries@2.0.7, npm/object.values@1.1.7, npm/on-finished@2.4.1, npm/onetime@5.1.2, npm/open@8.4.2, npm/p-limit@2.3.0, npm/parse-json@5.2.0, npm/parseurl@1.3.3, npm/path-key@3.1.1, npm/picomatch@2.3.1, npm/pirates@4.0.6, npm/postcss-discard-comments@5.1.0, npm/postcss-loader@7.3.4, npm/postcss-nested-import@1.3.0, npm/postcss-preset-env@7.8.3, npm/postcss@8.4.8, npm/prettier-plugin-tailwindcss@0.1.13, npm/prettier@2.8.8, npm/progress@2.0.3, npm/qs@6.11.2, npm/react-dom@18.2.0, npm/react-syntax-highlighter@15.5.0, npm/react@18.2.0, npm/recast@0.23.4, npm/regexp.prototype.flags@1.5.2, npm/requireindex@1.2.0, npm/resolve-from@5.0.0, npm/resolve-global@1.0.0, npm/resolve@1.22.8, npm/rimraf@3.0.2, npm/rollup@3.29.4, npm/rsync@0.6.1, npm/safe-buffer@5.1.2, npm/semver@6.3.1, npm/set-function-name@2.0.1, npm/signal-exit@3.0.7, npm/split2@3.2.2, npm/storybook@7.6.16, npm/string-width@4.2.3, npm/strip-ansi@6.0.1, npm/strip-json-comments@3.1.1, npm/svgo@2.8.0, npm/tailwindcss@3.0.0, npm/ts-dedent@2.2.0, npm/ts-lit-plugin@1.2.1, npm/tsc@2.0.4, npm/tslib@2.6.2, npm/turbo@1.12.4, npm/type-is@1.6.18, npm/unpipe@1.0.0, npm/util-deprecate@1.0.2, npm/util@0.12.5, npm/vary@1.1.2, npm/vite@4.5.2, npm/which-typed-array@1.1.14, npm/yargs@17.7.2

View full report↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NEW PACKAGE A Pull Request that creates a new NPM package to be released. Type: Component Suggestion Use this label for any issue that is a recommendation for a specific type of component. Why: Increase standardization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants