elements icon indicating copy to clipboard operation
elements copied to clipboard

feat: separating non-react specific utils and type definitions into it's own package.

Open ValeryG opened this issue 11 months ago • 2 comments

Separation of presentation and helper code

Both elements and elements-core are presentation level specific. They depend on react and their bundles they publish have client side polyfills and references to document/window and globalThis. This makes it hard to use code exported from those packages to be used in non-react or ssr running projects.

And there is an excellent code. Eg:

  • http-spec is producing AST, but the layer that creates TableOfContent structure is backed into presentation package.
  • string definitions to decipher security section are also very helpful on it's own without being tided to react components.
  • validations and guards on AST nodes

So the idea of this PR is to introduce new package, elements-utils make it be presentation framework agnostic (no dependency on react, no browser specific code in the bundle), and move the implementation described above into this package. So essentially make it a helper on top of http-spec, and keep elements and elements-core hold presentation level.

  • [ X] Read CONTRIBUTING.md

Other Available PR Templates:

  • Release: https://github.com/stoplightio/elements/compare?template=release.md
    • [X] Read the release section of CONTRIBUTING.md

TODO:

as new package @stoplight/elements-utls is not published, there are some temperately changes introduced to prevent CI from failing. Those changes needed to be rolled back after package is published:

ValeryG avatar Dec 10 '24 15:12 ValeryG

Deploy Preview for stoplight-elements ready!

Name Link
Latest commit b11a1014e98ac2d10e7169293f2666dc41c4a9fa
Latest deploy log https://app.netlify.com/sites/stoplight-elements/deploys/675b0f90e0febf000872bd52
Deploy Preview https://deploy-preview-2751--stoplight-elements.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Dec 10 '24 15:12 netlify[bot]

Deploy Preview for stoplight-elements-demo ready!

Name Link
Latest commit b11a1014e98ac2d10e7169293f2666dc41c4a9fa
Latest deploy log https://app.netlify.com/sites/stoplight-elements-demo/deploys/675b0f900d7843000868ae71
Deploy Preview https://deploy-preview-2751--stoplight-elements-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Dec 10 '24 15:12 netlify[bot]