Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add UiCanvasInformation component #533

Merged
merged 4 commits into from
Apr 20, 2023
Merged
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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ install:
npm i
make node_modules/.bin/protobuf/bin/protoc

update-protocol:
npm i --save-exact @dcl/protocol@next
cd packages/@dcl/sdk-commands; npm i --save-exact @dcl/protocol@next
$(MAKE) sync-deps

lint:
node_modules/.bin/eslint . --ext .ts

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
"dependencies": {
"@actions/core": "^1.10.0",
"@dcl/protocol": "1.0.0-4671230683.commit-a8d74c3",
"@dcl/protocol": "1.0.0-4747376947.commit-d770e0d",
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
"@types/fs-extra": "^9.0.12",
"@types/jest": "^28.1.8",
Expand Down
24 changes: 24 additions & 0 deletions packages/@dcl/playground-assets/etc/playground-assets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ export const componentDefinitionByName: {
"core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
"core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
"core::UiBackground": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiBackground>>;
"core::UiCanvasInformation": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiCanvasInformation>>;
"core::UiDropdown": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdown>>;
"core::UiDropdownResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>>;
"core::UiInput": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInput>>;
Expand Down Expand Up @@ -2090,6 +2091,14 @@ export interface PBUiBackground {
uvs: number[];
}

// @public (undocumented)
export interface PBUiCanvasInformation {
devicePixelRatio: number;
height: number;
interactableArea: BorderRect | undefined;
width: number;
}

// @public (undocumented)
export interface PBUiDropdown {
// (undocumented)
Expand Down Expand Up @@ -2528,6 +2537,18 @@ export type ReceiveMessage = CrdtMessageBody & {
messageBuffer: Uint8Array;
};

// @public (undocumented)
export interface Rect {
// (undocumented)
height: number;
// (undocumented)
width: number;
// (undocumented)
x: number;
// (undocumented)
y: number;
}

// Warning: (ae-missing-release-tag) "RPCSendableMessage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -2823,6 +2844,9 @@ export interface UiButtonProps extends UiLabelProps, EntityPropTypes {
variant?: 'primary' | 'secondary';
}

// @public (undocumented)
export const UiCanvasInformation: LastWriteWinElementSetComponentDefinition<PBUiCanvasInformation>;

// @public (undocumented)
export type UiComponent = () => ReactEcs.JSX.Element;

Expand Down
14 changes: 7 additions & 7 deletions packages/@dcl/sdk-commands/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@dcl/sdk-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@dcl/inspector": "file:../inspector",
"@dcl/linker-dapp": "0.7.0",
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
"@dcl/protocol": "1.0.0-4671230683.commit-a8d74c3",
"@dcl/protocol": "1.0.0-4747376947.commit-d770e0d",
"@dcl/rpc": "^1.1.1",
"@dcl/schemas": "^6.11.1",
"@segment/analytics-node": "^1.0.0-beta.22",
Expand Down
21 changes: 21 additions & 0 deletions test/ecs/components/UiCanvasInformation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Engine, components } from '../../../packages/@dcl/ecs/src'
import { testComponentSerialization } from './assertion'

describe('Generated UiCanvasInformation ProtoBuf', () => {
it('should serialize/deserialize UiCanvasInformation', () => {
const newEngine = Engine()
const UiCanvasInformation = components.UiCanvasInformation(newEngine)

testComponentSerialization(UiCanvasInformation, {
devicePixelRatio: 1,
height: 1,
width: 1,
interactableArea: {
bottom: 0,
left: 0,
right: 0,
top: 0
}
})
})
})
8 changes: 4 additions & 4 deletions test/snapshots/development-bundles/testing-fw.test.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=344.9k bytes
SCENE_COMPILED_JS_SIZE_PROD=347.7k bytes
THE BUNDLE HAS SOURCEMAPS
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
Expand All @@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/testing-fw.test.js
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 29k
MALLOC_COUNT = 9626
ALIVE_OBJS_DELTA ~= 1.79k
MALLOC_COUNT = 9715
ALIVE_OBJS_DELTA ~= 1.81k
CALL onStart()
LOG: ["Adding one to position.y=0"]
Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0}
Expand Down Expand Up @@ -64,4 +64,4 @@ CALL onUpdate(0.1)
OPCODES ~= 4k
MALLOC_COUNT = -40
ALIVE_OBJS_DELTA ~= -0.01k
MEMORY_USAGE_COUNT ~= 945.82k bytes
MEMORY_USAGE_COUNT ~= 951.46k bytes
8 changes: 4 additions & 4 deletions test/snapshots/development-bundles/two-way-crdt.test.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=344.9k bytes
SCENE_COMPILED_JS_SIZE_PROD=347.7k bytes
THE BUNDLE HAS SOURCEMAPS
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
Expand All @@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/two-way-crdt.test.js
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 29k
MALLOC_COUNT = 9626
ALIVE_OBJS_DELTA ~= 1.79k
MALLOC_COUNT = 9715
ALIVE_OBJS_DELTA ~= 1.81k
CALL onStart()
LOG: ["Adding one to position.y=0"]
Renderer: PUT_COMPONENT e=0x0 c=1 t=1 data={"position":{"x":1,"y":0,"z":0},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":9,"y":9,"z":9},"parent":0}
Expand Down Expand Up @@ -64,4 +64,4 @@ CALL onUpdate(0.1)
OPCODES ~= 4k
MALLOC_COUNT = -40
ALIVE_OBJS_DELTA ~= -0.01k
MEMORY_USAGE_COUNT ~= 945.82k bytes
MEMORY_USAGE_COUNT ~= 951.46k bytes
2 changes: 1 addition & 1 deletion test/snapshots/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions test/snapshots/production-bundles/append-value-crdt.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=153.3k bytes
SCENE_COMPILED_JS_SIZE_PROD=154.7k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/append-value-crdt.js
REQUIRE: long
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 30k
MALLOC_COUNT = 8466
ALIVE_OBJS_DELTA ~= 1.80k
OPCODES ~= 31k
MALLOC_COUNT = 8550
ALIVE_OBJS_DELTA ~= 1.82k
CALL onStart()
Renderer: APPEND_VALUE e=0x200 c=1063 t=0 data={"button":0,"hit":{"position":{"x":1,"y":2,"z":3},"globalOrigin":{"x":1,"y":2,"z":3},"direction":{"x":1,"y":2,"z":3},"normalHit":{"x":1,"y":2,"z":3},"length":10,"meshName":"mesh","entityId":512},"state":1,"timestamp":1,"analog":5}
OPCODES ~= 8k
Expand Down Expand Up @@ -55,4 +55,4 @@ CALL onUpdate(0.1)
OPCODES ~= 12k
MALLOC_COUNT = 31
ALIVE_OBJS_DELTA ~= 0.01k
MEMORY_USAGE_COUNT ~= 697.61k bytes
MEMORY_USAGE_COUNT ~= 702.00k bytes
10 changes: 5 additions & 5 deletions test/snapshots/production-bundles/billboard.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=186.1k bytes
SCENE_COMPILED_JS_SIZE_PROD=187.4k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/billboard.js
REQUIRE: long
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 40k
MALLOC_COUNT = 10758
ALIVE_OBJS_DELTA ~= 2.25k
OPCODES ~= 41k
MALLOC_COUNT = 10842
ALIVE_OBJS_DELTA ~= 2.27k
CALL onStart()
OPCODES ~= 0k
MALLOC_COUNT = 4
Expand Down Expand Up @@ -77,4 +77,4 @@ CALL onUpdate(0.1)
OPCODES ~= 8k
MALLOC_COUNT = 0
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 848.37k bytes
MEMORY_USAGE_COUNT ~= 852.75k bytes
10 changes: 5 additions & 5 deletions test/snapshots/production-bundles/composite.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=150.7k bytes
SCENE_COMPILED_JS_SIZE_PROD=152k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -9,9 +9,9 @@ EVAL test/snapshots/production-bundles/composite.js
REQUIRE: ~system/Scene
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 29k
MALLOC_COUNT = 8021
ALIVE_OBJS_DELTA ~= 1.68k
OPCODES ~= 30k
MALLOC_COUNT = 8105
ALIVE_OBJS_DELTA ~= 1.70k
CALL onStart()
OPCODES ~= 0k
MALLOC_COUNT = 14
Expand All @@ -34,4 +34,4 @@ CALL onUpdate(0.1)
OPCODES ~= 1k
MALLOC_COUNT = 0
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 673.00k bytes
MEMORY_USAGE_COUNT ~= 677.38k bytes
10 changes: 5 additions & 5 deletions test/snapshots/production-bundles/cube-deleted.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=150.1k bytes
SCENE_COMPILED_JS_SIZE_PROD=151.4k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/cube-deleted.js
REQUIRE: long
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 29k
MALLOC_COUNT = 7992
ALIVE_OBJS_DELTA ~= 1.67k
OPCODES ~= 30k
MALLOC_COUNT = 8076
ALIVE_OBJS_DELTA ~= 1.69k
CALL onStart()
OPCODES ~= 0k
MALLOC_COUNT = 6
Expand Down Expand Up @@ -42,4 +42,4 @@ CALL onUpdate(0.1)
OPCODES ~= 3k
MALLOC_COUNT = 1
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 670.88k bytes
MEMORY_USAGE_COUNT ~= 675.26k bytes
10 changes: 5 additions & 5 deletions test/snapshots/production-bundles/cube.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=149.5k bytes
SCENE_COMPILED_JS_SIZE_PROD=150.8k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -8,9 +8,9 @@ EVAL test/snapshots/production-bundles/cube.js
REQUIRE: long
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 29k
MALLOC_COUNT = 7831
ALIVE_OBJS_DELTA ~= 1.63k
OPCODES ~= 30k
MALLOC_COUNT = 7915
ALIVE_OBJS_DELTA ~= 1.66k
CALL onStart()
OPCODES ~= 0k
MALLOC_COUNT = 6
Expand All @@ -32,4 +32,4 @@ CALL onUpdate(0.1)
OPCODES ~= 1k
MALLOC_COUNT = 0
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 655.32k bytes
MEMORY_USAGE_COUNT ~= 659.70k bytes
8 changes: 4 additions & 4 deletions test/snapshots/production-bundles/cubes.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=186.5k bytes
SCENE_COMPILED_JS_SIZE_PROD=187.8k bytes
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
MALLOC_COUNT = 1005
Expand All @@ -9,8 +9,8 @@ EVAL test/snapshots/production-bundles/cubes.js
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 80k
MALLOC_COUNT = 14208
ALIVE_OBJS_DELTA ~= 3.56k
MALLOC_COUNT = 14292
ALIVE_OBJS_DELTA ~= 3.58k
CALL onStart()
OPCODES ~= 0k
MALLOC_COUNT = 6
Expand Down Expand Up @@ -1652,4 +1652,4 @@ CALL onUpdate(0.1)
OPCODES ~= 636k
MALLOC_COUNT = 0
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 986.52k bytes
MEMORY_USAGE_COUNT ~= 990.90k bytes
Loading