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

Remove Css, styled_label and friends #487

Merged
merged 33 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b2e35a5
Remove Css_Legacy_Core
davesnx Jul 4, 2024
0ff8f5b
WIP
davesnx Jul 4, 2024
c291844
Merge branch 'main' of github.com:/davesnx/styled-ppx into Remove-Css…
davesnx Jul 5, 2024
64beff7
Make emotion compile
davesnx Jul 5, 2024
9be6dc1
Remove pseudoclass and pseudoselector
davesnx Jul 5, 2024
ec3fd36
Cleanup emotion package
davesnx Jul 5, 2024
869e5ba
Reuse Properties
davesnx Jul 5, 2024
fd045f5
Rename styled-ppx.emotion/emotion_native -> styled-ppx.native/melange
davesnx Jul 5, 2024
0843be2
Make names of runtime explicit, doesn't matter thoguht
davesnx Jul 5, 2024
32dcbd5
Move emotion intro 'runtime'
davesnx Jul 5, 2024
8f6e178
Merge container work
davesnx Jul 5, 2024
ee3d961
Remove css
davesnx Jul 5, 2024
73061e4
Fix rescript
davesnx Jul 5, 2024
0b2e9b3
Rename to melange
davesnx Jul 5, 2024
4299291
Remove fallback on rescript
davesnx Jul 5, 2024
cb319e6
revert: Remove fallback on rescript
davesnx Jul 5, 2024
1e27b6d
Rename styled_ppx -> ppx
davesnx Jul 5, 2024
e2bcbfa
Remove Css_ from parser
davesnx Jul 5, 2024
37abc66
Rename reason-css-parser to css-property-parser
davesnx Jul 5, 2024
7f01642
Inline property_parser
davesnx Jul 5, 2024
eea5648
Add interface for Generate
davesnx Jul 5, 2024
9cc03d5
Remove style_label hook
davesnx Jul 5, 2024
a267aa5
Remove server-reason-react.melange_ppx from shared
davesnx Jul 5, 2024
00dacbe
Remove all Array.to_list from native
davesnx Jul 5, 2024
11a43bb
Remove all usages of non Kloth
davesnx Jul 5, 2024
5af8fc4
Remove all dependencies from the runtime
davesnx Jul 5, 2024
bdcae13
Align interfaces between all Kloths
davesnx Jul 5, 2024
a56e7dd
Fix rescript's kloth
davesnx Jul 5, 2024
bdf5451
Fix binding with bs.
davesnx Jul 5, 2024
80edec4
Add change item for 0.58
davesnx Jul 5, 2024
d5921b8
Improve docs
davesnx Jul 5, 2024
8e53a8d
Reflect breakages in changes.md
davesnx Jul 5, 2024
e6ebb97
Polish docs for 0.58
davesnx Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,12 @@ jobs:
name: ${{ matrix.os }}
path: _build/default/packages/bin/bin.exe

- name: Upload runtime artifacts for @davesnx/styled-ppx/runtime/css
- name: Upload runtime artifacts for @davesnx/styled-ppx/runtime
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: runtime-css
path: _build/default/packages/css/rescript

- name: Upload runtime artifacts for @davesnx/styled-ppx/runtime/emotion
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: runtime-emotion
path: _build/default/packages/emotion/rescript
name: runtime-rescript
path: _build/default/packages/runtime/rescript

- name: Save cache when not Windows
uses: actions/cache/save@v3
Expand Down Expand Up @@ -151,18 +144,11 @@ jobs:
# with:
# name: windows-latest
# path: _release/platform-windows-x64

- name: Download runtime-css artifacts
uses: actions/download-artifact@v3
with:
name: runtime-css
path: _release/css

- name: Download runtime-emotion artifacts
- name: Download runtime-rescript artifacts
uses: actions/download-artifact@v3
with:
name: runtime-emotion
path: _release/emotion
name: runtime-rescript
path: _release/rescript

- name: Release nightly (@davesnx/styled-ppx) package
if: ${{ success() && github.event_name == 'pull_request' && github.event.pull_request.user.login == 'davesnx' }}
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changes

