@cratis/scene.engine 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/PackageSelection.js.map +1 -1
- package/dist/cjs/aggregateContributions.js.map +1 -1
- package/dist/cjs/buildStarterProfile.js.map +1 -1
- package/dist/cjs/computeSizeClass.js.map +1 -1
- package/dist/cjs/elementKind.js.map +1 -1
- package/dist/cjs/evaluateFlowArrangement.js.map +1 -1
- package/dist/cjs/evaluateFreeformArrangement.js.map +1 -1
- package/dist/cjs/evaluateFreeformSlotArrangement.js.map +1 -1
- package/dist/cjs/flowNodeKind.js.map +1 -1
- package/dist/cjs/incompatibleStarterThemes.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/packageCatalog.js.map +1 -1
- package/dist/cjs/packageVersionRange.js.map +1 -1
- package/dist/cjs/panelKind.js +5 -1
- package/dist/cjs/panelKind.js.map +1 -1
- package/dist/cjs/renderElement.js.map +1 -1
- package/dist/cjs/resolveComponentName.js.map +1 -1
- package/dist/cjs/resolvePackageDependencies.js.map +1 -1
- package/dist/cjs/resolveScreenTemplates.js.map +1 -1
- package/dist/cjs/themeCompatibility.js.map +1 -1
- package/dist/esm/PackageSelection.js.map +1 -1
- package/dist/esm/aggregateContributions.js.map +1 -1
- package/dist/esm/buildStarterProfile.js.map +1 -1
- package/dist/esm/computeSizeClass.js.map +1 -1
- package/dist/esm/elementKind.js.map +1 -1
- package/dist/esm/evaluateFlowArrangement.js.map +1 -1
- package/dist/esm/evaluateFreeformArrangement.js.map +1 -1
- package/dist/esm/evaluateFreeformSlotArrangement.js.map +1 -1
- package/dist/esm/flowNodeKind.js.map +1 -1
- package/dist/esm/for_panelKind/when_telling_the_panels_apart.js +6 -2
- package/dist/esm/for_panelKind/when_telling_the_panels_apart.js.map +1 -1
- package/dist/esm/incompatibleStarterThemes.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/packageCatalog.js.map +1 -1
- package/dist/esm/packageVersionRange.js.map +1 -1
- package/dist/esm/panelKind.d.ts +2 -1
- package/dist/esm/panelKind.d.ts.map +1 -1
- package/dist/esm/panelKind.js +5 -2
- package/dist/esm/panelKind.js.map +1 -1
- package/dist/esm/renderElement.js.map +1 -1
- package/dist/esm/resolveComponentName.js.map +1 -1
- package/dist/esm/resolvePackageDependencies.js.map +1 -1
- package/dist/esm/resolveScreenTemplates.js.map +1 -1
- package/dist/esm/themeCompatibility.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/for_panelKind/when_telling_the_panels_apart.ts +8 -3
- package/package.json +3 -3
- package/panelKind.ts +5 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import { DockPanel, Grid, HorizontalAlignment, Orientation, Panel, StackPanel, VerticalAlignment, Visibility, WrapPanel } from '@cratis/scene.model';
|
|
5
|
-
import { isDockPanel, isGrid, isStackPanel, isWrapPanel } from '../index';
|
|
4
|
+
import { Canvas, DockPanel, Grid, HorizontalAlignment, Orientation, Panel, StackPanel, VerticalAlignment, Visibility, WrapPanel } from '@cratis/scene.model';
|
|
5
|
+
import { isCanvas, isDockPanel, isGrid, isStackPanel, isWrapPanel } from '../index';
|
|
6
6
|
|
|
7
7
|
const base = {
|
|
8
8
|
id: 'panel',
|
|
@@ -21,6 +21,7 @@ const base = {
|
|
|
21
21
|
children: [],
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const canvas: Canvas = { ...base, extent: { width: 1280, height: 800 } };
|
|
24
25
|
const grid: Grid = { ...base, rows: [], columns: [] };
|
|
25
26
|
const dock: DockPanel = { ...base, lastChildFill: true };
|
|
26
27
|
const stack: StackPanel = { ...base, orientation: Orientation.Vertical, spacing: 0 };
|
|
@@ -28,6 +29,7 @@ const wrap: WrapPanel = { ...base, orientation: Orientation.Horizontal };
|
|
|
28
29
|
const plain: Panel = { ...base };
|
|
29
30
|
|
|
30
31
|
describe('when telling the panels apart', () => {
|
|
32
|
+
it('should recognize a canvas by its extent', () => isCanvas(canvas).should.be.true);
|
|
31
33
|
it('should recognize a grid by its tracks', () => isGrid(grid).should.be.true);
|
|
32
34
|
it('should recognize a dock panel by its fill flag', () => isDockPanel(dock).should.be.true);
|
|
33
35
|
it('should recognize a stack panel by its spacing', () => isStackPanel(stack).should.be.true);
|
|
@@ -36,7 +38,10 @@ describe('when telling the panels apart', () => {
|
|
|
36
38
|
it('should not mistake a stack panel for a wrap panel', () => isWrapPanel(stack).should.be.false);
|
|
37
39
|
it('should not mistake a wrap panel for a stack panel', () => isStackPanel(wrap).should.be.false);
|
|
38
40
|
it('should not mistake a grid for a dock panel', () => isDockPanel(grid).should.be.false);
|
|
41
|
+
it('should not mistake a canvas for a grouping panel', () => isCanvas(plain).should.be.false);
|
|
42
|
+
it('should leave a canvas unclaimed by the arranging guards', () =>
|
|
43
|
+
[isGrid(canvas), isDockPanel(canvas), isStackPanel(canvas), isWrapPanel(canvas)].should.have.members([false, false, false, false]));
|
|
39
44
|
|
|
40
45
|
it('should leave a plain panel unclaimed by every guard', () =>
|
|
41
|
-
[isGrid(plain), isDockPanel(plain), isStackPanel(plain), isWrapPanel(plain)].should.have.members([false, false, false, false]));
|
|
46
|
+
[isCanvas(plain), isGrid(plain), isDockPanel(plain), isStackPanel(plain), isWrapPanel(plain)].should.have.members([false, false, false, false, false]));
|
|
42
47
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.engine",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "The Scene runtime: walks a Scene element tree and drives whichever renderer is plugged in. Does not know React, or any other rendering platform, exists.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cratis",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"up": "yarn g:up"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@cratis/scene.model": "3.
|
|
50
|
+
"@cratis/scene.model": "3.3.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@cratis/scene.model": "3.
|
|
53
|
+
"@cratis/scene.model": "3.3.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/panelKind.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import { DockPanel, Grid, Panel, StackPanel, WrapPanel } from '@cratis/scene.model';
|
|
4
|
+
import { Canvas, DockPanel, Grid, Panel, StackPanel, WrapPanel } from '@cratis/scene.model';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Type guards telling the concrete panels apart, by the property each one alone declares - the same way
|
|
@@ -13,6 +13,10 @@ import { DockPanel, Grid, Panel, StackPanel, WrapPanel } from '@cratis/scene.mod
|
|
|
13
13
|
* whatever way its platform considers neutral.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
export function isCanvas(panel: Panel): panel is Canvas {
|
|
17
|
+
return 'extent' in panel;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
export function isGrid(panel: Panel): panel is Grid {
|
|
17
21
|
return 'rows' in panel && 'columns' in panel;
|
|
18
22
|
}
|