@dile/ui 2.24.2 → 2.25.1

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.
@@ -16,6 +16,10 @@ export class DileCard extends LitElement {
16
16
  font-weight: var(--dile-card-font-weight, normal);
17
17
  box-shadow: var(--dile-card-box-shadow, 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1));
18
18
  }
19
+ :host([grey]) {
20
+ background-color: var(--dile-card-grey-background-color, #f4f4f4);
21
+ color: var(--dile-card-grey-text-color, #303030);
22
+ }
19
23
  h1, main, footer {
20
24
  padding-right: var(--dile-card-padding-x, 1rem);
21
25
  padding-left: var(--dile-card-padding-x, 1rem);
@@ -0,0 +1 @@
1
+ export { DileWebVisor } from "./src/DileWebVisor.js";
@@ -0,0 +1,123 @@
1
+ import { html, css, LitElement } from "lit";
2
+ import "../../button/button.js";
3
+ import '../../icon/icon.js';
4
+ import { zoomInIcon, zoomOutIcon, cropIcon } from "@dile/icons/index.js";
5
+
6
+ export class DileWebVisor extends LitElement {
7
+
8
+ static styles = css`
9
+ :host {
10
+ display: block;
11
+ border: 1px solid #e0e0e0;
12
+ border-radius: 8px;
13
+ overflow: hidden;
14
+ font-family: sans-serif;
15
+ background: #f5f5f5;
16
+ }
17
+
18
+ .toolbar {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: space-between;
22
+ padding: 8px 12px;
23
+ background: #ffffff;
24
+ border-bottom: 1px solid #e0e0e0;
25
+ }
26
+
27
+ .controls {
28
+ display: flex;
29
+ gap: 8px;
30
+ }
31
+
32
+ iframe {
33
+ width: 100%;
34
+ height: 100%;
35
+ border: none;
36
+ transform-origin: 0 0;
37
+ transition: transform 0.2s ease-in-out;
38
+ }
39
+
40
+ .zoom {
41
+ --dile-icon-color: #000000;
42
+ }
43
+ `;
44
+ static properties = {
45
+ url: { type: String },
46
+ title: { type: String },
47
+ _zoom: { type: Number }
48
+ };
49
+
50
+ constructor() {
51
+ super();
52
+ this.url = "";
53
+ this.title = "";
54
+ this._zoom = 1;
55
+ }
56
+
57
+ render() {
58
+ return html`
59
+ <div class="web-visor">
60
+ ${this._toolbarTemplate}
61
+ ${this._webTemplate}
62
+ </div>
63
+ `;
64
+ }
65
+
66
+ get _toolbarTemplate() {
67
+ return html`
68
+ <div class="toolbar">
69
+ <span class="url-display">${this.title}</span>
70
+ <div class="controls">
71
+ <dile-button @click=${this._zoomOut}>
72
+ <dile-icon class="zoom" .icon=${zoomOutIcon}></dile-icon>
73
+ </dile-button>
74
+ <dile-button @click=${this._zoomIn}>
75
+ <dile-icon class="zoom" .icon=${zoomInIcon}></dile-icon>
76
+ </dile-button>
77
+ <dile-button @click=${this._toggleFullScreen}>
78
+ <dile-icon class="zoom" .icon=${cropIcon}></dile-icon>
79
+ </dile-button>
80
+ </div>
81
+ </div>
82
+ `;
83
+ }
84
+
85
+ get _webTemplate() {
86
+ return html`
87
+ <iframe
88
+ src="${this.url}"
89
+ style="transform: scale(${this._zoom}); width: ${100 / this._zoom}%; height: ${100 / this._zoom}%;"
90
+ title=${this.title}
91
+ ></iframe>
92
+ `;
93
+ }
94
+
95
+ _toggleFullScreen() {
96
+ const target = this.renderRoot?.querySelector(".web-visor");
97
+ if (!target) return;
98
+
99
+ const isFullscreen = document.fullscreenElement || document.webkitFullscreenElement;
100
+
101
+ if (!isFullscreen) {
102
+ const request = target.requestFullscreen || target.webkitRequestFullscreen;
103
+ if (request) {
104
+ request.call(target).catch?.((err) => {
105
+ console.error("Error al entrar en pantalla completa:", err);
106
+ });
107
+ }
108
+ } else {
109
+ const exit = document.exitFullscreen || document.webkitExitFullscreen;
110
+ if (exit) {
111
+ exit.call(document);
112
+ }
113
+ }
114
+ }
115
+
116
+ _zoomIn() {
117
+ this._zoom += 0.1;
118
+ }
119
+
120
+ _zoomOut() {
121
+ if (this._zoom > 0.2) this._zoom -= 0.1;
122
+ }
123
+ }
@@ -0,0 +1,3 @@
1
+ import { DileWebVisor } from "./src/DileWebVisor.js";
2
+
3
+ window.customElements.define("dile-web-visor", DileWebVisor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/ui",
3
- "version": "2.24.2",
3
+ "version": "2.25.1",
4
4
  "description": "UI Core components from dile-components.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "1fd283a53d99d94277dd1f3f2e3bd4b0304e9187"
29
+ "gitHead": "b2cab50d88bfaa12d23e9189ea089c8fa4d0af6b"
30
30
  }