## 0.58.0
- [FEATURE] Initial @container support #476 (@zakybilfagih)
- [FIX] Make selector nested maintain other selectors #486 (@davesnx)
- [BREAKING] Remove `Css` module, `styled_label` and friends #487 (@davesnx)
- [BREAKING] Merge styled-ppx.css and styled-ppx.emotion into styled-ppx.melange #487 (@davesnx)
- [BREAKING] Merge styled-ppx.css-native and styled-ppx.emotion-native into styled-ppx.native #487 (@davesnx)
- [BREAKING] Merge styled-ppx.css-native and styled-ppx.emotion-native into styled-ppx.native #487 (@davesnx)
- [BREAKING] Remove PseudoClass and PseudoClassParam #487 (@davesnx)
- Remove functor from Css_Js_Core #487 (@davesnx)
- Remove melange.js and melange.belt from styled-ppx.melange #487 (@davesnx)
- Remove server-reason-react.js and server-reason-react.belt from styled-ppx.native #487 (@davesnx)

## 0.57.1
- Remove public_name from alcotest_extra #484 (@davesnx)
- Fix nesting for selectors (and pseudo) in native #483 (@davesnx)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

![demo](./.github/demo-dark.png#gh-dark-mode-only)![styled-ppx-demo-dark](./.github/demo-light.png#gh-light-mode-only)

**styled-ppx** is a [ppx](https://tarides.com/blog/2019-05-09-an-introduction-to-ocaml-ppx-ecosystem) and a library that brings styled components to ReScript and Melange. It allows you to create **React Components** with type-safe style definitions that don't rely on a different language ([DSL](https://en.wikipedia.org/wiki/Domain-specific_language)) except CSS, but also can be used without React.
**styled-ppx** is a [ppx](https://tarides.com/blog/2019-05-09-an-introduction-to-ocaml-ppx-ecosystem) and a library that brings styled components to ReScript, Melange and Native. Create **React Components** or simply `class` with type-safe style definitions wiht only CSS.

Built on top of [emotion](https://emotion.sh), it allows you to style apps safely, quickly, and performantly - just as you have always done it.
Built on top of [emotion](https://emotion.sh), it allows you to style apps safely, quickly, and performantly - just as you always done it.

## [Documentation](https://styled-ppx.vercel.app)

Expand Down
5 changes: 2 additions & 3 deletions e2e/melange/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(alias e2e-melange)
(target e2e-melange)
(modules :standard \ debug)
(libraries ui styled-ppx.css styled-ppx.emotion reason-react)
(libraries ui styled-ppx.melange reason-react)
(preprocess
(pps melange.ppx styled-ppx reason-react-ppx))
(module_systems
Expand All @@ -18,7 +18,6 @@
server-reason-react.belt
server-reason-react.react
server-reason-react.reactDom
styled-ppx.emotion_native
styled-ppx.css_native)
styled-ppx.native)
(preprocess
(pps styled-ppx)))
3 changes: 1 addition & 2 deletions e2e/melange/src/native/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(library
(name ui_native)
(libraries
styled-ppx.css_native
styled-ppx.emotion_native
styled-ppx.native
server-reason-react.react
server-reason-react.js
server-reason-react.belt
Expand Down
2 changes: 1 addition & 1 deletion e2e/melange/src/ui/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(name ui)
(wrapped false)
(modes melange)
(libraries melange.belt styled-ppx.css styled-ppx.emotion reason-react)
(libraries melange.belt styled-ppx.melange reason-react)
(preprocess
(pps melange.ppx styled-ppx reason-react-ppx)))
5 changes: 1 addition & 4 deletions e2e/rescript-v10-JSX4/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"type": "dev"
},
{
"dir": "../../_build/default/packages/css/rescript"
},
{
"dir": "../../_build/default/packages/emotion/rescript"
"dir": "../../_build/default/packages/runtime/rescript"
}
],
"package-specs": [
Expand Down
5 changes: 1 addition & 4 deletions e2e/rescript-v9-JSX3/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"type": "dev"
},
{
"dir": "../../_build/default/packages/css/rescript"
},
{
"dir": "../../_build/default/packages/emotion/rescript"
"dir": "../../_build/default/packages/runtime/rescript"
}
],
"package-specs": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
module Parser = {
include Parser;
include Parse_from_string;
};
module Parser = Parser;
module Rule = Rule;
module Standard = Standard;
module Combinator = Combinator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3341,3 +3341,21 @@ let check_map =
("extended-percentage", check(extended_percentage)),
]),
);

