Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ css-module-displayname-generated_content_for_paged_media=Generated Content for P
css-module-displayname-fonts=Fonts
css-module-displayname-basic_box_model=Basic Box Model
css-module-displayname-speech=Speech
css-module-displayname-grid_positioning=Grid Positioning
css-module-displayname-grid=Grid Layout
css-module-displayname-flexible_box_layout=Flexible Box Layout
css-module-displayname-image_values=Image Values and Replaced Content
css-module-displayname-animations=Animations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class DefaultCssEditorModule extends CssEditorModule {
module("fonts", "http://www.w3.org/TR/css3-fonts"),
module("basic_box_model", "http://www.w3.org/TR/css3-box"),
module("speech", "http://www.w3.org/TR/css3-speech"),
// module("grid_positioning", "http://www.w3.org/TR/css3-grid"), //obsolete
module("grid", "http://www.w3.org/TR/css3-grid"),
module("flexible_box_layout", "http://www.w3.org/TR/css3-flexbox"),
module("image_values", "http://www.w3.org/TR/css3-images"),
module("animations", "http://www.w3.org/TR/css3-animations"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Grid positioning module

$category=grid

grid = <grid-template> \
| [ <grid-template-rows> / [auto-flow && dense?] <grid-auto-columns>?] \
| [ [auto-flow && dense?] <grid-auto-rows>? / <grid-template-columns>] \
| inherit | initial

grid-area = [<grid-line> [ / <grid-line> ]{0,3}] | inherit | initial

grid-auto-flow = [[ row | column ] || dense] | inherit | initial

grid-auto-columns;grid-auto-rows = [<track-size>]+ | inherit | initial

grid-row;grid-column = [<grid-line> [ / <grid-line> ]?] | inherit | initial

grid-row-start;grid-column-start;grid-row-end;grid-column-end = <grid-line> | inherit | initial

@grid-line = auto | !identifier | [<integer> && [!identifier]?] | [span && [<integer> || !identifier]]

grid-template = none \
| [ <grid-template-rows> / <grid-template-columns> ] \
| [[ <line-names>? <string> <track-size>? <line-names>?]+ [ / <explicit-track-list> ]?] \
| inherit | initial

grid-template-areas = none | <string>+ | inherit | initial

grid-template-columns;grid-template-rows = none | <track-list> | <auto-track-list> | inherit | initial

@track-list = [ [<line-names>]? [<track-size> | <track-repeat>]]+ [<line-names>]?
@auto-track-list = [ [ <line-names> ]? [<fixed-size> | <fixed-repeat>] ]* [<line-names>]? [<auto-repeat>]?
@explicit-track-list = [ [ <line-names> ]? <track-size> ]+ [<line-names>]?
@track-size = <track-breadth> | [ minmax ( <inflexible-breadth>, <track-breadth> ) ] | [ fit-content ( <length-percentage> ) ]
@fixed-size = <fixed-breadth> | [ minmax ( <fixed-breadth>, <track-breadth> ) ] | [ minmax ( <inflexible-breadth>, <fixed-breadth> )]
@track-breadth = <length-percentage> | !flex | min-content | max-content | auto
@inflexible-breadth = <length-percentage> | min-content | max-content | auto
@fixed-breadth = <length-percentage>
@length-percentage = <percentage> | <length>
@line-names = "[" [ !identifier ]+ "]"

@track-repeat = repeat ( <non-negative-integer>, [<line-names>? <track-size>]+ <line-names>?)
@auto-repeat = repeat ( [ auto-fill | auto-fit ], [<line-names>? <fixed-size>]+ <line-names>?)
@fixed-repeat = repeat ( <non-negative-integer>, [<line-names>? <fixed-size>]+ <line-names>?)

@non-negative-integer=!non-negative-integer

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2731,4 +2731,42 @@ public void testDisplay() throws ParseException {
assertCssCode(".demo {display: flow list-item}");
assertCssCode(".demo {display: list-item flow}");
}

public void testGrid() throws ParseException {
assertCssCode(".demo {grid-template-columns: 150px 1fr;}");
assertCssCode(".demo {grid-template-columns: 150px [item1-start] 1fr [item1-end];}");
assertCssCode(".demo {grid-template-rows: [item1-start] 50px 1fr 50px [item1-end]}");
assertCssCode(".demo {grid-template-rows: 1fr minmax(min-content, 1fr)}");
assertCssCode(".demo {grid-template-areas: \"head head\"\n\"nav main\"}");
assertCssCode(".demo {grid-template: auto 1fr / auto 1fr auto;}");
assertCssCode(".demo {grid-template: [header-top] \"a a a\" [header-bottom]\n"
+ "[main-top] \"b b b\" 1fr [main-bottom]\n"
+ "/ auto 1fr auto;}");
assertCssCode(".demo {grid-column-start: 4}");
assertCssCode(".demo {grid-column-end: auto}");
assertCssCode(".demo {grid-row-start: C}");
assertCssCode(".demo {grid-row-start: -4}");
assertCssCode(".demo {grid-row-end: B -1}");
assertCssCode(".demo {grid-row: A / C}");
assertCssCode(".demo {grid-column: 1 / 3}");
assertCssCode(".demo {grid-row: B}");
assertCssCode(".demo {grid-column: 4}");
assertCssCode(".demo {grid-auto-columns: 20px min-content fit-content(30px)}");
assertCssCode(".demo {grid-auto-rows: 40px minmax(max-content, auto)}");
assertCssCode(".demo {grid-auto-flow: row dense;}");
assertCssCode(".demo {grid-area: dummy-area}");
assertCssCode(".demo {grid-area: auto}");
assertCssCode(".demo {grid-area: 2 / 4}");
assertCssCode(".demo {grid-area: 1 / 3 / -1}");
assertCssCode(".demo {grid-area: header-start / sidebar-start / footer-end / sidebar-start}");
assertCssCode(".demo {grid: auto-flow 1fr / 100px;}");
assertCssCode(".demo {grid: \"H H\"\n"
+ "\" A B\"\n"
+ "\" F F\" 30px\n"
+ "/ auto 1fr\n"
+ "}");
assertCssCode(".demo {grid: repeat(auto-fill, 5em) / auto-flow 1fr;}");
assertCssCode(".demo {grid: auto-flow 1fr / repeat(auto-fill, 5em);}");
assertCssCode(".demo {grid: auto 1fr auto / repeat(5, 1fr);}");
}
}
1 change: 1 addition & 0 deletions ide/css.lib/src/org/netbeans/modules/css/lib/Css3.g
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ term
(functionName ws? LPAREN)=>function //"myfunction(" as predicate
| VARIABLE
| IDENT
| (LBRACKET WS? IDENT (WS IDENT)* WS? RBRACKET)
| NUMBER
| URANGE
| PERCENTAGE
Expand Down
Loading