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/[email protected] Transitive: environment, filesystem, unsafe +35 10.2 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +31 9.81 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment +2 2.5 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +37 10.2 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +31 9.84 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +32 9.8 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +33 9.84 MB nicolo-ribaudo
npm/@babel/[email protected] Transitive: environment, filesystem, unsafe +37 10.2 MB nicolo-ribaudo
npm/@csstools/[email protected] None 0 43.9 kB alaguna
npm/@csstools/[email protected] None 0 16.7 kB alaguna
npm/@types/[email protected] None 0 8.56 kB types
npm/@yarnpkg/[email protected] filesystem +1 784 kB arcanis
npm/[email protected] None +2 157 kB matteo.collina
npm/[email protected] filesystem, shell 0 113 kB abetomo
npm/[email protected] Transitive: environment, filesystem +3 2.74 MB zloirock
npm/[email protected] None +1 1.79 MB lahmatiy
npm/[email protected] None 0 11.4 kB feedic
npm/[email protected] None +1 55.9 kB feedic
npm/[email protected] None +2 28.3 kB mafintosh
npm/[email protected] None 0 6.23 kB mafintosh
npm/[email protected] None 0 314 kB ariya
npm/[email protected] None +2 21.4 kB phated
npm/[email protected] None 0 4.72 kB stefanpenner
npm/[email protected] None 0 3.71 kB jonschlinkert
npm/[email protected] environment, filesystem 0 32.5 kB isaacs
npm/[email protected] environment, unsafe Transitive: filesystem +30 68.8 MB swatinem
npm/[email protected] filesystem Transitive: environment, shell +42 7.14 MB dbanksdesign
npm/[email protected] None 0 50 kB typescript-bot
npm/[email protected] Transitive: environment, filesystem, network, shell +44 263 MB antfu, patak, soda, ...2 more

🚮 Removed packages: npm/@phase2/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

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.

2 participants