let parse = Parser_helper.parse;

module StringMap = Map.Make(String);

let (let.ok) = Result.bind;

let check_value = (~name, value) => {
let.ok check =
check_map
|> StringMap.find_opt(name)
|> Option.to_result(~none=`Unknown_value);

Ok(check(value));
};

let check_property = (~name) => check_value(~name="property-" ++ name);
/* let check_media_query = (~name) => check_value(~name="media-" ++ name); */
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
open Rule.Pattern;
open Styled_ppx_css_parser.Tokens;
open Standard;

module StringMap = Map.Make(String);

let (let.ok) = Result.bind;

let apply_parser = (parser, tokens_with_loc) => {
open Styled_ppx_css_parser.Css_lexer;
open Styled_ppx_css_parser.Lexer;

let tokens =
tokens_with_loc
Expand Down Expand Up @@ -41,7 +39,7 @@ let apply_parser = (parser, tokens_with_loc) => {

let parse = (rule_parser: Rule.rule('a), str) => {
let.ok tokens_with_loc =
Styled_ppx_css_parser.Css_lexer.from_string(str)
Styled_ppx_css_parser.Lexer.from_string(str)
|> Result.map_error(_ => "frozen");

apply_parser(rule_parser, tokens_with_loc);
Expand All @@ -51,14 +49,14 @@ let check = (prop: Rule.rule('a), value) =>
parse(prop, value) |> Result.is_ok;

// TODO: workarounds
let invalid = expect(STRING("not-implemented"));
let invalid = Rule.Pattern.expect(STRING("not-implemented"));
let attr_name = invalid;
let attr_fallback = invalid;
let string_token = invalid;
let ident_token = invalid;
let dimension = invalid;
let declaration_value = invalid;
let positive_integer = integer;
let positive_integer = Standard.integer;
let function_token = invalid;
let any_value = invalid;
let hash_token = invalid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name reason_css_parser)
(public_name styled-ppx.reason-css-parser)
(name Css_property_parser)
(public_name styled-ppx.css-property-parser)
(libraries sedlex styled-ppx.css-parser ppx_deriving.runtime compiler-libs)
(preprocess
(per_module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ module Make = (Builder: Ppxlib.Ast_builder.S) => {
);
let type_anotation = [%type:
list(Tokens.token) =>
(Reason_css_parser__Rule.data([%t core_type]), list(Tokens.token))
(Css_property_parser__Rule.data([%t core_type]), list(Tokens.token))
];
[%expr ([%e expression]: [%t type_anotation])];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
(kind ppx_rewriter)
(wrapped false)
(libraries styled-ppx.css-spec-parser ppxlib reason_css_parser_ppx_lib)
(modules Reason_css_parser_ppx)
(modules Css_property_parser_ppx)
(preprocess
(pps ppxlib.metaquot)))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Alcotest;
open Reason_css_parser;
open Css_property_parser;
open Rule.Match;
open Modifier;
open Combinator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Alcotest;
open Reason_css_parser;
open Css_property_parser;
open Combinator;
open Standard;
open Modifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Alcotest;
open Reason_css_parser;
open Css_property_parser;
open Rule;
open! Data;
open Styled_ppx_css_parser.Tokens;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Alcotest;
open Reason_css_parser;
open Css_property_parser;
open Combinator;
open Standard;
open Modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name Runner)
(libraries
alcotest
styled-ppx.reason-css-parser
styled-ppx.css-property-parser
reason_css_parser_ppx_lib
styled-ppx.css-parser
ppxlib
Expand Down
Loading
Loading