├── .github └── workflows │ └── rust.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── deprecate.sh ├── float-pigment-consistent-bincode ├── .gitignore ├── BINCODE-LICENSE.md ├── Cargo.toml ├── README.md ├── examples │ └── basic.rs ├── src │ ├── config │ │ ├── endian.rs │ │ ├── int.rs │ │ ├── limit.rs │ │ ├── mod.rs │ │ └── trailing.rs │ ├── de │ │ ├── mod.rs │ │ └── read.rs │ ├── error.rs │ ├── internal.rs │ ├── io.rs │ ├── lib.rs │ └── ser │ │ └── mod.rs └── tests │ └── test.rs ├── float-pigment-css-macro ├── Cargo.toml ├── README.md └── src │ ├── compatibility_check.rs │ ├── lib.rs │ ├── property_list.rs │ ├── resolve_font_size.rs │ ├── style_syntax.rs │ └── value_type.rs ├── float-pigment-css ├── .gitignore ├── Cargo.toml ├── README.md ├── benches │ └── parse.rs ├── cbindgen │ ├── cbindgen.toml │ ├── examples │ │ ├── compilation.cpp │ │ ├── inline_style_parsing.cpp │ │ └── zero_copy_deser.cpp │ ├── extra.rs │ ├── extra_header.h │ ├── extra_struct.h │ └── main.rs ├── compile_cache │ ├── bin │ │ └── main.rs │ └── publish │ │ ├── enum │ │ ├── AlignContent.toml │ │ ├── AlignContentType.toml │ │ ├── AlignItems.toml │ │ ├── AlignItemsType.toml │ │ ├── AlignSelf.toml │ │ ├── AlignSelfType.toml │ │ ├── Angle.toml │ │ ├── AngleOrPercentage.toml │ │ ├── AngleType.toml │ │ ├── AnimateableFeature.toml │ │ ├── AnimationDirection.toml │ │ ├── AnimationDirectionItem.toml │ │ ├── AnimationDirectionType.toml │ │ ├── AnimationFillMode.toml │ │ ├── AnimationFillModeItem.toml │ │ ├── AnimationFillModeType.toml │ │ ├── AnimationIterationCount.toml │ │ ├── AnimationIterationCountItem.toml │ │ ├── AnimationIterationCountType.toml │ │ ├── AnimationName.toml │ │ ├── AnimationNameItem.toml │ │ ├── AnimationNameType.toml │ │ ├── AnimationPlayState.toml │ │ ├── AnimationPlayStateItem.toml │ │ ├── AnimationPlayStateType.toml │ │ ├── AspectRatio.toml │ │ ├── AspectRatioType.toml │ │ ├── BackdropFilter.toml │ │ ├── BackdropFilterType.toml │ │ ├── BackgroundAttachment.toml │ │ ├── BackgroundAttachmentItem.toml │ │ ├── BackgroundAttachmentType.toml │ │ ├── BackgroundClip.toml │ │ ├── BackgroundClipItem.toml │ │ ├── BackgroundClipType.toml │ │ ├── BackgroundImage.toml │ │ ├── BackgroundImageGradientItem.toml │ │ ├── BackgroundImageItem.toml │ │ ├── BackgroundImageType.toml │ │ ├── BackgroundOrigin.toml │ │ ├── BackgroundOriginItem.toml │ │ ├── BackgroundOriginType.toml │ │ ├── BackgroundPosition.toml │ │ ├── BackgroundPositionItem.toml │ │ ├── BackgroundPositionType.toml │ │ ├── BackgroundPositionValue.toml │ │ ├── BackgroundRepeat.toml │ │ ├── BackgroundRepeatItem.toml │ │ ├── BackgroundRepeatType.toml │ │ ├── BackgroundRepeatValue.toml │ │ ├── BackgroundSize.toml │ │ ├── BackgroundSizeItem.toml │ │ ├── BackgroundSizeType.toml │ │ ├── BorderRadius.toml │ │ ├── BorderRadiusType.toml │ │ ├── BorderStyle.toml │ │ ├── BorderStyleType.toml │ │ ├── BoxShadow.toml │ │ ├── BoxShadowItem.toml │ │ ├── BoxShadowType.toml │ │ ├── BoxSizing.toml │ │ ├── BoxSizingType.toml │ │ ├── CalcExpr.toml │ │ ├── Color.toml │ │ ├── ColorType.toml │ │ ├── Contain.toml │ │ ├── ContainKeyword.toml │ │ ├── ContainType.toml │ │ ├── Content.toml │ │ ├── ContentType.toml │ │ ├── CustomProperty.toml │ │ ├── CustomPropertyType.toml │ │ ├── Direction.toml │ │ ├── DirectionType.toml │ │ ├── Display.toml │ │ ├── DisplayType.toml │ │ ├── DropShadow.toml │ │ ├── Filter.toml │ │ ├── FilterFunc.toml │ │ ├── FilterType.toml │ │ ├── FlexDirection.toml │ │ ├── FlexDirectionType.toml │ │ ├── FlexWrap.toml │ │ ├── FlexWrapType.toml │ │ ├── Float.toml │ │ ├── FloatType.toml │ │ ├── FontDisplay.toml │ │ ├── FontFamily.toml │ │ ├── FontFamilyName.toml │ │ ├── FontFamilyType.toml │ │ ├── FontFeatureSettings.toml │ │ ├── FontFeatureSettingsType.toml │ │ ├── FontSrc.toml │ │ ├── FontStyle.toml │ │ ├── FontStyleType.toml │ │ ├── FontWeight.toml │ │ ├── FontWeightType.toml │ │ ├── Gap.toml │ │ ├── GapType.toml │ │ ├── GradientColorItem.toml │ │ ├── GradientPosition.toml │ │ ├── GradientShape.toml │ │ ├── GradientSize.toml │ │ ├── ImageSource.toml │ │ ├── ImageTags.toml │ │ ├── ImportantBitSet.toml │ │ ├── JustifyContent.toml │ │ ├── JustifyContentType.toml │ │ ├── JustifyItems.toml │ │ ├── JustifyItemsType.toml │ │ ├── KeyFrame.toml │ │ ├── Length.toml │ │ ├── LengthExpr.toml │ │ ├── LengthType.toml │ │ ├── LetterSpacing.toml │ │ ├── LetterSpacingType.toml │ │ ├── LineHeight.toml │ │ ├── LineHeightType.toml │ │ ├── ListStyleImage.toml │ │ ├── ListStyleImageType.toml │ │ ├── ListStylePosition.toml │ │ ├── ListStylePositionType.toml │ │ ├── ListStyleType.toml │ │ ├── ListStyleTypeType.toml │ │ ├── MaskMode.toml │ │ ├── MaskModeItem.toml │ │ ├── MaskModeType.toml │ │ ├── MediaExpression.toml │ │ ├── MediaType.toml │ │ ├── MediaTypeDecorator.toml │ │ ├── Nullable.toml │ │ ├── NullablePtr.toml │ │ ├── Number.toml │ │ ├── NumberType.toml │ │ ├── Orientation.toml │ │ ├── Overflow.toml │ │ ├── OverflowType.toml │ │ ├── OverflowWrap.toml │ │ ├── OverflowWrapType.toml │ │ ├── PointerEvents.toml │ │ ├── PointerEventsType.toml │ │ ├── Position.toml │ │ ├── PositionType.toml │ │ ├── PseudoClassesType.toml │ │ ├── PseudoElementsType.toml │ │ ├── Resize.toml │ │ ├── ResizeType.toml │ │ ├── Scrollbar.toml │ │ ├── ScrollbarType.toml │ │ ├── SelectorRelationType.toml │ │ ├── ShadowItemType.toml │ │ ├── StepPosition.toml │ │ ├── StyleSheet.toml │ │ ├── TextAlign.toml │ │ ├── TextAlignType.toml │ │ ├── TextDecorationLine.toml │ │ ├── TextDecorationLineItem.toml │ │ ├── TextDecorationLineType.toml │ │ ├── TextDecorationStyle.toml │ │ ├── TextDecorationStyleType.toml │ │ ├── TextDecorationThickness.toml │ │ ├── TextDecorationThicknessType.toml │ │ ├── TextOverflow.toml │ │ ├── TextOverflowType.toml │ │ ├── TextShadow.toml │ │ ├── TextShadowItem.toml │ │ ├── TextShadowType.toml │ │ ├── Theme.toml │ │ ├── Transform.toml │ │ ├── TransformItem.toml │ │ ├── TransformOrigin.toml │ │ ├── TransformOriginType.toml │ │ ├── TransformType.toml │ │ ├── TransitionProperty.toml │ │ ├── TransitionPropertyItem.toml │ │ ├── TransitionPropertyType.toml │ │ ├── TransitionTime.toml │ │ ├── TransitionTimeType.toml │ │ ├── TransitionTimingFn.toml │ │ ├── TransitionTimingFnItem.toml │ │ ├── TransitionTimingFnType.toml │ │ ├── VerticalAlign.toml │ │ ├── VerticalAlignType.toml │ │ ├── Visibility.toml │ │ ├── VisibilityType.toml │ │ ├── WhiteSpace.toml │ │ ├── WhiteSpaceType.toml │ │ ├── WillChange.toml │ │ ├── WillChangeType.toml │ │ ├── WordBreak.toml │ │ ├── WordBreakType.toml │ │ ├── WordSpacing.toml │ │ ├── WordSpacingType.toml │ │ ├── WritingMode.toml │ │ ├── WritingModeType.toml │ │ ├── WxEngineTouchEvent.toml │ │ ├── WxEngineTouchEventType.toml │ │ ├── ZIndex.toml │ │ ├── ZIndexType.toml │ │ ├── debug_assertions , compatibility_enum_check (selector)_AttributeFlags.toml │ │ ├── debug_assertions , compatibility_enum_check (selector)_PseudoClasses.toml │ │ ├── selector_AttributeFlags.toml │ │ ├── selector_AttributeOperator.toml │ │ ├── selector_PseudoClasses.toml │ │ ├── selector_PseudoElements.toml │ │ └── selector_SelectorRelationType.toml │ │ ├── struct │ │ ├── Array.toml │ │ ├── AttributeType.toml │ │ ├── ConicGradientItem.toml │ │ ├── FeatureTag.toml │ │ ├── FontFace.toml │ │ ├── FontUrl.toml │ │ ├── InlineRule.toml │ │ ├── KeyFrameRule.toml │ │ ├── KeyFrames.toml │ │ ├── Media.toml │ │ ├── MediaQuery.toml │ │ ├── Rule.toml │ │ ├── Selector.toml │ │ ├── SelectorFragment.toml │ │ ├── StyleSheetV1.toml │ │ ├── selector_Attribute.toml │ │ ├── selector_Selector.toml │ │ └── selector_SelectorFragment.toml │ │ └── version.toml ├── examples │ ├── compile_json.rs │ ├── index.html │ └── index.js ├── float_pigment_css.h ├── src │ ├── check_trait.rs │ ├── ffi.rs │ ├── group.rs │ ├── length_num.rs │ ├── lib.rs │ ├── parser │ │ ├── hooks.rs │ │ ├── mod.rs │ │ └── property_value │ │ │ ├── background.rs │ │ │ ├── calc.rs │ │ │ ├── filter.rs │ │ │ ├── font.rs │ │ │ ├── gradient.rs │ │ │ ├── mod.rs │ │ │ └── var.rs │ ├── path.rs │ ├── property.rs │ ├── query.rs │ ├── resolve_font_size.rs │ ├── sheet │ │ ├── borrow.rs │ │ ├── borrow_resource.rs │ │ ├── font_face.rs │ │ ├── keyframes.rs │ │ ├── media.rs │ │ ├── mod.rs │ │ ├── rule.rs │ │ ├── selector.rs │ │ ├── serde_conv.rs │ │ └── str_store.rs │ ├── typing.rs │ └── typing_stringify.rs └── tests │ ├── calc.rs │ ├── compatibility │ ├── README.md │ ├── bincode_source │ │ ├── 204d056d_base.css.fpcssb │ │ ├── 204d056d_padding_case.css.fpcssb │ │ ├── 204d056d_style-v2.css.fpcssb │ │ ├── 204d056d_style.css.fpcssb │ │ ├── 3203403c_base.css.fpcssb │ │ ├── 3203403c_style-v2.css.fpcssb │ │ ├── 3203403c_style.css.fpcssb │ │ ├── 4cc8aa7a_base.css.fpcssb │ │ ├── 4cc8aa7a_style-v2.css.fpcssb │ │ ├── 4cc8aa7a_style.css.fpcssb │ │ ├── af63c90d_base.css.fpcssb │ │ ├── af63c90d_padding_case.css.fpcssb │ │ ├── af63c90d_style-v2.css.fpcssb │ │ ├── af63c90d_style.css.fpcssb │ │ ├── e9932238_base.css.fpcssb │ │ ├── e9932238_style-v2.css.fpcssb │ │ └── e9932238_style.css.fpcssb │ ├── css_source │ │ ├── base.css │ │ ├── base.rs │ │ ├── mod.rs │ │ ├── padding_case.css │ │ ├── padding_case.rs │ │ ├── style-v2.css │ │ ├── style.css │ │ ├── style.rs │ │ └── style_v2.rs │ ├── main.rs │ ├── temp_bincode │ │ └── index.fpcssb │ └── utils.rs │ ├── env.rs │ ├── error.rs │ ├── font_face.rs │ ├── global_values.rs │ ├── important.rs │ ├── keyframes.rs │ ├── media.rs │ ├── property.rs │ ├── property_value.rs │ ├── selector.rs │ ├── serde.rs │ ├── style_sheet_group.rs │ ├── utils │ └── mod.rs │ ├── var.rs │ └── warning.rs ├── float-pigment-forest-macro ├── Cargo.toml ├── README.md └── src │ ├── lib.rs │ └── style_manager.rs ├── float-pigment-forest ├── .gitignore ├── Cargo.toml ├── README.md ├── benches │ ├── create_node.rs │ ├── layout.rs │ └── operate_node.rs ├── cbindgen │ ├── cbindgen.toml │ ├── extra.rs │ ├── extra_header.h │ ├── extra_struct.h │ └── main.rs ├── float_pigment_layout.h ├── src │ ├── env.rs │ ├── ffi.rs │ ├── layout │ │ ├── layout_impl.rs │ │ └── mod.rs │ ├── lib.rs │ ├── node.rs │ └── style.rs └── tests │ ├── README.md │ ├── custom │ ├── cache.rs │ ├── css_aspect_ratio.rs │ ├── css_border.rs │ ├── css_box_sizing.rs │ ├── css_display.rs │ ├── css_flexbox │ │ ├── align_content.rs │ │ ├── align_items.rs │ │ ├── align_self.rs │ │ ├── flex_direction.rs │ │ ├── flex_grow.rs │ │ ├── flex_item_margin.rs │ │ ├── flex_shrink.rs │ │ ├── gap.rs │ │ ├── justify_content.rs │ │ ├── mod.rs │ │ └── order.rs │ ├── css_height.rs │ ├── css_inline │ │ ├── inline.rs │ │ ├── mod.rs │ │ └── text.rs │ ├── css_margin.rs │ ├── css_max_height.rs │ ├── css_max_width.rs │ ├── css_min_height.rs │ ├── css_min_width.rs │ ├── css_padding.rs │ ├── css_position.rs │ ├── css_text_align.rs │ ├── css_width.rs │ └── mod.rs │ ├── mod.rs │ └── wpt │ ├── css_display │ └── mod.rs │ ├── css_flexbox │ └── mod.rs │ └── mod.rs ├── float-pigment-layout ├── Cargo.toml ├── README.md └── src │ ├── algo │ ├── flex_box.rs │ ├── flow.rs │ └── mod.rs │ ├── cache.rs │ ├── lib.rs │ ├── special_positioned.rs │ ├── types.rs │ └── unit.rs ├── float-pigment-mlp ├── Cargo.toml ├── README.md └── src │ ├── context.rs │ ├── lib.rs │ ├── node │ ├── attribute.rs │ ├── element.rs │ ├── fragment.rs │ ├── mod.rs │ └── text.rs │ ├── tree.rs │ └── utils.rs ├── float-pigment ├── Cargo.toml ├── README.md ├── float_pigment_css.h ├── float_pigment_layout.h ├── float_pigment_types.h └── src │ ├── cpp_binding_gen_tools.rs │ └── lib.rs └── publish.sh /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Rust cache 20 | uses: Swatinem/rust-cache@v2 21 | - name: Build 22 | run: cargo build --verbose 23 | - name: Run tests 24 | run: cargo test --verbose 25 | - name: Clippy 26 | run: cargo clippy -- -D warnings 27 | - name: Clippy on no-default-features 28 | run: cargo clippy --no-default-features -- -D warnings 29 | - name: Clippy on all-features 30 | run: cargo clippy --all-features -- -D warnings 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | .DS_store 4 | /pkg 5 | /dist 6 | .idea 7 | .vscode 8 | build_stamp 9 | .cargo 10 | .history 11 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = [ 4 | "float-pigment-consistent-bincode", 5 | "float-pigment-mlp", 6 | "float-pigment-css-macro", 7 | "float-pigment-css", 8 | "float-pigment-layout", 9 | "float-pigment-forest-macro", 10 | "float-pigment-forest", 11 | "float-pigment", 12 | ] 13 | 14 | [workspace.package] 15 | version = "0.7.0" 16 | authors = ["LastLeaf ", "TtTRz "] 17 | categories = ["gui", "wasm"] 18 | edition = "2021" 19 | homepage = "https://github.com/wechat-miniprogram/float-pigment" 20 | keywords = ["CSS", "flexbox", "layout"] 21 | license = "MIT" 22 | repository = "https://github.com/wechat-miniprogram/float-pigment" 23 | 24 | [workspace.dependencies] 25 | float-pigment = { version = "0.7.0", path = "./float-pigment" } 26 | float-pigment-consistent-bincode = { version = "0.7.0", path = "./float-pigment-consistent-bincode", default-features = false } 27 | float-pigment-css = { version = "0.7.0", path = "./float-pigment-css", default-features = false } 28 | float-pigment-css-macro = { version = "0.7.0", path = "./float-pigment-css-macro" } 29 | float-pigment-forest = { version = "0.7.0", path = "./float-pigment-forest" } 30 | float-pigment-forest-macro = { version = "0.7.0", path = "./float-pigment-forest-macro" } 31 | float-pigment-layout = { version = "0.7.0", path = "./float-pigment-layout" } 32 | float-pigment-mlp = { version = "0.7.0", path = "./float-pigment-mlp" } 33 | 34 | [profile.release] 35 | opt-level = 's' 36 | lto = "fat" 37 | codegen-units = 1 38 | 39 | [workspace.lints.clippy] 40 | collapsible_else_if = "allow" 41 | while_let_on_iterator = "allow" 42 | get_first = "allow" 43 | let_and_return = "allow" 44 | redundant_closure = "allow" 45 | single_match = "allow" 46 | clone_on_copy = "allow" 47 | needless_lifetimes = "allow" 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2024 wechat-miniprogram 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /deprecate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" == "" ]; then 4 | echo "Missing version. Usage: $0 [VERSION]" 5 | exit -1 6 | fi 7 | 8 | VERSION="$1" 9 | PROJECTS=$(egrep '^[ \t]*"(.+)",$' Cargo.toml | sed -E 's/^[ \t]*"(.+)",$/\1/g') 10 | 11 | # cargo yank 12 | echo "Ready to deprecate version ${VERSION}." 13 | for PROJECT in $PROJECTS; do 14 | echo "" 15 | echo "Deprecating ${PROJECT}..." 16 | cargo yank --version "${VERSION}" "${PROJECT}" 17 | done 18 | 19 | # npm deprecate 20 | npm deprecate "float-pigment-css@${VERSION}" --registry https://registry.npmjs.org -m "sync with cargo yank" 21 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /Cargo.lock 3 | *.swp 4 | *.swo 5 | .cargo 6 | .vscode 7 | rls*.log 8 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/BINCODE-LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ty Overby 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-consistent-bincode" 3 | description = "A serialize format designed for `float-pigment-css`." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [features] 14 | default = ["std"] 15 | std = ["byteorder/std", "serde/std", "serde_bytes/std"] 16 | 17 | [dependencies] 18 | byteorder = { version = "1.3.0", default-features = false } 19 | serde = { version = "1.0", default-features = false, features = ["alloc"] } 20 | 21 | [dev-dependencies] 22 | serde_bytes = { version = "0.11", default-features = false } 23 | serde_derive = { version = "1.0", default-features = false } 24 | 25 | [lints] 26 | workspace = true 27 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/examples/basic.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate serde_derive; 3 | extern crate float_pigment_consistent_bincode as bincode; 4 | 5 | use bincode::{deserialize, serialize}; 6 | 7 | #[derive(Serialize, Deserialize, PartialEq, Debug)] 8 | struct Entity { 9 | x: f32, 10 | y: f32, 11 | } 12 | 13 | #[derive(Serialize, Deserialize, PartialEq, Debug)] 14 | struct World(Vec); 15 | 16 | fn main() { 17 | let world = World(vec![Entity { x: 0.0, y: 4.0 }, Entity { x: 10.0, y: 20.5 }]); 18 | 19 | let encoded: Vec = serialize(&world).unwrap(); 20 | 21 | // 8 bytes for the length of the vector (usize), 4 bytes per float. 22 | assert_eq!(encoded.len(), 8 + 4 * 4); 23 | 24 | let decoded: World = deserialize(&encoded[..]).unwrap(); 25 | 26 | assert_eq!(world, decoded); 27 | } 28 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/src/config/endian.rs: -------------------------------------------------------------------------------- 1 | use byteorder::{self, ByteOrder}; 2 | 3 | pub trait BincodeByteOrder { 4 | type Endian: ByteOrder + 'static; 5 | } 6 | 7 | /// Little-endian byte ordering. 8 | #[derive(Copy, Clone)] 9 | pub struct LittleEndian; 10 | 11 | /// Big-endian byte ordering. 12 | #[derive(Copy, Clone)] 13 | pub struct BigEndian; 14 | 15 | /// The native byte ordering of the current system. 16 | #[derive(Copy, Clone)] 17 | pub struct NativeEndian; 18 | 19 | impl BincodeByteOrder for LittleEndian { 20 | type Endian = byteorder::LittleEndian; 21 | } 22 | 23 | impl BincodeByteOrder for BigEndian { 24 | type Endian = byteorder::BigEndian; 25 | } 26 | 27 | impl BincodeByteOrder for NativeEndian { 28 | type Endian = byteorder::NativeEndian; 29 | } 30 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/src/config/limit.rs: -------------------------------------------------------------------------------- 1 | use alloc::boxed::Box; 2 | 3 | use crate::error::{ErrorKind, Result}; 4 | 5 | /// A trait for stopping serialization and deserialization when a certain limit has been reached. 6 | pub trait SizeLimit { 7 | /// Tells the SizeLimit that a certain number of bytes has been 8 | /// read or written. Returns Err if the limit has been exceeded. 9 | fn add(&mut self, n: u64) -> Result<()>; 10 | /// Returns the hard limit (if one exists) 11 | fn limit(&self) -> Option; 12 | } 13 | 14 | /// A SizeLimit that restricts serialized or deserialized messages from 15 | /// exceeding a certain byte length. 16 | #[derive(Copy, Clone)] 17 | pub struct Bounded(pub u64); 18 | 19 | /// A SizeLimit without a limit! 20 | /// Use this if you don't care about the size of encoded or decoded messages. 21 | #[derive(Copy, Clone)] 22 | pub struct Infinite; 23 | 24 | impl SizeLimit for Bounded { 25 | #[inline(always)] 26 | fn add(&mut self, n: u64) -> Result<()> { 27 | if self.0 >= n { 28 | self.0 -= n; 29 | Ok(()) 30 | } else { 31 | Err(Box::new(ErrorKind::SizeLimit)) 32 | } 33 | } 34 | 35 | #[inline(always)] 36 | fn limit(&self) -> Option { 37 | Some(self.0) 38 | } 39 | } 40 | 41 | impl SizeLimit for Infinite { 42 | #[inline(always)] 43 | fn add(&mut self, _: u64) -> Result<()> { 44 | Ok(()) 45 | } 46 | 47 | #[inline(always)] 48 | fn limit(&self) -> Option { 49 | None 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /float-pigment-consistent-bincode/src/config/trailing.rs: -------------------------------------------------------------------------------- 1 | use alloc::{boxed::Box, string::ToString}; 2 | 3 | use crate::de::read::SliceReader; 4 | use crate::{ErrorKind, Result}; 5 | 6 | /// A trait for erroring deserialization if not all bytes were read. 7 | pub trait TrailingBytes { 8 | /// Checks a given slice reader to determine if deserialization used all bytes in the slice. 9 | fn check_end(reader: &SliceReader) -> Result<()>; 10 | } 11 | 12 | /// A TrailingBytes config that will allow trailing bytes in slices after deserialization. 13 | #[derive(Copy, Clone)] 14 | pub struct AllowTrailing; 15 | 16 | /// A TrailingBytes config that will cause bincode to produce an error if bytes are left over in the slice when deserialization is complete. 17 | 18 | #[derive(Copy, Clone)] 19 | pub struct RejectTrailing; 20 | 21 | impl TrailingBytes for AllowTrailing { 22 | #[inline(always)] 23 | fn check_end(_reader: &SliceReader) -> Result<()> { 24 | Ok(()) 25 | } 26 | } 27 | 28 | impl TrailingBytes for RejectTrailing { 29 | #[inline(always)] 30 | fn check_end(reader: &SliceReader) -> Result<()> { 31 | if reader.is_finished() { 32 | Ok(()) 33 | } else { 34 | Err(Box::new(ErrorKind::Custom( 35 | "Slice had bytes remaining after deserialization".to_string(), 36 | ))) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /float-pigment-css-macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-css-macro" 3 | description = "Helper macros for float-pigment-css." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | proc-macro = true 15 | 16 | [features] 17 | serialize_compile_cache = [] 18 | 19 | [dependencies] 20 | proc-macro2 = "1.0" 21 | quote = "1.0" 22 | syn = { version = "1.0", features = ["full"] } 23 | serde_json = "1.0" 24 | serde = { version = "1.0", features = ["derive"] } 25 | toml = "0.5.8" 26 | rustc-hash = "1.1.0" 27 | 28 | [lints] 29 | workspace = true 30 | -------------------------------------------------------------------------------- /float-pigment-css-macro/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-css-macro 2 | 3 | Procedure macros for float-pigment-css. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | -------------------------------------------------------------------------------- /float-pigment-css-macro/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![recursion_limit = "128"] 2 | // #![feature(proc_macro_span)] 3 | // #![feature(path_file_prefix)] 4 | 5 | mod compatibility_check; 6 | mod property_list; 7 | mod resolve_font_size; 8 | mod style_syntax; 9 | mod value_type; 10 | 11 | #[proc_macro] 12 | pub fn property_list(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream { 13 | property_list::property_list(tokens) 14 | } 15 | 16 | #[proc_macro] 17 | pub fn property_value_format(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream { 18 | style_syntax::property_value_format(tokens) 19 | } 20 | 21 | #[proc_macro_attribute] 22 | pub fn property_value_type( 23 | attr: proc_macro::TokenStream, 24 | item: proc_macro::TokenStream, 25 | ) -> proc_macro::TokenStream { 26 | value_type::property_value_type(attr, item) 27 | } 28 | 29 | #[proc_macro_derive(ResolveFontSize, attributes(resolve_font_size))] 30 | pub fn resolve_font_size(attr: proc_macro::TokenStream) -> proc_macro::TokenStream { 31 | resolve_font_size::derive_resolve_font_size(attr) 32 | } 33 | 34 | #[proc_macro_derive(CompatibilityEnumCheck)] 35 | pub fn compatibility_check_enum_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 36 | compatibility_check::check_enum(input, compatibility_check::EnumCheckMode::Full) 37 | } 38 | 39 | #[proc_macro_derive(CompatibilityCheckForEnumVariant)] 40 | pub fn compatibility_check_for_enum_variant_derive( 41 | input: proc_macro::TokenStream, 42 | ) -> proc_macro::TokenStream { 43 | compatibility_check::check_enum(input, compatibility_check::EnumCheckMode::Variant) 44 | } 45 | 46 | #[proc_macro_derive(CompatibilityStructCheck)] 47 | pub fn compatibility_check_struct_derive( 48 | input: proc_macro::TokenStream, 49 | ) -> proc_macro::TokenStream { 50 | compatibility_check::check_struct(input) 51 | } 52 | 53 | #[proc_macro_attribute] 54 | pub fn compatibility_enum_check( 55 | attr: proc_macro::TokenStream, 56 | item: proc_macro::TokenStream, 57 | ) -> proc_macro::TokenStream { 58 | compatibility_check::check_enum_with_mod(attr, item) 59 | } 60 | 61 | #[proc_macro_attribute] 62 | pub fn compatibility_struct_check( 63 | attr: proc_macro::TokenStream, 64 | item: proc_macro::TokenStream, 65 | ) -> proc_macro::TokenStream { 66 | compatibility_check::check_struct_with_mod(attr, item) 67 | } 68 | -------------------------------------------------------------------------------- /float-pigment-css/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | **/*.rs.bk 4 | .DS_store 5 | /pkg 6 | /dist 7 | /cbindgen/src 8 | /compile_cache/enum 9 | /compile_cache/struct -------------------------------------------------------------------------------- /float-pigment-css/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-css" 3 | description = "The CSS parser for the float-pigment project." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | name = "float_pigment_css" 15 | crate-type = ["cdylib", "rlib"] 16 | 17 | [[bin]] 18 | name = "float_pigment_css_cpp_binding_gen_tool" 19 | path = "cbindgen/main.rs" 20 | required-features = ["build-cpp-header"] 21 | 22 | [[bin]] 23 | name = "float_pigment_css_update_version" 24 | path = "compile_cache/bin/main.rs" 25 | required-features = ["compile_cache"] 26 | 27 | [[test]] 28 | name = "bincode_test" 29 | path = "tests/compatibility/main.rs" 30 | required-features = ["compatibility_test"] 31 | test = false 32 | 33 | [[bench]] 34 | name = "parse" 35 | harness = false 36 | 37 | [features] 38 | default = ["std", "deserialize", "serialize", "ffi"] 39 | std = ["serde/std", "serde_json/std", "bit-set/std", "num-traits/std", "half/std", "float-pigment-consistent-bincode/std"] 40 | no-std-lock = [] 41 | wasm-entrance = ["wasm-bindgen", "console_log", "console_error_panic_hook", "js-sys"] 42 | nodejs-package = ["wasm-entrance"] 43 | build-cpp-header = ["cbindgen", "fs_extra"] 44 | serialize = [] 45 | deserialize = [] 46 | serialize_json = [] 47 | deserialize_json = [] 48 | write_cache = [] 49 | compatibility_test = [] 50 | compile_cache = ["toml", "colorful"] 51 | serialize_compile_cache = ["float-pigment-css-macro/serialize_compile_cache"] 52 | ffi = [] 53 | 54 | [dependencies] 55 | wasm-bindgen = { version = "0.2", optional = true } 56 | console_error_panic_hook = { version = "0.1", optional = true } 57 | js-sys = { version = "0.3", optional = true } 58 | log = "0.4" 59 | console_log = { version = "0.1", optional = true } 60 | cssparser = { version = "0.34", default-features = false } 61 | cssparser-color = { version = "0.2", default-features = false } 62 | float-pigment-css-macro = { workspace = true } 63 | float-pigment-consistent-bincode = { workspace = true } 64 | serde = { version = "1.0", default-features = false, features = ["derive"] } 65 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 66 | cbindgen = { version = "0.27", optional = true } 67 | bit-set = { version = "0.5.2", default-features = false } 68 | toml = { version = "0.5.8", optional = true } 69 | colorful = { version = "0.2.1", optional = true } 70 | hashbrown = { version = "0.14" } 71 | ahash = { version = "0.8", default-features = false } 72 | num-traits = { version = "0.2", default-features = false } 73 | az = "1.2" 74 | fixed = { version = "=1.23", default-features = false, features = ["num-traits", "serde"] } 75 | half = { version = "^2.0.0,<2.3.0", default-features = false } 76 | spin = "0.9" 77 | fs_extra = { version = "1.3", optional = true } 78 | 79 | [dev-dependencies] 80 | env_logger = "0.11" 81 | rand = "0.8.5" 82 | bencher = "0.1.5" 83 | 84 | [package.metadata.wasm-pack.profile.release] 85 | wasm-opt = false 86 | 87 | [lints] 88 | workspace = true 89 | -------------------------------------------------------------------------------- /float-pigment-css/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-css 2 | 3 | The CSS parser for the float-pigment project. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | 7 | 8 | ## Compile to WebAssembly 9 | 10 | In most cases this module is a dependency for high-level modules. 11 | 12 | But more, this module can be compiled to WebAssembly itself, and can be called from JavaScript. 13 | 14 | With [wasm-pack](https://github.com/rustwasm/wasm-pack) installed globally: 15 | 16 | ```shell 17 | wasm-pack build float-pigment-css --target nodejs --features nodejs-package 18 | ``` 19 | 20 | 21 | ## Generate C++ Headers 22 | 23 | This module contains C++ bindings, and it generates a C++ header file for visiting from C++. However, the C++ header should be updated manually. 24 | 25 | To update the C++ header, make sure installed: 26 | 27 | * [cargo-expand](https://github.com/dtolnay/cargo-expand) 28 | 29 | The C++ header update command: 30 | 31 | ```shell 32 | cargo run --bin float_pigment_css_cpp_binding_gen_tool --features build-cpp-header 33 | ``` 34 | 35 | 36 | ## Compatibility Checks 37 | 38 | Some `serde` structs and enums needs compatibility checks. 39 | 40 | This is because the `serialize_bincode` and `deserialize_bincode` forbid some changes to keep compatibilities across versions. 41 | It means that structs and enums can only *add new fields* but not *modify fields*. 42 | This is done by compare the current version of struct/enum definitions and the corresponding previous one. 43 | The previous struct/enum definitions are stored in the `compile_cache` dir. 44 | 45 | For new struct/enum that needs across-version compatibilities, `CompatibilityStructCheck` and `CompatibilityEnumCheck` macros must be derived. 46 | When struct/enum name conflicts, `compatibility_struct_check` can be used to specify a name prefix. For example: 47 | 48 | ```rust 49 | #[derive(Serialize, Deserialize, CompatibilityEnumCheck)] 50 | enum Name { 51 | None 52 | } 53 | 54 | #[derive(Serialize, Deserialize, CompatibilityStructCheck)] 55 | struct Hello { 56 | name: String 57 | } 58 | 59 | #[compatibility_struct_check(mod_name)] 60 | #[derive(Serialize, Deserialize)] 61 | struct Hello { 62 | name: String 63 | } 64 | ``` 65 | 66 | To update the `compile_cache`, run `cargo run --bin float_pigment_css_update_version --features compile_cache`. 67 | (This will be automatically done by the publish script.) 68 | -------------------------------------------------------------------------------- /float-pigment-css/benches/parse.rs: -------------------------------------------------------------------------------- 1 | extern crate rand; 2 | 3 | #[macro_use] 4 | extern crate bencher; 5 | 6 | use bencher::Bencher; 7 | use rand::distributions::Alphanumeric; 8 | use rand::{thread_rng, Rng}; 9 | 10 | use float_pigment_css::StyleSheet; 11 | 12 | const RULES: &str = "color: red;"; 13 | 14 | fn create_random_selector() -> String { 15 | let random_string: String = thread_rng() 16 | .sample_iter(&Alphanumeric) 17 | .take(30) 18 | .map(char::from) 19 | .collect(); 20 | format!(".{}", random_string) 21 | } 22 | 23 | fn random_rules_in_selectors(rules_times: i32, selector_times: i32) -> String { 24 | let mut style = vec![]; 25 | for _ in 0..selector_times { 26 | let tot_rules = vec![RULES; rules_times as usize]; 27 | let cur = format!("{} {{ {} }}", create_random_selector(), tot_rules.join("")); 28 | style.push(cur); 29 | } 30 | style.join("") 31 | } 32 | 33 | fn bench_parse_5000_rules_10_selector(b: &mut Bencher) { 34 | let style = &random_rules_in_selectors(5000, 10); 35 | b.iter(|| { 36 | StyleSheet::from_str(style); 37 | }); 38 | } 39 | 40 | fn bench_parse_500_rules_100_selector(b: &mut Bencher) { 41 | let style = &random_rules_in_selectors(500, 100); 42 | b.iter(|| { 43 | StyleSheet::from_str(style); 44 | }); 45 | } 46 | 47 | fn bench_parse_50_rules_1000_selector(b: &mut Bencher) { 48 | let style = &random_rules_in_selectors(50, 1000); 49 | b.iter(|| { 50 | StyleSheet::from_str(style); 51 | }); 52 | } 53 | 54 | fn bench_parse_50_rules_10_selector(b: &mut Bencher) { 55 | let style = &random_rules_in_selectors(50, 10); 56 | b.iter(|| { 57 | StyleSheet::from_str(style); 58 | }); 59 | } 60 | 61 | fn bench_parse_500_rules_10_selector(b: &mut Bencher) { 62 | let style = &random_rules_in_selectors(500, 10); 63 | b.iter(|| { 64 | StyleSheet::from_str(style); 65 | }); 66 | } 67 | 68 | benchmark_group!( 69 | benches, 70 | bench_parse_5000_rules_10_selector, 71 | bench_parse_500_rules_100_selector, 72 | bench_parse_50_rules_1000_selector, 73 | bench_parse_50_rules_10_selector, 74 | bench_parse_500_rules_10_selector, 75 | ); 76 | 77 | benchmark_main!(benches); 78 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/cbindgen.toml: -------------------------------------------------------------------------------- 1 | # This is a template cbindgen.toml file with all of the default values. 2 | # Some values are commented out because their absence is the real default. 3 | # 4 | # See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml 5 | # for detailed documentation of every option here. 6 | 7 | 8 | 9 | language = "C++" 10 | 11 | 12 | 13 | ############## Options for Wrapping the Contents of the Header ################# 14 | 15 | # header = "/* Text to put at the beginning of the generated file. Probably a license. */" 16 | # trailer = "/* Text to put at the end of the generated file */" 17 | # include_guard = "my_bindings_h" 18 | pragma_once = true 19 | autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" 20 | include_version = false 21 | # namespace = "my_namespace" 22 | namespaces = ["float_pigment"] 23 | using_namespaces = [] 24 | sys_includes = [] 25 | includes = [] 26 | no_includes = false 27 | after_includes = "" 28 | 29 | 30 | 31 | 32 | ############################ Code Style Options ################################ 33 | 34 | braces = "SameLine" 35 | line_length = 100 36 | tab_width = 2 37 | documentation = true 38 | documentation_style = "auto" 39 | line_endings = "LF" # also "CR", "CRLF", "Native" 40 | 41 | 42 | 43 | 44 | ############################# Codegen Options ################################## 45 | 46 | style = "both" 47 | sort_by = "Name" # default for `fn.sort_by` and `const.sort_by` 48 | usize_is_size_t = true 49 | 50 | 51 | 52 | [defines] 53 | # "target_os = freebsd" = "DEFINE_FREEBSD" 54 | # "feature = serde" = "DEFINE_SERDE" 55 | 56 | 57 | 58 | [export] 59 | include = [] 60 | exclude = [] 61 | # prefix = "CAPI_" 62 | item_types = [] 63 | renaming_overrides_prefixing = false 64 | 65 | 66 | 67 | [export.rename] 68 | 69 | [export.pre_body] 70 | 71 | [export.body] 72 | 73 | 74 | [export.mangle] 75 | 76 | 77 | [fn] 78 | rename_args = "None" 79 | # must_use = "MUST_USE_FUNC" 80 | # no_return = "NO_RETURN" 81 | # prefix = "START_FUNC" 82 | # postfix = "END_FUNC" 83 | args = "auto" 84 | sort_by = "Name" 85 | 86 | 87 | 88 | 89 | [struct] 90 | rename_fields = "None" 91 | # must_use = "MUST_USE_STRUCT" 92 | derive_constructor = false 93 | derive_eq = false 94 | derive_neq = false 95 | derive_lt = false 96 | derive_lte = false 97 | derive_gt = false 98 | derive_gte = false 99 | 100 | 101 | 102 | 103 | [enum] 104 | rename_variants = "None" 105 | # must_use = "MUST_USE_ENUM" 106 | add_sentinel = false 107 | prefix_with_name = false 108 | derive_helper_methods = false 109 | derive_const_casts = false 110 | derive_mut_casts = false 111 | # cast_assert_name = "ASSERT" 112 | derive_tagged_enum_destructor = false 113 | derive_tagged_enum_copy_constructor = false 114 | enum_class = true 115 | private_default_tagged_enum_constructor = false 116 | 117 | 118 | 119 | 120 | [const] 121 | allow_static_const = true 122 | allow_constexpr = false 123 | sort_by = "Name" 124 | 125 | 126 | 127 | 128 | [macro_expansion] 129 | bitflags = false 130 | 131 | 132 | 133 | 134 | 135 | 136 | ############## Options for How Your Rust library Should Be Parsed ############## 137 | 138 | [parse] 139 | parse_deps = false 140 | # include = [] 141 | exclude = [] 142 | clean = false 143 | extra_bindings = [] 144 | 145 | 146 | 147 | [parse.expand] 148 | crates = [] 149 | all_features = false 150 | default_features = true 151 | features = [] 152 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/examples/compilation.cpp: -------------------------------------------------------------------------------- 1 | #include "../../float_pigment_css.h" 2 | #include 3 | 4 | using namespace float_pigment; 5 | 6 | char *str_ref_clone(StrRef *sr) { 7 | char *s = static_cast(calloc(str_len(sr) + 1, 1)); 8 | memcpy(s, str_ptr(sr), str_len(sr)); 9 | s[str_len(sr)] = '\0'; 10 | return s; 11 | } 12 | 13 | // try output buffer content (as UTF-8, for debugging) 14 | void debug_output_buf(uint8_t *buf, size_t buffer_len) { 15 | char *str_buf = static_cast(calloc(buffer_len + 1, 1)); 16 | memcpy(str_buf, buf, buffer_len); 17 | str_buf[buffer_len] = '\0'; 18 | printf("%s\n", str_buf); 19 | free(str_buf); 20 | } 21 | 22 | // display warnings (as UTF-8) 23 | void display_and_free_warnings(Array *warnings) { 24 | for (int i = 0; i < warnings->len; i += 1) { 25 | Warning &w = warnings->ptr[i]; 26 | char *msg = str_ref_clone(&w.message); 27 | printf("%s (from line %d col %d to line %d col %d)\n", msg, w.start_line, 28 | w.start_col, w.end_line, w.end_col); 29 | free(msg); 30 | } 31 | array_warning_free(warnings); 32 | } 33 | 34 | int main() { 35 | size_t buffer_len; 36 | uint8_t *buf; 37 | Array *warnings = NULL; 38 | 39 | const char *a_wxss = 40 | "@media (width: 100px) { .a { color: red; unknown-prop: 1px; } }"; 41 | const char *b_wxss = "@import url(a);"; 42 | 43 | // create new style sheet resource store 44 | StyleSheetResourcePtr ssr = style_sheet_resource_new(); 45 | 46 | // compile a style sheet 47 | style_sheet_resource_add_source(&ssr, "my/sheet/a.wxss", a_wxss, &warnings); 48 | display_and_free_warnings(warnings); 49 | 50 | // serialize it into JSON and try output it 51 | buf = 52 | style_sheet_resource_serialize_json(&ssr, "my/sheet/a.wxss", &buffer_len); 53 | debug_output_buf(buf, buffer_len); 54 | buffer_free(buf, buffer_len); 55 | 56 | // compile another style sheet 57 | style_sheet_resource_add_source(&ssr, "my/sheet/b.wxss", b_wxss, &warnings); 58 | display_and_free_warnings(warnings); 59 | 60 | // serialize it into bincode 61 | buf = style_sheet_resource_serialize_bincode(&ssr, "my/sheet/b.wxss", 62 | &buffer_len); 63 | buffer_free(buf, buffer_len); 64 | 65 | // generate style sheet index 66 | StyleSheetImportIndexPtr ii = 67 | style_sheet_resource_generate_import_index(&ssr); 68 | 69 | // serialize it into JSON and try output it 70 | buf = style_sheet_import_index_serialize_json(&ii, &buffer_len); 71 | debug_output_buf(buf, buffer_len); 72 | buffer_free(buf, buffer_len); 73 | 74 | // get bincode version 75 | buf = style_sheet_resource_serialize_bincode(&ssr, "my/sheet/a.wxss", 76 | &buffer_len); 77 | StrRef *version = style_sheet_bincode_version(buf, buffer_len); 78 | buffer_free(buf, buffer_len); 79 | const char *v = str_ref_clone(version); 80 | puts(v); 81 | 82 | // free the resource store and the style sheet index 83 | style_sheet_import_index_free(&ii); 84 | style_sheet_resource_free(&ssr); 85 | } 86 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/examples/inline_style_parsing.cpp: -------------------------------------------------------------------------------- 1 | #include "../../float_pigment_css.h" 2 | #include 3 | 4 | using namespace float_pigment; 5 | 6 | char *str_ref_clone(StrRef *sr) { 7 | char *s = static_cast(calloc(str_len(sr) + 1, 1)); 8 | memcpy(s, str_ptr(sr), str_len(sr)); 9 | s[str_len(sr)] = '\0'; 10 | return s; 11 | } 12 | 13 | int main() { 14 | const char *css = "color: red; unknown-prop: 1px"; 15 | 16 | // compile to json format 17 | Array *warnings = NULL; 18 | Array *prop_list_ptr = parse_inline_style(css, &warnings); 19 | 20 | // display warnings (as UTF-8) 21 | for (int i = 0; i < warnings->len; i += 1) { 22 | Warning &w = warnings->ptr[i]; 23 | char *msg = str_ref_clone(&w.message); 24 | printf("%s (from line %d col %d to line %d col %d)\n", msg, w.start_line, 25 | w.start_col, w.end_line, w.end_col); 26 | free(msg); 27 | } 28 | array_warning_free(warnings); 29 | 30 | // try output some details (for debugging) 31 | Property *prop_list = prop_list_ptr->ptr; 32 | uint8_t color_r = prop_list[0].color._0.specified._0; 33 | uint8_t color_g = prop_list[0].color._0.specified._1; 34 | uint8_t color_b = prop_list[0].color._0.specified._2; 35 | uint8_t color_a = prop_list[0].color._0.specified._3; 36 | printf("color: rgba(%d, %d, %d, %d)\n", color_r, color_g, color_b, color_a); 37 | 38 | // free the json buffer 39 | inline_style_free(prop_list_ptr); 40 | } 41 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/extra.rs: -------------------------------------------------------------------------------- 1 | pub mod extra { 2 | #[repr(C)] 3 | pub struct Box { 4 | ptr: *mut T, 5 | } 6 | 7 | #[repr(C)] 8 | pub struct Array { 9 | ptr: *mut T, 10 | len: usize, 11 | } 12 | 13 | #[repr(C)] 14 | pub struct Nullable { 15 | non_null: bool, 16 | data: T, 17 | } 18 | 19 | #[repr(C)] 20 | pub struct NullablePtr { 21 | ptr: *mut T, 22 | } 23 | 24 | #[repr(C)] 25 | pub struct StyleSheetRcBuffer { 26 | ptr: *mut (), 27 | } 28 | 29 | #[repr(C)] 30 | pub struct StrBuffer { 31 | ptr: *mut (), 32 | } 33 | 34 | #[repr(C)] 35 | pub struct StrRef { 36 | offset: usize, 37 | len: usize, 38 | ptr: *mut (), 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/extra_header.h: -------------------------------------------------------------------------------- 1 | // Copyright 2024 wechat-miniprogram. MIT license. 2 | -------------------------------------------------------------------------------- /float-pigment-css/cbindgen/extra_struct.h: -------------------------------------------------------------------------------- 1 | struct Length; 2 | struct SelectorFragment; 3 | struct Number; 4 | struct Angle; 5 | struct CalcExpr; 6 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/bin/main.rs: -------------------------------------------------------------------------------- 1 | use serde::Serialize; 2 | use std::env::VarError; 3 | use std::fs::OpenOptions; 4 | use std::io::Write; 5 | use std::path::*; 6 | 7 | #[derive(Serialize)] 8 | struct CacheConfig { 9 | version: String, 10 | enum_total: i32, 11 | struct_total: i32, 12 | } 13 | 14 | fn get_version_from_cargo() -> Result { 15 | std::env::var("CARGO_PKG_VERSION") 16 | } 17 | fn write_version_to_cache(cfg: CacheConfig) { 18 | let mut pb = PathBuf::new(); 19 | pb.push(std::env::var("CARGO_MANIFEST_DIR").unwrap()); 20 | pb.push("compile_cache"); 21 | pb.push("publish"); 22 | pb.push("version.toml"); 23 | let mut options = OpenOptions::new(); 24 | let mut file = options 25 | .write(true) 26 | .read(true) 27 | .truncate(true) 28 | .create(true) 29 | .open(&pb) 30 | .unwrap(); 31 | let cfg_toml = toml::to_string(&cfg).unwrap(); 32 | file.write_all(cfg_toml.as_bytes()) 33 | .expect("write version error"); 34 | } 35 | 36 | fn folder_copy(path: &str, target_path: &str) -> i32 { 37 | let mut count = 0; 38 | for entry in std::fs::read_dir(path) 39 | .unwrap() 40 | .map(|res| res.map(|e| e.path())) 41 | { 42 | let entry = entry.unwrap(); 43 | let file_name = entry.file_name().unwrap().to_str().unwrap(); 44 | let mut pb = PathBuf::new(); 45 | pb.push(target_path); 46 | pb.push(file_name); 47 | let target = pb.to_str().unwrap(); 48 | std::fs::copy(entry, target).expect("copy error"); 49 | count += 1; 50 | } 51 | count 52 | } 53 | 54 | fn main() { 55 | // check version 56 | let version = match get_version_from_cargo() { 57 | Ok(ver) => ver, 58 | Err(_) => panic!("Check pkg version in Cargo.toml"), 59 | }; 60 | let root = std::env::var("CARGO_MANIFEST_DIR").unwrap(); 61 | let mut pb = PathBuf::new(); 62 | pb.push(root); 63 | pb.push("compile_cache"); 64 | pb.push("enum"); 65 | let __pb = pb.clone(); 66 | let cur_enum_path = __pb.to_str().unwrap(); 67 | pb.pop(); 68 | pb.push("struct"); 69 | let __pb = pb.clone(); 70 | let cur_struct_path = __pb.to_str().unwrap(); 71 | pb.pop(); 72 | pb.push("publish"); 73 | pb.push("enum"); 74 | let __pb = pb.clone(); 75 | let publish_enum_path = __pb.to_str().unwrap(); 76 | pb.pop(); 77 | pb.push("struct"); 78 | let __pb = pb.clone(); 79 | let publish_struct_path = __pb.to_str().unwrap(); 80 | 81 | let enum_total = folder_copy(cur_enum_path, publish_enum_path); 82 | let struct_total = folder_copy(cur_struct_path, publish_struct_path); 83 | let cfg = CacheConfig { 84 | version, 85 | enum_total, 86 | struct_total, 87 | }; 88 | // write version 89 | write_version_to_cache(cfg); 90 | } 91 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AlignContent.toml: -------------------------------------------------------------------------------- 1 | key = "AlignContent" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"Stretch\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceBetween\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceAround\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceEvenly\"\nfield = []\n", "typing = \"Unit\"\nident = \"Baseline\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AlignItems.toml: -------------------------------------------------------------------------------- 1 | key = "AlignItems" 2 | value = ["typing = \"Unit\"\nident = \"Stretch\"\nfield = []\n", "typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"Baseline\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AlignSelf.toml: -------------------------------------------------------------------------------- 1 | key = "AlignSelf" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Stretch\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"Baseline\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Angle.toml: -------------------------------------------------------------------------------- 1 | key = "Angle" 2 | value = ["typing = \"Unnamed\"\nident = \"Deg\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Grad\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Rad\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Turn\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Calc\"\nfield = [\"Box < CalcExpr >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AngleOrPercentage.toml: -------------------------------------------------------------------------------- 1 | key = "AngleOrPercentage" 2 | value = ["typing = \"Unnamed\"\nident = \"Angle\"\nfield = [\"Angle\"]\n", "typing = \"Unnamed\"\nident = \"Percentage\"\nfield = [\"f32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimateableFeature.toml: -------------------------------------------------------------------------------- 1 | key = "AnimateableFeature" 2 | value = ["typing = \"Unit\"\nident = \"Contents\"\nfield = []\n", "typing = \"Unit\"\nident = \"ScrollPosition\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"CustomIdent\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationDirection.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationDirection" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimationDirectionItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationDirectionItem.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationDirectionItem" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Reverse\"\nfield = []\n", "typing = \"Unit\"\nident = \"Alternate\"\nfield = []\n", "typing = \"Unit\"\nident = \"AlternateReverse\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationFillMode.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationFillMode" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimationFillModeItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationFillModeItem.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationFillModeItem" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Forwards\"\nfield = []\n", "typing = \"Unit\"\nident = \"Backwards\"\nfield = []\n", "typing = \"Unit\"\nident = \"Both\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationIterationCount.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationIterationCount" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimationIterationCountItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationIterationCountItem.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationIterationCountItem" 2 | value = ["typing = \"Unnamed\"\nident = \"Number\"\nfield = [\"f32\"]\n", "typing = \"Unit\"\nident = \"Infinite\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationName.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationName" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimationNameItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationNameItem.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationNameItem" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"CustomIdent\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationPlayState.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationPlayState" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimationPlayStateItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AnimationPlayStateItem.toml: -------------------------------------------------------------------------------- 1 | key = "AnimationPlayStateItem" 2 | value = ["typing = \"Unit\"\nident = \"Running\"\nfield = []\n", "typing = \"Unit\"\nident = \"Paused\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/AspectRatio.toml: -------------------------------------------------------------------------------- 1 | key = "AspectRatio" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Ratio\"\nfield = [\"Number\", \"Number\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackdropFilter.toml: -------------------------------------------------------------------------------- 1 | key = "BackdropFilter" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < FilterFunc >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundAttachment.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundAttachment" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundAttachmentItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundAttachmentItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundAttachmentItem" 2 | value = ["typing = \"Unit\"\nident = \"Scroll\"\nfield = []\n", "typing = \"Unit\"\nident = \"Fixed\"\nfield = []\n", "typing = \"Unit\"\nident = \"Local\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundClip.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundClip" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundClipItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundClipItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundClipItem" 2 | value = ["typing = \"Unit\"\nident = \"BorderBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"PaddingBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"ContentBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"Text\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundImage.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundImage" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundImageItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundImageGradientItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundImageGradientItem" 2 | value = ["typing = \"Unnamed\"\nident = \"LinearGradient\"\nfield = [\"Angle\", \"Array < GradientColorItem >\"]\n", "typing = \"Unnamed\"\nident = \"RadialGradient\"\nfield = [\"GradientShape\", \"GradientSize\", \"GradientPosition\", \"Array < GradientColorItem >\"]\n", "typing = \"Unnamed\"\nident = \"ConicGradient\"\nfield = [\"ConicGradientItem\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundImageItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundImageItem" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"StrRef\"]\n", "typing = \"Unnamed\"\nident = \"Gradient\"\nfield = [\"BackgroundImageGradientItem\"]\n", "typing = \"Unnamed\"\nident = \"Image\"\nfield = [\"ImageTags\", \"ImageSource\", \"Color\"]\n", "typing = \"Unnamed\"\nident = \"Element\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundOrigin.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundOrigin" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundOriginItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundOriginItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundOriginItem" 2 | value = ["typing = \"Unit\"\nident = \"BorderBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"PaddingBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"ContentBox\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundPosition.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundPosition" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundPositionItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundPositionItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundPositionItem" 2 | value = ["typing = \"Unnamed\"\nident = \"Pos\"\nfield = [\"BackgroundPositionValue\", \"BackgroundPositionValue\"]\n", "typing = \"Unnamed\"\nident = \"Value\"\nfield = [\"BackgroundPositionValue\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundPositionValue.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundPositionValue" 2 | value = ["typing = \"Unnamed\"\nident = \"Top\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Bottom\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Left\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Right\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundRepeat.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundRepeat" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundRepeatItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundRepeatItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundRepeatItem" 2 | value = ["typing = \"Unnamed\"\nident = \"Pos\"\nfield = [\"BackgroundRepeatValue\", \"BackgroundRepeatValue\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundRepeatValue.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundRepeatValue" 2 | value = ["typing = \"Unit\"\nident = \"Repeat\"\nfield = []\n", "typing = \"Unit\"\nident = \"NoRepeat\"\nfield = []\n", "typing = \"Unit\"\nident = \"Space\"\nfield = []\n", "typing = \"Unit\"\nident = \"Round\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundSize.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundSize" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BackgroundSizeItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BackgroundSizeItem.toml: -------------------------------------------------------------------------------- 1 | key = "BackgroundSizeItem" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\", \"Length\"]\n", "typing = \"Unit\"\nident = \"Cover\"\nfield = []\n", "typing = \"Unit\"\nident = \"Contain\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BorderRadius.toml: -------------------------------------------------------------------------------- 1 | key = "BorderRadius" 2 | value = ["typing = \"Unnamed\"\nident = \"Pos\"\nfield = [\"Length\", \"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BorderRadiusType.toml: -------------------------------------------------------------------------------- 1 | key = "BorderRadiusType" 2 | value = ["typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Initial\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inherit\"\nfield = []\n", "typing = \"Unit\"\nident = \"Unset\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Var\"\nfield = [\"Box < StrRef >\"]\n", "typing = \"Unnamed\"\nident = \"VarInShorthand\"\nfield = [\"Box < StrRef >\", \"Box < StrRef >\"]\n", "typing = \"Unit\"\nident = \"Invalid0\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid7\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid8\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid9\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidA\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidB\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidC\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidD\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidE\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidF\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid10\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid11\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid12\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid13\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid14\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid15\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid16\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid17\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid18\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid19\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid20\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid21\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid22\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid23\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid24\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid25\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid26\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid27\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid28\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid29\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid30\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid31\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid32\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid33\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid34\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid35\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid36\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid37\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid38\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid39\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3F\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Pos\"\nfield = [\"Length\", \"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BorderStyle.toml: -------------------------------------------------------------------------------- 1 | key = "BorderStyle" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Solid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Dotted\"\nfield = []\n", "typing = \"Unit\"\nident = \"Dashed\"\nfield = []\n", "typing = \"Unit\"\nident = \"Hidden\"\nfield = []\n", "typing = \"Unit\"\nident = \"Double\"\nfield = []\n", "typing = \"Unit\"\nident = \"Groove\"\nfield = []\n", "typing = \"Unit\"\nident = \"Ridge\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inset\"\nfield = []\n", "typing = \"Unit\"\nident = \"Outset\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BoxShadow.toml: -------------------------------------------------------------------------------- 1 | key = "BoxShadow" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < BoxShadowItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BoxShadowItem.toml: -------------------------------------------------------------------------------- 1 | key = "BoxShadowItem" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < ShadowItemType >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/BoxSizing.toml: -------------------------------------------------------------------------------- 1 | key = "BoxSizing" 2 | value = ["typing = \"Unit\"\nident = \"ContentBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"PaddingBox\"\nfield = []\n", "typing = \"Unit\"\nident = \"BorderBox\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/CalcExpr.toml: -------------------------------------------------------------------------------- 1 | key = "CalcExpr" 2 | value = ["typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Box < Length >\"]\n", "typing = \"Unnamed\"\nident = \"Number\"\nfield = [\"Box < Number >\"]\n", "typing = \"Unnamed\"\nident = \"Angle\"\nfield = [\"Box < Angle >\"]\n", "typing = \"Unnamed\"\nident = \"Plus\"\nfield = [\"Box < CalcExpr >\", \"Box < CalcExpr >\"]\n", "typing = \"Unnamed\"\nident = \"Sub\"\nfield = [\"Box < CalcExpr >\", \"Box < CalcExpr >\"]\n", "typing = \"Unnamed\"\nident = \"Mul\"\nfield = [\"Box < CalcExpr >\", \"Box < CalcExpr >\"]\n", "typing = \"Unnamed\"\nident = \"Div\"\nfield = [\"Box < CalcExpr >\", \"Box < CalcExpr >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Color.toml: -------------------------------------------------------------------------------- 1 | key = "Color" 2 | value = ["typing = \"Unit\"\nident = \"Undefined\"\nfield = []\n", "typing = \"Unit\"\nident = \"CurrentColor\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Specified\"\nfield = [\"u8\", \"u8\", \"u8\", \"u8\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Contain.toml: -------------------------------------------------------------------------------- 1 | key = "Contain" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Strict\"\nfield = []\n", "typing = \"Unit\"\nident = \"Content\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Multiple\"\nfield = [\"Array < ContainKeyword >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ContainKeyword.toml: -------------------------------------------------------------------------------- 1 | key = "ContainKeyword" 2 | value = ["typing = \"Unit\"\nident = \"Size\"\nfield = []\n", "typing = \"Unit\"\nident = \"Layout\"\nfield = []\n", "typing = \"Unit\"\nident = \"Style\"\nfield = []\n", "typing = \"Unit\"\nident = \"Paint\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Content.toml: -------------------------------------------------------------------------------- 1 | key = "Content" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Str\"\nfield = [\"StrRef\"]\n", "typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/CustomProperty.toml: -------------------------------------------------------------------------------- 1 | key = "CustomProperty" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Expr\"\nfield = [\"StrRef\", \"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Direction.toml: -------------------------------------------------------------------------------- 1 | key = "Direction" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"LTR\"\nfield = []\n", "typing = \"Unit\"\nident = \"RTL\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Display.toml: -------------------------------------------------------------------------------- 1 | key = "Display" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Block\"\nfield = []\n", "typing = \"Unit\"\nident = \"Flex\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inline\"\nfield = []\n", "typing = \"Unit\"\nident = \"InlineBlock\"\nfield = []\n", "typing = \"Unit\"\nident = \"Grid\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlowRoot\"\nfield = []\n", "typing = \"Unit\"\nident = \"InlineFlex\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/DropShadow.toml: -------------------------------------------------------------------------------- 1 | key = "DropShadow" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < ShadowItemType >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Filter.toml: -------------------------------------------------------------------------------- 1 | key = "Filter" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < FilterFunc >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FilterFunc.toml: -------------------------------------------------------------------------------- 1 | key = "FilterFunc" 2 | value = ["typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"StrRef\"]\n", "typing = \"Unnamed\"\nident = \"Blur\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Brightness\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Contrast\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"DropShadow\"\nfield = [\"DropShadow\"]\n", "typing = \"Unnamed\"\nident = \"Grayscale\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"HueRotate\"\nfield = [\"Angle\"]\n", "typing = \"Unnamed\"\nident = \"Invert\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Opacity\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Saturate\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Sepia\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FlexDirection.toml: -------------------------------------------------------------------------------- 1 | key = "FlexDirection" 2 | value = ["typing = \"Unit\"\nident = \"Row\"\nfield = []\n", "typing = \"Unit\"\nident = \"RowReverse\"\nfield = []\n", "typing = \"Unit\"\nident = \"Column\"\nfield = []\n", "typing = \"Unit\"\nident = \"ColumnReverse\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FlexWrap.toml: -------------------------------------------------------------------------------- 1 | key = "FlexWrap" 2 | value = ["typing = \"Unit\"\nident = \"NoWrap\"\nfield = []\n", "typing = \"Unit\"\nident = \"Wrap\"\nfield = []\n", "typing = \"Unit\"\nident = \"WrapReverse\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Float.toml: -------------------------------------------------------------------------------- 1 | key = "Float" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Left\"\nfield = []\n", "typing = \"Unit\"\nident = \"Right\"\nfield = []\n", "typing = \"Unit\"\nident = \"InlineStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"InlineEnd\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontDisplay.toml: -------------------------------------------------------------------------------- 1 | key = "FontDisplay" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"Block\"\nfield = []\n", "typing = \"Unit\"\nident = \"Swap\"\nfield = []\n", "typing = \"Unit\"\nident = \"Fallback\"\nfield = []\n", "typing = \"Unit\"\nident = \"Optional\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontFamily.toml: -------------------------------------------------------------------------------- 1 | key = "FontFamily" 2 | value = ["typing = \"Unnamed\"\nident = \"Names\"\nfield = [\"Array < FontFamilyName >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontFamilyName.toml: -------------------------------------------------------------------------------- 1 | key = "FontFamilyName" 2 | value = ["typing = \"Unit\"\nident = \"Serif\"\nfield = []\n", "typing = \"Unit\"\nident = \"SansSerif\"\nfield = []\n", "typing = \"Unit\"\nident = \"Monospace\"\nfield = []\n", "typing = \"Unit\"\nident = \"Cursive\"\nfield = []\n", "typing = \"Unit\"\nident = \"Fantasy\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Title\"\nfield = [\"StrRef\"]\n", "typing = \"Unit\"\nident = \"SystemUi\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontFamilyType.toml: -------------------------------------------------------------------------------- 1 | key = "FontFamilyType" 2 | value = ["typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Initial\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inherit\"\nfield = []\n", "typing = \"Unit\"\nident = \"Unset\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Var\"\nfield = [\"Box < StrRef >\"]\n", "typing = \"Unnamed\"\nident = \"VarInShorthand\"\nfield = [\"Box < StrRef >\", \"Box < StrRef >\"]\n", "typing = \"Unit\"\nident = \"Invalid0\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid7\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid8\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid9\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidA\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidB\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidC\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidD\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidE\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidF\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid10\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid11\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid12\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid13\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid14\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid15\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid16\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid17\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid18\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid19\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid20\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid21\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid22\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid23\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid24\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid25\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid26\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid27\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid28\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid29\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid30\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid31\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid32\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid33\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid34\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid35\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid36\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid37\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid38\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid39\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3F\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Names\"\nfield = [\"Array < FontFamilyName >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontFeatureSettings.toml: -------------------------------------------------------------------------------- 1 | key = "FontFeatureSettings" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"FeatureTags\"\nfield = [\"Array < FeatureTag >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontSrc.toml: -------------------------------------------------------------------------------- 1 | key = "FontSrc" 2 | value = ["typing = \"Unnamed\"\nident = \"Local\"\nfield = [\"FontFamilyName\"]\n", "typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"FontUrl\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontStyle.toml: -------------------------------------------------------------------------------- 1 | key = "FontStyle" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Italic\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Oblique\"\nfield = [\"Angle\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/FontWeight.toml: -------------------------------------------------------------------------------- 1 | key = "FontWeight" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Bold\"\nfield = []\n", "typing = \"Unit\"\nident = \"Bolder\"\nfield = []\n", "typing = \"Unit\"\nident = \"Lighter\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Num\"\nfield = [\"Number\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Gap.toml: -------------------------------------------------------------------------------- 1 | key = "Gap" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/GradientColorItem.toml: -------------------------------------------------------------------------------- 1 | key = "GradientColorItem" 2 | value = ["typing = \"Unnamed\"\nident = \"ColorHint\"\nfield = [\"Color\", \"Length\"]\n", "typing = \"Unnamed\"\nident = \"SimpleColorHint\"\nfield = [\"Color\"]\n", "typing = \"Unnamed\"\nident = \"AngleOrPercentageColorHint\"\nfield = [\"Color\", \"AngleOrPercentage\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/GradientPosition.toml: -------------------------------------------------------------------------------- 1 | key = "GradientPosition" 2 | value = ["typing = \"Unnamed\"\nident = \"Pos\"\nfield = [\"Length\", \"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/GradientShape.toml: -------------------------------------------------------------------------------- 1 | key = "GradientShape" 2 | value = ["typing = \"Unit\"\nident = \"Ellipse\"\nfield = []\n", "typing = \"Unit\"\nident = \"Circle\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/GradientSize.toml: -------------------------------------------------------------------------------- 1 | key = "GradientSize" 2 | value = ["typing = \"Unit\"\nident = \"FarthestCorner\"\nfield = []\n", "typing = \"Unit\"\nident = \"ClosestSide\"\nfield = []\n", "typing = \"Unit\"\nident = \"ClosestCorner\"\nfield = []\n", "typing = \"Unit\"\nident = \"FarthestSide\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Len\"\nfield = [\"Length\", \"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ImageSource.toml: -------------------------------------------------------------------------------- 1 | key = "ImageSource" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ImageTags.toml: -------------------------------------------------------------------------------- 1 | key = "ImageTags" 2 | value = ["typing = \"Unit\"\nident = \"LTR\"\nfield = []\n", "typing = \"Unit\"\nident = \"RTL\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ImportantBitSet.toml: -------------------------------------------------------------------------------- 1 | key = "ImportantBitSet" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Array\"\nfield = [\"Array < u8 >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/JustifyContent.toml: -------------------------------------------------------------------------------- 1 | key = "JustifyContent" 2 | value = ["typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceBetween\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceAround\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpaceEvenly\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"Left\"\nfield = []\n", "typing = \"Unit\"\nident = \"Right\"\nfield = []\n", "typing = \"Unit\"\nident = \"Stretch\"\nfield = []\n", "typing = \"Unit\"\nident = \"Baseline\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/JustifyItems.toml: -------------------------------------------------------------------------------- 1 | key = "JustifyItems" 2 | value = ["typing = \"Unit\"\nident = \"Stretch\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"FlexEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"SelfEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"Left\"\nfield = []\n", "typing = \"Unit\"\nident = \"Right\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/KeyFrame.toml: -------------------------------------------------------------------------------- 1 | key = "KeyFrame" 2 | value = ["typing = \"Unit\"\nident = \"From\"\nfield = []\n", "typing = \"Unit\"\nident = \"To\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Ratio\"\nfield = [\"f32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Length.toml: -------------------------------------------------------------------------------- 1 | key = "Length" 2 | value = ["typing = \"Unit\"\nident = \"Undefined\"\nfield = []\n", "typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Px\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Vw\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Vh\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Rem\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Rpx\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Em\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Ratio\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Expr\"\nfield = [\"LengthExpr\"]\n", "typing = \"Unnamed\"\nident = \"Vmin\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Vmax\"\nfield = [\"f32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/LengthExpr.toml: -------------------------------------------------------------------------------- 1 | key = "LengthExpr" 2 | value = ["typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Env\"\nfield = [\"StrRef\", \"Box < Length >\"]\n", "typing = \"Unnamed\"\nident = \"Calc\"\nfield = [\"Box < CalcExpr >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/LetterSpacing.toml: -------------------------------------------------------------------------------- 1 | key = "LetterSpacing" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/LineHeight.toml: -------------------------------------------------------------------------------- 1 | key = "LineHeight" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Num\"\nfield = [\"Number\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ListStyleImage.toml: -------------------------------------------------------------------------------- 1 | key = "ListStyleImage" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Url\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ListStylePosition.toml: -------------------------------------------------------------------------------- 1 | key = "ListStylePosition" 2 | value = ["typing = \"Unit\"\nident = \"Outside\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inside\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ListStyleType.toml: -------------------------------------------------------------------------------- 1 | key = "ListStyleType" 2 | value = ["typing = \"Unit\"\nident = \"Disc\"\nfield = []\n", "typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Circle\"\nfield = []\n", "typing = \"Unit\"\nident = \"Square\"\nfield = []\n", "typing = \"Unit\"\nident = \"Decimal\"\nfield = []\n", "typing = \"Unit\"\nident = \"CjkDecimal\"\nfield = []\n", "typing = \"Unit\"\nident = \"DecimalLeadingZero\"\nfield = []\n", "typing = \"Unit\"\nident = \"LowerRoman\"\nfield = []\n", "typing = \"Unit\"\nident = \"UpperRoman\"\nfield = []\n", "typing = \"Unit\"\nident = \"LowerGreek\"\nfield = []\n", "typing = \"Unit\"\nident = \"LowerAlpha\"\nfield = []\n", "typing = \"Unit\"\nident = \"LowerLatin\"\nfield = []\n", "typing = \"Unit\"\nident = \"UpperAlpha\"\nfield = []\n", "typing = \"Unit\"\nident = \"UpperLatin\"\nfield = []\n", "typing = \"Unit\"\nident = \"Armenian\"\nfield = []\n", "typing = \"Unit\"\nident = \"Georgian\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"CustomIdent\"\nfield = [\"StrRef\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MaskMode.toml: -------------------------------------------------------------------------------- 1 | key = "MaskMode" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < MaskModeItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MaskModeItem.toml: -------------------------------------------------------------------------------- 1 | key = "MaskModeItem" 2 | value = ["typing = \"Unit\"\nident = \"MatchSource\"\nfield = []\n", "typing = \"Unit\"\nident = \"Alpha\"\nfield = []\n", "typing = \"Unit\"\nident = \"Luminance\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MaskModeType.toml: -------------------------------------------------------------------------------- 1 | key = "MaskModeType" 2 | value = ["typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Initial\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inherit\"\nfield = []\n", "typing = \"Unit\"\nident = \"Unset\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Var\"\nfield = [\"Box < StrRef >\"]\n", "typing = \"Unnamed\"\nident = \"VarInShorthand\"\nfield = [\"Box < StrRef >\", \"Box < StrRef >\"]\n", "typing = \"Unit\"\nident = \"Invalid0\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid7\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid8\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid9\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidA\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidB\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidC\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidD\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidE\"\nfield = []\n", "typing = \"Unit\"\nident = \"InvalidF\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid10\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid11\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid12\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid13\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid14\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid15\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid16\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid17\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid18\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid19\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid1F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid20\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid21\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid22\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid23\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid24\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid25\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid26\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid27\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid28\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid29\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid2F\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid30\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid31\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid32\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid33\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid34\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid35\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid36\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid37\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid38\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid39\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3A\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3B\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3C\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3D\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3E\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid3F\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < MaskModeItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MediaExpression.toml: -------------------------------------------------------------------------------- 1 | key = "MediaExpression" 2 | value = ["typing = \"Unit\"\nident = \"Unknown\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"MediaType\"\nfield = [\"MediaType\"]\n", "typing = \"Unnamed\"\nident = \"Orientation\"\nfield = [\"Orientation\"]\n", "typing = \"Unnamed\"\nident = \"Width\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"MinWidth\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"MaxWidth\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Height\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"MinHeight\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"MaxHeight\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"Theme\"\nfield = [\"Theme\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MediaType.toml: -------------------------------------------------------------------------------- 1 | key = "MediaType" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"All\"\nfield = []\n", "typing = \"Unit\"\nident = \"Screen\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/MediaTypeDecorator.toml: -------------------------------------------------------------------------------- 1 | key = "MediaTypeDecorator" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Not\"\nfield = []\n", "typing = \"Unit\"\nident = \"Only\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Nullable.toml: -------------------------------------------------------------------------------- 1 | key = "Nullable" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Some\"\nfield = [\"T\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/NullablePtr.toml: -------------------------------------------------------------------------------- 1 | key = "NullablePtr" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Some\"\nfield = [\"Box < T >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Number.toml: -------------------------------------------------------------------------------- 1 | key = "Number" 2 | value = ["typing = \"Unnamed\"\nident = \"F32\"\nfield = [\"f32\"]\n", "typing = \"Unnamed\"\nident = \"I32\"\nfield = [\"i32\"]\n", "typing = \"Unnamed\"\nident = \"Calc\"\nfield = [\"Box < CalcExpr >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Orientation.toml: -------------------------------------------------------------------------------- 1 | key = "Orientation" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Portrait\"\nfield = []\n", "typing = \"Unit\"\nident = \"Landscape\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Overflow.toml: -------------------------------------------------------------------------------- 1 | key = "Overflow" 2 | value = ["typing = \"Unit\"\nident = \"Visible\"\nfield = []\n", "typing = \"Unit\"\nident = \"Hidden\"\nfield = []\n", "typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"Scroll\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/OverflowWrap.toml: -------------------------------------------------------------------------------- 1 | key = "OverflowWrap" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"BreakWord\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/PointerEvents.toml: -------------------------------------------------------------------------------- 1 | key = "PointerEvents" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"WxRoot\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Position.toml: -------------------------------------------------------------------------------- 1 | key = "Position" 2 | value = ["typing = \"Unit\"\nident = \"Static\"\nfield = []\n", "typing = \"Unit\"\nident = \"Relative\"\nfield = []\n", "typing = \"Unit\"\nident = \"Absolute\"\nfield = []\n", "typing = \"Unit\"\nident = \"Fixed\"\nfield = []\n", "typing = \"Unit\"\nident = \"Sticky\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/PseudoClassesType.toml: -------------------------------------------------------------------------------- 1 | key = "PseudoClassesType" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Host\"\nfield = []\n", "typing = \"Unit\"\nident = \"FirstChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"LastChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"Empty\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"NotExpr\"\nfield = [\"Array < SelectorFragment >\"]\n", "typing = \"Unit\"\nident = \"OnlyChild\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"NthChild\"\nfield = [\"i32\", \"i32\", \"Nullable < Box < Array < SelectorFragment > > >\"]\n", "typing = \"Unnamed\"\nident = \"NthOfType\"\nfield = [\"i32\", \"i32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/PseudoElementsType.toml: -------------------------------------------------------------------------------- 1 | key = "PseudoElementsType" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Before\"\nfield = []\n", "typing = \"Unit\"\nident = \"After\"\nfield = []\n", "typing = \"Unit\"\nident = \"Selection\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Resize.toml: -------------------------------------------------------------------------------- 1 | key = "Resize" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Both\"\nfield = []\n", "typing = \"Unit\"\nident = \"Horizontal\"\nfield = []\n", "typing = \"Unit\"\nident = \"Vertical\"\nfield = []\n", "typing = \"Unit\"\nident = \"Block\"\nfield = []\n", "typing = \"Unit\"\nident = \"Inline\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Scrollbar.toml: -------------------------------------------------------------------------------- 1 | key = "Scrollbar" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"Hidden\"\nfield = []\n", "typing = \"Unit\"\nident = \"AutoHide\"\nfield = []\n", "typing = \"Unit\"\nident = \"AlwaysShow\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/SelectorRelationType.toml: -------------------------------------------------------------------------------- 1 | key = "SelectorRelationType" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Invalid\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Ancestor\"\nfield = [\"Box < SelectorFragment >\"]\n", "typing = \"Unnamed\"\nident = \"DirectParent\"\nfield = [\"Box < SelectorFragment >\"]\n", "typing = \"Unnamed\"\nident = \"NextSibling\"\nfield = [\"Box < SelectorFragment >\"]\n", "typing = \"Unnamed\"\nident = \"SubsequentSibling\"\nfield = [\"Box < SelectorFragment >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ShadowItemType.toml: -------------------------------------------------------------------------------- 1 | key = "ShadowItemType" 2 | value = ["typing = \"Unit\"\nident = \"Inset\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"OffsetX\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"OffsetY\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"BlurRadius\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"SpreadRadius\"\nfield = [\"Length\"]\n", "typing = \"Unnamed\"\nident = \"Color\"\nfield = [\"Color\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/StepPosition.toml: -------------------------------------------------------------------------------- 1 | key = "StepPosition" 2 | value = ["typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"JumpStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"JumpEnd\"\nfield = []\n", "typing = \"Unit\"\nident = \"JumpNone\"\nfield = []\n", "typing = \"Unit\"\nident = \"JumpBoth\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/StyleSheet.toml: -------------------------------------------------------------------------------- 1 | key = "StyleSheet" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"V1\"\nfield = [\"StyleSheetV1\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextAlign.toml: -------------------------------------------------------------------------------- 1 | key = "TextAlign" 2 | value = ["typing = \"Unit\"\nident = \"Left\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"Right\"\nfield = []\n", "typing = \"Unit\"\nident = \"Justify\"\nfield = []\n", "typing = \"Unit\"\nident = \"JustifyAll\"\nfield = []\n", "typing = \"Unit\"\nident = \"Start\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"MatchParent\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextDecorationLine.toml: -------------------------------------------------------------------------------- 1 | key = "TextDecorationLine" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"SpellingError\"\nfield = []\n", "typing = \"Unit\"\nident = \"GrammarError\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < TextDecorationLineItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextDecorationLineItem.toml: -------------------------------------------------------------------------------- 1 | key = "TextDecorationLineItem" 2 | value = ["typing = \"Unit\"\nident = \"Overline\"\nfield = []\n", "typing = \"Unit\"\nident = \"LineThrough\"\nfield = []\n", "typing = \"Unit\"\nident = \"Underline\"\nfield = []\n", "typing = \"Unit\"\nident = \"Blink\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextDecorationStyle.toml: -------------------------------------------------------------------------------- 1 | key = "TextDecorationStyle" 2 | value = ["typing = \"Unit\"\nident = \"Solid\"\nfield = []\n", "typing = \"Unit\"\nident = \"Double\"\nfield = []\n", "typing = \"Unit\"\nident = \"Dotted\"\nfield = []\n", "typing = \"Unit\"\nident = \"Dashed\"\nfield = []\n", "typing = \"Unit\"\nident = \"Wavy\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextDecorationThickness.toml: -------------------------------------------------------------------------------- 1 | key = "TextDecorationThickness" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unit\"\nident = \"FromFont\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextOverflow.toml: -------------------------------------------------------------------------------- 1 | key = "TextOverflow" 2 | value = ["typing = \"Unit\"\nident = \"Clip\"\nfield = []\n", "typing = \"Unit\"\nident = \"Ellipsis\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextShadow.toml: -------------------------------------------------------------------------------- 1 | key = "TextShadow" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < TextShadowItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TextShadowItem.toml: -------------------------------------------------------------------------------- 1 | key = "TextShadowItem" 2 | value = ["typing = \"Unnamed\"\nident = \"TextShadowValue\"\nfield = [\"Length\", \"Length\", \"Length\", \"Color\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Theme.toml: -------------------------------------------------------------------------------- 1 | key = "Theme" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unit\"\nident = \"Light\"\nfield = []\n", "typing = \"Unit\"\nident = \"Dark\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Transform.toml: -------------------------------------------------------------------------------- 1 | key = "Transform" 2 | value = ["typing = \"Unnamed\"\nident = \"Series\"\nfield = [\"Array < TransformItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransformItem.toml: -------------------------------------------------------------------------------- 1 | key = "TransformItem" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Matrix\"\nfield = [\"[f32; 6]\"]\n", "typing = \"Unnamed\"\nident = \"Matrix3D\"\nfield = [\"[f32; 16]\"]\n", "typing = \"Unnamed\"\nident = \"Translate2D\"\nfield = [\"Length\", \"Length\"]\n", "typing = \"Unnamed\"\nident = \"Translate3D\"\nfield = [\"Length\", \"Length\", \"Length\"]\n", "typing = \"Unnamed\"\nident = \"Scale2D\"\nfield = [\"f32\", \"f32\"]\n", "typing = \"Unnamed\"\nident = \"Scale3D\"\nfield = [\"f32\", \"f32\", \"f32\"]\n", "typing = \"Unnamed\"\nident = \"Rotate2D\"\nfield = [\"Angle\"]\n", "typing = \"Unnamed\"\nident = \"Rotate3D\"\nfield = [\"f32\", \"f32\", \"f32\", \"Angle\"]\n", "typing = \"Unnamed\"\nident = \"Skew\"\nfield = [\"Angle\", \"Angle\"]\n", "typing = \"Unnamed\"\nident = \"Perspective\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransformOrigin.toml: -------------------------------------------------------------------------------- 1 | key = "TransformOrigin" 2 | value = ["typing = \"Unnamed\"\nident = \"LengthTuple\"\nfield = [\"Length\", \"Length\", \"Length\"]\n", "typing = \"Unit\"\nident = \"Left\"\nfield = []\n", "typing = \"Unit\"\nident = \"Right\"\nfield = []\n", "typing = \"Unit\"\nident = \"Center\"\nfield = []\n", "typing = \"Unit\"\nident = \"Bottom\"\nfield = []\n", "typing = \"Unit\"\nident = \"Top\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransitionProperty.toml: -------------------------------------------------------------------------------- 1 | key = "TransitionProperty" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < TransitionPropertyItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransitionTime.toml: -------------------------------------------------------------------------------- 1 | key = "TransitionTime" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < u32 >\"]\n", "typing = \"Unnamed\"\nident = \"ListI32\"\nfield = [\"Array < i32 >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransitionTimingFn.toml: -------------------------------------------------------------------------------- 1 | key = "TransitionTimingFn" 2 | value = ["typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < TransitionTimingFnItem >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/TransitionTimingFnItem.toml: -------------------------------------------------------------------------------- 1 | key = "TransitionTimingFnItem" 2 | value = ["typing = \"Unit\"\nident = \"Linear\"\nfield = []\n", "typing = \"Unit\"\nident = \"Ease\"\nfield = []\n", "typing = \"Unit\"\nident = \"EaseIn\"\nfield = []\n", "typing = \"Unit\"\nident = \"EaseOut\"\nfield = []\n", "typing = \"Unit\"\nident = \"EaseInOut\"\nfield = []\n", "typing = \"Unit\"\nident = \"StepStart\"\nfield = []\n", "typing = \"Unit\"\nident = \"StepEnd\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Steps\"\nfield = [\"i32\", \"StepPosition\"]\n", "typing = \"Unnamed\"\nident = \"CubicBezier\"\nfield = [\"f32\", \"f32\", \"f32\", \"f32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/VerticalAlign.toml: -------------------------------------------------------------------------------- 1 | key = "VerticalAlign" 2 | value = ["typing = \"Unit\"\nident = \"Baseline\"\nfield = []\n", "typing = \"Unit\"\nident = \"Top\"\nfield = []\n", "typing = \"Unit\"\nident = \"Middle\"\nfield = []\n", "typing = \"Unit\"\nident = \"Bottom\"\nfield = []\n", "typing = \"Unit\"\nident = \"TextTop\"\nfield = []\n", "typing = \"Unit\"\nident = \"TextBottom\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/Visibility.toml: -------------------------------------------------------------------------------- 1 | key = "Visibility" 2 | value = ["typing = \"Unit\"\nident = \"Visible\"\nfield = []\n", "typing = \"Unit\"\nident = \"Hidden\"\nfield = []\n", "typing = \"Unit\"\nident = \"Collapse\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WhiteSpace.toml: -------------------------------------------------------------------------------- 1 | key = "WhiteSpace" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unit\"\nident = \"NoWrap\"\nfield = []\n", "typing = \"Unit\"\nident = \"Pre\"\nfield = []\n", "typing = \"Unit\"\nident = \"PreWrap\"\nfield = []\n", "typing = \"Unit\"\nident = \"PreLine\"\nfield = []\n", "typing = \"Unit\"\nident = \"WxPreEdit\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WillChange.toml: -------------------------------------------------------------------------------- 1 | key = "WillChange" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"List\"\nfield = [\"Array < AnimateableFeature >\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WordBreak.toml: -------------------------------------------------------------------------------- 1 | key = "WordBreak" 2 | value = ["typing = \"Unit\"\nident = \"BreakWord\"\nfield = []\n", "typing = \"Unit\"\nident = \"BreakAll\"\nfield = []\n", "typing = \"Unit\"\nident = \"KeepAll\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WordSpacing.toml: -------------------------------------------------------------------------------- 1 | key = "WordSpacing" 2 | value = ["typing = \"Unit\"\nident = \"Normal\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Length\"\nfield = [\"Length\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WritingMode.toml: -------------------------------------------------------------------------------- 1 | key = "WritingMode" 2 | value = ["typing = \"Unit\"\nident = \"HorizontalTb\"\nfield = []\n", "typing = \"Unit\"\nident = \"VerticalLr\"\nfield = []\n", "typing = \"Unit\"\nident = \"VerticalRl\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/WxEngineTouchEvent.toml: -------------------------------------------------------------------------------- 1 | key = "WxEngineTouchEvent" 2 | value = ["typing = \"Unit\"\nident = \"Gesture\"\nfield = []\n", "typing = \"Unit\"\nident = \"Click\"\nfield = []\n", "typing = \"Unit\"\nident = \"None\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/ZIndex.toml: -------------------------------------------------------------------------------- 1 | key = "ZIndex" 2 | value = ["typing = \"Unit\"\nident = \"Auto\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Num\"\nfield = [\"Number\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/debug_assertions , compatibility_enum_check (selector)_AttributeFlags.toml: -------------------------------------------------------------------------------- 1 | key = "AttributeFlags" 2 | value = ["typing = \"Unit\"\nident = \"CaseSensitivityDependsOnName\"\nfield = []\n", "typing = \"Unit\"\nident = \"CaseSensitive\"\nfield = []\n", "typing = \"Unit\"\nident = \"CaseInsensitive\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/debug_assertions , compatibility_enum_check (selector)_PseudoClasses.toml: -------------------------------------------------------------------------------- 1 | key = "PseudoClasses" 2 | value = ["typing = \"Unit\"\nident = \"Host\"\nfield = []\n", "typing = \"Unit\"\nident = \"FirstChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"LastChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"Empty\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Not\"\nfield = [\"Vec < SelectorFragment >\"]\n", "typing = \"Unit\"\nident = \"OnlyChild\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"NthChild\"\nfield = [\"i32\", \"i32\", \"Option < Box < Vec < SelectorFragment > > >\"]\n", "typing = \"Unnamed\"\nident = \"NthOfType\"\nfield = [\"i32\", \"i32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/selector_AttributeFlags.toml: -------------------------------------------------------------------------------- 1 | key = "AttributeFlags" 2 | value = ["typing = \"Unit\"\nident = \"CaseSensitivityDependsOnName\"\nfield = []\n", "typing = \"Unit\"\nident = \"CaseSensitive\"\nfield = []\n", "typing = \"Unit\"\nident = \"CaseInsensitive\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/selector_AttributeOperator.toml: -------------------------------------------------------------------------------- 1 | key = "AttributeOperator" 2 | value = ["typing = \"Unit\"\nident = \"Set\"\nfield = []\n", "typing = \"Unit\"\nident = \"Exact\"\nfield = []\n", "typing = \"Unit\"\nident = \"List\"\nfield = []\n", "typing = \"Unit\"\nident = \"Hyphen\"\nfield = []\n", "typing = \"Unit\"\nident = \"Begin\"\nfield = []\n", "typing = \"Unit\"\nident = \"End\"\nfield = []\n", "typing = \"Unit\"\nident = \"Contain\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/selector_PseudoClasses.toml: -------------------------------------------------------------------------------- 1 | key = "PseudoClasses" 2 | value = ["typing = \"Unit\"\nident = \"Host\"\nfield = []\n", "typing = \"Unit\"\nident = \"FirstChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"LastChild\"\nfield = []\n", "typing = \"Unit\"\nident = \"Empty\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Not\"\nfield = [\"Vec < SelectorFragment >\"]\n", "typing = \"Unit\"\nident = \"OnlyChild\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"NthChild\"\nfield = [\"i32\", \"i32\", \"Option < Box < Vec < SelectorFragment > > >\"]\n", "typing = \"Unnamed\"\nident = \"NthOfType\"\nfield = [\"i32\", \"i32\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/selector_PseudoElements.toml: -------------------------------------------------------------------------------- 1 | key = "PseudoElements" 2 | value = ["typing = \"Unit\"\nident = \"Before\"\nfield = []\n", "typing = \"Unit\"\nident = \"After\"\nfield = []\n", "typing = \"Unit\"\nident = \"Selection\"\nfield = []\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/enum/selector_SelectorRelationType.toml: -------------------------------------------------------------------------------- 1 | key = "SelectorRelationType" 2 | value = ["typing = \"Unit\"\nident = \"None\"\nfield = []\n", "typing = \"Unnamed\"\nident = \"Ancestor\"\nfield = [\"SelectorFragment\"]\n", "typing = \"Unnamed\"\nident = \"DirectParent\"\nfield = [\"SelectorFragment\"]\n", "typing = \"Unnamed\"\nident = \"NextSibling\"\nfield = [\"SelectorFragment\"]\n", "typing = \"Unnamed\"\nident = \"SubsequentSibling\"\nfield = [\"SelectorFragment\"]\n"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/Array.toml: -------------------------------------------------------------------------------- 1 | key = "Array" 2 | value = ["Box<[T]>"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/AttributeType.toml: -------------------------------------------------------------------------------- 1 | key = "AttributeType" 2 | value = ["AttributeOperator", "AttributeFlags", "bool", "StrRef", "Nullable"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/ConicGradientItem.toml: -------------------------------------------------------------------------------- 1 | key = "ConicGradientItem" 2 | value = ["Angle", "GradientPosition", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/FeatureTag.toml: -------------------------------------------------------------------------------- 1 | key = "FeatureTag" 2 | value = ["StrRef", "Number"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/FontFace.toml: -------------------------------------------------------------------------------- 1 | key = "FontFace" 2 | value = ["FontFamilyName", "Array", "Nullable", "Nullable", "Nullable"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/FontUrl.toml: -------------------------------------------------------------------------------- 1 | key = "FontUrl" 2 | value = ["Box", "Nullable>"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/InlineRule.toml: -------------------------------------------------------------------------------- 1 | key = "InlineRule" 2 | value = ["Array", "ImportantBitSet"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/KeyFrameRule.toml: -------------------------------------------------------------------------------- 1 | key = "KeyFrameRule" 2 | value = ["Array", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/KeyFrames.toml: -------------------------------------------------------------------------------- 1 | key = "KeyFrames" 2 | value = ["StrRef", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/Media.toml: -------------------------------------------------------------------------------- 1 | key = "Media" 2 | value = ["Nullable", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/MediaQuery.toml: -------------------------------------------------------------------------------- 1 | key = "MediaQuery" 2 | value = ["MediaTypeDecorator", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/Rule.toml: -------------------------------------------------------------------------------- 1 | key = "Rule" 2 | value = ["Selector", "Array", "Nullable", "ImportantBitSet"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/Selector.toml: -------------------------------------------------------------------------------- 1 | key = "Selector" 2 | value = ["Array", "u16"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/SelectorFragment.toml: -------------------------------------------------------------------------------- 1 | key = "SelectorFragment" 2 | value = ["StrRef", "StrRef", "Array", "SelectorRelationType", "PseudoClassesType", "PseudoElementsType", "NullablePtr>"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/StyleSheetV1.toml: -------------------------------------------------------------------------------- 1 | key = "StyleSheetV1" 2 | value = ["StrBuffer", "Array", "Array>", "Array", "Array", "Box", "Array", "Array"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/selector_Attribute.toml: -------------------------------------------------------------------------------- 1 | key = "Attribute" 2 | value = ["AttributeOperator", "AttributeFlags", "bool", "String", "Option"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/selector_Selector.toml: -------------------------------------------------------------------------------- 1 | key = "Selector" 2 | value = ["Vec", "u16"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/struct/selector_SelectorFragment.toml: -------------------------------------------------------------------------------- 1 | key = "SelectorFragment" 2 | value = ["String", "String", "Vec", "Option>", "Cell", "Option>", "Option>", "Option>>"] 3 | -------------------------------------------------------------------------------- /float-pigment-css/compile_cache/publish/version.toml: -------------------------------------------------------------------------------- 1 | version = "0.6.0" 2 | enum_total = 204 3 | struct_total = 18 4 | -------------------------------------------------------------------------------- /float-pigment-css/examples/compile_json.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | // let style_text = r#" 3 | // .my-class { 4 | // color: #abc; 5 | // } 6 | // @media (max-width: 800px) { 7 | // .my-class { 8 | // color: #def; 9 | // } 10 | // } 11 | // @media only screen and (max-width: 900px), not screen and (min-width: 400px) { 12 | // .my-class { 13 | // color: 123 14 | // } 15 | // } 16 | // "#; 17 | let _st = r#" 18 | #a { 19 | height: 100px; 20 | } 21 | .b { 22 | height: 200px !important; 23 | width: 400px; 24 | } 25 | .b { 26 | height: 300px; 27 | overflow: hidden auto; 28 | transition-property: overflow, all, width; 29 | } 30 | "#; 31 | // #[cfg(debug_assertions)] 32 | // println!( 33 | // "{}", 34 | // float_pigment_css::compile_style_sheet_to_json("text", st) 35 | // ); 36 | } 37 | -------------------------------------------------------------------------------- /float-pigment-css/examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /float-pigment-css/examples/index.js: -------------------------------------------------------------------------------- 1 | const mod = require("../pkg/float_pigment_css.js"); 2 | 3 | const { compileStyleSheetToJson } = mod; 4 | 5 | const result = compileStyleSheetToJson("test", ` 6 | .my-class { 7 | color: #abc; 8 | } 9 | @media (max-width: 800px) { 10 | .my-class { 11 | color: 200px; 12 | flex-flow: column-reverse wrap; 13 | pointer-events: auto; 14 | 15 | } 16 | }`); 17 | 18 | console.log(result); 19 | 20 | 21 | const re = mod.compileStyleSheetToBincode("test", ` 22 | .my-class { 23 | color: #abc; 24 | } 25 | @media (max-width: 800px) { 26 | .my-class { 27 | color: 200px; 28 | flex-flow: column-reverse wrap; 29 | pointer-events: auto; 30 | 31 | } 32 | }`); 33 | 34 | console.log(re); 35 | 36 | -------------------------------------------------------------------------------- /float-pigment-css/src/check_trait.rs: -------------------------------------------------------------------------------- 1 | use alloc::{boxed::Box, string::String, vec::Vec}; 2 | use core::cell::Cell; 3 | 4 | use crate::sheet::str_store::StrBuffer; 5 | 6 | pub trait CompatibilityCheck { 7 | fn check() {} 8 | } 9 | 10 | macro_rules! gen_check { 11 | ($($x: ty),+) => { 12 | $(impl CompatibilityCheck for $x {})+ 13 | }; 14 | } 15 | 16 | macro_rules! gen_check_with_generics { 17 | ($($x: ty),+) => { 18 | $( 19 | impl CompatibilityCheck for $x 20 | where 21 | T: CompatibilityCheck, 22 | { 23 | fn check() { 24 | T::check(); 25 | } 26 | } 27 | )+ 28 | }; 29 | } 30 | 31 | gen_check!( 32 | (), 33 | u8, 34 | f32, 35 | i32, 36 | u32, 37 | u16, 38 | usize, 39 | StrBuffer, 40 | String, 41 | [f32; 6], 42 | [f32; 16], 43 | bool 44 | ); 45 | 46 | gen_check_with_generics!(Vec, Box, Box<[T]>, Cell, Option); 47 | -------------------------------------------------------------------------------- /float-pigment-css/src/parser/hooks.rs: -------------------------------------------------------------------------------- 1 | //! Parser hooks can be used to attach some compilation information. 2 | 3 | use alloc::vec::Vec; 4 | 5 | #[cfg(feature = "ffi")] 6 | use core::ffi::{c_char, CStr}; 7 | 8 | use cssparser::SourceLocation; 9 | 10 | use super::{Warning, WarningKind}; 11 | 12 | #[cfg(feature = "ffi")] 13 | use crate::ffi::{FfiResult, NullPtr}; 14 | 15 | use crate::property::Property; 16 | 17 | /// A `context` for current sompilation step. 18 | pub struct ParserHooksContext<'a> { 19 | pub(super) warnings: &'a mut Vec, 20 | pub(super) start_loc: SourceLocation, 21 | pub(super) end_loc: SourceLocation, 22 | } 23 | 24 | impl<'a> ParserHooksContext<'a> { 25 | /// Generate a new warning in the current location. 26 | pub fn generate_warning(&mut self, message: &str) { 27 | let start = self.start_loc; 28 | let end = self.end_loc; 29 | self.warnings.push(Warning { 30 | kind: WarningKind::HooksGenerated, 31 | message: message.into(), 32 | start_line: start.line, 33 | start_col: start.column, 34 | end_line: end.line, 35 | end_col: end.column, 36 | }) 37 | } 38 | } 39 | 40 | /// A list of hooks that can be implemented. 41 | pub trait Hooks { 42 | /// Trigger once whenever a property has been parsed. 43 | fn parsed_property(&mut self, _ctx: &mut ParserHooksContext, _p: &mut Property) {} 44 | } 45 | 46 | /// The C FFI for `ParserHooksContext`. 47 | #[cfg(feature = "ffi")] 48 | #[repr(C)] 49 | pub struct CParserHooksContext { 50 | inner: *mut (), 51 | } 52 | 53 | #[cfg(feature = "ffi")] 54 | impl CParserHooksContext { 55 | /// The C FFI for `ParserHooksContext::generate_warning`. 56 | /// 57 | /// # Safety 58 | /// 59 | /// The message should be a valid C string. 60 | #[no_mangle] 61 | pub unsafe extern "C" fn generate_warning( 62 | &mut self, 63 | message: *const c_char, 64 | ) -> FfiResult { 65 | use crate::check_null; 66 | use crate::ffi::FfiErrorCode; 67 | use core::ptr::null; 68 | check_null!(message, FfiErrorCode::StrNullPointer, null()); 69 | let message = CStr::from_ptr(message).to_string_lossy(); 70 | let ctx = &mut *(self.inner as *mut ParserHooksContext); 71 | ctx.generate_warning(&message); 72 | FfiResult::ok(null()) 73 | } 74 | } 75 | 76 | /// The C FFI for `ParserHooks`. 77 | #[cfg(feature = "ffi")] 78 | #[repr(C)] 79 | pub struct CParserHooks { 80 | parsed_property: extern "C" fn(CParserHooksContext, *mut Property), 81 | } 82 | 83 | #[cfg(feature = "ffi")] 84 | impl Hooks for CParserHooks { 85 | fn parsed_property(&mut self, ctx: &mut ParserHooksContext, p: &mut Property) { 86 | let ctx = CParserHooksContext { 87 | inner: ctx as *mut _ as *mut (), 88 | }; 89 | let f = &mut self.parsed_property; 90 | f(ctx, p); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /float-pigment-css/src/path.rs: -------------------------------------------------------------------------------- 1 | use alloc::string::String; 2 | 3 | pub(crate) fn resolve(base: &str, rel: &str) -> String { 4 | let mut slices = vec![]; 5 | let mut extra_parent_count = 0; 6 | let from_root = base.starts_with('/') || rel.starts_with('/'); 7 | let main = if let Some(rel) = rel.strip_prefix('/') { 8 | rel 9 | } else { 10 | for slice in base.split('/') { 11 | match slice { 12 | "" | "." => {} 13 | ".." => { 14 | if slices.pop().is_none() && !from_root { 15 | extra_parent_count += 1; 16 | } 17 | } 18 | _ => { 19 | slices.push(slice); 20 | } 21 | } 22 | } 23 | rel 24 | }; 25 | slices.pop(); 26 | for slice in main.split('/') { 27 | match slice { 28 | "" | "." => {} 29 | ".." => { 30 | if slices.pop().is_none() && !from_root { 31 | extra_parent_count += 1; 32 | } 33 | } 34 | _ => { 35 | slices.push(slice); 36 | } 37 | } 38 | } 39 | let mut ret = String::new(); 40 | for _ in 0..extra_parent_count { 41 | ret += "../"; 42 | } 43 | ret += &slices.join("/"); 44 | ret 45 | } 46 | -------------------------------------------------------------------------------- /float-pigment-css/src/resolve_font_size.rs: -------------------------------------------------------------------------------- 1 | use alloc::boxed::Box; 2 | 3 | use crate::sheet::{borrow::Array, str_store::StrRef}; 4 | 5 | pub(crate) trait ResolveFontSize { 6 | fn resolve_font_size(&mut self, font_size: f32); 7 | } 8 | 9 | macro_rules! empty_impl { 10 | ($x:ty) => { 11 | impl ResolveFontSize for $x { 12 | fn resolve_font_size(&mut self, _: f32) { 13 | // empty 14 | } 15 | } 16 | }; 17 | } 18 | 19 | empty_impl!(u8); 20 | empty_impl!(u32); 21 | empty_impl!(i32); 22 | empty_impl!(f32); 23 | empty_impl!(StrRef); 24 | 25 | impl ResolveFontSize for &mut T { 26 | fn resolve_font_size(&mut self, font_size: f32) { 27 | (*self).resolve_font_size(font_size) 28 | } 29 | } 30 | 31 | impl ResolveFontSize for Box { 32 | fn resolve_font_size(&mut self, font_size: f32) { 33 | (**self).resolve_font_size(font_size) 34 | } 35 | } 36 | 37 | impl ResolveFontSize for Array { 38 | fn resolve_font_size(&mut self, font_size: f32) { 39 | for item in self.iter_mut() { 40 | item.resolve_font_size(font_size); 41 | } 42 | } 43 | } 44 | 45 | impl ResolveFontSize for [T; N] { 46 | fn resolve_font_size(&mut self, font_size: f32) { 47 | for item in self.iter_mut() { 48 | item.resolve_font_size(font_size); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /float-pigment-css/src/sheet/keyframes.rs: -------------------------------------------------------------------------------- 1 | use alloc::{string::String, vec::Vec}; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | 5 | use super::PropertyMeta; 6 | 7 | #[cfg(debug_assertions)] 8 | use float_pigment_css_macro::CompatibilityEnumCheck; 9 | 10 | /// A `@keyframes`` definition. 11 | #[allow(missing_docs)] 12 | #[derive(Clone, Debug)] 13 | pub struct KeyFrames { 14 | pub ident: String, 15 | pub keyframes: Vec, 16 | } 17 | 18 | impl KeyFrames { 19 | pub(crate) fn new(ident: String, keyframes: Vec) -> Self { 20 | Self { ident, keyframes } 21 | } 22 | } 23 | 24 | impl core::fmt::Display for KeyFrames { 25 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 26 | write!(f, "@keyframes {} {{ ", self.ident)?; 27 | for keyframe in &self.keyframes { 28 | write!(f, "{} ", keyframe)?; 29 | } 30 | write!(f, "}}") 31 | } 32 | } 33 | 34 | /// The percentage field in a keyframe item. 35 | #[repr(C)] 36 | #[derive(Clone, Debug, Serialize, Deserialize)] 37 | #[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))] 38 | pub enum KeyFrame { 39 | /// `from` in a keyframe. 40 | From, 41 | /// `to` in a keyframe. 42 | To, 43 | /// Percentage value in a keyframe. 44 | Ratio(f32), 45 | } 46 | 47 | impl KeyFrame { 48 | /// Get the normalized ratio (between `0.` and `1.`). 49 | pub fn ratio(&self) -> f32 { 50 | match self { 51 | Self::From => 0., 52 | Self::To => 1., 53 | Self::Ratio(x) => *x, 54 | } 55 | } 56 | } 57 | 58 | /// A keyframe item in `@keyframes`, e.g. `50% { ... }`. 59 | #[allow(missing_docs)] 60 | #[derive(Clone, Debug)] 61 | pub struct KeyFrameRule { 62 | pub keyframe: Vec, 63 | pub properties: Vec, 64 | } 65 | 66 | impl KeyFrameRule { 67 | pub(crate) fn new(keyframe: Vec, properties: Vec) -> Self { 68 | Self { 69 | keyframe, 70 | properties, 71 | } 72 | } 73 | } 74 | 75 | impl core::fmt::Display for KeyFrameRule { 76 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 77 | write!( 78 | f, 79 | "{} {{ ", 80 | self.keyframe 81 | .iter() 82 | .map(|x| { 83 | match x { 84 | KeyFrame::From => "from".to_owned(), 85 | KeyFrame::To => "to".to_owned(), 86 | KeyFrame::Ratio(ratio) => format!("{:.2}%", ratio * 100.), 87 | } 88 | }) 89 | .collect::>() 90 | .join(", ") 91 | )?; 92 | for prop in &self.properties { 93 | write!( 94 | f, 95 | "{}: {}; ", 96 | prop.get_property_name(), 97 | prop.get_property_value_string() 98 | )?; 99 | } 100 | write!(f, "}}") 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/README.md: -------------------------------------------------------------------------------- 1 | # css serde 兼容性测试 2 | 3 | > 用于测试 css bincode 是否具有前/后兼容性 4 | 5 | ## 目录说明 6 | 7 | ## 向前兼容性 8 | 9 | 检验新的 deserializer 是否能正确解开历史版本的的 bincode 10 | 11 | * 用当前版本的 deserializer 去解 bincode_cache 中的所有 bincode,检查结果是否符合预期 12 | 13 | * 向 bincode_cache 写入当前 serialize 的 bincode,供下一个版本测试 14 | 15 | ## 向后兼容性 16 | 17 | 检验历史版本的 deserializer 是否能兼容更新编出来的 bincode 18 | 19 | * 用当前版本编出来的 bincode 给所有的历史 deserializer 去解,检查结果是否符合预期 20 | 21 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/204d056d_base.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/204d056d_base.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/204d056d_padding_case.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/204d056d_padding_case.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/204d056d_style-v2.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/204d056d_style-v2.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/204d056d_style.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/204d056d_style.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/3203403c_base.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/3203403c_base.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/3203403c_style-v2.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/3203403c_style-v2.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/3203403c_style.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/3203403c_style.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_base.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_base.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_style-v2.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_style-v2.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_style.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/4cc8aa7a_style.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/af63c90d_base.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/af63c90d_base.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/af63c90d_padding_case.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/af63c90d_padding_case.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/af63c90d_style-v2.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/af63c90d_style-v2.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/af63c90d_style.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/af63c90d_style.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/e9932238_base.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/e9932238_base.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/e9932238_style-v2.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/e9932238_style-v2.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/bincode_source/e9932238_style.css.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/bincode_source/e9932238_style.css.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/base.css: -------------------------------------------------------------------------------- 1 | @import url("a.wxss"); 2 | 3 | @media(prefers-color-scheme: dark) { 4 | .a { 5 | height: 10px; 6 | } 7 | } 8 | 9 | @media(prefers-color-scheme: dark) { 10 | .b { 11 | height: 10px; 12 | } 13 | } 14 | 15 | @font-face { 16 | font-family: "hello/world"; 17 | src: local(sans-serif); 18 | font-weight: 200; 19 | font-style: normal; 20 | font-display: optional; 21 | } 22 | 23 | .a { 24 | height: 100px; 25 | padding-left: 10px; 26 | aspect-ratio: auto; 27 | margin: 10px; 28 | } 29 | 30 | .b { 31 | width: 100px; 32 | border: 1px solid black; 33 | background-position-x: 10px; 34 | } -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/base.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheetGroup}; 2 | 3 | use crate::utils::query; 4 | 5 | pub fn base_css_assert(ssg: StyleSheetGroup) { 6 | // assert 7 | let np = query(&ssg, "", "", ["a"], []); 8 | assert_eq!(np.height(), Length::Px(100.)); 9 | assert_eq!(np.padding_left(), Length::Px(10.)); 10 | assert_eq!(np.aspect_ratio(), AspectRatio::Auto); 11 | assert_eq!(np.margin_left(), Length::Px(10.)); 12 | assert_eq!(np.margin_top(), Length::Px(10.)); 13 | assert_eq!(np.margin_right(), Length::Px(10.)); 14 | assert_eq!(np.margin_bottom(), Length::Px(10.)); 15 | 16 | let np = query(&ssg, "", "", ["b"], []); 17 | assert_eq!(np.width(), Length::Px(100.)); 18 | assert_eq!(np.border_left_width(), Length::Px(1.)); 19 | assert_eq!(np.border_top_width(), Length::Px(1.)); 20 | assert_eq!(np.border_right_width(), Length::Px(1.)); 21 | assert_eq!(np.border_bottom_width(), Length::Px(1.)); 22 | assert_eq!(np.border_left_color(), Color::Specified(0, 0, 0, 255)); 23 | assert_eq!(np.border_top_color(), Color::Specified(0, 0, 0, 255)); 24 | assert_eq!(np.border_right_color(), Color::Specified(0, 0, 0, 255)); 25 | assert_eq!(np.border_bottom_color(), Color::Specified(0, 0, 0, 255)); 26 | assert_eq!(np.border_left_style(), BorderStyle::Solid); 27 | assert_eq!(np.border_top_style(), BorderStyle::Solid); 28 | assert_eq!(np.border_right_style(), BorderStyle::Solid); 29 | assert_eq!(np.border_bottom_style(), BorderStyle::Solid); 30 | assert_eq!( 31 | np.background_position_x(), 32 | BackgroundPosition::List( 33 | vec![BackgroundPositionItem::Value( 34 | BackgroundPositionValue::Left(Length::Px(10.)) 35 | )] 36 | .into() 37 | ) 38 | ) 39 | } 40 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod base; 2 | pub mod padding_case; 3 | pub mod style; 4 | pub mod style_v2; 5 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/padding_case.css: -------------------------------------------------------------------------------- 1 | .intro { 2 | margin: 50px; 3 | background: red; 4 | padding: 0 24px; 5 | padding: 0 calc(24px + constant(safe-area-inset-right)) constant(safe-area-inset-bottom) calc(24px+constant (safe-area-inset-left)); 6 | } -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/padding_case.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheetGroup}; 2 | 3 | use crate::utils::query; 4 | 5 | pub fn padding_case_assert(ssg: StyleSheetGroup) { 6 | let np = query(&ssg, "", "", ["intro"], []); 7 | println!("{:?}", ssg.style_sheet(0)); 8 | assert_eq!(np.padding_left(), Length::Px(24.)); 9 | assert_eq!(np.padding_right(), Length::Px(24.)); 10 | assert_eq!(np.padding_top(), Length::Px(0.)); 11 | assert_eq!(np.padding_bottom(), Length::Px(0.)); 12 | assert_eq!(np.margin_left(), Length::Px(50.)); 13 | assert_eq!(np.margin_right(), Length::Px(50.)); 14 | assert_eq!(np.margin_top(), Length::Px(50.)); 15 | assert_eq!(np.margin_bottom(), Length::Px(50.)); 16 | } 17 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/style.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheetGroup}; 2 | 3 | use crate::utils::query; 4 | 5 | pub fn style_css_assert(ssg: StyleSheetGroup) { 6 | let np = query(&ssg, "wx-button", "", [""], []); 7 | assert_eq!(np.position(), Position::Relative); 8 | assert_eq!(np.margin_left(), Length::Auto); 9 | assert_eq!(np.margin_right(), Length::Auto); 10 | assert_eq!(np.padding_left(), Length::Px(14.)); 11 | assert_eq!(np.padding_right(), Length::Px(14.)); 12 | assert_eq!(np.font_size(), Length::Px(18.)); 13 | assert_eq!(np.text_align(), TextAlign::Center); 14 | assert_eq!(np.flex_direction(), FlexDirection::Row); 15 | assert_eq!(np.justify_content(), JustifyContent::Center); 16 | assert_eq!(np.line_height(), LineHeight::Num(Number::F32(2.555_555_6))); 17 | assert_eq!( 18 | np.border_top_left_radius(), 19 | BorderRadius::Pos(Length::Px(5.), Length::Px(5.)) 20 | ); 21 | assert_eq!(np.border_left_width(), Length::Px(0.5)); 22 | assert_eq!(np.border_bottom_width(), Length::Px(0.5)); 23 | assert_eq!(np.border_right_style(), BorderStyle::Solid); 24 | assert_eq!(np.border_top_style(), BorderStyle::Solid); 25 | assert_eq!(np.border_left_color(), Color::Specified(0, 0, 0, 51)); 26 | assert_eq!(np.border_bottom_color(), Color::Specified(0, 0, 0, 51)); 27 | assert_eq!(np.overflow_x(), Overflow::Hidden); 28 | assert_eq!(np.overflow_y(), Overflow::Hidden); 29 | assert_eq!(np.color(), Color::Specified(0, 0, 0, 255)); 30 | 31 | // TODO 32 | } 33 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/css_source/style_v2.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheetGroup}; 2 | 3 | use crate::utils::query; 4 | 5 | pub fn style_v2_css_assert(ssg: StyleSheetGroup) { 6 | let np = query(&ssg, "wx-button", "", [""], []); 7 | assert_eq!(np.padding_top(), Length::Px(8.)); 8 | assert_eq!(np.padding_right(), Length::Px(24.)); 9 | assert_eq!( 10 | np.border_top_left_radius(), 11 | BorderRadius::Pos(Length::Px(4.), Length::Px(4.)) 12 | ); 13 | assert_eq!(np.font_size(), Length::Px(17.)); 14 | assert_eq!(np.font_weight(), FontWeight::Num(Number::F32(700.))); 15 | 16 | // TODO 17 | } 18 | -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/temp_bincode/index.fpcssb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-css/tests/compatibility/temp_bincode/index.fpcssb -------------------------------------------------------------------------------- /float-pigment-css/tests/compatibility/utils.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::length_num::LengthNum; 2 | use float_pigment_css::StyleSheetGroup; 3 | use float_pigment_css::{property::*, MediaQueryStatus, StyleQuery}; 4 | use std::process::Command; 5 | use std::{ 6 | fs::OpenOptions, 7 | io::{BufReader, Read, Write}, 8 | path::PathBuf, 9 | }; 10 | 11 | #[allow(dead_code)] 12 | pub fn query( 13 | ssg: &StyleSheetGroup, 14 | tag_name: &str, 15 | id: &str, 16 | classes: [&str; N], 17 | attributes: [&str; M], 18 | ) -> NodeProperties { 19 | query_with_media( 20 | ssg, 21 | tag_name, 22 | id, 23 | classes, 24 | attributes, 25 | &MediaQueryStatus::::default_screen(), 26 | ) 27 | } 28 | 29 | #[allow(dead_code)] 30 | pub fn query_with_media( 31 | ssg: &StyleSheetGroup, 32 | tag_name: &str, 33 | id: &str, 34 | classes: [&str; N], 35 | attributes: [&str; M], 36 | media_query_status: &MediaQueryStatus, 37 | ) -> NodeProperties { 38 | let classes = classes 39 | .iter() 40 | .map(|x| (x.to_string(), None)) 41 | .collect::>(); 42 | let attributes = attributes.iter().map(|x| x.to_string()).collect::>(); 43 | let query = StyleQuery::single(None, None, None, tag_name, id, &classes, &attributes); 44 | let mut node_properties = NodeProperties::new(None); 45 | ssg.query_single(&query, media_query_status, &mut node_properties); 46 | node_properties 47 | } 48 | 49 | pub fn dir_files_path(path: &PathBuf) -> Vec { 50 | let paths = std::fs::read_dir(path).unwrap(); 51 | paths.map(|x| x.unwrap().path()).collect() 52 | } 53 | 54 | fn create_file(path: &PathBuf) -> Result { 55 | let mut options = OpenOptions::new(); 56 | let file = options 57 | .read(true) 58 | .write(true) 59 | .create(true) 60 | .truncate(true) 61 | .open(path); 62 | file 63 | } 64 | 65 | pub fn read_file_as_string(path: &PathBuf) -> String { 66 | let mut options = OpenOptions::new(); 67 | let file = options 68 | .read(true) 69 | .open(path) 70 | .unwrap_or_else(|_| panic!("open file error. file path: {:?}", path.to_str())); 71 | let mut reader = BufReader::new(file); 72 | let mut string = String::new(); 73 | reader.read_to_string(&mut string).unwrap(); 74 | string 75 | } 76 | 77 | pub fn read_bincode(path: &PathBuf) -> Vec { 78 | std::fs::read(path).unwrap_or_else(|_| panic!("{:?} is not exists.", path.to_str())) 79 | } 80 | 81 | pub fn write_bincode(path: &PathBuf, bincode: Vec) { 82 | let mut file = create_file(path) 83 | .unwrap_or_else(|_| panic!("create file error. file path: {:?}", path.to_str())); 84 | file.write_all(bincode.as_slice()) 85 | .unwrap_or_else(|_| panic!("write bincode error. file path: {:?}", path.to_str())) 86 | } 87 | 88 | pub fn get_current_commit() -> String { 89 | let output = Command::new("git") 90 | .arg("rev-parse") 91 | .arg("HEAD") 92 | .output() 93 | .expect("get current git commit error."); 94 | let ret = String::from_utf8_lossy(&output.stdout).to_string(); 95 | let ret = ret.replace("\n", "").replace("\"", ""); 96 | let ret: String = ret.trim().into(); 97 | ret[..8].into() 98 | } 99 | -------------------------------------------------------------------------------- /float-pigment-css/tests/env.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheet, StyleSheetGroup}; 2 | 3 | mod utils; 4 | use utils::*; 5 | 6 | macro_rules! test_parse_property { 7 | ($prop: ident, $prop_name: expr, $str_value: expr, $value: expr) => {{ 8 | let name = $prop_name; 9 | let value = $value; 10 | let str_value = $str_value; 11 | let style_str = format!(".a{{{}:{};}}", name, str_value); 12 | let mut ssg = StyleSheetGroup::new(); 13 | let ss = StyleSheet::from_str(&style_str); 14 | ssg.append(ss); 15 | let np = query(&ssg, "", "", ["a"], []); 16 | assert_eq!(np.$prop(), value); 17 | }}; 18 | } 19 | 20 | #[test] 21 | pub fn env() { 22 | test_parse_property!( 23 | margin_left, 24 | "margin-left", 25 | "env(safe-area-inset-bottom, 10px)", 26 | Length::Expr(LengthExpr::Env( 27 | "safe-area-inset-bottom".into(), 28 | Box::new(Length::Px(10.)) 29 | )) 30 | ); 31 | 32 | test_parse_property!( 33 | margin_left, 34 | "margin-left", 35 | "env(safe-area-inset-bottom, 10p)", 36 | Length::Expr(LengthExpr::Env( 37 | "safe-area-inset-bottom".into(), 38 | Box::new(Length::Px(0.)) 39 | )) 40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /float-pigment-css/tests/error.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::Length, StyleSheet, StyleSheetGroup}; 2 | 3 | mod utils; 4 | use utils::*; 5 | 6 | #[test] 7 | fn ignore_error_property_segment() { 8 | let ss = StyleSheet::from_str( 9 | r#" 10 | .a { 11 | height: 200px; 12 | width: 300px 500px 8000px; 13 | margin-top: 100px 14 | margin-left: 400px; 15 | width: 20xx; 16 | width: 200px; 17 | 18 | } 19 | "#, 20 | ); 21 | let mut ssg = StyleSheetGroup::new(); 22 | ssg.append(ss); 23 | let node_properties = query(&ssg, "", "", ["a"], []); 24 | assert_eq!(node_properties.height(), Length::Px(200.)); 25 | assert_eq!(node_properties.width(), Length::Px(200.)); 26 | assert_ne!(node_properties.margin_left(), Length::Px(400.)); 27 | assert_ne!(node_properties.margin_top(), Length::Px(100.)) 28 | } 29 | 30 | #[test] 31 | fn ignore_error_segment() { 32 | let ss = StyleSheet::from_str( 33 | r#" 34 | .a { 35 | height: 200px; 36 | width: 300px 500px 8000px; 37 | margin-top: 100px 38 | margin-left: 400px; 39 | width: 20xx;; 40 | width: 200px; 41 | } 42 | .b {{ 43 | 44 | }} 45 | .c { height: 100px } 46 | .d { 47 | {(())}asdasdadasdadafffsdd >>> ,, .. ## 48 | a@%$@^@%24 49 | .e { height: 200px } 50 | } 51 | .f { height: 300px } 52 | .g { 53 | height: 200px; 54 | asdasfafafafasdadfasda; 55 | width: 300px; 56 | } 57 | "#, 58 | ); 59 | let mut ssg = StyleSheetGroup::new(); 60 | assert_eq!(ss.rules_count(Some(0)).unwrap(), 4u32); 61 | ssg.append(ss); 62 | let node_properties = query(&ssg, "", "", ["a"], []); 63 | assert_eq!(node_properties.height(), Length::Px(200.)); 64 | assert_eq!(node_properties.width(), Length::Px(200.)); 65 | assert_ne!(node_properties.margin_left(), Length::Px(400.)); 66 | assert_ne!(node_properties.margin_top(), Length::Px(100.)); 67 | 68 | let node_properties = query(&ssg, "", "", ["c"], []); 69 | assert_eq!(node_properties.height(), Length::Px(100.)); 70 | 71 | let node_properties = query(&ssg, "", "", ["f"], []); 72 | assert_eq!(node_properties.height(), Length::Px(300.)); 73 | } 74 | -------------------------------------------------------------------------------- /float-pigment-css/tests/font_face.rs: -------------------------------------------------------------------------------- 1 | use std::rc::Rc; 2 | 3 | use float_pigment_css::{ 4 | sheet::{FontDisplay, FontFace, FontSrc, FontUrl}, 5 | typing::*, 6 | StyleSheet, 7 | }; 8 | 9 | #[test] 10 | fn font_face() { 11 | let s = r#" 12 | @font-face { 13 | font-family: sans-serif; 14 | src: local(sans-serif), url("../path/to/font.svg") format("svg"), url(https://sss.vss); 15 | font-weight: 200; 16 | font-style: normal; 17 | font-display: optional; 18 | hello: 123; 19 | } 20 | "#; 21 | let ss = StyleSheet::from_str_with_path("/absolute/mod/hello.css", s); 22 | let ssv = ss.sheets(); 23 | let ss = ssv.first().unwrap().borrow(); 24 | let ff = ss.font_face().first().unwrap(); 25 | let mut font_face = FontFace::new(); 26 | font_face 27 | .with_font_family(FontFamilyName::SansSerif) 28 | .with_src(vec![ 29 | FontSrc::Local(FontFamilyName::SansSerif), 30 | FontSrc::Url(FontUrl { 31 | url: "absolute/path/to/font.svg".into(), 32 | format: Some(vec!["svg".into()]), 33 | }), 34 | FontSrc::Url(FontUrl { 35 | url: "https://sss.vss".into(), 36 | format: None, 37 | }), 38 | ]) 39 | .with_font_style(Some(FontStyleType::Normal)) 40 | .with_font_weight(Some(FontWeightType::Num(Number::F32(200.)))) 41 | .with_font_display(Some(FontDisplay::Optional)); 42 | assert_eq!(&Rc::new(font_face), ff); 43 | } 44 | 45 | #[test] 46 | fn font_face_1() { 47 | let s = r#" 48 | @font-face { 49 | font-family: 'iconfont6'; 50 | src: url('https://m.elongstatic.com/hotel/h5/wechat-xcx/20180913zhllx/iconfont/iconfont6.ttf?t=20181010') format('truetype'), url('https://m.elongstatic.com/hotel/h5/wechat-xcx/20180913zhllx/iconfont/iconfont6.woff?t=20181010') format('woff'); 51 | } 52 | .iconfont { 53 | /* font-size: 14px;*/ 54 | font-style: normal; 55 | -webkit-font-smoothing: antialiased; 56 | -moz-osx-font-smoothing: grayscale; 57 | } 58 | @font-face { 59 | font-family: 'iconfont3'; 60 | src: url('https://m.elongstatic.com/hotel/h5/wechat-xcx/20220811/iconfont/iconfont3.ttf') format('truetype'), 61 | url('https://m.elongstatic.com/hotel/h5/wechat-xcx/20220811/iconfont/iconfont3.ttf') format('woff'); 62 | }"#; 63 | let ss = StyleSheet::from_str_with_path("/absolute/mod/hello.css", s); 64 | let ssv = ss.sheets(); 65 | let ss = ssv.first().unwrap().borrow(); 66 | let _ff = ss.font_face().first().unwrap(); 67 | } 68 | 69 | #[test] 70 | fn font_face_url_without_schema() { 71 | let s = r#" 72 | @font-face { 73 | font-family: 'iconfont6'; 74 | src: url("//qq.com"); 75 | } 76 | "#; 77 | 78 | let ss = StyleSheet::from_str_with_path("/absolute/mod/hello.css", s); 79 | let ssv = ss.sheets(); 80 | let ss = ssv.first().unwrap().borrow(); 81 | let ff = ss.font_face().first().unwrap(); 82 | assert_eq!( 83 | ff.src.first(), 84 | Some(&FontSrc::Url(FontUrl { 85 | url: "//qq.com".into(), 86 | format: None, 87 | })) 88 | ) 89 | } 90 | -------------------------------------------------------------------------------- /float-pigment-css/tests/global_values.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{typing::*, StyleSheet, StyleSheetGroup}; 2 | 3 | mod utils; 4 | use utils::*; 5 | 6 | #[test] 7 | fn initial() { 8 | let mut ssg = StyleSheetGroup::new(); 9 | let ss = StyleSheet::from_str( 10 | " 11 | .a { 12 | display: none; 13 | color: red; 14 | } 15 | .b { 16 | display: initial; 17 | color: initial; 18 | } 19 | ", 20 | ); 21 | ssg.append(ss); 22 | let node_properties = query(&ssg, "", "", ["a"], []); 23 | assert_eq!(node_properties.display(), Display::None); 24 | assert_eq!(node_properties.color(), Color::Specified(255, 0, 0, 255)); 25 | let child_node_properties = query_list( 26 | &ssg, 27 | [QueryItem::new().c("a").end(), QueryItem::new().c("b").end()], 28 | ); 29 | assert_eq!(child_node_properties.display(), Display::Inline); 30 | assert_eq!( 31 | child_node_properties.color(), 32 | Color::Specified(0, 0, 0, 255) 33 | ); 34 | } 35 | 36 | #[test] 37 | fn inherit() { 38 | let mut ssg = StyleSheetGroup::new(); 39 | let ss = StyleSheet::from_str( 40 | " 41 | .a { 42 | display: none; 43 | color: red; 44 | } 45 | .b { 46 | display: inherit; 47 | color: inherit; 48 | } 49 | ", 50 | ); 51 | ssg.append(ss); 52 | let node_properties = query(&ssg, "", "", ["a"], []); 53 | assert_eq!(node_properties.display(), Display::None); 54 | assert_eq!(node_properties.color(), Color::Specified(255, 0, 0, 255)); 55 | let child_node_properties = query_list_with_parent( 56 | &ssg, 57 | [QueryItem::new().c("a").end(), QueryItem::new().c("b").end()], 58 | &node_properties, 59 | ); 60 | assert_eq!(child_node_properties.display(), Display::None); 61 | assert_eq!( 62 | child_node_properties.color(), 63 | Color::Specified(255, 0, 0, 255) 64 | ); 65 | } 66 | 67 | #[test] 68 | fn unset() { 69 | let mut ssg = StyleSheetGroup::new(); 70 | let ss = StyleSheet::from_str( 71 | " 72 | .a { 73 | display: none; 74 | color: red; 75 | } 76 | .b { 77 | display: unset; 78 | color: unset; 79 | } 80 | ", 81 | ); 82 | ssg.append(ss); 83 | let node_properties = query(&ssg, "", "", ["a"], []); 84 | assert_eq!(node_properties.display(), Display::None); 85 | assert_eq!(node_properties.color(), Color::Specified(255, 0, 0, 255)); 86 | let child_node_properties = query_list_with_parent( 87 | &ssg, 88 | [QueryItem::new().c("a").end(), QueryItem::new().c("b").end()], 89 | &node_properties, 90 | ); 91 | assert_eq!(child_node_properties.display(), Display::Inline); 92 | assert_eq!( 93 | child_node_properties.color(), 94 | Color::Specified(255, 0, 0, 255) 95 | ); 96 | } 97 | -------------------------------------------------------------------------------- /float-pigment-css/tests/keyframes.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{StyleSheet, StyleSheetGroup}; 2 | 3 | #[test] 4 | fn test_keyframes() { 5 | let mut ssg = StyleSheetGroup::new(); 6 | let ss = StyleSheet::from_str( 7 | r#" 8 | @keyframes hello { 9 | 0% { 10 | top: 0; 11 | } 12 | 50% { 13 | top: 30px; 14 | left: 20px; 15 | } 16 | 50% { 17 | top: 10px; 18 | } 19 | 100% { 20 | top: 0; 21 | } 22 | } 23 | @keyframes box-ani_2 { 24 | 120% { 25 | margin-left: 0px; 26 | } 27 | 80% { 28 | margin-left: 200px; 29 | } 30 | } 31 | @keyframes mymove_3 { 32 | 0% { 33 | } 34 | to { 35 | margin-left: 200px; 36 | } 37 | } 38 | @keyframes mymove_4 { 39 | 20% { 40 | margin-left: 20px; 41 | } 42 | 80% { 43 | margin-left: 200px; 44 | } 45 | } 46 | "#, 47 | ); 48 | println!("{:?}", &ss); 49 | ssg.append(ss); 50 | } 51 | -------------------------------------------------------------------------------- /float-pigment-css/tests/warning.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::{property::Property, StyleSheet, StyleSheetResource}; 2 | 3 | mod utils; 4 | 5 | #[test] 6 | fn warning_test() { 7 | let _ = StyleSheet::from_str( 8 | r#" 9 | @font-face { 10 | hello: 100px; 11 | } 12 | .a { 13 | height: 100pp; 14 | width: 10px 10px; 15 | } 16 | "#, 17 | ); 18 | } 19 | 20 | #[test] 21 | fn parser_hooks_property() { 22 | struct Hooks {} 23 | 24 | impl float_pigment_css::parser::hooks::Hooks for Hooks { 25 | fn parsed_property( 26 | &mut self, 27 | _ctx: &mut float_pigment_css::parser::hooks::ParserHooksContext, 28 | p: &mut float_pigment_css::property::Property, 29 | ) { 30 | if let Property::Color(_) = p { 31 | // empty 32 | } else { 33 | panic!(""); 34 | } 35 | } 36 | } 37 | 38 | let mut ssr = StyleSheetResource::new(); 39 | let hooks = Hooks {}; 40 | ssr.add_source_with_hooks("a", ".a { color: red }", Some(Box::new(hooks))); 41 | } 42 | -------------------------------------------------------------------------------- /float-pigment-forest-macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-forest-macro" 3 | description = "Helper macros for float-pigment-forest." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | proc-macro = true 15 | 16 | [dependencies] 17 | proc-macro2 = "1.0" 18 | quote = "1.0" 19 | syn = { version = "1.0", features = ["full"] } 20 | 21 | [lints] 22 | workspace = true 23 | -------------------------------------------------------------------------------- /float-pigment-forest-macro/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-forest-macro 2 | 3 | Procedure macros for float-pigment-forest. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | -------------------------------------------------------------------------------- /float-pigment-forest-macro/src/lib.rs: -------------------------------------------------------------------------------- 1 | use quote::quote; 2 | use syn::{parse_macro_input, ItemStruct}; 3 | 4 | mod style_manager; 5 | 6 | #[proc_macro_derive(StyleManagerGetter)] 7 | pub fn style_manager_getter(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 8 | style_manager::gen_getter(input) 9 | } 10 | 11 | #[proc_macro_derive(StyleManagerSetter)] 12 | pub fn style_manager_setter(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 13 | style_manager::gen_setter(input) 14 | } 15 | 16 | #[proc_macro_derive(StyleManagerMutation)] 17 | pub fn style_manager_mutation(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 18 | style_manager::gen_mutation(input) 19 | } 20 | 21 | #[proc_macro_derive(FieldCount)] 22 | pub fn derive_field_count(input: proc_macro::TokenStream) -> proc_macro::TokenStream { 23 | let input = parse_macro_input!(input as ItemStruct); 24 | 25 | let name = &input.ident; 26 | let field_count = input.fields.iter().count(); 27 | 28 | let output = quote! { 29 | impl #name { 30 | pub(crate) fn field_count(&self) -> usize { 31 | #field_count 32 | } 33 | } 34 | }; 35 | 36 | proc_macro::TokenStream::from(output) 37 | } 38 | -------------------------------------------------------------------------------- /float-pigment-forest/.gitignore: -------------------------------------------------------------------------------- 1 | /cbindgen/src 2 | /target 3 | Cargo.lock 4 | **/*.rs.bk 5 | .DS_store -------------------------------------------------------------------------------- /float-pigment-forest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-forest" 3 | description = "A node tree implementation for float-pigment-layout." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | name = "float_pigment_forest" 15 | crate-type = ["staticlib", "cdylib", "rlib"] 16 | 17 | [[bin]] 18 | name = "float_pigment_layout_cpp_binding_gen_tool" 19 | path = "cbindgen/main.rs" 20 | required-features = ["build-cpp-header"] 21 | 22 | [[bench]] 23 | name = "create_node" 24 | harness = false 25 | 26 | [[bench]] 27 | name = "operate_node" 28 | harness = false 29 | 30 | [[bench]] 31 | name = "layout" 32 | harness = false 33 | 34 | [features] 35 | default = [] 36 | build-cpp-header = ["cbindgen", "fs_extra"] 37 | 38 | [dependencies] 39 | float-pigment-css = { workspace = true } 40 | float-pigment-layout = { workspace = true } 41 | euclid = "0.22" 42 | cbindgen = { version = "0.27", optional = true } 43 | lru = "0.7.8" 44 | float-pigment-forest-macro = { workspace = true } 45 | bit-vec = "0.6.3" 46 | lazy_static = "1.4" 47 | fs_extra = { version = "1.3", optional = true } 48 | 49 | [dev-dependencies] 50 | rand = "0.8.5" 51 | criterion = "0.5.1" 52 | float-pigment-mlp = { workspace = true } 53 | rustc-hash = "1.1.0" 54 | 55 | [target.'cfg(target_os="macos")'.dev-dependencies] 56 | piston_window = "0.128.0" 57 | 58 | [lints.clippy] 59 | missing_safety_doc = "allow" 60 | clone_on_copy = "allow" 61 | -------------------------------------------------------------------------------- /float-pigment-forest/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-forest 2 | 3 | A node tree implementation for float-pigment-layout. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | -------------------------------------------------------------------------------- /float-pigment-forest/benches/create_node.rs: -------------------------------------------------------------------------------- 1 | use criterion::{black_box, criterion_group, criterion_main, Criterion}; 2 | use float_pigment_forest::node::*; 3 | 4 | fn create_element(num: usize) { 5 | for _ in 0..num { 6 | let node = Node::new_ptr(); 7 | black_box(node); 8 | } 9 | } 10 | 11 | fn gen_elem_tree(deep: usize, cur: usize, mut parent: Option) { 12 | if cur > deep { 13 | return; 14 | } 15 | if parent.is_none() { 16 | parent = Some(Node::new_ptr()); 17 | } 18 | let current = Node::new_ptr(); 19 | unsafe { (*(parent.unwrap())).append_child(current) } 20 | for _ in 0..10 { 21 | gen_elem_tree(deep, cur + 1, Some(current)) 22 | } 23 | black_box(parent); 24 | } 25 | 26 | fn criterion_benchmark(c: &mut Criterion) { 27 | c.bench_function("create 1000 elements", |b| b.iter(|| create_element(1000))); 28 | c.bench_function("create 10000 elements", |b| { 29 | b.iter(|| create_element(10000)) 30 | }); 31 | c.bench_function("gen 10^2 element tree", |b| { 32 | b.iter(|| gen_elem_tree(2, 0, None)) 33 | }); 34 | // c.bench_function("gen 10^3 element tree", |b| { 35 | // b.iter(|| gen_elem_tree(3, 0, None)) 36 | // }); 37 | } 38 | 39 | criterion_group!(benches, criterion_benchmark); 40 | criterion_main!(benches); 41 | -------------------------------------------------------------------------------- /float-pigment-forest/benches/layout.rs: -------------------------------------------------------------------------------- 1 | use criterion::{criterion_group, criterion_main, Criterion}; 2 | use float_pigment_css::{fixed::traits::ToFixed, typing::*}; 3 | use float_pigment_forest::node::*; 4 | 5 | unsafe fn as_ref<'a>(node: *mut Node) -> &'a Node { 6 | &*node 7 | } 8 | fn gen_tree() -> &'static Node { 9 | unsafe { 10 | let root = as_ref(Node::new_ptr()); 11 | let flex_container = as_ref(Node::new_ptr()); 12 | flex_container.set_display(Display::Flex); 13 | flex_container.set_width(float_pigment_layout::DefLength::Points((30000.).to_fixed())); 14 | 15 | root.append_child(convert_node_ref_to_ptr(flex_container)); 16 | for _ in 0..2000 { 17 | let flex_item = as_ref(Node::new_ptr()); 18 | flex_item.set_width(float_pigment_layout::DefLength::Points(10.0.to_fixed())); 19 | flex_item.set_height(float_pigment_layout::DefLength::Points(10.0.to_fixed())); 20 | flex_container.append_child(convert_node_ref_to_ptr(flex_item)); 21 | } 22 | root 23 | } 24 | } 25 | 26 | fn layout_test(root: &Node) { 27 | unsafe { 28 | root.layout( 29 | OptionSize::new( 30 | OptionNum::some(30000.0.to_fixed()), 31 | OptionNum::some(800.0.to_fixed()), 32 | ), 33 | Size::new(375.0.to_fixed(), 800.0.to_fixed()), 34 | ); 35 | } 36 | } 37 | 38 | fn criterion_benchmark(c: &mut Criterion) { 39 | let root = gen_tree(); 40 | c.bench_function("layout", |b| b.iter(|| layout_test(root))); 41 | c.bench_function("layout second", |b| b.iter(|| layout_test(root))); 42 | // println!( 43 | // "{}", 44 | // root.dump_to_html( 45 | // DumpOptions { 46 | // recursive: true, 47 | // layout: true, 48 | // style: DumpStyleMode::Mutation, 49 | // }, 50 | // 0, 51 | // ) 52 | // ) 53 | } 54 | 55 | criterion_group!(benches, criterion_benchmark); 56 | criterion_main!(benches); 57 | -------------------------------------------------------------------------------- /float-pigment-forest/benches/operate_node.rs: -------------------------------------------------------------------------------- 1 | use criterion::{black_box, criterion_group, criterion_main, Criterion}; 2 | use float_pigment_forest::node::*; 3 | 4 | fn append_element(num: usize) { 5 | let parent: *mut Node = Node::new_ptr(); 6 | for _ in 0..num { 7 | let node = Node::new_ptr(); 8 | unsafe { 9 | (*parent).append_child(node); 10 | } 11 | } 12 | black_box(parent); 13 | } 14 | 15 | fn insert_element_to_first(num: usize) { 16 | let parent: *mut Node = Node::new_ptr(); 17 | for _ in 0..num { 18 | let node = Node::new_ptr(); 19 | unsafe { 20 | (*parent).insert_child_at(node, 0); 21 | } 22 | } 23 | black_box(parent); 24 | } 25 | 26 | fn criterion_benchmark(c: &mut Criterion) { 27 | c.bench_function("append 100 elements", |b| b.iter(|| append_element(100))); 28 | c.bench_function("append 1000 elements", |b| b.iter(|| append_element(1000))); 29 | 30 | c.bench_function("insert 100 elements at the first", |b| { 31 | b.iter(|| insert_element_to_first(100)) 32 | }); 33 | } 34 | 35 | criterion_group!(benches, criterion_benchmark); 36 | criterion_main!(benches); 37 | -------------------------------------------------------------------------------- /float-pigment-forest/cbindgen/cbindgen.toml: -------------------------------------------------------------------------------- 1 | # This is a template cbindgen.toml file with all of the default values. 2 | # Some values are commented out because their absence is the real default. 3 | # 4 | # See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml 5 | # for detailed documentation of every option here. 6 | 7 | 8 | 9 | language = "C++" 10 | 11 | 12 | 13 | ############## Options for Wrapping the Contents of the Header ################# 14 | 15 | # header = "/* Text to put at the beginning of the generated file. Probably a license. */" 16 | # trailer = "/* Text to put at the end of the generated file */" 17 | # include_guard = "my_bindings_h" 18 | pragma_once = true 19 | autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" 20 | include_version = false 21 | # namespace = "my_namespace" 22 | namespaces = ["float_pigment"] 23 | using_namespaces = [] 24 | sys_includes = [] 25 | includes = [] 26 | no_includes = false 27 | after_includes = "" 28 | 29 | 30 | 31 | 32 | ############################ Code Style Options ################################ 33 | 34 | braces = "SameLine" 35 | line_length = 100 36 | tab_width = 2 37 | documentation = true 38 | documentation_style = "auto" 39 | line_endings = "LF" # also "CR", "CRLF", "Native" 40 | 41 | 42 | 43 | 44 | ############################# Codegen Options ################################## 45 | 46 | style = "both" 47 | sort_by = "Name" # default for `fn.sort_by` and `const.sort_by` 48 | usize_is_size_t = true 49 | 50 | 51 | 52 | [defines] 53 | # "target_os = freebsd" = "DEFINE_FREEBSD" 54 | # "feature = serde" = "DEFINE_SERDE" 55 | 56 | 57 | 58 | [export] 59 | include = [""] 60 | exclude = [] 61 | # prefix = "CAPI_" 62 | item_types = [] 63 | renaming_overrides_prefixing = false 64 | 65 | 66 | 67 | [export.rename] 68 | 69 | [export.pre_body] 70 | 71 | [export.body] 72 | 73 | 74 | [export.mangle] 75 | 76 | 77 | [fn] 78 | rename_args = "None" 79 | # must_use = "MUST_USE_FUNC" 80 | # no_return = "NO_RETURN" 81 | # prefix = "START_FUNC" 82 | # postfix = "END_FUNC" 83 | args = "auto" 84 | sort_by = "Name" 85 | 86 | 87 | 88 | 89 | [struct] 90 | rename_fields = "None" 91 | # must_use = "MUST_USE_STRUCT" 92 | derive_constructor = false 93 | derive_eq = false 94 | derive_neq = false 95 | derive_lt = false 96 | derive_lte = false 97 | derive_gt = false 98 | derive_gte = false 99 | 100 | 101 | 102 | 103 | [enum] 104 | rename_variants = "None" 105 | # must_use = "MUST_USE_ENUM" 106 | add_sentinel = false 107 | prefix_with_name = false 108 | derive_helper_methods = false 109 | derive_const_casts = false 110 | derive_mut_casts = false 111 | # cast_assert_name = "ASSERT" 112 | derive_tagged_enum_destructor = false 113 | derive_tagged_enum_copy_constructor = false 114 | enum_class = true 115 | private_default_tagged_enum_constructor = false 116 | 117 | 118 | 119 | 120 | [const] 121 | allow_static_const = true 122 | allow_constexpr = false 123 | sort_by = "Name" 124 | 125 | 126 | 127 | 128 | [macro_expansion] 129 | bitflags = false 130 | 131 | 132 | 133 | 134 | 135 | 136 | ############## Options for How Your Rust library Should Be Parsed ############## 137 | 138 | [parse] 139 | parse_deps = false 140 | # include = [] 141 | exclude = [] 142 | clean = false 143 | extra_bindings = [] 144 | 145 | 146 | 147 | [parse.expand] 148 | crates = [] 149 | all_features = false 150 | default_features = true 151 | features = [] 152 | -------------------------------------------------------------------------------- /float-pigment-forest/cbindgen/extra.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-forest/cbindgen/extra.rs -------------------------------------------------------------------------------- /float-pigment-forest/cbindgen/extra_header.h: -------------------------------------------------------------------------------- 1 | // Copyright 2024 wechat-miniprogram. MIT license. 2 | -------------------------------------------------------------------------------- /float-pigment-forest/cbindgen/extra_struct.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wechat-miniprogram/float-pigment/6a8172cc3316f7d79cb8db39e4762d57fd02b561/float-pigment-forest/cbindgen/extra_struct.h -------------------------------------------------------------------------------- /float-pigment-forest/src/env.rs: -------------------------------------------------------------------------------- 1 | use float_pigment_css::num_traits::Zero; 2 | use float_pigment_layout::ScreenQuery; 3 | 4 | use crate::Len; 5 | #[derive(Debug, Clone, Copy)] 6 | pub struct Env { 7 | pub screen_width: Len, 8 | pub screen_height: Len, 9 | } 10 | 11 | impl ScreenQuery for Env { 12 | fn screen_height(&self) -> Len { 13 | self.screen_height 14 | } 15 | fn screen_width(&self) -> Len { 16 | self.screen_width 17 | } 18 | } 19 | 20 | impl Default for Env { 21 | fn default() -> Self { 22 | Self { 23 | screen_width: Len::zero(), 24 | screen_height: Len::zero(), 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /float-pigment-forest/src/layout/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::Len; 2 | 3 | pub(crate) mod layout_impl; 4 | 5 | #[derive(Debug, Default, Clone, Copy, PartialEq)] 6 | pub struct LayoutPosition { 7 | pub left: Len, 8 | pub top: Len, 9 | pub width: Len, 10 | pub height: Len, 11 | } 12 | -------------------------------------------------------------------------------- /float-pigment-forest/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod env; 2 | pub mod ffi; 3 | pub mod layout; 4 | pub mod node; 5 | pub(crate) mod style; 6 | 7 | pub use node::*; 8 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/README.md: -------------------------------------------------------------------------------- 1 | # Layout Test List 2 | 3 | ## box 4 | 5 | - [ ] display [cases](./custom/css_display.rs) 6 | - [X] block 7 | - [X] flex 8 | - [ ] inline [cases](./custom/css_inline/inline.rs) 9 | - [ ] inline-block [cases](./custom/css_inline/inline.rs) 10 | - [X] none 11 | - [X] box-sizing [cases](./custom/css_box_sizing.rs) 12 | - [X] border-box 13 | - [X] content-box 14 | - [ ] writing-mode 15 | 16 | ## size 17 | 18 | - [X] width [cases](./custom/css_width.rs) 19 | - [X] min-width [cases](./custom/css_min_width.rs) 20 | - [X] max-width [cases](./custom/css_min_height.rs) 21 | - [X] height [cases](./custom/css_height.rs) 22 | - [X] min-height [cases](./custom/css_min_height.rs) 23 | - [X] max-height [cases](./custom/css_max_height.rs) 24 | - [X] border [cases](./custom/css_border.rs) 25 | - [X] border-top 26 | - [X] border-bottom 27 | - [X] border-left 28 | - [X] border-right 29 | - [X] padding [cases](./custom/css_padding.rs) 30 | - [X] padding-top 31 | - [X] padding-bottom 32 | - [X] padding-left 33 | - [X] padding-right 34 | - [X] aspect-ratio [cases](./custom/css_aspect_ratio.rs) 35 | 36 | ### flex 37 | 38 | - [X] flex 39 | - [X] flex-grow [cases](./custom/css_flexbox/flex_grow.rs) 40 | - [X] flex-shrink [cases](./custom/css_flexbox/flex_shrink.rs) 41 | - [X] flex-direction [cases](./custom/css_flexbox/flex_direction.rs) 42 | - [X] row 43 | - [X] row-reverse 44 | - [X] column 45 | - [X] column-reverse 46 | - [ ] flex-wrap 47 | - [ ] flex-basis 48 | - [X] justify-content [cases](./custom/css_flexbox/justify-content.rs) 49 | - [X] start 50 | - [X] flex-start 51 | - [X] center 52 | - [X] end 53 | - [X] flex-end 54 | - [X] left 55 | - [X] right 56 | - [X] space-evenly 57 | - [X] space-between 58 | - [X] space-around 59 | - [X] align-content [cases](./custom/css_flexbox/align_content.rs) 60 | - [X] start 61 | - [X] flex-start 62 | - [X] end 63 | - [X] flex-end 64 | - [X] center 65 | - [X] space-around 66 | - [X] space-evenly 67 | - [X] space-between 68 | - [X] align-items [cases](./custom/css_flexbox/align_items.rs) 69 | - [X] start 70 | - [X] flex-start 71 | - [X] center 72 | - [X] end 73 | - [X] flex-end 74 | - [X] baseline 75 | - [X] stretch 76 | - [X] align-self [cases](./custom/css_flexbox/align_self.rs) 77 | - [X] stretch 78 | - [X] center 79 | - [X] start 80 | - [X] flex-start 81 | - [X] self-start 82 | - [X] end 83 | - [X] flex-end 84 | - [X] self-end 85 | - [ ] baseline 86 | - [X] order [cases](./custom/css_flexbox/order.rs) 87 | 88 | ### position 89 | 90 | - [X] position [cases](./custom/css_position.rs) 91 | - [X] absolute 92 | - [X] relative 93 | - [X] fixed 94 | - [X] left [cases](./custom/css_position.rs) 95 | - [X] right [cases](./custom/css_position.rs) 96 | - [X] top [cases](./custom/css_position.rs) 97 | - [X] bottom [cases](./custom/css_position.rs) 98 | - [X] margin [cases](./custom/css_margin.rs) 99 | - [X] margin-left 100 | - [X] margin-right 101 | - [X] margin-top 102 | - [X] margin-bottom 103 | - [X] text-align [cases](./custom/css_text_align.rs) 104 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_border.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn border_fixed_content_box() { 5 | assert_xml!( 6 | r#" 7 |
8 | "# 9 | ) 10 | } 11 | 12 | #[test] 13 | fn border_fixed_border_box() { 14 | assert_xml!( 15 | r#" 16 |
17 | "# 18 | ) 19 | } 20 | 21 | #[test] 22 | fn border_percentage_content_box() { 23 | assert_xml!( 24 | r#" 25 |
26 |
27 |
28 | "# 29 | ) 30 | } 31 | 32 | #[test] 33 | fn border_left_fixed_content_box() { 34 | assert_xml!( 35 | r#" 36 |
37 | "# 38 | ) 39 | } 40 | 41 | #[test] 42 | fn border_right_fixed_content_box() { 43 | assert_xml!( 44 | r#" 45 |
46 | "# 47 | ) 48 | } 49 | 50 | #[test] 51 | fn border_top_fixed_content_box() { 52 | assert_xml!( 53 | r#" 54 |
55 | "# 56 | ) 57 | } 58 | 59 | #[test] 60 | fn border_bottom_fixed_content_box() { 61 | assert_xml!( 62 | r#" 63 |
64 | "# 65 | ) 66 | } 67 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_box_sizing.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn content_box() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 | "# 11 | ) 12 | } 13 | 14 | #[test] 15 | fn border_box() { 16 | assert_xml!( 17 | r#" 18 |
19 |
20 |
21 | "# 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_display.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn display_block() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 |
12 |
13 | "# 14 | ) 15 | } 16 | 17 | #[test] 18 | fn display_none() { 19 | assert_xml!( 20 | r#" 21 |
22 |
23 |
24 |
25 | "# 26 | ) 27 | } 28 | 29 | #[test] 30 | fn display_flex() { 31 | assert_xml!( 32 | r#" 33 |
34 |
35 |
36 |
37 |
38 |
39 | "# 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/align_self.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn align_self_center() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | "# 18 | ) 19 | } 20 | 21 | #[test] 22 | fn align_self_stretch() { 23 | assert_xml!( 24 | r#" 25 |
26 |
27 |
28 |
29 |
30 | 31 |
32 | "# 33 | ) 34 | } 35 | 36 | #[test] 37 | fn align_self_self_flex_start() { 38 | assert_xml!( 39 | r#" 40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | "# 51 | ) 52 | } 53 | 54 | #[test] 55 | fn align_self_self_flex_end() { 56 | assert_xml!( 57 | r#" 58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | "# 69 | ) 70 | } 71 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/flex_direction.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn flex_direction_row() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 | 11 |
12 | "# 13 | ) 14 | } 15 | 16 | #[test] 17 | fn flex_direction_row_reverse() { 18 | assert_xml!( 19 | r#" 20 |
21 |
22 |
23 | 24 |
25 | "# 26 | ) 27 | } 28 | 29 | #[test] 30 | fn flex_direction_column() { 31 | assert_xml!( 32 | r#" 33 |
34 |
35 |
36 |
37 | "# 38 | ) 39 | } 40 | 41 | #[test] 42 | fn flex_direction_column_reverse() { 43 | assert_xml!( 44 | r#" 45 |
46 |
47 |
48 |
49 | "# 50 | ) 51 | } 52 | 53 | #[test] 54 | fn flex_direction_row_with_parent_padding() { 55 | assert_xml!( 56 | r#" 57 |
58 |
59 |
60 | "# 61 | ) 62 | } 63 | 64 | #[test] 65 | fn flex_direction_row_reverse_with_parent_padding() { 66 | assert_xml!( 67 | r#" 68 |
69 |
70 |
71 | "# 72 | ) 73 | } 74 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/flex_grow.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn flex_grow_0_1() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 | "# 12 | ) 13 | } 14 | 15 | #[test] 16 | fn flex_grow_1_1() { 17 | assert_xml!( 18 | r#" 19 |
20 |
21 |
22 |
23 | "# 24 | ) 25 | } 26 | 27 | #[test] 28 | fn flex_grow_1_2() { 29 | assert_xml!( 30 | r#" 31 |
32 |
33 |
34 |
35 | "# 36 | ) 37 | } 38 | 39 | #[test] 40 | fn flex_grow_0_1_2() { 41 | assert_xml!( 42 | r#" 43 |
44 |
45 |
46 |
47 |
48 | "# 49 | ) 50 | } 51 | 52 | #[test] 53 | fn flex_grow_0_width_1_2() { 54 | assert_xml!( 55 | r#" 56 |
57 |
58 |
59 |
60 |
61 | "# 62 | ) 63 | } 64 | 65 | #[test] 66 | fn flex_grow_0_width() { 67 | assert_xml!( 68 | r#" 69 |
70 |
71 |
72 |
73 |
74 | "# 75 | ) 76 | } 77 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/flex_item_margin.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn flex_item_with_margin() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 | "# 12 | ) 13 | } 14 | 15 | #[test] 16 | fn flex_item_with_margin_1() { 17 | assert_xml!( 18 | r#" 19 |
20 |
21 |
22 |
23 | "# 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/flex_shrink.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn flex_shrink_0_1() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 | "# 12 | ) 13 | } 14 | 15 | #[test] 16 | fn flex_shrink_1_1() { 17 | assert_xml!( 18 | r#" 19 |
20 |
21 |
22 |
23 | "# 24 | ) 25 | } 26 | 27 | #[test] 28 | fn flex_shrink_1_0_2() { 29 | assert_xml!( 30 | r#" 31 |
32 |
33 |
34 |
35 |
36 | "# 37 | ) 38 | } 39 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/gap.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn gap() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 | "# 12 | ) 13 | } 14 | 15 | #[test] 16 | fn column_gap_in_flex_row_box() { 17 | assert_xml!( 18 | r#" 19 |
20 |
21 |
22 |
23 | "# 24 | ) 25 | } 26 | 27 | #[test] 28 | fn row_gap_in_flex_row_box() { 29 | assert_xml!( 30 | r#" 31 |
32 |
33 |
34 |
35 | "# 36 | ) 37 | } 38 | 39 | #[test] 40 | fn column_gap_in_flex_column_box() { 41 | assert_xml!( 42 | r#" 43 |
44 |
45 |
46 |
47 | "# 48 | ) 49 | } 50 | 51 | #[test] 52 | fn row_gap_in_flex_column_box() { 53 | assert_xml!( 54 | r#" 55 |
56 |
57 |
58 |
59 | "# 60 | ) 61 | } 62 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_flexbox/mod.rs: -------------------------------------------------------------------------------- 1 | mod align_items; 2 | mod align_self; 3 | mod flex_direction; 4 | mod flex_grow; 5 | mod flex_shrink; 6 | mod justify_content; 7 | mod order; 8 | 9 | mod align_content; 10 | 11 | mod flex_item_margin; 12 | mod gap; 13 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_height.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn height_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 | "# 9 | ) 10 | } 11 | 12 | #[test] 13 | fn height_percentage() { 14 | assert_xml!( 15 | r#" 16 |
17 |
18 |
19 | "# 20 | ) 21 | } 22 | 23 | #[test] 24 | fn height_auto() { 25 | assert_xml!( 26 | r#" 27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | "# 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_inline/mod.rs: -------------------------------------------------------------------------------- 1 | mod inline; 2 | mod text; 3 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_inline/text.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn text_with_font_size() { 5 | assert_xml!( 6 | r#" 7 |
8 | XX 9 |
10 | "#, 11 | true 12 | ) 13 | } 14 | 15 | #[test] 16 | fn text_with_font_size_2() { 17 | assert_xml!( 18 | r#" 19 |
20 |
XX
21 |
22 | "#, 23 | true 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_max_height.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn max_height_fixed_gt_height() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 |
12 | "# 13 | ) 14 | } 15 | 16 | #[test] 17 | fn max_height_fixed_lt_height() { 18 | assert_xml!( 19 | r#" 20 |
21 |
22 |
23 |
24 |
25 | "# 26 | ) 27 | } 28 | 29 | #[test] 30 | fn max_height_percentage_lt_height() { 31 | assert_xml!( 32 | r#" 33 |
34 |
35 |
36 |
37 |
38 | "# 39 | ) 40 | } 41 | 42 | #[test] 43 | fn max_height_percentage_gt_height() { 44 | assert_xml!( 45 | r#" 46 |
47 |
48 |
49 |
50 |
51 | "# 52 | ) 53 | } 54 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_max_width.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn max_width_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 | "# 11 | ) 12 | } 13 | 14 | #[test] 15 | fn max_width_percentage() { 16 | assert_xml!( 17 | r#" 18 |
19 |
20 |
21 | "# 22 | ) 23 | } 24 | 25 | #[test] 26 | fn max_width_fixed_lt_width() { 27 | assert_xml!( 28 | r#" 29 |
30 |
31 |
32 | "# 33 | ) 34 | } 35 | 36 | #[test] 37 | fn max_width_fixed_gt_width() { 38 | assert_xml!( 39 | r#" 40 |
41 |
42 |
43 | "# 44 | ) 45 | } 46 | 47 | #[test] 48 | fn max_width_fixed_lt_child_width() { 49 | assert_xml!( 50 | r#" 51 |
52 |
53 |
54 |
55 |
56 | "# 57 | ) 58 | } 59 | 60 | #[test] 61 | fn max_width_fixed_gt_child_width() { 62 | assert_xml!( 63 | r#" 64 |
65 |
66 |
67 |
68 |
69 | "# 70 | ) 71 | } 72 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_min_height.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn min_height_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 |
12 | "# 13 | ) 14 | } 15 | 16 | #[test] 17 | fn min_height_fixed_gt_height() { 18 | assert_xml!( 19 | r#" 20 |
21 |
22 |
23 |
24 |
25 | "# 26 | ) 27 | } 28 | 29 | #[test] 30 | fn min_height_fixed_lt_height() { 31 | assert_xml!( 32 | r#" 33 |
34 |
35 |
36 |
37 |
38 | "# 39 | ) 40 | } 41 | 42 | #[test] 43 | fn min_height_percentage() { 44 | assert_xml!( 45 | r#" 46 |
47 |
48 |
49 |
50 |
51 | "# 52 | ) 53 | } 54 | 55 | #[test] 56 | fn min_height_percentage_gt_height() { 57 | assert_xml!( 58 | r#" 59 |
60 |
61 |
62 |
63 |
64 | "# 65 | ) 66 | } 67 | 68 | #[test] 69 | fn min_height_percentage_lt_height() { 70 | assert_xml!( 71 | r#" 72 |
73 |
74 |
75 |
76 |
77 | "# 78 | ) 79 | } 80 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_min_width.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn min_width_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 | "# 11 | ) 12 | } 13 | 14 | #[test] 15 | fn min_width_percentage() { 16 | assert_xml!( 17 | r#" 18 |
19 |
20 |
21 | "# 22 | ) 23 | } 24 | 25 | #[test] 26 | fn min_width_fixed_in_flex() { 27 | assert_xml!( 28 | r#" 29 |
30 |
31 |
32 | "# 33 | ) 34 | } 35 | 36 | #[test] 37 | fn min_width_percentage_in_flex() { 38 | assert_xml!( 39 | r#" 40 |
41 |
42 |
43 | "# 44 | ) 45 | } 46 | 47 | #[test] 48 | fn min_width_fixed_lt_width() { 49 | assert_xml!( 50 | r#" 51 |
52 |
53 |
54 | "# 55 | ) 56 | } 57 | 58 | #[test] 59 | fn min_width_fixed_gt_width() { 60 | assert_xml!( 61 | r#" 62 |
63 |
64 |
65 | "# 66 | ) 67 | } 68 | 69 | #[test] 70 | fn min_height_flex_align_items_center() { 71 | assert_xml!( 72 | r#" 73 |
74 |
75 |
76 | "# 77 | ) 78 | } 79 | 80 | #[test] 81 | fn min_height_flex_justify_content_center() { 82 | assert_xml!( 83 | r#" 84 |
85 |
86 |
87 | "# 88 | ) 89 | } 90 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_padding.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn padding_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 | "# 11 | ) 12 | } 13 | 14 | #[test] 15 | fn padding_left_fixed() { 16 | assert_xml!( 17 | r#" 18 |
19 |
20 |
21 | "# 22 | ) 23 | } 24 | 25 | #[test] 26 | fn padding_right_fixed() { 27 | assert_xml!( 28 | r#" 29 |
30 |
31 |
32 | "# 33 | ) 34 | } 35 | 36 | #[test] 37 | fn padding_top_fixed() { 38 | assert_xml!( 39 | r#" 40 |
41 |
42 |
43 | "# 44 | ) 45 | } 46 | 47 | #[test] 48 | fn padding_bottom_fixed() { 49 | assert_xml!( 50 | r#" 51 |
52 |
53 |
54 | "# 55 | ) 56 | } 57 | 58 | #[test] 59 | fn padding_percentage() { 60 | assert_xml!( 61 | r#" 62 |
63 |
64 |
65 | "# 66 | ) 67 | } 68 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_text_align.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn text_align_1() { 5 | assert_xml!( 6 | r#" 7 |
8 |
9 |
10 |
11 | "# 12 | ) 13 | } 14 | 15 | #[test] 16 | fn text_align_2() { 17 | assert_xml!( 18 | r#" 19 |
20 |
21 |
22 |
23 | "# 24 | ) 25 | } 26 | 27 | #[test] 28 | fn text_align_3() { 29 | assert_xml!( 30 | r#" 31 |
32 |
33 |
34 |
35 | "# 36 | ) 37 | } 38 | 39 | #[test] 40 | fn text_align_4() { 41 | assert_xml!( 42 | r#" 43 |
44 |
45 |
46 |
47 |
48 |
49 | "# 50 | ) 51 | } 52 | 53 | #[test] 54 | fn text_align_5() { 55 | assert_xml!( 56 | r#" 57 |
58 |
59 |
60 | "# 61 | ) 62 | } 63 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/css_width.rs: -------------------------------------------------------------------------------- 1 | use crate::*; 2 | 3 | #[test] 4 | fn width_fixed() { 5 | assert_xml!( 6 | r#" 7 |
8 | "# 9 | ) 10 | } 11 | 12 | #[test] 13 | fn width_percentage() { 14 | assert_xml!( 15 | r#" 16 |
17 |
18 |
19 | "# 20 | ) 21 | } 22 | 23 | #[test] 24 | fn width_auto() { 25 | assert_xml!( 26 | r#" 27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | "# 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/custom/mod.rs: -------------------------------------------------------------------------------- 1 | mod css_display; 2 | mod css_flexbox; 3 | 4 | mod cache; 5 | mod css_aspect_ratio; 6 | mod css_box_sizing; 7 | mod css_height; 8 | mod css_inline; 9 | mod css_margin; 10 | mod css_min_height; 11 | mod css_padding; 12 | mod css_position; 13 | mod css_text_align; 14 | mod css_width; 15 | 16 | mod css_max_height; 17 | mod css_min_width; 18 | 19 | mod css_max_width; 20 | 21 | mod css_border; 22 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/wpt/css_display/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/wpt/css_flexbox/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /float-pigment-forest/tests/wpt/mod.rs: -------------------------------------------------------------------------------- 1 | mod css_display; 2 | mod css_flexbox; 3 | -------------------------------------------------------------------------------- /float-pigment-layout/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-layout" 3 | description = "A light-weight layout engine which supports common web layout algorithms." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | name = "float_pigment_layout" 15 | crate-type = ["rlib"] 16 | 17 | [features] 18 | default = ["std"] 19 | std = ["float-pigment-css/std"] 20 | 21 | [dependencies] 22 | paste = "1.0" 23 | log = "0.4" 24 | euclid = { version = "0.22", default-features = false, features = ["libm"] } 25 | lru = "0.7.8" 26 | float-pigment-css = { workspace = true } 27 | 28 | [lints] 29 | workspace = true 30 | -------------------------------------------------------------------------------- /float-pigment-layout/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-layout 2 | 3 | A light-weight layout engine which supports common web layout algorithms. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | -------------------------------------------------------------------------------- /float-pigment-layout/src/algo/mod.rs: -------------------------------------------------------------------------------- 1 | // Some code Borrowed from https://vislyhq.github.io/stretch/ , MIT license 2 | 3 | // MIT License 4 | 5 | // Copyright (c) 2018 Visly Inc. 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | // SOFTWARE. 24 | 25 | pub(crate) mod flex_box; 26 | pub(crate) mod flow; 27 | -------------------------------------------------------------------------------- /float-pigment-mlp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment-mlp" 3 | description = "Testing utilities for float-pigment. Should not be used by modules of other projects." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | crate-type = ["rlib"] 15 | 16 | [features] 17 | default = [] 18 | htmlstream = [] 19 | 20 | [dependencies] 21 | serde = { version = "1.0.166", features = ["derive", "rc"] } 22 | serde_json = "1.0.99" 23 | serde_derive = "1.0.166" 24 | regex = "1.8.4" 25 | htmlstream = "0.1.3" 26 | xmlparser = "0.13.5" 27 | rustc-hash = "1.1.0" 28 | 29 | [lints] 30 | workspace = true 31 | -------------------------------------------------------------------------------- /float-pigment-mlp/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment-mlp 2 | 3 | Testing utilities for float-pigment. Should not be used by modules of other projects. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/context.rs: -------------------------------------------------------------------------------- 1 | use crate::tree::Tree; 2 | 3 | #[derive(Default, Debug)] 4 | pub struct Config; 5 | #[derive(Debug)] 6 | pub struct Context { 7 | config: Config, 8 | tree: Option, 9 | } 10 | 11 | impl Context { 12 | pub fn create(cfg: Option) -> Self { 13 | Self { 14 | config: cfg.unwrap_or_default(), 15 | tree: None, 16 | } 17 | } 18 | pub fn tree(&self) -> Option<&Tree> { 19 | self.tree.as_ref() 20 | } 21 | pub fn config(&self) -> &Config { 22 | &self.config 23 | } 24 | } 25 | pub trait Parse { 26 | fn parse(&mut self, input: T); 27 | } 28 | 29 | impl Parse<&str> for Context { 30 | fn parse(&mut self, input: &str) { 31 | self.tree = Some(Tree::from(input)); 32 | } 33 | } 34 | 35 | impl Parse for Context { 36 | fn parse(&mut self, input: String) { 37 | self.tree = Some(Tree::from(&input)); 38 | } 39 | } 40 | 41 | #[cfg(test)] 42 | mod tests { 43 | use super::*; 44 | #[test] 45 | fn parse() { 46 | let raw = r#" 47 |
hello 48 | world 49 |
50 | "#; 51 | let mut ctx = Context::create(None); 52 | ctx.parse(raw); 53 | if let Some(t) = ctx.tree() { 54 | println!("{:?}", t); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod utils; 2 | 3 | pub mod context; 4 | pub mod node; 5 | pub(crate) mod tree; 6 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/node/attribute.rs: -------------------------------------------------------------------------------- 1 | use std::cell::RefCell; 2 | 3 | use rustc_hash::FxHashMap; 4 | #[derive(Default)] 5 | pub struct Attribute { 6 | inner: RefCell>, 7 | } 8 | 9 | impl std::fmt::Debug for Attribute { 10 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 11 | write!(f, "{:?}", self.inner.borrow()) 12 | } 13 | } 14 | 15 | impl Attribute { 16 | pub fn keys(&self) -> Vec { 17 | self.inner 18 | .borrow() 19 | .keys() 20 | .map(|x| x.into()) 21 | .collect::>() 22 | } 23 | 24 | pub fn get(&self, k: &str) -> Option { 25 | self.inner.borrow().get_key_value(k).map(|x| x.1.into()) 26 | } 27 | 28 | pub fn add(&self, key: String, value: String) { 29 | self.inner.borrow_mut().insert(key, value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/node/element.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | cell::{RefCell, RefMut}, 3 | rc::Rc, 4 | }; 5 | 6 | use super::{attribute::Attribute, NodeType}; 7 | 8 | pub struct Element { 9 | tag: String, 10 | attributes: Attribute, 11 | children: RefCell>>, 12 | } 13 | 14 | impl std::fmt::Debug for Element { 15 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 16 | write!( 17 | f, 18 | "Element {{ tag: {:?}, attributes: {:?}, children: {:?} }}", 19 | self.tag, 20 | self.attributes, 21 | self.children.borrow() 22 | ) 23 | } 24 | } 25 | 26 | impl Element { 27 | pub(crate) fn new(tag: String) -> Self { 28 | Self { 29 | attributes: Attribute::default(), 30 | tag, 31 | children: RefCell::new(vec![]), 32 | } 33 | } 34 | pub fn tag(&self) -> &str { 35 | self.tag.as_str() 36 | } 37 | pub fn children_mut(&self) -> RefMut>> { 38 | self.children.borrow_mut() 39 | } 40 | pub fn for_each_child(&self, f: Box) { 41 | self.children 42 | .borrow() 43 | .iter() 44 | .for_each(|item| f(item.as_ref())) 45 | } 46 | pub fn attributes(&self) -> &Attribute { 47 | &self.attributes 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/node/fragment.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | cell::{RefCell, RefMut}, 3 | fmt::Debug, 4 | rc::Rc, 5 | }; 6 | 7 | use super::NodeType; 8 | pub struct Fragment(RefCell>>); 9 | 10 | impl Debug for Fragment { 11 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 12 | write!(f, "Fragment {{ children: {:?} }}", self.0.borrow()) 13 | } 14 | } 15 | 16 | impl Fragment { 17 | pub(crate) fn new() -> Self { 18 | Self(RefCell::new(vec![])) 19 | } 20 | pub fn for_each_child(&self, f: Box) { 21 | self.0.borrow().iter().for_each(|item| f(item.as_ref())) 22 | } 23 | pub fn children_mut(&self) -> RefMut>> { 24 | self.0.borrow_mut() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/node/mod.rs: -------------------------------------------------------------------------------- 1 | use self::{element::Element, fragment::Fragment, text::Text}; 2 | 3 | pub mod attribute; 4 | pub mod element; 5 | pub mod fragment; 6 | pub mod text; 7 | 8 | pub enum NodeType { 9 | Fragment(Fragment), 10 | Element(Element), 11 | Text(Text), 12 | } 13 | 14 | impl std::fmt::Debug for NodeType { 15 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 16 | match self { 17 | Self::Element(e) => { 18 | write!(f, "{:?}", e) 19 | } 20 | Self::Fragment(e) => { 21 | write!(f, "{:?}", e) 22 | } 23 | Self::Text(e) => { 24 | write!(f, "{:?}", e) 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/node/text.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Debug; 2 | 3 | #[derive(Debug)] 4 | pub struct Text(String); 5 | 6 | impl Text { 7 | pub fn text(&self) -> &str { 8 | &self.0 9 | } 10 | pub(crate) fn new(text: String) -> Self { 11 | Self(text) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /float-pigment-mlp/src/utils.rs: -------------------------------------------------------------------------------- 1 | use regex::Regex; 2 | 3 | /// character filter 4 | fn char_filter(source: &str, regex: &str, replace: &str) -> String { 5 | let rg = Regex::new(regex).unwrap(); 6 | rg.replace_all(source, replace).into() 7 | } 8 | 9 | #[allow(unused)] 10 | pub(crate) fn multi_space_to_single(source: &str) -> String { 11 | char_filter(source, r"\s\s+", " ") 12 | } 13 | 14 | #[allow(unused)] 15 | pub(crate) fn nl_filter(source: &str) -> String { 16 | char_filter(source, r"\n", "") 17 | } 18 | 19 | #[cfg(test)] 20 | mod test { 21 | #[test] 22 | fn char_filter() { 23 | let raw = "hello\n \n world\n "; 24 | let ret = super::char_filter(raw.trim(), r"[\n]+[\s]*", " "); 25 | assert_eq!(ret, "hello world"); 26 | } 27 | #[test] 28 | fn multi_space_filter() { 29 | let raw = "hello world"; 30 | 31 | let ret = super::multi_space_to_single(raw); 32 | assert_eq!(ret, "hello world"); 33 | } 34 | #[test] 35 | fn nl_filter() { 36 | let raw = "\n\n"; 37 | let ret = super::nl_filter(raw); 38 | assert_eq!(ret, ""); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /float-pigment/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "float-pigment" 3 | description = "A collection of major float-pigment crates." 4 | version.workspace = true 5 | authors.workspace = true 6 | categories.workspace = true 7 | edition.workspace = true 8 | homepage.workspace = true 9 | keywords.workspace = true 10 | license.workspace = true 11 | repository.workspace = true 12 | 13 | [lib] 14 | name = "float_pigment" 15 | crate-type = ["staticlib", "cdylib", "rlib"] 16 | 17 | [[bin]] 18 | name = "float_pigment_cpp_binding_gen_tool" 19 | path = "src/cpp_binding_gen_tools.rs" 20 | 21 | [dependencies] 22 | float-pigment-css = { workspace = true } 23 | float-pigment-forest = { workspace = true } 24 | float-pigment-layout = { workspace = true } 25 | 26 | [lints] 27 | workspace = true 28 | -------------------------------------------------------------------------------- /float-pigment/README.md: -------------------------------------------------------------------------------- 1 | # float-pigment 2 | 3 | A collection of major float-pigment crates. 4 | 5 | This is a crate of the [float-pigment](https://github.com/wechat-miniprogram/float-pigment) project. See its documentation for details. 6 | 7 | 8 | ## Generate C++ Headers 9 | 10 | This module contains C++ bindings, and it generates a C++ header file for visiting from C++. However, the C++ header should be updated manually. 11 | 12 | To update the C++ header, make sure installed: 13 | 14 | * [cargo-expand](https://github.com/dtolnay/cargo-expand) 15 | 16 | The C++ header update command: 17 | 18 | ```shell 19 | cargo run --bin float_pigment_cpp_binding_gen_tool 20 | ``` 21 | -------------------------------------------------------------------------------- /float-pigment/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub extern crate float_pigment_css; 2 | pub extern crate float_pigment_forest; 3 | pub extern crate float_pigment_layout; 4 | --------------------------------------------------------------------------------