@inglorious/logo 3.0.2 → 3.0.4
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/README.md +1 -1
- package/package.json +2 -2
- package/src/style.css +4 -2
- package/src/template.js +18 -8
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Import the package and its stylesheet, and (optionally) the types for TypeScript
|
|
|
21
21
|
Then, register the `logo` type in your store, create an entity of that type, and use `api.render(entityId)` inside your templates (see the [`web-logo`](https://github.com/IngloriousCoderz/inglorious-forge/tree/main/examples/apps/web-logo) demo app).
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
import { createStore } from "@inglorious/
|
|
24
|
+
import { createStore } from "@inglorious/store"
|
|
25
25
|
import { logo } from "@inglorious/logo"
|
|
26
26
|
import "@inglorious/logo/style.css"
|
|
27
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/logo",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "The Inglorious Coderz logo, remade to be compatible with Inglorious Web.",
|
|
5
5
|
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"**/*.css"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@inglorious/web": "
|
|
47
|
+
"@inglorious/web": "6.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"prettier": "^3.6.2",
|
package/src/style.css
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&.left {
|
|
24
|
-
transform: rotateY(0deg) translateZ(var(--z-translation))
|
|
24
|
+
transform: rotateY(0deg) translateZ(var(--z-translation))
|
|
25
|
+
skew(calc(1 * var(--skew)));
|
|
25
26
|
|
|
26
27
|
> img {
|
|
27
28
|
transform: var(--left-face-flip);
|
|
@@ -29,7 +30,8 @@
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
&.right {
|
|
32
|
-
transform: rotateY(90deg) translateZ(var(--z-translation))
|
|
33
|
+
transform: rotateY(90deg) translateZ(var(--z-translation))
|
|
34
|
+
skew(calc(-1 * var(--skew)));
|
|
33
35
|
|
|
34
36
|
> img {
|
|
35
37
|
transform: var(--right-face-flip);
|
package/src/template.js
CHANGED
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
* @property {boolean} [isScrollPrevented]
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { html
|
|
17
|
+
import { html } from "@inglorious/web"
|
|
18
|
+
import { styleMap } from "@inglorious/web/directives/style-map"
|
|
19
|
+
import { when } from "@inglorious/web/directives/when"
|
|
18
20
|
|
|
19
21
|
import eye from "./assets/eye.svg"
|
|
20
22
|
import * as faces from "./assets/faces/index.js"
|
|
21
23
|
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
+
const DEFAULT_POSITION = [0, 0] // eslint-disable-line no-magic-numbers
|
|
25
|
+
const DEFAULT_ROTATION = [-45, -40] // eslint-disable-line no-magic-numbers
|
|
24
26
|
const DEFAULT_SIZE = 256
|
|
25
|
-
const
|
|
27
|
+
const DEFAULT_SKEW = 12
|
|
26
28
|
const STEP = 0.001
|
|
27
29
|
const HALF = 0.5
|
|
28
30
|
|
|
@@ -34,7 +36,14 @@ const HALF = 0.5
|
|
|
34
36
|
* @returns {import('lit-html').TemplateResult}
|
|
35
37
|
*/
|
|
36
38
|
export function render(entity) {
|
|
37
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
size = DEFAULT_SIZE,
|
|
41
|
+
position = DEFAULT_POSITION,
|
|
42
|
+
rotation = DEFAULT_ROTATION,
|
|
43
|
+
skew = DEFAULT_SKEW,
|
|
44
|
+
} = entity
|
|
45
|
+
const [x, y] = position
|
|
46
|
+
const [hRotation, vRotation] = rotation
|
|
38
47
|
const [left, right] = entity.faces
|
|
39
48
|
|
|
40
49
|
return html`<div
|
|
@@ -42,12 +51,13 @@ export function render(entity) {
|
|
|
42
51
|
style=${styleMap({
|
|
43
52
|
"--size": `${size}px`,
|
|
44
53
|
"--transform": `scaleY(1.2) translateZ(-${size}px) rotateX(${
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
rotateY(${
|
|
54
|
+
vRotation - STEP * y
|
|
55
|
+
}deg)
|
|
56
|
+
rotateY(${hRotation + STEP * x}deg)`,
|
|
48
57
|
"--z-translation": `${size * HALF}px`,
|
|
49
58
|
"--left-face-flip": left.reverse ? "rotateY(180deg)" : "none",
|
|
50
59
|
"--right-face-flip": right.reverse ? "rotateY(180deg)" : "none",
|
|
60
|
+
"--skew": `${skew}deg`,
|
|
51
61
|
})}
|
|
52
62
|
>
|
|
53
63
|
<div class="iw-logo-cube">
|