zen-wdg 2.2.7 → 2.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/components/UI/Button.vue.d.ts +1 -1
- package/dist/components/UI/Input.vue.d.ts +1 -1
- package/dist/components/ZModal.vue.d.ts +155 -0
- package/dist/widgets/z-calendar-widget.vue.d.ts +84 -0
- package/dist/widgets/z-marked-widget.vue.d.ts +9 -6
- package/dist/widgets/z-notes-widget.vue.d.ts +42 -0
- package/dist/widgets/z-weather-widget.vue.d.ts +22 -0
- package/dist/zen-wdg.css +1 -1
- package/dist/zen-wdg.es.js +2159 -140
- package/dist/zen-wdg.umd.js +1 -1
- package/package.json +1 -1
- package/src/index.js +34 -2
- package/src/widgets/z-calendar-widget.vue +990 -0
- package/src/widgets/z-marked-widget.vue +143 -38
- package/src/widgets/z-notes-widget.vue +1073 -0
- package/src/widgets/z-search-widget.vue +2 -2
- package/src/widgets/z-weather-widget.vue +530 -0
package/dist/zen-wdg.es.js
CHANGED
|
@@ -17,7 +17,39 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
import { createElementBlock, openBlock, createElementVNode, createTextVNode, toDisplayString, normalizeClass, withKeys, defineComponent, ref, shallowRef, onMounted, watch, onUnmounted, h, nextTick, resolveComponent, normalizeStyle, createBlock, createCommentVNode, Fragment, renderList, createVNode, withModifiers, withDirectives, vModelText, vModelCheckbox, vModelSelect, Transition, withCtx, TransitionGroup, defineCustomElement } from "vue";
|
|
21
53
|
const _export_sfc = (sfc, props) => {
|
|
22
54
|
const target = sfc.__vccOpts || sfc;
|
|
23
55
|
for (const [key, val] of props) {
|
|
@@ -25,7 +57,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
25
57
|
}
|
|
26
58
|
return target;
|
|
27
59
|
};
|
|
28
|
-
const _sfc_main$
|
|
60
|
+
const _sfc_main$9 = {
|
|
29
61
|
name: "ZClockWidget",
|
|
30
62
|
data() {
|
|
31
63
|
return {
|
|
@@ -76,26 +108,26 @@ const _sfc_main$6 = {
|
|
|
76
108
|
}
|
|
77
109
|
}
|
|
78
110
|
};
|
|
79
|
-
const _hoisted_1$
|
|
80
|
-
const _hoisted_2$
|
|
81
|
-
const _hoisted_3$
|
|
82
|
-
const _hoisted_4$
|
|
83
|
-
function _sfc_render$
|
|
84
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
85
|
-
createElementVNode("div", _hoisted_2$
|
|
86
|
-
createElementVNode("div", _hoisted_3$
|
|
111
|
+
const _hoisted_1$8 = { class: "clock-container" };
|
|
112
|
+
const _hoisted_2$7 = { class: "clock" };
|
|
113
|
+
const _hoisted_3$6 = { class: "time" };
|
|
114
|
+
const _hoisted_4$6 = { class: "date" };
|
|
115
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
117
|
+
createElementVNode("div", _hoisted_2$7, [
|
|
118
|
+
createElementVNode("div", _hoisted_3$6, [
|
|
87
119
|
createElementVNode("span", null, toDisplayString($data.hours), 1),
|
|
88
120
|
_cache[0] || (_cache[0] = createTextVNode(":", -1)),
|
|
89
121
|
createElementVNode("span", null, toDisplayString($data.minutes), 1)
|
|
90
122
|
]),
|
|
91
|
-
createElementVNode("div", _hoisted_4$
|
|
123
|
+
createElementVNode("div", _hoisted_4$6, [
|
|
92
124
|
createElementVNode("span", null, toDisplayString($data.dayOfWeek) + ", " + toDisplayString($data.day) + " " + toDisplayString($data.month) + " " + toDisplayString($data.year), 1)
|
|
93
125
|
])
|
|
94
126
|
])
|
|
95
127
|
]);
|
|
96
128
|
}
|
|
97
|
-
const ZClockWidget = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
98
|
-
const _sfc_main$
|
|
129
|
+
const ZClockWidget = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-e9445086"]]);
|
|
130
|
+
const _sfc_main$8 = {
|
|
99
131
|
data() {
|
|
100
132
|
return {};
|
|
101
133
|
},
|
|
@@ -126,8 +158,8 @@ const _sfc_main$5 = {
|
|
|
126
158
|
}
|
|
127
159
|
}
|
|
128
160
|
};
|
|
129
|
-
const _hoisted_1$
|
|
130
|
-
function _sfc_render$
|
|
161
|
+
const _hoisted_1$7 = ["placeholder", "value"];
|
|
162
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
131
163
|
return openBlock(), createElementBlock("input", {
|
|
132
164
|
placeholder: $props.placeholder,
|
|
133
165
|
value: $props.modelValue,
|
|
@@ -138,9 +170,9 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
138
170
|
{ "round": $props.round },
|
|
139
171
|
{ "rounded": $props.rounded }
|
|
140
172
|
])
|
|
141
|
-
}, null, 42, _hoisted_1$
|
|
173
|
+
}, null, 42, _hoisted_1$7);
|
|
142
174
|
}
|
|
143
|
-
const Input = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
175
|
+
const Input = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-2ad90286"]]);
|
|
144
176
|
const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
145
177
|
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
146
178
|
const colonSeparated = value.split(":");
|
|
@@ -1788,7 +1820,7 @@ const Icon = defineComponent((props, { emit }) => {
|
|
|
1788
1820
|
],
|
|
1789
1821
|
emits: ["load"]
|
|
1790
1822
|
});
|
|
1791
|
-
const _sfc_main$
|
|
1823
|
+
const _sfc_main$7 = {
|
|
1792
1824
|
data() {
|
|
1793
1825
|
return {};
|
|
1794
1826
|
},
|
|
@@ -1842,7 +1874,7 @@ const _sfc_main$4 = {
|
|
|
1842
1874
|
},
|
|
1843
1875
|
methods: {}
|
|
1844
1876
|
};
|
|
1845
|
-
function _sfc_render$
|
|
1877
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1846
1878
|
const _component_Icon = resolveComponent("Icon");
|
|
1847
1879
|
return openBlock(), createElementBlock("button", {
|
|
1848
1880
|
class: normalizeClass(
|
|
@@ -1873,8 +1905,8 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1873
1905
|
}, null, 8, ["icon", "width", "height"])) : createCommentVNode("", true)
|
|
1874
1906
|
], 6);
|
|
1875
1907
|
}
|
|
1876
|
-
const Button = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1877
|
-
const _sfc_main$
|
|
1908
|
+
const Button = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-10678914"]]);
|
|
1909
|
+
const _sfc_main$6 = {
|
|
1878
1910
|
name: "Dropdown",
|
|
1879
1911
|
props: {
|
|
1880
1912
|
modelValue: Object,
|
|
@@ -1928,58 +1960,58 @@ const _sfc_main$3 = {
|
|
|
1928
1960
|
document.removeEventListener("click", this.handleClickOutside);
|
|
1929
1961
|
}
|
|
1930
1962
|
};
|
|
1931
|
-
const _hoisted_1$
|
|
1963
|
+
const _hoisted_1$6 = {
|
|
1932
1964
|
class: "container",
|
|
1933
1965
|
ref: "dropdown"
|
|
1934
1966
|
};
|
|
1935
|
-
const _hoisted_2$
|
|
1936
|
-
const _hoisted_3$
|
|
1937
|
-
const _hoisted_4$
|
|
1967
|
+
const _hoisted_2$6 = { key: 0 };
|
|
1968
|
+
const _hoisted_3$5 = ["src"];
|
|
1969
|
+
const _hoisted_4$5 = {
|
|
1938
1970
|
key: 1,
|
|
1939
1971
|
class: "placeholder"
|
|
1940
1972
|
};
|
|
1941
|
-
const _hoisted_5$
|
|
1973
|
+
const _hoisted_5$5 = {
|
|
1942
1974
|
key: 0,
|
|
1943
1975
|
class: "column list"
|
|
1944
1976
|
};
|
|
1945
|
-
const _hoisted_6$
|
|
1946
|
-
const _hoisted_7$
|
|
1947
|
-
const _hoisted_8$
|
|
1948
|
-
const _hoisted_9$
|
|
1949
|
-
function _sfc_render$
|
|
1950
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1977
|
+
const _hoisted_6$5 = ["onClick"];
|
|
1978
|
+
const _hoisted_7$5 = { key: 0 };
|
|
1979
|
+
const _hoisted_8$5 = ["src"];
|
|
1980
|
+
const _hoisted_9$5 = { key: 1 };
|
|
1981
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1982
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
1951
1983
|
createElementVNode("div", {
|
|
1952
1984
|
class: "row select",
|
|
1953
1985
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.toggleDropdown && $options.toggleDropdown(...args))
|
|
1954
1986
|
}, [
|
|
1955
|
-
$options.selected ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
1987
|
+
$options.selected ? (openBlock(), createElementBlock("span", _hoisted_2$6, [
|
|
1956
1988
|
$options.selected.logo ? (openBlock(), createElementBlock("img", {
|
|
1957
1989
|
key: 0,
|
|
1958
1990
|
src: $options.selected.logo,
|
|
1959
1991
|
class: "logo"
|
|
1960
|
-
}, null, 8, _hoisted_3$
|
|
1961
|
-
])) : (openBlock(), createElementBlock("span", _hoisted_4$
|
|
1992
|
+
}, null, 8, _hoisted_3$5)) : createCommentVNode("", true)
|
|
1993
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_4$5, "Selecciona una opción"))
|
|
1962
1994
|
]),
|
|
1963
|
-
$data.isOpen ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
1995
|
+
$data.isOpen ? (openBlock(), createElementBlock("div", _hoisted_5$5, [
|
|
1964
1996
|
(openBlock(true), createElementBlock(Fragment, null, renderList($props.options, (item, index) => {
|
|
1965
1997
|
return openBlock(), createElementBlock("div", {
|
|
1966
1998
|
class: normalizeClass(["item row", { "active": item.id == $options.selected.id }]),
|
|
1967
1999
|
onClick: ($event) => $options.selectItem(item)
|
|
1968
2000
|
}, [
|
|
1969
|
-
item.logo ? (openBlock(), createElementBlock("span", _hoisted_7$
|
|
2001
|
+
item.logo ? (openBlock(), createElementBlock("span", _hoisted_7$5, [
|
|
1970
2002
|
createElementVNode("img", {
|
|
1971
2003
|
src: item.logo,
|
|
1972
2004
|
class: "logo"
|
|
1973
|
-
}, null, 8, _hoisted_8$
|
|
2005
|
+
}, null, 8, _hoisted_8$5)
|
|
1974
2006
|
])) : createCommentVNode("", true),
|
|
1975
|
-
item.label ? (openBlock(), createElementBlock("span", _hoisted_9$
|
|
1976
|
-
], 10, _hoisted_6$
|
|
2007
|
+
item.label ? (openBlock(), createElementBlock("span", _hoisted_9$5, toDisplayString(item.label), 1)) : createCommentVNode("", true)
|
|
2008
|
+
], 10, _hoisted_6$5);
|
|
1977
2009
|
}), 256))
|
|
1978
2010
|
])) : createCommentVNode("", true)
|
|
1979
2011
|
], 512);
|
|
1980
2012
|
}
|
|
1981
|
-
const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1982
|
-
const _sfc_main$
|
|
2013
|
+
const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-d1389195"]]);
|
|
2014
|
+
const _sfc_main$5 = {
|
|
1983
2015
|
name: "ZSearchWidget",
|
|
1984
2016
|
data() {
|
|
1985
2017
|
return {
|
|
@@ -1994,8 +2026,8 @@ const _sfc_main$2 = {
|
|
|
1994
2026
|
{
|
|
1995
2027
|
id: 2,
|
|
1996
2028
|
logo: "https://astian.org/wp-content/uploads/2025/06/favicon-1.png",
|
|
1997
|
-
label: "
|
|
1998
|
-
search: "https://astiango.
|
|
2029
|
+
label: "AstianGO",
|
|
2030
|
+
search: "https://astiango.com/?q="
|
|
1999
2031
|
}
|
|
2000
2032
|
],
|
|
2001
2033
|
engine: {
|
|
@@ -2038,14 +2070,14 @@ const _sfc_main$2 = {
|
|
|
2038
2070
|
}
|
|
2039
2071
|
}
|
|
2040
2072
|
};
|
|
2041
|
-
const _hoisted_1$
|
|
2042
|
-
const _hoisted_2$
|
|
2043
|
-
function _sfc_render$
|
|
2073
|
+
const _hoisted_1$5 = { class: "container-search" };
|
|
2074
|
+
const _hoisted_2$5 = { class: "search" };
|
|
2075
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2044
2076
|
const _component_Dropdown = resolveComponent("Dropdown");
|
|
2045
2077
|
const _component_Input = resolveComponent("Input");
|
|
2046
2078
|
const _component_Button = resolveComponent("Button");
|
|
2047
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2048
|
-
createElementVNode("div", _hoisted_2$
|
|
2079
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
2080
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
2049
2081
|
createElementVNode("div", null, [
|
|
2050
2082
|
createVNode(_component_Dropdown, {
|
|
2051
2083
|
options: $data.engines,
|
|
@@ -2071,8 +2103,8 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2071
2103
|
])
|
|
2072
2104
|
]);
|
|
2073
2105
|
}
|
|
2074
|
-
const ZSearchWidget = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2075
|
-
const _sfc_main$
|
|
2106
|
+
const ZSearchWidget = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-834a689a"]]);
|
|
2107
|
+
const _sfc_main$4 = {
|
|
2076
2108
|
name: "ZTodoWidget",
|
|
2077
2109
|
data() {
|
|
2078
2110
|
return {
|
|
@@ -2100,24 +2132,24 @@ const _sfc_main$1 = {
|
|
|
2100
2132
|
}
|
|
2101
2133
|
}
|
|
2102
2134
|
};
|
|
2103
|
-
const _hoisted_1$
|
|
2104
|
-
const _hoisted_2$
|
|
2105
|
-
const _hoisted_3$
|
|
2135
|
+
const _hoisted_1$4 = { class: "todo-widget" };
|
|
2136
|
+
const _hoisted_2$4 = { class: "task-section" };
|
|
2137
|
+
const _hoisted_3$4 = {
|
|
2106
2138
|
key: 0,
|
|
2107
2139
|
class: "empty"
|
|
2108
2140
|
};
|
|
2109
|
-
const _hoisted_4$
|
|
2110
|
-
const _hoisted_5$
|
|
2111
|
-
const _hoisted_6$
|
|
2112
|
-
const _hoisted_7$
|
|
2113
|
-
const _hoisted_8$
|
|
2141
|
+
const _hoisted_4$4 = { class: "actions" };
|
|
2142
|
+
const _hoisted_5$4 = ["onClick"];
|
|
2143
|
+
const _hoisted_6$4 = ["onClick"];
|
|
2144
|
+
const _hoisted_7$4 = { class: "task-section completed" };
|
|
2145
|
+
const _hoisted_8$4 = {
|
|
2114
2146
|
key: 0,
|
|
2115
2147
|
class: "empty"
|
|
2116
2148
|
};
|
|
2117
|
-
const _hoisted_9$
|
|
2118
|
-
const _hoisted_10$
|
|
2119
|
-
function _sfc_render$
|
|
2120
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2149
|
+
const _hoisted_9$4 = { class: "done" };
|
|
2150
|
+
const _hoisted_10$4 = ["onClick"];
|
|
2151
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2152
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
2121
2153
|
_cache[5] || (_cache[5] = createElementVNode("h2", { class: "title" }, "📝 Mis Tareas", -1)),
|
|
2122
2154
|
createElementVNode("form", {
|
|
2123
2155
|
onSubmit: _cache[1] || (_cache[1] = withModifiers((...args) => $options.addTask && $options.addTask(...args), ["prevent"])),
|
|
@@ -2132,45 +2164,45 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2132
2164
|
]),
|
|
2133
2165
|
_cache[2] || (_cache[2] = createElementVNode("button", { type: "submit" }, "Agregar", -1))
|
|
2134
2166
|
], 32),
|
|
2135
|
-
createElementVNode("div", _hoisted_2$
|
|
2167
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
2136
2168
|
_cache[3] || (_cache[3] = createElementVNode("h3", null, "Tareas Pendientes", -1)),
|
|
2137
|
-
$data.pendingTasks.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
2169
|
+
$data.pendingTasks.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_3$4, "Sin tareas.")) : createCommentVNode("", true),
|
|
2138
2170
|
createElementVNode("ul", null, [
|
|
2139
2171
|
(openBlock(true), createElementBlock(Fragment, null, renderList($data.pendingTasks, (task, index) => {
|
|
2140
2172
|
return openBlock(), createElementBlock("li", { key: index }, [
|
|
2141
2173
|
createElementVNode("span", null, toDisplayString(task.text), 1),
|
|
2142
|
-
createElementVNode("div", _hoisted_4$
|
|
2174
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
2143
2175
|
createElementVNode("button", {
|
|
2144
2176
|
onClick: ($event) => $options.completeTask(index)
|
|
2145
|
-
}, "✔️", 8, _hoisted_5$
|
|
2177
|
+
}, "✔️", 8, _hoisted_5$4),
|
|
2146
2178
|
createElementVNode("button", {
|
|
2147
2179
|
onClick: ($event) => $options.deleteTask(index)
|
|
2148
|
-
}, "🗑️", 8, _hoisted_6$
|
|
2180
|
+
}, "🗑️", 8, _hoisted_6$4)
|
|
2149
2181
|
])
|
|
2150
2182
|
]);
|
|
2151
2183
|
}), 128))
|
|
2152
2184
|
])
|
|
2153
2185
|
]),
|
|
2154
|
-
createElementVNode("div", _hoisted_7$
|
|
2186
|
+
createElementVNode("div", _hoisted_7$4, [
|
|
2155
2187
|
_cache[4] || (_cache[4] = createElementVNode("h3", null, "Completadas", -1)),
|
|
2156
|
-
$data.completedTasks.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
2188
|
+
$data.completedTasks.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8$4, "Ninguna aún.")) : createCommentVNode("", true),
|
|
2157
2189
|
createElementVNode("ul", null, [
|
|
2158
2190
|
(openBlock(true), createElementBlock(Fragment, null, renderList($data.completedTasks, (task, index) => {
|
|
2159
2191
|
return openBlock(), createElementBlock("li", {
|
|
2160
2192
|
key: "c" + index
|
|
2161
2193
|
}, [
|
|
2162
|
-
createElementVNode("span", _hoisted_9$
|
|
2194
|
+
createElementVNode("span", _hoisted_9$4, toDisplayString(task.text), 1),
|
|
2163
2195
|
createElementVNode("button", {
|
|
2164
2196
|
onClick: ($event) => $options.deleteCompleted(index)
|
|
2165
|
-
}, "❌", 8, _hoisted_10$
|
|
2197
|
+
}, "❌", 8, _hoisted_10$4)
|
|
2166
2198
|
]);
|
|
2167
2199
|
}), 128))
|
|
2168
2200
|
])
|
|
2169
2201
|
])
|
|
2170
2202
|
]);
|
|
2171
2203
|
}
|
|
2172
|
-
const ZTodoWidget = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2173
|
-
const _sfc_main = {
|
|
2204
|
+
const ZTodoWidget = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-3560194d"]]);
|
|
2205
|
+
const _sfc_main$3 = {
|
|
2174
2206
|
name: "ZMarkedWidget",
|
|
2175
2207
|
props: {
|
|
2176
2208
|
theme: {
|
|
@@ -2201,71 +2233,71 @@ const _sfc_main = {
|
|
|
2201
2233
|
{
|
|
2202
2234
|
title: "Astian",
|
|
2203
2235
|
url: "https://astian.org/",
|
|
2204
|
-
|
|
2236
|
+
domain: "astian.org"
|
|
2205
2237
|
},
|
|
2206
2238
|
{
|
|
2207
2239
|
title: "Amazon",
|
|
2208
2240
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM9HD56Q0VD2QZXQ2AR505&url=https%3A%2F%2Famazon.com",
|
|
2209
|
-
|
|
2241
|
+
domain: "amazon.com"
|
|
2210
2242
|
},
|
|
2211
2243
|
{
|
|
2212
2244
|
title: "Avast",
|
|
2213
2245
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM8H9350F4CBP07A8V7C5T&url=http%3A%2F%2Favast.com%2F",
|
|
2214
|
-
|
|
2246
|
+
domain: "avast.com"
|
|
2215
2247
|
},
|
|
2216
2248
|
{
|
|
2217
2249
|
title: "Youtube",
|
|
2218
2250
|
url: "https://youtube.com",
|
|
2219
|
-
|
|
2251
|
+
domain: "youtube.com"
|
|
2220
2252
|
},
|
|
2221
2253
|
{
|
|
2222
2254
|
title: "Instagram",
|
|
2223
2255
|
url: "https://instagram.com",
|
|
2224
|
-
|
|
2256
|
+
domain: "instagram.com"
|
|
2225
2257
|
},
|
|
2226
2258
|
{
|
|
2227
2259
|
title: "Wish.com",
|
|
2228
2260
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM8H9350F4CBP07A8V7C5T&url=http%3A%2F%2Fwish.com",
|
|
2229
|
-
|
|
2261
|
+
domain: "wish.com"
|
|
2230
2262
|
},
|
|
2231
2263
|
{
|
|
2232
2264
|
title: "Prime",
|
|
2233
2265
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM8H9350F4CBP07A8V7C5T&url=http%3A%2F%2Fprimevideo.com",
|
|
2234
|
-
|
|
2266
|
+
domain: "primevideo.com"
|
|
2235
2267
|
},
|
|
2236
2268
|
{
|
|
2237
2269
|
title: "Shein",
|
|
2238
2270
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM8H9350F4CBP07A8V7C5T&url=http%3A%2F%2Fshein.com",
|
|
2239
|
-
|
|
2271
|
+
domain: "shein.com"
|
|
2240
2272
|
}
|
|
2241
2273
|
],
|
|
2242
2274
|
Work: [
|
|
2243
2275
|
{
|
|
2244
2276
|
title: "GitHub",
|
|
2245
2277
|
url: "https://github.com",
|
|
2246
|
-
|
|
2278
|
+
domain: "github.com"
|
|
2247
2279
|
},
|
|
2248
2280
|
{
|
|
2249
2281
|
title: "Notion",
|
|
2250
2282
|
url: "https://notion.so",
|
|
2251
|
-
|
|
2283
|
+
domain: "notion.so"
|
|
2252
2284
|
}
|
|
2253
2285
|
],
|
|
2254
2286
|
Study: [
|
|
2255
2287
|
{
|
|
2256
2288
|
title: "MDN Web Docs",
|
|
2257
2289
|
url: "https://developer.mozilla.org",
|
|
2258
|
-
|
|
2290
|
+
domain: "mozilla.org"
|
|
2259
2291
|
},
|
|
2260
2292
|
{
|
|
2261
2293
|
title: "FreeCodeCamp",
|
|
2262
2294
|
url: "https://freecodecamp.org",
|
|
2263
|
-
|
|
2295
|
+
domain: "freecodecamp.org"
|
|
2264
2296
|
},
|
|
2265
2297
|
{
|
|
2266
2298
|
title: "Udemy",
|
|
2267
2299
|
url: "https://r.v2i8b.com/api/v1/bid/redirect?campaign_id=01JVSM8H9350F4CBP07A8V7C5T&url=http%3A%2F%2Fudemy.com%2F",
|
|
2268
|
-
|
|
2300
|
+
domain: "udemy.com"
|
|
2269
2301
|
}
|
|
2270
2302
|
]
|
|
2271
2303
|
};
|
|
@@ -2273,7 +2305,8 @@ const _sfc_main = {
|
|
|
2273
2305
|
return {
|
|
2274
2306
|
STORAGE_KEY,
|
|
2275
2307
|
bookmarks,
|
|
2276
|
-
activeTab: "Personal"
|
|
2308
|
+
activeTab: "Personal",
|
|
2309
|
+
faviconAttempts: {}
|
|
2277
2310
|
};
|
|
2278
2311
|
},
|
|
2279
2312
|
computed: {
|
|
@@ -2298,38 +2331,109 @@ const _sfc_main = {
|
|
|
2298
2331
|
}
|
|
2299
2332
|
},
|
|
2300
2333
|
deleteBookmark(index) {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2334
|
+
return __async(this, null, function* () {
|
|
2335
|
+
const item = this.bookmarks[this.activeTab][index];
|
|
2336
|
+
const confirmed = yield window.ZenModals.showDeleteConfirm(item.title);
|
|
2337
|
+
if (confirmed) {
|
|
2338
|
+
this.bookmarks[this.activeTab].splice(index, 1);
|
|
2339
|
+
this.saveState();
|
|
2340
|
+
}
|
|
2341
|
+
});
|
|
2306
2342
|
},
|
|
2307
2343
|
editBookmark(index) {
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2344
|
+
return __async(this, null, function* () {
|
|
2345
|
+
const item = this.bookmarks[this.activeTab][index];
|
|
2346
|
+
const newTitle = yield window.ZenModals.showPrompt({
|
|
2347
|
+
title: "Editar Marcador",
|
|
2348
|
+
message: "Introduce el nuevo título:",
|
|
2349
|
+
inputDefaultValue: item.title,
|
|
2350
|
+
inputPlaceholder: "Título del marcador"
|
|
2351
|
+
});
|
|
2352
|
+
if (!newTitle) return;
|
|
2353
|
+
const newUrl = yield window.ZenModals.showPrompt({
|
|
2354
|
+
title: "Editar URL",
|
|
2355
|
+
message: "Introduce la nueva URL:",
|
|
2356
|
+
inputDefaultValue: item.url,
|
|
2357
|
+
inputType: "url",
|
|
2358
|
+
inputPlaceholder: "https://ejemplo.com"
|
|
2359
|
+
});
|
|
2360
|
+
if (!newUrl) return;
|
|
2361
|
+
try {
|
|
2362
|
+
item.title = newTitle;
|
|
2363
|
+
item.url = newUrl;
|
|
2364
|
+
item.domain = new URL(newUrl).hostname;
|
|
2365
|
+
delete item.logo;
|
|
2366
|
+
this.saveState();
|
|
2367
|
+
} catch (error) {
|
|
2368
|
+
console.error("URL inválida:", error);
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2317
2371
|
},
|
|
2318
2372
|
addBookmarkPrompt() {
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2373
|
+
return __async(this, null, function* () {
|
|
2374
|
+
const title = yield window.ZenModals.showPrompt({
|
|
2375
|
+
title: "Nuevo Marcador",
|
|
2376
|
+
message: "Introduce el nombre del marcador:",
|
|
2377
|
+
inputPlaceholder: "Nombre del sitio"
|
|
2378
|
+
});
|
|
2379
|
+
if (!title) return;
|
|
2380
|
+
const url = yield window.ZenModals.showPrompt({
|
|
2381
|
+
title: "URL del Marcador",
|
|
2382
|
+
message: "Introduce la URL:",
|
|
2383
|
+
inputType: "url",
|
|
2384
|
+
inputPlaceholder: "https://ejemplo.com"
|
|
2385
|
+
});
|
|
2386
|
+
if (!url) return;
|
|
2387
|
+
try {
|
|
2388
|
+
const domain = new URL(url).hostname;
|
|
2389
|
+
this.bookmarks[this.activeTab].push({ title, url, domain });
|
|
2390
|
+
this.saveState();
|
|
2391
|
+
} catch (error) {
|
|
2392
|
+
console.error("URL inválida:", error);
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
},
|
|
2396
|
+
getFaviconUrl(item) {
|
|
2397
|
+
if (item.logo) return item.logo;
|
|
2398
|
+
const domain = item.domain || this.extractDomain(item.url);
|
|
2399
|
+
const attempt = this.faviconAttempts[domain] || 0;
|
|
2400
|
+
const services = [
|
|
2401
|
+
`https://icons.duckduckgo.com/ip3/${domain}.ico`,
|
|
2402
|
+
`https://www.google.com/s2/favicons?domain=${domain}&sz=128`,
|
|
2403
|
+
`https://logo.clearbit.com/${domain}`,
|
|
2404
|
+
`https://favicons.githubusercontent.com/${domain}`,
|
|
2405
|
+
`https://${domain}/favicon.ico`
|
|
2406
|
+
];
|
|
2407
|
+
return services[Math.min(attempt, services.length - 1)];
|
|
2408
|
+
},
|
|
2409
|
+
extractDomain(url) {
|
|
2410
|
+
try {
|
|
2411
|
+
return new URL(url).hostname;
|
|
2412
|
+
} catch (e) {
|
|
2413
|
+
return url;
|
|
2414
|
+
}
|
|
2415
|
+
},
|
|
2416
|
+
onImageError(event, item) {
|
|
2328
2417
|
const img = event.target;
|
|
2329
|
-
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2332
|
-
|
|
2418
|
+
const domain = item.domain || this.extractDomain(item.url);
|
|
2419
|
+
const currentAttempt = this.faviconAttempts[domain] || 0;
|
|
2420
|
+
if (currentAttempt < 4) {
|
|
2421
|
+
this.faviconAttempts[domain] = currentAttempt + 1;
|
|
2422
|
+
img.src = this.getFaviconUrl(item);
|
|
2423
|
+
} else {
|
|
2424
|
+
img.style.display = "none";
|
|
2425
|
+
const iconContainer = img.parentNode;
|
|
2426
|
+
const colors = ["#066D5A", "#0891b2", "#7c3aed", "#dc2626", "#ea580c", "#ca8a04", "#16a34a"];
|
|
2427
|
+
const colorIndex = item.title.charCodeAt(0) % colors.length;
|
|
2428
|
+
iconContainer.style.backgroundColor = colors[colorIndex];
|
|
2429
|
+
iconContainer.style.display = "flex";
|
|
2430
|
+
iconContainer.style.alignItems = "center";
|
|
2431
|
+
iconContainer.style.justifyContent = "center";
|
|
2432
|
+
iconContainer.style.fontSize = "1.5rem";
|
|
2433
|
+
iconContainer.style.fontWeight = "bold";
|
|
2434
|
+
iconContainer.style.color = "white";
|
|
2435
|
+
iconContainer.textContent = item.title.charAt(0).toUpperCase();
|
|
2436
|
+
}
|
|
2333
2437
|
}
|
|
2334
2438
|
},
|
|
2335
2439
|
watch: {
|
|
@@ -2341,18 +2445,18 @@ const _sfc_main = {
|
|
|
2341
2445
|
}
|
|
2342
2446
|
}
|
|
2343
2447
|
};
|
|
2344
|
-
const _hoisted_1 = { class: "container-marked" };
|
|
2345
|
-
const _hoisted_2 = ["onClick"];
|
|
2346
|
-
const _hoisted_3 = { class: "grid" };
|
|
2347
|
-
const _hoisted_4 = { class: "option-app" };
|
|
2348
|
-
const _hoisted_5 = ["onClick"];
|
|
2349
|
-
const _hoisted_6 = ["onClick"];
|
|
2350
|
-
const _hoisted_7 = ["href", "target"];
|
|
2351
|
-
const _hoisted_8 = { class: "column" };
|
|
2352
|
-
const _hoisted_9 = { class: "logo-container" };
|
|
2353
|
-
const _hoisted_10 = ["src", "alt", "onError"];
|
|
2354
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2355
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
2448
|
+
const _hoisted_1$3 = { class: "container-marked" };
|
|
2449
|
+
const _hoisted_2$3 = ["onClick"];
|
|
2450
|
+
const _hoisted_3$3 = { class: "grid" };
|
|
2451
|
+
const _hoisted_4$3 = { class: "option-app" };
|
|
2452
|
+
const _hoisted_5$3 = ["onClick"];
|
|
2453
|
+
const _hoisted_6$3 = ["onClick"];
|
|
2454
|
+
const _hoisted_7$3 = ["href", "target"];
|
|
2455
|
+
const _hoisted_8$3 = { class: "column" };
|
|
2456
|
+
const _hoisted_9$3 = { class: "logo-container" };
|
|
2457
|
+
const _hoisted_10$3 = ["src", "alt", "onError"];
|
|
2458
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2459
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
2356
2460
|
createElementVNode("div", {
|
|
2357
2461
|
class: normalizeClass(["tabs", [$props.theme == "dark" ? "dark" : "light"]])
|
|
2358
2462
|
}, [
|
|
@@ -2364,43 +2468,43 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2364
2468
|
createElementVNode("button", {
|
|
2365
2469
|
class: normalizeClass(["tab", { active: tab === $data.activeTab }]),
|
|
2366
2470
|
onClick: ($event) => $options.setActiveTab(tab)
|
|
2367
|
-
}, toDisplayString(tab), 11, _hoisted_2)
|
|
2471
|
+
}, toDisplayString(tab), 11, _hoisted_2$3)
|
|
2368
2472
|
]);
|
|
2369
2473
|
}), 128))
|
|
2370
2474
|
], 2),
|
|
2371
|
-
createElementVNode("div", _hoisted_3, [
|
|
2475
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
2372
2476
|
(openBlock(true), createElementBlock(Fragment, null, renderList($options.currentBookmarks, (item, index) => {
|
|
2373
2477
|
return openBlock(), createElementBlock("div", {
|
|
2374
2478
|
key: index,
|
|
2375
2479
|
class: normalizeClass(["card", $props.small ? "small" : ""])
|
|
2376
2480
|
}, [
|
|
2377
|
-
createElementVNode("div", _hoisted_4, [
|
|
2481
|
+
createElementVNode("div", _hoisted_4$3, [
|
|
2378
2482
|
createElementVNode("button", {
|
|
2379
2483
|
class: "edit-app",
|
|
2380
2484
|
onClick: withModifiers(($event) => $options.editBookmark(index), ["prevent"])
|
|
2381
|
-
}, "✏️", 8, _hoisted_5),
|
|
2485
|
+
}, "✏️", 8, _hoisted_5$3),
|
|
2382
2486
|
createElementVNode("button", {
|
|
2383
2487
|
class: "delete-app",
|
|
2384
2488
|
onClick: withModifiers(($event) => $options.deleteBookmark(index), ["prevent"])
|
|
2385
|
-
}, "🗑️", 8, _hoisted_6)
|
|
2489
|
+
}, "🗑️", 8, _hoisted_6$3)
|
|
2386
2490
|
]),
|
|
2387
2491
|
createElementVNode("a", {
|
|
2388
2492
|
href: item.url,
|
|
2389
2493
|
class: normalizeClass(["card-link", $props.theme == "dark" ? "dark" : "light"]),
|
|
2390
2494
|
target: $props.open == "Self Tab" ? "_self" : "_blank"
|
|
2391
2495
|
}, [
|
|
2392
|
-
createElementVNode("div", _hoisted_8, [
|
|
2393
|
-
createElementVNode("div", _hoisted_9, [
|
|
2496
|
+
createElementVNode("div", _hoisted_8$3, [
|
|
2497
|
+
createElementVNode("div", _hoisted_9$3, [
|
|
2394
2498
|
createElementVNode("img", {
|
|
2395
|
-
src: item
|
|
2499
|
+
src: $options.getFaviconUrl(item),
|
|
2396
2500
|
alt: item.title + " logo",
|
|
2397
2501
|
class: normalizeClass({ small: $props.small }),
|
|
2398
|
-
onError: ($event) => $options.onImageError($event, item
|
|
2399
|
-
}, null, 42, _hoisted_10)
|
|
2502
|
+
onError: ($event) => $options.onImageError($event, item)
|
|
2503
|
+
}, null, 42, _hoisted_10$3)
|
|
2400
2504
|
]),
|
|
2401
2505
|
createTextVNode(" " + toDisplayString(item.title), 1)
|
|
2402
2506
|
])
|
|
2403
|
-
], 10, _hoisted_7)
|
|
2507
|
+
], 10, _hoisted_7$3)
|
|
2404
2508
|
], 2);
|
|
2405
2509
|
}), 128)),
|
|
2406
2510
|
$options.currentBookmarks.length < 8 ? (openBlock(), createElementBlock("div", {
|
|
@@ -2421,11 +2525,1907 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2421
2525
|
])
|
|
2422
2526
|
]);
|
|
2423
2527
|
}
|
|
2424
|
-
const ZMarkedWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
2528
|
+
const ZMarkedWidget = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-1625b2ac"]]);
|
|
2529
|
+
const _sfc_main$2 = {
|
|
2530
|
+
name: "ZCalendarWidget",
|
|
2531
|
+
props: {
|
|
2532
|
+
theme: {
|
|
2533
|
+
type: String,
|
|
2534
|
+
default: "light"
|
|
2535
|
+
},
|
|
2536
|
+
useStorage: {
|
|
2537
|
+
type: Boolean,
|
|
2538
|
+
default: true
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
data() {
|
|
2542
|
+
const STORAGE_KEY = "calendar_widget_events";
|
|
2543
|
+
let events = [];
|
|
2544
|
+
if (this.useStorage) {
|
|
2545
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
2546
|
+
events = stored ? JSON.parse(stored) : [];
|
|
2547
|
+
}
|
|
2548
|
+
const emptyForm = {
|
|
2549
|
+
name: "",
|
|
2550
|
+
date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
2551
|
+
startTime: "09:00",
|
|
2552
|
+
endTime: "10:00",
|
|
2553
|
+
color: "#066D5A",
|
|
2554
|
+
isRecurring: false,
|
|
2555
|
+
recurringType: "daily"
|
|
2556
|
+
};
|
|
2557
|
+
return {
|
|
2558
|
+
STORAGE_KEY,
|
|
2559
|
+
currentView: "month",
|
|
2560
|
+
// day, week, month
|
|
2561
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
2562
|
+
showEventModal: false,
|
|
2563
|
+
editingEvent: null,
|
|
2564
|
+
events,
|
|
2565
|
+
eventForm: emptyForm,
|
|
2566
|
+
viewLabels: {
|
|
2567
|
+
day: "Día",
|
|
2568
|
+
week: "Semana",
|
|
2569
|
+
month: "Mes"
|
|
2570
|
+
},
|
|
2571
|
+
dayNames: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
|
|
2572
|
+
colors: ["#066D5A", "#0891b2", "#7c3aed", "#dc2626", "#ea580c", "#ca8a04", "#16a34a", "#ec4899"]
|
|
2573
|
+
};
|
|
2574
|
+
},
|
|
2575
|
+
computed: {
|
|
2576
|
+
currentDateLabel() {
|
|
2577
|
+
const months = [
|
|
2578
|
+
"Enero",
|
|
2579
|
+
"Febrero",
|
|
2580
|
+
"Marzo",
|
|
2581
|
+
"Abril",
|
|
2582
|
+
"Mayo",
|
|
2583
|
+
"Junio",
|
|
2584
|
+
"Julio",
|
|
2585
|
+
"Agosto",
|
|
2586
|
+
"Septiembre",
|
|
2587
|
+
"Octubre",
|
|
2588
|
+
"Noviembre",
|
|
2589
|
+
"Diciembre"
|
|
2590
|
+
];
|
|
2591
|
+
if (this.currentView === "day") {
|
|
2592
|
+
return `${this.currentDate.getDate()} de ${months[this.currentDate.getMonth()]} ${this.currentDate.getFullYear()}`;
|
|
2593
|
+
} else if (this.currentView === "week") {
|
|
2594
|
+
const weekStart = this.getWeekStart(this.currentDate);
|
|
2595
|
+
const weekEnd = new Date(weekStart);
|
|
2596
|
+
weekEnd.setDate(weekEnd.getDate() + 6);
|
|
2597
|
+
return `${weekStart.getDate()} - ${weekEnd.getDate()} ${months[this.currentDate.getMonth()]} ${this.currentDate.getFullYear()}`;
|
|
2598
|
+
} else {
|
|
2599
|
+
return `${months[this.currentDate.getMonth()]} ${this.currentDate.getFullYear()}`;
|
|
2600
|
+
}
|
|
2601
|
+
},
|
|
2602
|
+
weekDays() {
|
|
2603
|
+
const start = this.getWeekStart(this.currentDate);
|
|
2604
|
+
const days = [];
|
|
2605
|
+
for (let i = 0; i < 7; i++) {
|
|
2606
|
+
const date = new Date(start);
|
|
2607
|
+
date.setDate(start.getDate() + i);
|
|
2608
|
+
days.push({
|
|
2609
|
+
date: this.formatDate(date),
|
|
2610
|
+
name: this.dayNames[date.getDay()],
|
|
2611
|
+
number: date.getDate()
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
return days;
|
|
2615
|
+
},
|
|
2616
|
+
monthDays() {
|
|
2617
|
+
const year = this.currentDate.getFullYear();
|
|
2618
|
+
const month = this.currentDate.getMonth();
|
|
2619
|
+
const firstDay = new Date(year, month, 1);
|
|
2620
|
+
const startDate = new Date(firstDay);
|
|
2621
|
+
startDate.setDate(startDate.getDate() - firstDay.getDay());
|
|
2622
|
+
const days = [];
|
|
2623
|
+
const currentDay = new Date(startDate);
|
|
2624
|
+
for (let i = 0; i < 42; i++) {
|
|
2625
|
+
days.push({
|
|
2626
|
+
date: this.formatDate(currentDay),
|
|
2627
|
+
number: currentDay.getDate(),
|
|
2628
|
+
isCurrentMonth: currentDay.getMonth() === month
|
|
2629
|
+
});
|
|
2630
|
+
currentDay.setDate(currentDay.getDate() + 1);
|
|
2631
|
+
}
|
|
2632
|
+
return days;
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
methods: {
|
|
2636
|
+
loadEvents() {
|
|
2637
|
+
if (!this.useStorage) return [];
|
|
2638
|
+
const stored = localStorage.getItem(this.STORAGE_KEY);
|
|
2639
|
+
return stored ? JSON.parse(stored) : [];
|
|
2640
|
+
},
|
|
2641
|
+
saveEvents() {
|
|
2642
|
+
if (this.useStorage) {
|
|
2643
|
+
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(this.events));
|
|
2644
|
+
}
|
|
2645
|
+
},
|
|
2646
|
+
getEmptyForm() {
|
|
2647
|
+
return {
|
|
2648
|
+
name: "",
|
|
2649
|
+
date: this.formatDate(/* @__PURE__ */ new Date()),
|
|
2650
|
+
startTime: "09:00",
|
|
2651
|
+
endTime: "10:00",
|
|
2652
|
+
color: "#066D5A",
|
|
2653
|
+
isRecurring: false,
|
|
2654
|
+
recurringType: "daily"
|
|
2655
|
+
};
|
|
2656
|
+
},
|
|
2657
|
+
formatDate(date) {
|
|
2658
|
+
const d = new Date(date);
|
|
2659
|
+
const year = d.getFullYear();
|
|
2660
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
2661
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
2662
|
+
return `${year}-${month}-${day}`;
|
|
2663
|
+
},
|
|
2664
|
+
formatHour(hour) {
|
|
2665
|
+
return `${String(hour).padStart(2, "0")}:00`;
|
|
2666
|
+
},
|
|
2667
|
+
isToday(dateString) {
|
|
2668
|
+
return dateString === this.formatDate(/* @__PURE__ */ new Date());
|
|
2669
|
+
},
|
|
2670
|
+
getWeekStart(date) {
|
|
2671
|
+
const d = new Date(date);
|
|
2672
|
+
const day = d.getDay();
|
|
2673
|
+
const diff = d.getDate() - day;
|
|
2674
|
+
return new Date(d.setDate(diff));
|
|
2675
|
+
},
|
|
2676
|
+
previousPeriod() {
|
|
2677
|
+
const d = new Date(this.currentDate);
|
|
2678
|
+
if (this.currentView === "day") {
|
|
2679
|
+
d.setDate(d.getDate() - 1);
|
|
2680
|
+
} else if (this.currentView === "week") {
|
|
2681
|
+
d.setDate(d.getDate() - 7);
|
|
2682
|
+
} else {
|
|
2683
|
+
d.setMonth(d.getMonth() - 1);
|
|
2684
|
+
}
|
|
2685
|
+
this.currentDate = d;
|
|
2686
|
+
},
|
|
2687
|
+
nextPeriod() {
|
|
2688
|
+
const d = new Date(this.currentDate);
|
|
2689
|
+
if (this.currentView === "day") {
|
|
2690
|
+
d.setDate(d.getDate() + 1);
|
|
2691
|
+
} else if (this.currentView === "week") {
|
|
2692
|
+
d.setDate(d.getDate() + 7);
|
|
2693
|
+
} else {
|
|
2694
|
+
d.setMonth(d.getMonth() + 1);
|
|
2695
|
+
}
|
|
2696
|
+
this.currentDate = d;
|
|
2697
|
+
},
|
|
2698
|
+
goToToday() {
|
|
2699
|
+
this.currentDate = /* @__PURE__ */ new Date();
|
|
2700
|
+
},
|
|
2701
|
+
selectDay(dateString) {
|
|
2702
|
+
this.currentDate = new Date(dateString);
|
|
2703
|
+
this.currentView = "day";
|
|
2704
|
+
},
|
|
2705
|
+
getEventsForDay(dateString) {
|
|
2706
|
+
return this.events.filter((event) => {
|
|
2707
|
+
if (event.date === dateString) return true;
|
|
2708
|
+
if (event.isRecurring) {
|
|
2709
|
+
const eventDate = new Date(event.date);
|
|
2710
|
+
const checkDate = new Date(dateString);
|
|
2711
|
+
if (checkDate < eventDate) return false;
|
|
2712
|
+
if (event.recurringType === "daily") return true;
|
|
2713
|
+
if (event.recurringType === "weekly") {
|
|
2714
|
+
return eventDate.getDay() === checkDate.getDay();
|
|
2715
|
+
}
|
|
2716
|
+
if (event.recurringType === "monthly") {
|
|
2717
|
+
return eventDate.getDate() === checkDate.getDate();
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
return false;
|
|
2721
|
+
});
|
|
2722
|
+
},
|
|
2723
|
+
getEventsForHour(dateString, hour) {
|
|
2724
|
+
return this.getEventsForDay(dateString).filter((event) => {
|
|
2725
|
+
const startHour = parseInt(event.startTime.split(":")[0]);
|
|
2726
|
+
const endHour = parseInt(event.endTime.split(":")[0]);
|
|
2727
|
+
return hour >= startHour && hour < endHour;
|
|
2728
|
+
});
|
|
2729
|
+
},
|
|
2730
|
+
saveEvent() {
|
|
2731
|
+
return __async(this, null, function* () {
|
|
2732
|
+
if (!this.eventForm.name) {
|
|
2733
|
+
yield window.ZenModals.showWarning({
|
|
2734
|
+
title: "Nombre requerido",
|
|
2735
|
+
message: "Por favor, ingresa un nombre para el evento"
|
|
2736
|
+
});
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
if (this.editingEvent) {
|
|
2740
|
+
const index = this.events.findIndex((e) => e.id === this.editingEvent.id);
|
|
2741
|
+
this.events[index] = __spreadProps(__spreadValues({}, this.eventForm), { id: this.editingEvent.id });
|
|
2742
|
+
} else {
|
|
2743
|
+
this.events.push(__spreadProps(__spreadValues({}, this.eventForm), {
|
|
2744
|
+
id: Date.now() + Math.random()
|
|
2745
|
+
}));
|
|
2746
|
+
}
|
|
2747
|
+
this.saveEvents();
|
|
2748
|
+
this.closeModal();
|
|
2749
|
+
});
|
|
2750
|
+
},
|
|
2751
|
+
editEvent(event) {
|
|
2752
|
+
this.editingEvent = event;
|
|
2753
|
+
this.eventForm = __spreadValues({}, event);
|
|
2754
|
+
this.showEventModal = true;
|
|
2755
|
+
},
|
|
2756
|
+
deleteEvent() {
|
|
2757
|
+
return __async(this, null, function* () {
|
|
2758
|
+
const confirmed = yield window.ZenModals.showDeleteConfirm("este evento");
|
|
2759
|
+
if (confirmed) {
|
|
2760
|
+
this.events = this.events.filter((e) => e.id !== this.editingEvent.id);
|
|
2761
|
+
this.saveEvents();
|
|
2762
|
+
this.closeModal();
|
|
2763
|
+
}
|
|
2764
|
+
});
|
|
2765
|
+
},
|
|
2766
|
+
closeModal() {
|
|
2767
|
+
this.showEventModal = false;
|
|
2768
|
+
this.editingEvent = null;
|
|
2769
|
+
this.eventForm = this.getEmptyForm();
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
const _hoisted_1$2 = { class: "calendar-header" };
|
|
2774
|
+
const _hoisted_2$2 = { class: "view-selector" };
|
|
2775
|
+
const _hoisted_3$2 = ["onClick"];
|
|
2776
|
+
const _hoisted_4$2 = { class: "navigation" };
|
|
2777
|
+
const _hoisted_5$2 = { class: "current-date" };
|
|
2778
|
+
const _hoisted_6$2 = { class: "calendar-view" };
|
|
2779
|
+
const _hoisted_7$2 = {
|
|
2780
|
+
key: 0,
|
|
2781
|
+
class: "day-view"
|
|
2782
|
+
};
|
|
2783
|
+
const _hoisted_8$2 = { class: "time-grid" };
|
|
2784
|
+
const _hoisted_9$2 = { class: "hour-label" };
|
|
2785
|
+
const _hoisted_10$2 = { class: "hour-content" };
|
|
2786
|
+
const _hoisted_11$2 = ["onClick"];
|
|
2787
|
+
const _hoisted_12$2 = { class: "event-title" };
|
|
2788
|
+
const _hoisted_13$2 = { class: "event-time" };
|
|
2789
|
+
const _hoisted_14$2 = {
|
|
2790
|
+
key: 0,
|
|
2791
|
+
class: "event-recurring"
|
|
2792
|
+
};
|
|
2793
|
+
const _hoisted_15$2 = {
|
|
2794
|
+
key: 1,
|
|
2795
|
+
class: "week-view"
|
|
2796
|
+
};
|
|
2797
|
+
const _hoisted_16$2 = { class: "week-header" };
|
|
2798
|
+
const _hoisted_17$2 = { class: "day-name" };
|
|
2799
|
+
const _hoisted_18$2 = { class: "week-grid" };
|
|
2800
|
+
const _hoisted_19$2 = { class: "week-hour-label" };
|
|
2801
|
+
const _hoisted_20$2 = ["onClick"];
|
|
2802
|
+
const _hoisted_21$2 = { class: "event-title" };
|
|
2803
|
+
const _hoisted_22$2 = {
|
|
2804
|
+
key: 2,
|
|
2805
|
+
class: "month-view"
|
|
2806
|
+
};
|
|
2807
|
+
const _hoisted_23$1 = { class: "month-header" };
|
|
2808
|
+
const _hoisted_24$1 = { class: "month-grid" };
|
|
2809
|
+
const _hoisted_25$1 = ["onClick"];
|
|
2810
|
+
const _hoisted_26$1 = { class: "day-number" };
|
|
2811
|
+
const _hoisted_27$1 = { class: "day-events" };
|
|
2812
|
+
const _hoisted_28$1 = ["title"];
|
|
2813
|
+
const _hoisted_29 = {
|
|
2814
|
+
key: 0,
|
|
2815
|
+
class: "more-events"
|
|
2816
|
+
};
|
|
2817
|
+
const _hoisted_30 = { class: "modal-content" };
|
|
2818
|
+
const _hoisted_31 = { class: "modal-header" };
|
|
2819
|
+
const _hoisted_32 = { class: "modal-body" };
|
|
2820
|
+
const _hoisted_33 = { class: "form-group" };
|
|
2821
|
+
const _hoisted_34 = { class: "form-group" };
|
|
2822
|
+
const _hoisted_35 = { class: "form-row" };
|
|
2823
|
+
const _hoisted_36 = { class: "form-group" };
|
|
2824
|
+
const _hoisted_37 = { class: "form-group" };
|
|
2825
|
+
const _hoisted_38 = { class: "form-group" };
|
|
2826
|
+
const _hoisted_39 = { class: "color-picker" };
|
|
2827
|
+
const _hoisted_40 = ["onClick"];
|
|
2828
|
+
const _hoisted_41 = { class: "form-group" };
|
|
2829
|
+
const _hoisted_42 = { class: "checkbox-label" };
|
|
2830
|
+
const _hoisted_43 = {
|
|
2831
|
+
key: 0,
|
|
2832
|
+
class: "form-group"
|
|
2833
|
+
};
|
|
2834
|
+
const _hoisted_44 = { class: "modal-footer" };
|
|
2835
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2836
|
+
return openBlock(), createElementBlock("div", {
|
|
2837
|
+
class: normalizeClass(["calendar-container", $props.theme === "dark" ? "dark" : "light"])
|
|
2838
|
+
}, [
|
|
2839
|
+
createElementVNode("div", _hoisted_1$2, [
|
|
2840
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
2841
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(["day", "week", "month"], (view) => {
|
|
2842
|
+
return createElementVNode("button", {
|
|
2843
|
+
key: view,
|
|
2844
|
+
class: normalizeClass(["view-btn", { active: $data.currentView === view }]),
|
|
2845
|
+
onClick: ($event) => $data.currentView = view
|
|
2846
|
+
}, toDisplayString($data.viewLabels[view]), 11, _hoisted_3$2);
|
|
2847
|
+
}), 64))
|
|
2848
|
+
]),
|
|
2849
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
2850
|
+
createElementVNode("button", {
|
|
2851
|
+
onClick: _cache[0] || (_cache[0] = (...args) => $options.previousPeriod && $options.previousPeriod(...args)),
|
|
2852
|
+
class: "nav-btn"
|
|
2853
|
+
}, "‹"),
|
|
2854
|
+
createElementVNode("span", _hoisted_5$2, toDisplayString($options.currentDateLabel), 1),
|
|
2855
|
+
createElementVNode("button", {
|
|
2856
|
+
onClick: _cache[1] || (_cache[1] = (...args) => $options.nextPeriod && $options.nextPeriod(...args)),
|
|
2857
|
+
class: "nav-btn"
|
|
2858
|
+
}, "›"),
|
|
2859
|
+
createElementVNode("button", {
|
|
2860
|
+
onClick: _cache[2] || (_cache[2] = (...args) => $options.goToToday && $options.goToToday(...args)),
|
|
2861
|
+
class: "today-btn"
|
|
2862
|
+
}, "Hoy")
|
|
2863
|
+
]),
|
|
2864
|
+
createElementVNode("button", {
|
|
2865
|
+
onClick: _cache[3] || (_cache[3] = ($event) => $data.showEventModal = true),
|
|
2866
|
+
class: "add-event-btn"
|
|
2867
|
+
}, "+ Evento")
|
|
2868
|
+
]),
|
|
2869
|
+
createElementVNode("div", _hoisted_6$2, [
|
|
2870
|
+
$data.currentView === "day" ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
|
|
2871
|
+
createElementVNode("div", _hoisted_8$2, [
|
|
2872
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(24, (hour) => {
|
|
2873
|
+
return createElementVNode("div", {
|
|
2874
|
+
key: hour,
|
|
2875
|
+
class: "hour-slot"
|
|
2876
|
+
}, [
|
|
2877
|
+
createElementVNode("div", _hoisted_9$2, toDisplayString($options.formatHour(hour - 1)), 1),
|
|
2878
|
+
createElementVNode("div", _hoisted_10$2, [
|
|
2879
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.getEventsForHour($options.formatDate($data.currentDate), hour - 1), (event) => {
|
|
2880
|
+
return openBlock(), createElementBlock("div", {
|
|
2881
|
+
key: event.id,
|
|
2882
|
+
class: "event-card",
|
|
2883
|
+
style: normalizeStyle({ backgroundColor: event.color }),
|
|
2884
|
+
onClick: ($event) => $options.editEvent(event)
|
|
2885
|
+
}, [
|
|
2886
|
+
createElementVNode("div", _hoisted_12$2, toDisplayString(event.name), 1),
|
|
2887
|
+
createElementVNode("div", _hoisted_13$2, toDisplayString(event.startTime) + " - " + toDisplayString(event.endTime), 1),
|
|
2888
|
+
event.isRecurring ? (openBlock(), createElementBlock("div", _hoisted_14$2, "🔁")) : createCommentVNode("", true)
|
|
2889
|
+
], 12, _hoisted_11$2);
|
|
2890
|
+
}), 128))
|
|
2891
|
+
])
|
|
2892
|
+
]);
|
|
2893
|
+
}), 64))
|
|
2894
|
+
])
|
|
2895
|
+
])) : createCommentVNode("", true),
|
|
2896
|
+
$data.currentView === "week" ? (openBlock(), createElementBlock("div", _hoisted_15$2, [
|
|
2897
|
+
createElementVNode("div", _hoisted_16$2, [
|
|
2898
|
+
_cache[15] || (_cache[15] = createElementVNode("div", { class: "week-time-label" }, null, -1)),
|
|
2899
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, (day) => {
|
|
2900
|
+
return openBlock(), createElementBlock("div", {
|
|
2901
|
+
key: day.date,
|
|
2902
|
+
class: "week-day-header"
|
|
2903
|
+
}, [
|
|
2904
|
+
createElementVNode("div", _hoisted_17$2, toDisplayString(day.name), 1),
|
|
2905
|
+
createElementVNode("div", {
|
|
2906
|
+
class: normalizeClass(["day-number", { today: $options.isToday(day.date) }])
|
|
2907
|
+
}, toDisplayString(day.number), 3)
|
|
2908
|
+
]);
|
|
2909
|
+
}), 128))
|
|
2910
|
+
]),
|
|
2911
|
+
createElementVNode("div", _hoisted_18$2, [
|
|
2912
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(24, (hour) => {
|
|
2913
|
+
return createElementVNode("div", {
|
|
2914
|
+
key: hour,
|
|
2915
|
+
class: "week-hour-row"
|
|
2916
|
+
}, [
|
|
2917
|
+
createElementVNode("div", _hoisted_19$2, toDisplayString($options.formatHour(hour - 1)), 1),
|
|
2918
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, (day) => {
|
|
2919
|
+
return openBlock(), createElementBlock("div", {
|
|
2920
|
+
key: day.date,
|
|
2921
|
+
class: "week-hour-cell"
|
|
2922
|
+
}, [
|
|
2923
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.getEventsForHour(day.date, hour - 1), (event) => {
|
|
2924
|
+
return openBlock(), createElementBlock("div", {
|
|
2925
|
+
key: event.id,
|
|
2926
|
+
class: "event-card small",
|
|
2927
|
+
style: normalizeStyle({ backgroundColor: event.color }),
|
|
2928
|
+
onClick: ($event) => $options.editEvent(event)
|
|
2929
|
+
}, [
|
|
2930
|
+
createElementVNode("div", _hoisted_21$2, toDisplayString(event.name), 1)
|
|
2931
|
+
], 12, _hoisted_20$2);
|
|
2932
|
+
}), 128))
|
|
2933
|
+
]);
|
|
2934
|
+
}), 128))
|
|
2935
|
+
]);
|
|
2936
|
+
}), 64))
|
|
2937
|
+
])
|
|
2938
|
+
])) : createCommentVNode("", true),
|
|
2939
|
+
$data.currentView === "month" ? (openBlock(), createElementBlock("div", _hoisted_22$2, [
|
|
2940
|
+
createElementVNode("div", _hoisted_23$1, [
|
|
2941
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.dayNames, (day) => {
|
|
2942
|
+
return openBlock(), createElementBlock("div", {
|
|
2943
|
+
key: day,
|
|
2944
|
+
class: "month-day-name"
|
|
2945
|
+
}, toDisplayString(day), 1);
|
|
2946
|
+
}), 128))
|
|
2947
|
+
]),
|
|
2948
|
+
createElementVNode("div", _hoisted_24$1, [
|
|
2949
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.monthDays, (day) => {
|
|
2950
|
+
return openBlock(), createElementBlock("div", {
|
|
2951
|
+
key: day.date,
|
|
2952
|
+
class: normalizeClass(["month-day", {
|
|
2953
|
+
"other-month": !day.isCurrentMonth,
|
|
2954
|
+
"today": $options.isToday(day.date)
|
|
2955
|
+
}]),
|
|
2956
|
+
onClick: ($event) => $options.selectDay(day.date)
|
|
2957
|
+
}, [
|
|
2958
|
+
createElementVNode("div", _hoisted_26$1, toDisplayString(day.number), 1),
|
|
2959
|
+
createElementVNode("div", _hoisted_27$1, [
|
|
2960
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.getEventsForDay(day.date).slice(0, 3), (event) => {
|
|
2961
|
+
return openBlock(), createElementBlock("div", {
|
|
2962
|
+
key: event.id,
|
|
2963
|
+
class: "event-dot",
|
|
2964
|
+
style: normalizeStyle({ backgroundColor: event.color }),
|
|
2965
|
+
title: event.name
|
|
2966
|
+
}, null, 12, _hoisted_28$1);
|
|
2967
|
+
}), 128)),
|
|
2968
|
+
$options.getEventsForDay(day.date).length > 3 ? (openBlock(), createElementBlock("div", _hoisted_29, " +" + toDisplayString($options.getEventsForDay(day.date).length - 3), 1)) : createCommentVNode("", true)
|
|
2969
|
+
])
|
|
2970
|
+
], 10, _hoisted_25$1);
|
|
2971
|
+
}), 128))
|
|
2972
|
+
])
|
|
2973
|
+
])) : createCommentVNode("", true)
|
|
2974
|
+
]),
|
|
2975
|
+
$data.showEventModal ? (openBlock(), createElementBlock("div", {
|
|
2976
|
+
key: 0,
|
|
2977
|
+
class: "modal-overlay",
|
|
2978
|
+
onClick: _cache[14] || (_cache[14] = withModifiers((...args) => $options.closeModal && $options.closeModal(...args), ["self"]))
|
|
2979
|
+
}, [
|
|
2980
|
+
createElementVNode("div", _hoisted_30, [
|
|
2981
|
+
createElementVNode("div", _hoisted_31, [
|
|
2982
|
+
createElementVNode("h3", null, toDisplayString($data.editingEvent ? "Editar Evento" : "Nuevo Evento"), 1),
|
|
2983
|
+
createElementVNode("button", {
|
|
2984
|
+
onClick: _cache[4] || (_cache[4] = (...args) => $options.closeModal && $options.closeModal(...args)),
|
|
2985
|
+
class: "close-btn"
|
|
2986
|
+
}, "✕")
|
|
2987
|
+
]),
|
|
2988
|
+
createElementVNode("div", _hoisted_32, [
|
|
2989
|
+
createElementVNode("div", _hoisted_33, [
|
|
2990
|
+
_cache[16] || (_cache[16] = createElementVNode("label", null, "Nombre del evento", -1)),
|
|
2991
|
+
withDirectives(createElementVNode("input", {
|
|
2992
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.eventForm.name = $event),
|
|
2993
|
+
type: "text",
|
|
2994
|
+
placeholder: "Ej: Reunión con el equipo"
|
|
2995
|
+
}, null, 512), [
|
|
2996
|
+
[vModelText, $data.eventForm.name]
|
|
2997
|
+
])
|
|
2998
|
+
]),
|
|
2999
|
+
createElementVNode("div", _hoisted_34, [
|
|
3000
|
+
_cache[17] || (_cache[17] = createElementVNode("label", null, "Fecha", -1)),
|
|
3001
|
+
withDirectives(createElementVNode("input", {
|
|
3002
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.eventForm.date = $event),
|
|
3003
|
+
type: "date"
|
|
3004
|
+
}, null, 512), [
|
|
3005
|
+
[vModelText, $data.eventForm.date]
|
|
3006
|
+
])
|
|
3007
|
+
]),
|
|
3008
|
+
createElementVNode("div", _hoisted_35, [
|
|
3009
|
+
createElementVNode("div", _hoisted_36, [
|
|
3010
|
+
_cache[18] || (_cache[18] = createElementVNode("label", null, "Hora de inicio", -1)),
|
|
3011
|
+
withDirectives(createElementVNode("input", {
|
|
3012
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.eventForm.startTime = $event),
|
|
3013
|
+
type: "time"
|
|
3014
|
+
}, null, 512), [
|
|
3015
|
+
[vModelText, $data.eventForm.startTime]
|
|
3016
|
+
])
|
|
3017
|
+
]),
|
|
3018
|
+
createElementVNode("div", _hoisted_37, [
|
|
3019
|
+
_cache[19] || (_cache[19] = createElementVNode("label", null, "Hora de fin", -1)),
|
|
3020
|
+
withDirectives(createElementVNode("input", {
|
|
3021
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.eventForm.endTime = $event),
|
|
3022
|
+
type: "time"
|
|
3023
|
+
}, null, 512), [
|
|
3024
|
+
[vModelText, $data.eventForm.endTime]
|
|
3025
|
+
])
|
|
3026
|
+
])
|
|
3027
|
+
]),
|
|
3028
|
+
createElementVNode("div", _hoisted_38, [
|
|
3029
|
+
_cache[20] || (_cache[20] = createElementVNode("label", null, "Color", -1)),
|
|
3030
|
+
createElementVNode("div", _hoisted_39, [
|
|
3031
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.colors, (color) => {
|
|
3032
|
+
return openBlock(), createElementBlock("div", {
|
|
3033
|
+
key: color,
|
|
3034
|
+
class: normalizeClass(["color-option", { selected: $data.eventForm.color === color }]),
|
|
3035
|
+
style: normalizeStyle({ backgroundColor: color }),
|
|
3036
|
+
onClick: ($event) => $data.eventForm.color = color
|
|
3037
|
+
}, null, 14, _hoisted_40);
|
|
3038
|
+
}), 128))
|
|
3039
|
+
])
|
|
3040
|
+
]),
|
|
3041
|
+
createElementVNode("div", _hoisted_41, [
|
|
3042
|
+
createElementVNode("label", _hoisted_42, [
|
|
3043
|
+
withDirectives(createElementVNode("input", {
|
|
3044
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.eventForm.isRecurring = $event),
|
|
3045
|
+
type: "checkbox"
|
|
3046
|
+
}, null, 512), [
|
|
3047
|
+
[vModelCheckbox, $data.eventForm.isRecurring]
|
|
3048
|
+
]),
|
|
3049
|
+
_cache[21] || (_cache[21] = createTextVNode(" Evento repetitivo ", -1))
|
|
3050
|
+
])
|
|
3051
|
+
]),
|
|
3052
|
+
$data.eventForm.isRecurring ? (openBlock(), createElementBlock("div", _hoisted_43, [
|
|
3053
|
+
_cache[23] || (_cache[23] = createElementVNode("label", null, "Frecuencia", -1)),
|
|
3054
|
+
withDirectives(createElementVNode("select", {
|
|
3055
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.eventForm.recurringType = $event)
|
|
3056
|
+
}, _cache[22] || (_cache[22] = [
|
|
3057
|
+
createElementVNode("option", { value: "daily" }, "Diario", -1),
|
|
3058
|
+
createElementVNode("option", { value: "weekly" }, "Semanal", -1),
|
|
3059
|
+
createElementVNode("option", { value: "monthly" }, "Mensual", -1)
|
|
3060
|
+
]), 512), [
|
|
3061
|
+
[vModelSelect, $data.eventForm.recurringType]
|
|
3062
|
+
])
|
|
3063
|
+
])) : createCommentVNode("", true)
|
|
3064
|
+
]),
|
|
3065
|
+
createElementVNode("div", _hoisted_44, [
|
|
3066
|
+
$data.editingEvent ? (openBlock(), createElementBlock("button", {
|
|
3067
|
+
key: 0,
|
|
3068
|
+
onClick: _cache[11] || (_cache[11] = (...args) => $options.deleteEvent && $options.deleteEvent(...args)),
|
|
3069
|
+
class: "delete-btn"
|
|
3070
|
+
}, "Eliminar")) : createCommentVNode("", true),
|
|
3071
|
+
createElementVNode("button", {
|
|
3072
|
+
onClick: _cache[12] || (_cache[12] = (...args) => $options.closeModal && $options.closeModal(...args)),
|
|
3073
|
+
class: "cancel-btn"
|
|
3074
|
+
}, "Cancelar"),
|
|
3075
|
+
createElementVNode("button", {
|
|
3076
|
+
onClick: _cache[13] || (_cache[13] = (...args) => $options.saveEvent && $options.saveEvent(...args)),
|
|
3077
|
+
class: "save-btn"
|
|
3078
|
+
}, toDisplayString($data.editingEvent ? "Guardar" : "Crear"), 1)
|
|
3079
|
+
])
|
|
3080
|
+
])
|
|
3081
|
+
])) : createCommentVNode("", true)
|
|
3082
|
+
], 2);
|
|
3083
|
+
}
|
|
3084
|
+
const ZCalendarWidget = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-b191092b"]]);
|
|
3085
|
+
const _sfc_main$1 = {
|
|
3086
|
+
name: "ZWeatherWidget",
|
|
3087
|
+
data() {
|
|
3088
|
+
return {
|
|
3089
|
+
loading: true,
|
|
3090
|
+
error: null,
|
|
3091
|
+
weatherData: null,
|
|
3092
|
+
locationName: "",
|
|
3093
|
+
latitude: null,
|
|
3094
|
+
longitude: null,
|
|
3095
|
+
lastUpdate: "",
|
|
3096
|
+
updateInterval: null
|
|
3097
|
+
};
|
|
3098
|
+
},
|
|
3099
|
+
mounted() {
|
|
3100
|
+
this.getLocation();
|
|
3101
|
+
this.updateInterval = setInterval(() => {
|
|
3102
|
+
if (this.latitude && this.longitude) {
|
|
3103
|
+
this.fetchWeather(this.latitude, this.longitude);
|
|
3104
|
+
}
|
|
3105
|
+
}, 6e5);
|
|
3106
|
+
},
|
|
3107
|
+
beforeUnmount() {
|
|
3108
|
+
if (this.updateInterval) {
|
|
3109
|
+
clearInterval(this.updateInterval);
|
|
3110
|
+
}
|
|
3111
|
+
},
|
|
3112
|
+
methods: {
|
|
3113
|
+
getLocation() {
|
|
3114
|
+
this.loading = true;
|
|
3115
|
+
this.error = null;
|
|
3116
|
+
if (!navigator.geolocation) {
|
|
3117
|
+
this.error = "La geolocalización no está disponible en tu navegador";
|
|
3118
|
+
this.loading = false;
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
3121
|
+
navigator.geolocation.getCurrentPosition(
|
|
3122
|
+
(position) => {
|
|
3123
|
+
this.latitude = position.coords.latitude;
|
|
3124
|
+
this.longitude = position.coords.longitude;
|
|
3125
|
+
this.fetchWeather(this.latitude, this.longitude);
|
|
3126
|
+
this.fetchLocationName(this.latitude, this.longitude);
|
|
3127
|
+
},
|
|
3128
|
+
(error) => {
|
|
3129
|
+
this.loading = false;
|
|
3130
|
+
switch (error.code) {
|
|
3131
|
+
case error.PERMISSION_DENIED:
|
|
3132
|
+
this.error = "Permiso de ubicación denegado. Activa la ubicación para usar este widget.";
|
|
3133
|
+
break;
|
|
3134
|
+
case error.POSITION_UNAVAILABLE:
|
|
3135
|
+
this.error = "Información de ubicación no disponible.";
|
|
3136
|
+
break;
|
|
3137
|
+
case error.TIMEOUT:
|
|
3138
|
+
this.error = "Tiempo de espera agotado al obtener la ubicación.";
|
|
3139
|
+
break;
|
|
3140
|
+
default:
|
|
3141
|
+
this.error = "Error desconocido al obtener la ubicación.";
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
);
|
|
3145
|
+
},
|
|
3146
|
+
fetchWeather(lat, lon) {
|
|
3147
|
+
return __async(this, null, function* () {
|
|
3148
|
+
try {
|
|
3149
|
+
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m&timezone=auto`;
|
|
3150
|
+
const response = yield fetch(url);
|
|
3151
|
+
if (!response.ok) {
|
|
3152
|
+
throw new Error("Error al obtener datos del clima");
|
|
3153
|
+
}
|
|
3154
|
+
this.weatherData = yield response.json();
|
|
3155
|
+
this.updateLastUpdateTime();
|
|
3156
|
+
this.loading = false;
|
|
3157
|
+
} catch (err) {
|
|
3158
|
+
this.error = "No se pudo obtener la información del clima";
|
|
3159
|
+
this.loading = false;
|
|
3160
|
+
}
|
|
3161
|
+
});
|
|
3162
|
+
},
|
|
3163
|
+
fetchLocationName(lat, lon) {
|
|
3164
|
+
return __async(this, null, function* () {
|
|
3165
|
+
try {
|
|
3166
|
+
const cacheKey = this.generateCacheKey(lat, lon);
|
|
3167
|
+
const cachedLocation = this.getLocationFromCache(cacheKey);
|
|
3168
|
+
if (cachedLocation) {
|
|
3169
|
+
this.locationName = cachedLocation;
|
|
3170
|
+
console.log("📦 Ubicación obtenida del cache:", cachedLocation);
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
console.log("🌐 Consultando Nominatim para ubicación...");
|
|
3174
|
+
const url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}&zoom=10`;
|
|
3175
|
+
const response = yield fetch(url, {
|
|
3176
|
+
headers: {
|
|
3177
|
+
"User-Agent": "ZenWDG-WeatherWidget/1.0"
|
|
3178
|
+
}
|
|
3179
|
+
});
|
|
3180
|
+
if (response.ok) {
|
|
3181
|
+
const data = yield response.json();
|
|
3182
|
+
const cityName = data.address.city || data.address.town || data.address.village || data.address.state || "Tu ubicación";
|
|
3183
|
+
this.locationName = cityName;
|
|
3184
|
+
this.saveLocationToCache(cacheKey, cityName);
|
|
3185
|
+
console.log("💾 Ubicación guardada en cache:", cityName);
|
|
3186
|
+
} else {
|
|
3187
|
+
this.locationName = "Tu ubicación";
|
|
3188
|
+
}
|
|
3189
|
+
} catch (err) {
|
|
3190
|
+
this.locationName = "Tu ubicación";
|
|
3191
|
+
}
|
|
3192
|
+
});
|
|
3193
|
+
},
|
|
3194
|
+
generateCacheKey(lat, lon) {
|
|
3195
|
+
const roundedLat = Math.round(lat * 100) / 100;
|
|
3196
|
+
const roundedLon = Math.round(lon * 100) / 100;
|
|
3197
|
+
return `${roundedLat},${roundedLon}`;
|
|
3198
|
+
},
|
|
3199
|
+
getLocationFromCache(cacheKey) {
|
|
3200
|
+
try {
|
|
3201
|
+
const cache = localStorage.getItem("weather_location_cache");
|
|
3202
|
+
if (!cache) return null;
|
|
3203
|
+
const cacheData = JSON.parse(cache);
|
|
3204
|
+
const entry = cacheData[cacheKey];
|
|
3205
|
+
if (!entry) return null;
|
|
3206
|
+
const now = Date.now();
|
|
3207
|
+
const cacheAge = now - entry.timestamp;
|
|
3208
|
+
const maxAge = 30 * 24 * 60 * 60 * 1e3;
|
|
3209
|
+
if (cacheAge > maxAge) {
|
|
3210
|
+
delete cacheData[cacheKey];
|
|
3211
|
+
localStorage.setItem("weather_location_cache", JSON.stringify(cacheData));
|
|
3212
|
+
return null;
|
|
3213
|
+
}
|
|
3214
|
+
return entry.name;
|
|
3215
|
+
} catch (err) {
|
|
3216
|
+
console.warn("Error al leer cache de ubicaciones:", err);
|
|
3217
|
+
return null;
|
|
3218
|
+
}
|
|
3219
|
+
},
|
|
3220
|
+
saveLocationToCache(cacheKey, locationName) {
|
|
3221
|
+
try {
|
|
3222
|
+
let cacheData = {};
|
|
3223
|
+
const existingCache = localStorage.getItem("weather_location_cache");
|
|
3224
|
+
if (existingCache) {
|
|
3225
|
+
cacheData = JSON.parse(existingCache);
|
|
3226
|
+
}
|
|
3227
|
+
cacheData[cacheKey] = {
|
|
3228
|
+
name: locationName,
|
|
3229
|
+
timestamp: Date.now()
|
|
3230
|
+
};
|
|
3231
|
+
const entries = Object.entries(cacheData);
|
|
3232
|
+
if (entries.length > 100) {
|
|
3233
|
+
entries.sort((a, b) => b[1].timestamp - a[1].timestamp);
|
|
3234
|
+
cacheData = Object.fromEntries(entries.slice(0, 100));
|
|
3235
|
+
}
|
|
3236
|
+
localStorage.setItem("weather_location_cache", JSON.stringify(cacheData));
|
|
3237
|
+
} catch (err) {
|
|
3238
|
+
console.warn("Error al guardar en cache de ubicaciones:", err);
|
|
3239
|
+
}
|
|
3240
|
+
},
|
|
3241
|
+
refreshWeather() {
|
|
3242
|
+
if (this.latitude && this.longitude) {
|
|
3243
|
+
this.loading = true;
|
|
3244
|
+
this.fetchWeather(this.latitude, this.longitude);
|
|
3245
|
+
} else {
|
|
3246
|
+
this.getLocation();
|
|
3247
|
+
}
|
|
3248
|
+
},
|
|
3249
|
+
updateLastUpdateTime() {
|
|
3250
|
+
const now = /* @__PURE__ */ new Date();
|
|
3251
|
+
this.lastUpdate = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}`;
|
|
3252
|
+
},
|
|
3253
|
+
getWeatherIcon(code) {
|
|
3254
|
+
const weatherIcons = {
|
|
3255
|
+
0: "☀️",
|
|
3256
|
+
// Clear sky
|
|
3257
|
+
1: "🌤️",
|
|
3258
|
+
// Mainly clear
|
|
3259
|
+
2: "⛅",
|
|
3260
|
+
// Partly cloudy
|
|
3261
|
+
3: "☁️",
|
|
3262
|
+
// Overcast
|
|
3263
|
+
45: "🌫️",
|
|
3264
|
+
// Fog
|
|
3265
|
+
48: "🌫️",
|
|
3266
|
+
// Depositing rime fog
|
|
3267
|
+
51: "🌦️",
|
|
3268
|
+
// Light drizzle
|
|
3269
|
+
53: "🌦️",
|
|
3270
|
+
// Moderate drizzle
|
|
3271
|
+
55: "🌧️",
|
|
3272
|
+
// Dense drizzle
|
|
3273
|
+
61: "🌧️",
|
|
3274
|
+
// Slight rain
|
|
3275
|
+
63: "🌧️",
|
|
3276
|
+
// Moderate rain
|
|
3277
|
+
65: "🌧️",
|
|
3278
|
+
// Heavy rain
|
|
3279
|
+
71: "🌨️",
|
|
3280
|
+
// Slight snow
|
|
3281
|
+
73: "🌨️",
|
|
3282
|
+
// Moderate snow
|
|
3283
|
+
75: "❄️",
|
|
3284
|
+
// Heavy snow
|
|
3285
|
+
77: "🌨️",
|
|
3286
|
+
// Snow grains
|
|
3287
|
+
80: "🌦️",
|
|
3288
|
+
// Slight rain showers
|
|
3289
|
+
81: "🌧️",
|
|
3290
|
+
// Moderate rain showers
|
|
3291
|
+
82: "⛈️",
|
|
3292
|
+
// Violent rain showers
|
|
3293
|
+
85: "🌨️",
|
|
3294
|
+
// Slight snow showers
|
|
3295
|
+
86: "❄️",
|
|
3296
|
+
// Heavy snow showers
|
|
3297
|
+
95: "⛈️",
|
|
3298
|
+
// Thunderstorm
|
|
3299
|
+
96: "⛈️",
|
|
3300
|
+
// Thunderstorm with slight hail
|
|
3301
|
+
99: "⛈️"
|
|
3302
|
+
// Thunderstorm with heavy hail
|
|
3303
|
+
};
|
|
3304
|
+
return weatherIcons[code] || "🌤️";
|
|
3305
|
+
},
|
|
3306
|
+
getWeatherDescription(code) {
|
|
3307
|
+
const descriptions = {
|
|
3308
|
+
0: "Cielo despejado",
|
|
3309
|
+
1: "Principalmente despejado",
|
|
3310
|
+
2: "Parcialmente nublado",
|
|
3311
|
+
3: "Nublado",
|
|
3312
|
+
45: "Niebla",
|
|
3313
|
+
48: "Niebla con escarcha",
|
|
3314
|
+
51: "Llovizna ligera",
|
|
3315
|
+
53: "Llovizna moderada",
|
|
3316
|
+
55: "Llovizna densa",
|
|
3317
|
+
61: "Lluvia ligera",
|
|
3318
|
+
63: "Lluvia moderada",
|
|
3319
|
+
65: "Lluvia fuerte",
|
|
3320
|
+
71: "Nevada ligera",
|
|
3321
|
+
73: "Nevada moderada",
|
|
3322
|
+
75: "Nevada fuerte",
|
|
3323
|
+
77: "Granizo",
|
|
3324
|
+
80: "Chubascos ligeros",
|
|
3325
|
+
81: "Chubascos moderados",
|
|
3326
|
+
82: "Chubascos violentos",
|
|
3327
|
+
85: "Chubascos de nieve ligeros",
|
|
3328
|
+
86: "Chubascos de nieve fuertes",
|
|
3329
|
+
95: "Tormenta eléctrica",
|
|
3330
|
+
96: "Tormenta con granizo ligero",
|
|
3331
|
+
99: "Tormenta con granizo fuerte"
|
|
3332
|
+
};
|
|
3333
|
+
return descriptions[code] || "Condición desconocida";
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
};
|
|
3337
|
+
const _hoisted_1$1 = { class: "weather-container" };
|
|
3338
|
+
const _hoisted_2$1 = { class: "weather-widget" };
|
|
3339
|
+
const _hoisted_3$1 = {
|
|
3340
|
+
key: 0,
|
|
3341
|
+
class: "weather-loading"
|
|
3342
|
+
};
|
|
3343
|
+
const _hoisted_4$1 = {
|
|
3344
|
+
key: 1,
|
|
3345
|
+
class: "weather-error"
|
|
3346
|
+
};
|
|
3347
|
+
const _hoisted_5$1 = {
|
|
3348
|
+
key: 2,
|
|
3349
|
+
class: "weather-content"
|
|
3350
|
+
};
|
|
3351
|
+
const _hoisted_6$1 = { class: "weather-header" };
|
|
3352
|
+
const _hoisted_7$1 = { class: "location" };
|
|
3353
|
+
const _hoisted_8$1 = { class: "location-name" };
|
|
3354
|
+
const _hoisted_9$1 = { class: "weather-main" };
|
|
3355
|
+
const _hoisted_10$1 = { class: "temperature" };
|
|
3356
|
+
const _hoisted_11$1 = { class: "temp-value" };
|
|
3357
|
+
const _hoisted_12$1 = { class: "weather-icon" };
|
|
3358
|
+
const _hoisted_13$1 = { class: "weather-description" };
|
|
3359
|
+
const _hoisted_14$1 = { class: "weather-details" };
|
|
3360
|
+
const _hoisted_15$1 = { class: "detail-item" };
|
|
3361
|
+
const _hoisted_16$1 = { class: "detail-value" };
|
|
3362
|
+
const _hoisted_17$1 = { class: "detail-item" };
|
|
3363
|
+
const _hoisted_18$1 = { class: "detail-value" };
|
|
3364
|
+
const _hoisted_19$1 = { class: "detail-item" };
|
|
3365
|
+
const _hoisted_20$1 = { class: "detail-value" };
|
|
3366
|
+
const _hoisted_21$1 = { class: "weather-footer" };
|
|
3367
|
+
const _hoisted_22$1 = { class: "last-update" };
|
|
3368
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3369
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
3370
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
3371
|
+
$data.loading ? (openBlock(), createElementBlock("div", _hoisted_3$1, _cache[2] || (_cache[2] = [
|
|
3372
|
+
createElementVNode("div", { class: "spinner" }, null, -1),
|
|
3373
|
+
createElementVNode("p", null, "Obteniendo ubicación...", -1)
|
|
3374
|
+
]))) : $data.error ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
3375
|
+
_cache[3] || (_cache[3] = createElementVNode("span", { class: "error-icon" }, "⚠️", -1)),
|
|
3376
|
+
createElementVNode("p", null, toDisplayString($data.error), 1),
|
|
3377
|
+
createElementVNode("button", {
|
|
3378
|
+
onClick: _cache[0] || (_cache[0] = (...args) => $options.getLocation && $options.getLocation(...args)),
|
|
3379
|
+
class: "retry-btn"
|
|
3380
|
+
}, "Reintentar")
|
|
3381
|
+
])) : $data.weatherData ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
3382
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
3383
|
+
createElementVNode("div", _hoisted_7$1, [
|
|
3384
|
+
_cache[4] || (_cache[4] = createElementVNode("span", { class: "location-icon" }, "📍", -1)),
|
|
3385
|
+
createElementVNode("span", _hoisted_8$1, toDisplayString($data.locationName), 1)
|
|
3386
|
+
])
|
|
3387
|
+
]),
|
|
3388
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
3389
|
+
createElementVNode("div", _hoisted_10$1, [
|
|
3390
|
+
createElementVNode("span", _hoisted_11$1, toDisplayString(Math.round($data.weatherData.current.temperature_2m)), 1),
|
|
3391
|
+
_cache[5] || (_cache[5] = createElementVNode("span", { class: "temp-unit" }, "°C", -1))
|
|
3392
|
+
]),
|
|
3393
|
+
createElementVNode("div", _hoisted_12$1, toDisplayString($options.getWeatherIcon($data.weatherData.current.weather_code)), 1)
|
|
3394
|
+
]),
|
|
3395
|
+
createElementVNode("div", _hoisted_13$1, toDisplayString($options.getWeatherDescription($data.weatherData.current.weather_code)), 1),
|
|
3396
|
+
createElementVNode("div", _hoisted_14$1, [
|
|
3397
|
+
createElementVNode("div", _hoisted_15$1, [
|
|
3398
|
+
_cache[6] || (_cache[6] = createElementVNode("span", { class: "detail-icon" }, "💨", -1)),
|
|
3399
|
+
_cache[7] || (_cache[7] = createElementVNode("span", { class: "detail-label" }, "Viento", -1)),
|
|
3400
|
+
createElementVNode("span", _hoisted_16$1, toDisplayString(Math.round($data.weatherData.current.wind_speed_10m)) + " km/h", 1)
|
|
3401
|
+
]),
|
|
3402
|
+
createElementVNode("div", _hoisted_17$1, [
|
|
3403
|
+
_cache[8] || (_cache[8] = createElementVNode("span", { class: "detail-icon" }, "💧", -1)),
|
|
3404
|
+
_cache[9] || (_cache[9] = createElementVNode("span", { class: "detail-label" }, "Humedad", -1)),
|
|
3405
|
+
createElementVNode("span", _hoisted_18$1, toDisplayString($data.weatherData.current.relative_humidity_2m) + "%", 1)
|
|
3406
|
+
]),
|
|
3407
|
+
createElementVNode("div", _hoisted_19$1, [
|
|
3408
|
+
_cache[10] || (_cache[10] = createElementVNode("span", { class: "detail-icon" }, "🌡️", -1)),
|
|
3409
|
+
_cache[11] || (_cache[11] = createElementVNode("span", { class: "detail-label" }, "Sensación", -1)),
|
|
3410
|
+
createElementVNode("span", _hoisted_20$1, toDisplayString(Math.round($data.weatherData.current.apparent_temperature)) + "°C", 1)
|
|
3411
|
+
])
|
|
3412
|
+
]),
|
|
3413
|
+
createElementVNode("div", _hoisted_21$1, [
|
|
3414
|
+
createElementVNode("span", _hoisted_22$1, "Actualizado: " + toDisplayString($data.lastUpdate), 1),
|
|
3415
|
+
createElementVNode("button", {
|
|
3416
|
+
onClick: _cache[1] || (_cache[1] = (...args) => $options.refreshWeather && $options.refreshWeather(...args)),
|
|
3417
|
+
class: "refresh-btn"
|
|
3418
|
+
}, "🔄")
|
|
3419
|
+
])
|
|
3420
|
+
])) : createCommentVNode("", true)
|
|
3421
|
+
])
|
|
3422
|
+
]);
|
|
3423
|
+
}
|
|
3424
|
+
const ZWeatherWidget = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-5f11c261"]]);
|
|
3425
|
+
const _sfc_main = {
|
|
3426
|
+
name: "ZNotesWidget",
|
|
3427
|
+
data() {
|
|
3428
|
+
return {
|
|
3429
|
+
notes: [],
|
|
3430
|
+
categories: [
|
|
3431
|
+
{ id: "default", name: "Sin categoría", color: "#6b7280" }
|
|
3432
|
+
],
|
|
3433
|
+
showNewNoteForm: false,
|
|
3434
|
+
showCategoryManager: false,
|
|
3435
|
+
newNote: {
|
|
3436
|
+
title: "",
|
|
3437
|
+
content: "",
|
|
3438
|
+
categoryId: ""
|
|
3439
|
+
},
|
|
3440
|
+
newCategoryName: "",
|
|
3441
|
+
newCategoryColor: "#3b82f6",
|
|
3442
|
+
filterCategory: null,
|
|
3443
|
+
sortBy: "date",
|
|
3444
|
+
storageKey: "zen-notes-widget",
|
|
3445
|
+
categoriesKey: "zen-notes-categories"
|
|
3446
|
+
};
|
|
3447
|
+
},
|
|
3448
|
+
computed: {
|
|
3449
|
+
filteredNotes() {
|
|
3450
|
+
let filtered = [...this.notes];
|
|
3451
|
+
if (this.filterCategory === "pinned") {
|
|
3452
|
+
filtered = filtered.filter((note) => note.isPinned);
|
|
3453
|
+
} else if (this.filterCategory) {
|
|
3454
|
+
filtered = filtered.filter((note) => note.categoryId === this.filterCategory);
|
|
3455
|
+
}
|
|
3456
|
+
filtered.sort((a, b) => {
|
|
3457
|
+
if (this.sortBy === "date") {
|
|
3458
|
+
return new Date(b.createdAt) - new Date(a.createdAt);
|
|
3459
|
+
} else if (this.sortBy === "title") {
|
|
3460
|
+
return (a.title || "").localeCompare(b.title || "");
|
|
3461
|
+
} else if (this.sortBy === "category") {
|
|
3462
|
+
const catA = this.getCategoryName(a.categoryId);
|
|
3463
|
+
const catB = this.getCategoryName(b.categoryId);
|
|
3464
|
+
return catA.localeCompare(catB);
|
|
3465
|
+
}
|
|
3466
|
+
return 0;
|
|
3467
|
+
});
|
|
3468
|
+
return filtered.sort((a, b) => {
|
|
3469
|
+
if (a.isPinned && !b.isPinned) return -1;
|
|
3470
|
+
if (!a.isPinned && b.isPinned) return 1;
|
|
3471
|
+
return 0;
|
|
3472
|
+
});
|
|
3473
|
+
},
|
|
3474
|
+
pinnedNotesCount() {
|
|
3475
|
+
return this.notes.filter((note) => note.isPinned).length;
|
|
3476
|
+
}
|
|
3477
|
+
},
|
|
3478
|
+
methods: {
|
|
3479
|
+
toggleNewNote() {
|
|
3480
|
+
this.showNewNoteForm = !this.showNewNoteForm;
|
|
3481
|
+
if (this.showNewNoteForm) {
|
|
3482
|
+
this.$nextTick(() => {
|
|
3483
|
+
var _a;
|
|
3484
|
+
(_a = this.$refs.titleInput) == null ? void 0 : _a.focus();
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
},
|
|
3488
|
+
saveNote() {
|
|
3489
|
+
if (!this.newNote.content.trim()) return;
|
|
3490
|
+
const note = {
|
|
3491
|
+
id: Date.now().toString(),
|
|
3492
|
+
title: this.newNote.title.trim(),
|
|
3493
|
+
content: this.newNote.content.trim(),
|
|
3494
|
+
categoryId: this.newNote.categoryId,
|
|
3495
|
+
isPinned: false,
|
|
3496
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3497
|
+
};
|
|
3498
|
+
this.notes.unshift(note);
|
|
3499
|
+
this.saveToStorage();
|
|
3500
|
+
this.cancelNewNote();
|
|
3501
|
+
},
|
|
3502
|
+
cancelNewNote() {
|
|
3503
|
+
this.newNote = {
|
|
3504
|
+
title: "",
|
|
3505
|
+
content: "",
|
|
3506
|
+
categoryId: ""
|
|
3507
|
+
};
|
|
3508
|
+
this.showNewNoteForm = false;
|
|
3509
|
+
},
|
|
3510
|
+
deleteNote(id) {
|
|
3511
|
+
return __async(this, null, function* () {
|
|
3512
|
+
const confirmed = yield window.ZenModals.showDeleteConfirm("esta nota");
|
|
3513
|
+
if (confirmed) {
|
|
3514
|
+
this.notes = this.notes.filter((note) => note.id !== id);
|
|
3515
|
+
this.saveToStorage();
|
|
3516
|
+
}
|
|
3517
|
+
});
|
|
3518
|
+
},
|
|
3519
|
+
togglePin(id) {
|
|
3520
|
+
const note = this.notes.find((n) => n.id === id);
|
|
3521
|
+
if (note) {
|
|
3522
|
+
note.isPinned = !note.isPinned;
|
|
3523
|
+
this.saveToStorage();
|
|
3524
|
+
}
|
|
3525
|
+
},
|
|
3526
|
+
addCategory() {
|
|
3527
|
+
if (!this.newCategoryName.trim()) return;
|
|
3528
|
+
const category = {
|
|
3529
|
+
id: Date.now().toString(),
|
|
3530
|
+
name: this.newCategoryName.trim(),
|
|
3531
|
+
color: this.newCategoryColor
|
|
3532
|
+
};
|
|
3533
|
+
this.categories.push(category);
|
|
3534
|
+
this.saveCategoriesToStorage();
|
|
3535
|
+
this.newCategoryName = "";
|
|
3536
|
+
this.newCategoryColor = "#3b82f6";
|
|
3537
|
+
},
|
|
3538
|
+
deleteCategory(id) {
|
|
3539
|
+
return __async(this, null, function* () {
|
|
3540
|
+
const confirmed = yield window.ZenModals.showConfirm({
|
|
3541
|
+
title: "¿Eliminar categoría?",
|
|
3542
|
+
message: "Las notas de esta categoría no se eliminarán, solo la categoría.",
|
|
3543
|
+
confirmText: "Eliminar",
|
|
3544
|
+
cancelText: "Cancelar",
|
|
3545
|
+
confirmButtonClass: "danger"
|
|
3546
|
+
});
|
|
3547
|
+
if (confirmed) {
|
|
3548
|
+
this.categories = this.categories.filter((cat) => cat.id !== id);
|
|
3549
|
+
this.saveCategoriesToStorage();
|
|
3550
|
+
}
|
|
3551
|
+
});
|
|
3552
|
+
},
|
|
3553
|
+
getCategoryName(categoryId) {
|
|
3554
|
+
const category = this.categories.find((cat) => cat.id === categoryId);
|
|
3555
|
+
return category ? category.name : "Sin categoría";
|
|
3556
|
+
},
|
|
3557
|
+
getCategoryColor(categoryId) {
|
|
3558
|
+
const category = this.categories.find((cat) => cat.id === categoryId);
|
|
3559
|
+
return category ? category.color : "#6b7280";
|
|
3560
|
+
},
|
|
3561
|
+
getNoteColor(note) {
|
|
3562
|
+
if (note.categoryId) {
|
|
3563
|
+
return this.getCategoryColor(note.categoryId);
|
|
3564
|
+
}
|
|
3565
|
+
return "#6b7280";
|
|
3566
|
+
},
|
|
3567
|
+
formatDate(dateString) {
|
|
3568
|
+
const date = new Date(dateString);
|
|
3569
|
+
const now = /* @__PURE__ */ new Date();
|
|
3570
|
+
const diff = now - date;
|
|
3571
|
+
const days = Math.floor(diff / (1e3 * 60 * 60 * 24));
|
|
3572
|
+
if (days === 0) {
|
|
3573
|
+
const hours = Math.floor(diff / (1e3 * 60 * 60));
|
|
3574
|
+
if (hours === 0) {
|
|
3575
|
+
const minutes = Math.floor(diff / (1e3 * 60));
|
|
3576
|
+
return minutes === 0 ? "Ahora" : `Hace ${minutes}m`;
|
|
3577
|
+
}
|
|
3578
|
+
return `Hace ${hours}h`;
|
|
3579
|
+
} else if (days === 1) {
|
|
3580
|
+
return "Ayer";
|
|
3581
|
+
} else if (days < 7) {
|
|
3582
|
+
return `Hace ${days} días`;
|
|
3583
|
+
} else {
|
|
3584
|
+
return date.toLocaleDateString("es-ES", {
|
|
3585
|
+
day: "numeric",
|
|
3586
|
+
month: "short",
|
|
3587
|
+
year: date.getFullYear() !== now.getFullYear() ? "numeric" : void 0
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
},
|
|
3591
|
+
exportNotes() {
|
|
3592
|
+
if (this.notes.length === 0) {
|
|
3593
|
+
alert("No hay notas para exportar");
|
|
3594
|
+
return;
|
|
3595
|
+
}
|
|
3596
|
+
let exportText = "# MIS NOTAS\n";
|
|
3597
|
+
exportText += `# Exportado el ${(/* @__PURE__ */ new Date()).toLocaleString("es-ES")}
|
|
3598
|
+
|
|
3599
|
+
`;
|
|
3600
|
+
exportText += "═".repeat(60) + "\n\n";
|
|
3601
|
+
const notesByCategory = {};
|
|
3602
|
+
this.notes.forEach((note) => {
|
|
3603
|
+
const categoryName = this.getCategoryName(note.categoryId);
|
|
3604
|
+
if (!notesByCategory[categoryName]) {
|
|
3605
|
+
notesByCategory[categoryName] = [];
|
|
3606
|
+
}
|
|
3607
|
+
notesByCategory[categoryName].push(note);
|
|
3608
|
+
});
|
|
3609
|
+
Object.keys(notesByCategory).sort().forEach((categoryName) => {
|
|
3610
|
+
exportText += `## 🏷️ ${categoryName.toUpperCase()}
|
|
3611
|
+
`;
|
|
3612
|
+
exportText += "─".repeat(60) + "\n\n";
|
|
3613
|
+
notesByCategory[categoryName].forEach((note) => {
|
|
3614
|
+
exportText += `### ${note.title || "Sin título"}`;
|
|
3615
|
+
if (note.isPinned) exportText += " 📌";
|
|
3616
|
+
exportText += "\n";
|
|
3617
|
+
exportText += `Fecha: ${new Date(note.createdAt).toLocaleString("es-ES")}
|
|
3618
|
+
|
|
3619
|
+
`;
|
|
3620
|
+
exportText += `${note.content}
|
|
3621
|
+
|
|
3622
|
+
`;
|
|
3623
|
+
exportText += "─".repeat(60) + "\n\n";
|
|
3624
|
+
});
|
|
3625
|
+
});
|
|
3626
|
+
exportText += "\n═".repeat(60) + "\n";
|
|
3627
|
+
exportText += `Total de notas: ${this.notes.length}
|
|
3628
|
+
`;
|
|
3629
|
+
exportText += `Notas fijadas: ${this.pinnedNotesCount}
|
|
3630
|
+
`;
|
|
3631
|
+
const blob = new Blob([exportText], { type: "text/plain;charset=utf-8" });
|
|
3632
|
+
const url = URL.createObjectURL(blob);
|
|
3633
|
+
const link = document.createElement("a");
|
|
3634
|
+
link.href = url;
|
|
3635
|
+
link.download = `notas_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.txt`;
|
|
3636
|
+
document.body.appendChild(link);
|
|
3637
|
+
link.click();
|
|
3638
|
+
document.body.removeChild(link);
|
|
3639
|
+
URL.revokeObjectURL(url);
|
|
3640
|
+
alert("✅ Notas exportadas exitosamente");
|
|
3641
|
+
},
|
|
3642
|
+
saveToStorage() {
|
|
3643
|
+
try {
|
|
3644
|
+
localStorage.setItem(this.storageKey, JSON.stringify(this.notes));
|
|
3645
|
+
} catch (e) {
|
|
3646
|
+
console.error("Error al guardar notas:", e);
|
|
3647
|
+
}
|
|
3648
|
+
},
|
|
3649
|
+
loadFromStorage() {
|
|
3650
|
+
try {
|
|
3651
|
+
const data = localStorage.getItem(this.storageKey);
|
|
3652
|
+
if (data) {
|
|
3653
|
+
this.notes = JSON.parse(data);
|
|
3654
|
+
}
|
|
3655
|
+
} catch (e) {
|
|
3656
|
+
console.error("Error al cargar notas:", e);
|
|
3657
|
+
}
|
|
3658
|
+
},
|
|
3659
|
+
saveCategoriesToStorage() {
|
|
3660
|
+
try {
|
|
3661
|
+
localStorage.setItem(this.categoriesKey, JSON.stringify(this.categories));
|
|
3662
|
+
} catch (e) {
|
|
3663
|
+
console.error("Error al guardar categorías:", e);
|
|
3664
|
+
}
|
|
3665
|
+
},
|
|
3666
|
+
loadCategoriesFromStorage() {
|
|
3667
|
+
try {
|
|
3668
|
+
const data = localStorage.getItem(this.categoriesKey);
|
|
3669
|
+
if (data) {
|
|
3670
|
+
const loaded = JSON.parse(data);
|
|
3671
|
+
if (!loaded.find((c) => c.id === "default")) {
|
|
3672
|
+
loaded.unshift({ id: "default", name: "Sin categoría", color: "#6b7280" });
|
|
3673
|
+
}
|
|
3674
|
+
this.categories = loaded;
|
|
3675
|
+
}
|
|
3676
|
+
} catch (e) {
|
|
3677
|
+
console.error("Error al cargar categorías:", e);
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
},
|
|
3681
|
+
mounted() {
|
|
3682
|
+
this.loadCategoriesFromStorage();
|
|
3683
|
+
this.loadFromStorage();
|
|
3684
|
+
}
|
|
3685
|
+
};
|
|
3686
|
+
const _hoisted_1 = { class: "notes-widget" };
|
|
3687
|
+
const _hoisted_2 = { class: "notes-header" };
|
|
3688
|
+
const _hoisted_3 = { class: "header-actions" };
|
|
3689
|
+
const _hoisted_4 = { class: "modal-header" };
|
|
3690
|
+
const _hoisted_5 = { class: "modal-body" };
|
|
3691
|
+
const _hoisted_6 = { class: "category-form" };
|
|
3692
|
+
const _hoisted_7 = { class: "categories-list" };
|
|
3693
|
+
const _hoisted_8 = { class: "category-name" };
|
|
3694
|
+
const _hoisted_9 = ["onClick"];
|
|
3695
|
+
const _hoisted_10 = {
|
|
3696
|
+
key: 0,
|
|
3697
|
+
class: "new-note-form"
|
|
3698
|
+
};
|
|
3699
|
+
const _hoisted_11 = { class: "note-form-actions" };
|
|
3700
|
+
const _hoisted_12 = ["value"];
|
|
3701
|
+
const _hoisted_13 = { class: "form-buttons" };
|
|
3702
|
+
const _hoisted_14 = { class: "notes-controls" };
|
|
3703
|
+
const _hoisted_15 = { class: "filter-controls" };
|
|
3704
|
+
const _hoisted_16 = ["onClick"];
|
|
3705
|
+
const _hoisted_17 = { class: "sort-controls" };
|
|
3706
|
+
const _hoisted_18 = { class: "notes-list" };
|
|
3707
|
+
const _hoisted_19 = {
|
|
3708
|
+
key: 0,
|
|
3709
|
+
class: "empty-state"
|
|
3710
|
+
};
|
|
3711
|
+
const _hoisted_20 = { class: "note-card-header" };
|
|
3712
|
+
const _hoisted_21 = ["onClick"];
|
|
3713
|
+
const _hoisted_22 = ["onClick"];
|
|
3714
|
+
const _hoisted_23 = { class: "note-title" };
|
|
3715
|
+
const _hoisted_24 = { class: "note-content" };
|
|
3716
|
+
const _hoisted_25 = { class: "note-footer" };
|
|
3717
|
+
const _hoisted_26 = { class: "note-date" };
|
|
3718
|
+
const _hoisted_27 = { class: "notes-stats" };
|
|
3719
|
+
const _hoisted_28 = { key: 0 };
|
|
3720
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3721
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
3722
|
+
createElementVNode("div", _hoisted_2, [
|
|
3723
|
+
_cache[19] || (_cache[19] = createElementVNode("h2", { class: "notes-title" }, "📝 Notas", -1)),
|
|
3724
|
+
createElementVNode("div", _hoisted_3, [
|
|
3725
|
+
createElementVNode("button", {
|
|
3726
|
+
onClick: _cache[0] || (_cache[0] = ($event) => $data.showCategoryManager = !$data.showCategoryManager),
|
|
3727
|
+
class: "icon-btn",
|
|
3728
|
+
title: "Gestionar Categorías"
|
|
3729
|
+
}, " 🏷️ "),
|
|
3730
|
+
createElementVNode("button", {
|
|
3731
|
+
onClick: _cache[1] || (_cache[1] = (...args) => $options.exportNotes && $options.exportNotes(...args)),
|
|
3732
|
+
class: "icon-btn",
|
|
3733
|
+
title: "Exportar Notas"
|
|
3734
|
+
}, " 💾 "),
|
|
3735
|
+
createElementVNode("button", {
|
|
3736
|
+
onClick: _cache[2] || (_cache[2] = (...args) => $options.toggleNewNote && $options.toggleNewNote(...args)),
|
|
3737
|
+
class: "icon-btn add-btn",
|
|
3738
|
+
title: "Nueva Nota"
|
|
3739
|
+
}, " ➕ ")
|
|
3740
|
+
])
|
|
3741
|
+
]),
|
|
3742
|
+
createVNode(Transition, { name: "modal" }, {
|
|
3743
|
+
default: withCtx(() => [
|
|
3744
|
+
$data.showCategoryManager ? (openBlock(), createElementBlock("div", {
|
|
3745
|
+
key: 0,
|
|
3746
|
+
class: "modal-overlay",
|
|
3747
|
+
onClick: _cache[9] || (_cache[9] = ($event) => $data.showCategoryManager = false)
|
|
3748
|
+
}, [
|
|
3749
|
+
createElementVNode("div", {
|
|
3750
|
+
class: "modal-content",
|
|
3751
|
+
onClick: _cache[8] || (_cache[8] = withModifiers(() => {
|
|
3752
|
+
}, ["stop"]))
|
|
3753
|
+
}, [
|
|
3754
|
+
createElementVNode("div", _hoisted_4, [
|
|
3755
|
+
_cache[20] || (_cache[20] = createElementVNode("h3", null, "🏷️ Gestionar Categorías", -1)),
|
|
3756
|
+
createElementVNode("button", {
|
|
3757
|
+
onClick: _cache[3] || (_cache[3] = ($event) => $data.showCategoryManager = false),
|
|
3758
|
+
class: "close-btn"
|
|
3759
|
+
}, "✕")
|
|
3760
|
+
]),
|
|
3761
|
+
createElementVNode("div", _hoisted_5, [
|
|
3762
|
+
createElementVNode("div", _hoisted_6, [
|
|
3763
|
+
withDirectives(createElementVNode("input", {
|
|
3764
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.newCategoryName = $event),
|
|
3765
|
+
onKeypress: _cache[5] || (_cache[5] = withKeys((...args) => $options.addCategory && $options.addCategory(...args), ["enter"])),
|
|
3766
|
+
placeholder: "Nombre de categoría",
|
|
3767
|
+
class: "category-input"
|
|
3768
|
+
}, null, 544), [
|
|
3769
|
+
[vModelText, $data.newCategoryName]
|
|
3770
|
+
]),
|
|
3771
|
+
withDirectives(createElementVNode("input", {
|
|
3772
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.newCategoryColor = $event),
|
|
3773
|
+
type: "color",
|
|
3774
|
+
class: "color-picker"
|
|
3775
|
+
}, null, 512), [
|
|
3776
|
+
[vModelText, $data.newCategoryColor]
|
|
3777
|
+
]),
|
|
3778
|
+
createElementVNode("button", {
|
|
3779
|
+
onClick: _cache[7] || (_cache[7] = (...args) => $options.addCategory && $options.addCategory(...args)),
|
|
3780
|
+
class: "add-category-btn"
|
|
3781
|
+
}, "Agregar")
|
|
3782
|
+
]),
|
|
3783
|
+
createElementVNode("div", _hoisted_7, [
|
|
3784
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.categories, (category) => {
|
|
3785
|
+
return openBlock(), createElementBlock("div", {
|
|
3786
|
+
key: category.id,
|
|
3787
|
+
class: "category-item"
|
|
3788
|
+
}, [
|
|
3789
|
+
createElementVNode("span", {
|
|
3790
|
+
class: "category-color-preview",
|
|
3791
|
+
style: normalizeStyle({ backgroundColor: category.color })
|
|
3792
|
+
}, null, 4),
|
|
3793
|
+
createElementVNode("span", _hoisted_8, toDisplayString(category.name), 1),
|
|
3794
|
+
category.id !== "default" ? (openBlock(), createElementBlock("button", {
|
|
3795
|
+
key: 0,
|
|
3796
|
+
onClick: ($event) => $options.deleteCategory(category.id),
|
|
3797
|
+
class: "delete-category-btn",
|
|
3798
|
+
title: "Eliminar"
|
|
3799
|
+
}, " 🗑️ ", 8, _hoisted_9)) : createCommentVNode("", true)
|
|
3800
|
+
]);
|
|
3801
|
+
}), 128))
|
|
3802
|
+
])
|
|
3803
|
+
])
|
|
3804
|
+
])
|
|
3805
|
+
])) : createCommentVNode("", true)
|
|
3806
|
+
]),
|
|
3807
|
+
_: 1
|
|
3808
|
+
}),
|
|
3809
|
+
createVNode(Transition, { name: "slide" }, {
|
|
3810
|
+
default: withCtx(() => [
|
|
3811
|
+
$data.showNewNoteForm ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
3812
|
+
withDirectives(createElementVNode("input", {
|
|
3813
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.newNote.title = $event),
|
|
3814
|
+
placeholder: "Título de la nota...",
|
|
3815
|
+
class: "note-title-input",
|
|
3816
|
+
ref: "titleInput"
|
|
3817
|
+
}, null, 512), [
|
|
3818
|
+
[vModelText, $data.newNote.title]
|
|
3819
|
+
]),
|
|
3820
|
+
withDirectives(createElementVNode("textarea", {
|
|
3821
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.newNote.content = $event),
|
|
3822
|
+
placeholder: "Escribe tu nota aquí...",
|
|
3823
|
+
class: "note-content-input",
|
|
3824
|
+
rows: "4"
|
|
3825
|
+
}, null, 512), [
|
|
3826
|
+
[vModelText, $data.newNote.content]
|
|
3827
|
+
]),
|
|
3828
|
+
createElementVNode("div", _hoisted_11, [
|
|
3829
|
+
withDirectives(createElementVNode("select", {
|
|
3830
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.newNote.categoryId = $event),
|
|
3831
|
+
class: "category-select"
|
|
3832
|
+
}, [
|
|
3833
|
+
_cache[21] || (_cache[21] = createElementVNode("option", { value: "" }, "Sin categoría", -1)),
|
|
3834
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.categories.filter((c) => c.id !== "default"), (category) => {
|
|
3835
|
+
return openBlock(), createElementBlock("option", {
|
|
3836
|
+
key: category.id,
|
|
3837
|
+
value: category.id
|
|
3838
|
+
}, toDisplayString(category.name), 9, _hoisted_12);
|
|
3839
|
+
}), 128))
|
|
3840
|
+
], 512), [
|
|
3841
|
+
[vModelSelect, $data.newNote.categoryId]
|
|
3842
|
+
]),
|
|
3843
|
+
createElementVNode("div", _hoisted_13, [
|
|
3844
|
+
createElementVNode("button", {
|
|
3845
|
+
onClick: _cache[13] || (_cache[13] = (...args) => $options.cancelNewNote && $options.cancelNewNote(...args)),
|
|
3846
|
+
class: "cancel-btn"
|
|
3847
|
+
}, "Cancelar"),
|
|
3848
|
+
createElementVNode("button", {
|
|
3849
|
+
onClick: _cache[14] || (_cache[14] = (...args) => $options.saveNote && $options.saveNote(...args)),
|
|
3850
|
+
class: "save-btn"
|
|
3851
|
+
}, "Guardar")
|
|
3852
|
+
])
|
|
3853
|
+
])
|
|
3854
|
+
])) : createCommentVNode("", true)
|
|
3855
|
+
]),
|
|
3856
|
+
_: 1
|
|
3857
|
+
}),
|
|
3858
|
+
createElementVNode("div", _hoisted_14, [
|
|
3859
|
+
createElementVNode("div", _hoisted_15, [
|
|
3860
|
+
createElementVNode("button", {
|
|
3861
|
+
onClick: _cache[15] || (_cache[15] = ($event) => $data.filterCategory = null),
|
|
3862
|
+
class: normalizeClass(["filter-btn", { active: $data.filterCategory === null }])
|
|
3863
|
+
}, " 📋 Todas ", 2),
|
|
3864
|
+
createElementVNode("button", {
|
|
3865
|
+
onClick: _cache[16] || (_cache[16] = ($event) => $data.filterCategory = "pinned"),
|
|
3866
|
+
class: normalizeClass(["filter-btn", { active: $data.filterCategory === "pinned" }])
|
|
3867
|
+
}, " 📌 Fijadas ", 2),
|
|
3868
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($data.categories.filter((c) => c.id !== "default"), (category) => {
|
|
3869
|
+
return openBlock(), createElementBlock("button", {
|
|
3870
|
+
key: category.id,
|
|
3871
|
+
onClick: ($event) => $data.filterCategory = category.id,
|
|
3872
|
+
class: normalizeClass(["filter-btn", { active: $data.filterCategory === category.id }]),
|
|
3873
|
+
style: normalizeStyle({ borderColor: category.color, color: $data.filterCategory === category.id ? category.color : "" })
|
|
3874
|
+
}, toDisplayString(category.name), 15, _hoisted_16);
|
|
3875
|
+
}), 128))
|
|
3876
|
+
]),
|
|
3877
|
+
createElementVNode("div", _hoisted_17, [
|
|
3878
|
+
withDirectives(createElementVNode("select", {
|
|
3879
|
+
"onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => $data.sortBy = $event),
|
|
3880
|
+
class: "sort-select"
|
|
3881
|
+
}, _cache[22] || (_cache[22] = [
|
|
3882
|
+
createElementVNode("option", { value: "date" }, "📅 Fecha", -1),
|
|
3883
|
+
createElementVNode("option", { value: "title" }, "🔤 Título", -1),
|
|
3884
|
+
createElementVNode("option", { value: "category" }, "🏷️ Categoría", -1)
|
|
3885
|
+
]), 512), [
|
|
3886
|
+
[vModelSelect, $data.sortBy]
|
|
3887
|
+
])
|
|
3888
|
+
])
|
|
3889
|
+
]),
|
|
3890
|
+
createElementVNode("div", _hoisted_18, [
|
|
3891
|
+
$options.filteredNotes.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
3892
|
+
_cache[23] || (_cache[23] = createElementVNode("div", { class: "empty-icon" }, "📭", -1)),
|
|
3893
|
+
_cache[24] || (_cache[24] = createElementVNode("p", null, "No hay notas", -1)),
|
|
3894
|
+
createElementVNode("button", {
|
|
3895
|
+
onClick: _cache[18] || (_cache[18] = (...args) => $options.toggleNewNote && $options.toggleNewNote(...args)),
|
|
3896
|
+
class: "create-first-note-btn"
|
|
3897
|
+
}, " Crear primera nota ")
|
|
3898
|
+
])) : createCommentVNode("", true),
|
|
3899
|
+
createVNode(TransitionGroup, {
|
|
3900
|
+
name: "note-list",
|
|
3901
|
+
tag: "div",
|
|
3902
|
+
class: "notes-grid"
|
|
3903
|
+
}, {
|
|
3904
|
+
default: withCtx(() => [
|
|
3905
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.filteredNotes, (note) => {
|
|
3906
|
+
return openBlock(), createElementBlock("div", {
|
|
3907
|
+
key: note.id,
|
|
3908
|
+
class: normalizeClass(["note-card", { pinned: note.isPinned }]),
|
|
3909
|
+
style: normalizeStyle({ borderLeftColor: $options.getNoteColor(note) })
|
|
3910
|
+
}, [
|
|
3911
|
+
createElementVNode("div", _hoisted_20, [
|
|
3912
|
+
createElementVNode("button", {
|
|
3913
|
+
onClick: ($event) => $options.togglePin(note.id),
|
|
3914
|
+
class: normalizeClass(["pin-btn", { pinned: note.isPinned }]),
|
|
3915
|
+
title: "Fijar/Desfijar"
|
|
3916
|
+
}, toDisplayString(note.isPinned ? "📌" : "📍"), 11, _hoisted_21),
|
|
3917
|
+
createElementVNode("button", {
|
|
3918
|
+
onClick: ($event) => $options.deleteNote(note.id),
|
|
3919
|
+
class: "delete-btn",
|
|
3920
|
+
title: "Eliminar"
|
|
3921
|
+
}, " 🗑️ ", 8, _hoisted_22)
|
|
3922
|
+
]),
|
|
3923
|
+
createElementVNode("h3", _hoisted_23, toDisplayString(note.title || "Sin título"), 1),
|
|
3924
|
+
createElementVNode("p", _hoisted_24, toDisplayString(note.content), 1),
|
|
3925
|
+
createElementVNode("div", _hoisted_25, [
|
|
3926
|
+
note.categoryId ? (openBlock(), createElementBlock("span", {
|
|
3927
|
+
key: 0,
|
|
3928
|
+
class: "note-category",
|
|
3929
|
+
style: normalizeStyle({
|
|
3930
|
+
backgroundColor: $options.getCategoryColor(note.categoryId),
|
|
3931
|
+
color: "white"
|
|
3932
|
+
})
|
|
3933
|
+
}, toDisplayString($options.getCategoryName(note.categoryId)), 5)) : createCommentVNode("", true),
|
|
3934
|
+
createElementVNode("span", _hoisted_26, toDisplayString($options.formatDate(note.createdAt)), 1)
|
|
3935
|
+
])
|
|
3936
|
+
], 6);
|
|
3937
|
+
}), 128))
|
|
3938
|
+
]),
|
|
3939
|
+
_: 1
|
|
3940
|
+
})
|
|
3941
|
+
]),
|
|
3942
|
+
createElementVNode("div", _hoisted_27, [
|
|
3943
|
+
createElementVNode("span", null, "Total: " + toDisplayString($data.notes.length) + " notas", 1),
|
|
3944
|
+
$options.pinnedNotesCount > 0 ? (openBlock(), createElementBlock("span", _hoisted_28, "📌 " + toDisplayString($options.pinnedNotesCount) + " fijadas", 1)) : createCommentVNode("", true)
|
|
3945
|
+
])
|
|
3946
|
+
]);
|
|
3947
|
+
}
|
|
3948
|
+
const ZNotesWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7326bacf"]]);
|
|
3949
|
+
class ModalManager {
|
|
3950
|
+
constructor() {
|
|
3951
|
+
this.currentModal = null;
|
|
3952
|
+
this.resolveCallback = null;
|
|
3953
|
+
this.rejectCallback = null;
|
|
3954
|
+
}
|
|
3955
|
+
/**
|
|
3956
|
+
* Crea el HTML del modal
|
|
3957
|
+
*/
|
|
3958
|
+
createModalHTML(config) {
|
|
3959
|
+
const {
|
|
3960
|
+
title = "",
|
|
3961
|
+
message = "",
|
|
3962
|
+
type = "confirm",
|
|
3963
|
+
confirmText = "Confirmar",
|
|
3964
|
+
cancelText = "Cancelar",
|
|
3965
|
+
showCancel = true,
|
|
3966
|
+
showIcon = true,
|
|
3967
|
+
inputLabel = "",
|
|
3968
|
+
inputPlaceholder = "",
|
|
3969
|
+
inputType = "text",
|
|
3970
|
+
inputDefaultValue = "",
|
|
3971
|
+
confirmButtonClass = ""
|
|
3972
|
+
} = config;
|
|
3973
|
+
const icons = {
|
|
3974
|
+
confirm: "⚠️",
|
|
3975
|
+
success: "✅",
|
|
3976
|
+
error: "❌",
|
|
3977
|
+
info: "ℹ️",
|
|
3978
|
+
warning: "⚠️",
|
|
3979
|
+
prompt: ""
|
|
3980
|
+
};
|
|
3981
|
+
const bgClasses = {
|
|
3982
|
+
confirm: "modal-bg-confirm",
|
|
3983
|
+
prompt: "modal-bg-prompt",
|
|
3984
|
+
success: "modal-bg-success",
|
|
3985
|
+
error: "modal-bg-error",
|
|
3986
|
+
warning: "modal-bg-warning",
|
|
3987
|
+
info: "modal-bg-info"
|
|
3988
|
+
};
|
|
3989
|
+
const iconHTML = showIcon && icons[type] ? `<div class="z-modal-icon">${icons[type]}</div>` : "";
|
|
3990
|
+
const inputHTML = type === "prompt" ? `
|
|
3991
|
+
<div class="z-modal-input-group">
|
|
3992
|
+
${inputLabel ? `<label class="z-modal-label">${inputLabel}</label>` : ""}
|
|
3993
|
+
<input
|
|
3994
|
+
type="${inputType}"
|
|
3995
|
+
class="z-modal-input"
|
|
3996
|
+
placeholder="${inputPlaceholder}"
|
|
3997
|
+
value="${inputDefaultValue}"
|
|
3998
|
+
id="z-modal-input"
|
|
3999
|
+
/>
|
|
4000
|
+
</div>
|
|
4001
|
+
` : "";
|
|
4002
|
+
const cancelBtnHTML = showCancel ? `<button class="z-modal-btn z-modal-btn-cancel" data-action="cancel">${cancelText}</button>` : "";
|
|
4003
|
+
return `
|
|
4004
|
+
<div class="z-modal-overlay" data-action="overlay">
|
|
4005
|
+
<div class="z-modal-container ${bgClasses[type]} z-modal-size-medium">
|
|
4006
|
+
${title ? `
|
|
4007
|
+
<div class="z-modal-header">
|
|
4008
|
+
<h3 class="z-modal-title">${title}</h3>
|
|
4009
|
+
<button class="z-modal-close" data-action="close" aria-label="Cerrar">
|
|
4010
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
4011
|
+
<path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
4012
|
+
</svg>
|
|
4013
|
+
</button>
|
|
4014
|
+
</div>
|
|
4015
|
+
` : ""}
|
|
4016
|
+
|
|
4017
|
+
<div class="z-modal-body">
|
|
4018
|
+
${iconHTML}
|
|
4019
|
+
${message ? `<p class="z-modal-message">${message}</p>` : ""}
|
|
4020
|
+
${inputHTML}
|
|
4021
|
+
</div>
|
|
4022
|
+
|
|
4023
|
+
<div class="z-modal-footer">
|
|
4024
|
+
${cancelBtnHTML}
|
|
4025
|
+
<button class="z-modal-btn z-modal-btn-confirm ${confirmButtonClass}" data-action="confirm">
|
|
4026
|
+
${confirmText}
|
|
4027
|
+
</button>
|
|
4028
|
+
</div>
|
|
4029
|
+
</div>
|
|
4030
|
+
</div>
|
|
4031
|
+
`;
|
|
4032
|
+
}
|
|
4033
|
+
/**
|
|
4034
|
+
* Muestra un modal
|
|
4035
|
+
*/
|
|
4036
|
+
show(config) {
|
|
4037
|
+
return new Promise((resolve, reject) => {
|
|
4038
|
+
if (this.currentModal) {
|
|
4039
|
+
this.close();
|
|
4040
|
+
}
|
|
4041
|
+
this.resolveCallback = resolve;
|
|
4042
|
+
this.rejectCallback = reject;
|
|
4043
|
+
const modalDiv = document.createElement("div");
|
|
4044
|
+
modalDiv.innerHTML = this.createModalHTML(config);
|
|
4045
|
+
this.currentModal = modalDiv.firstElementChild;
|
|
4046
|
+
document.body.appendChild(this.currentModal);
|
|
4047
|
+
this.injectStyles();
|
|
4048
|
+
this.setupEventListeners(config.type);
|
|
4049
|
+
requestAnimationFrame(() => {
|
|
4050
|
+
this.currentModal.classList.add("z-modal-show");
|
|
4051
|
+
});
|
|
4052
|
+
if (config.type === "prompt") {
|
|
4053
|
+
setTimeout(() => {
|
|
4054
|
+
const input = document.getElementById("z-modal-input");
|
|
4055
|
+
if (input) input.focus();
|
|
4056
|
+
}, 100);
|
|
4057
|
+
}
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
/**
|
|
4061
|
+
* Configura event listeners
|
|
4062
|
+
*/
|
|
4063
|
+
setupEventListeners(type) {
|
|
4064
|
+
const handleClick = (e) => {
|
|
4065
|
+
var _a;
|
|
4066
|
+
const action = (_a = e.target.closest("[data-action]")) == null ? void 0 : _a.dataset.action;
|
|
4067
|
+
if (action === "confirm") {
|
|
4068
|
+
if (type === "prompt") {
|
|
4069
|
+
const input = document.getElementById("z-modal-input");
|
|
4070
|
+
this.resolve(input ? input.value : "");
|
|
4071
|
+
} else {
|
|
4072
|
+
this.resolve(true);
|
|
4073
|
+
}
|
|
4074
|
+
} else if (action === "cancel" || action === "close") {
|
|
4075
|
+
this.resolve(false);
|
|
4076
|
+
} else if (action === "overlay") {
|
|
4077
|
+
this.resolve(false);
|
|
4078
|
+
}
|
|
4079
|
+
};
|
|
4080
|
+
const handleKeydown = (e) => {
|
|
4081
|
+
if (e.key === "Escape") {
|
|
4082
|
+
this.resolve(false);
|
|
4083
|
+
} else if (e.key === "Enter" && type === "prompt") {
|
|
4084
|
+
const input = document.getElementById("z-modal-input");
|
|
4085
|
+
this.resolve(input ? input.value : "");
|
|
4086
|
+
}
|
|
4087
|
+
};
|
|
4088
|
+
this.currentModal.addEventListener("click", handleClick);
|
|
4089
|
+
document.addEventListener("keydown", handleKeydown);
|
|
4090
|
+
this.currentModal._handleClick = handleClick;
|
|
4091
|
+
this.currentModal._handleKeydown = handleKeydown;
|
|
4092
|
+
}
|
|
4093
|
+
/**
|
|
4094
|
+
* Resuelve y cierra el modal
|
|
4095
|
+
*/
|
|
4096
|
+
resolve(value) {
|
|
4097
|
+
if (this.resolveCallback) {
|
|
4098
|
+
this.resolveCallback(value);
|
|
4099
|
+
}
|
|
4100
|
+
this.close();
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* Cierra el modal
|
|
4104
|
+
*/
|
|
4105
|
+
close() {
|
|
4106
|
+
if (!this.currentModal) return;
|
|
4107
|
+
if (this.currentModal._handleClick) {
|
|
4108
|
+
this.currentModal.removeEventListener("click", this.currentModal._handleClick);
|
|
4109
|
+
}
|
|
4110
|
+
if (this.currentModal._handleKeydown) {
|
|
4111
|
+
document.removeEventListener("keydown", this.currentModal._handleKeydown);
|
|
4112
|
+
}
|
|
4113
|
+
this.currentModal.classList.remove("z-modal-show");
|
|
4114
|
+
setTimeout(() => {
|
|
4115
|
+
if (this.currentModal && this.currentModal.parentNode) {
|
|
4116
|
+
this.currentModal.parentNode.removeChild(this.currentModal);
|
|
4117
|
+
}
|
|
4118
|
+
this.currentModal = null;
|
|
4119
|
+
this.resolveCallback = null;
|
|
4120
|
+
this.rejectCallback = null;
|
|
4121
|
+
}, 300);
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Inyecta los estilos CSS del modal
|
|
4125
|
+
*/
|
|
4126
|
+
injectStyles() {
|
|
4127
|
+
if (document.getElementById("z-modal-styles")) return;
|
|
4128
|
+
const style = document.createElement("style");
|
|
4129
|
+
style.id = "z-modal-styles";
|
|
4130
|
+
style.textContent = `
|
|
4131
|
+
.z-modal-overlay {
|
|
4132
|
+
position: fixed;
|
|
4133
|
+
top: 0;
|
|
4134
|
+
left: 0;
|
|
4135
|
+
right: 0;
|
|
4136
|
+
bottom: 0;
|
|
4137
|
+
background: rgba(0, 0, 0, 0.6);
|
|
4138
|
+
backdrop-filter: blur(8px);
|
|
4139
|
+
-webkit-backdrop-filter: blur(8px);
|
|
4140
|
+
display: flex;
|
|
4141
|
+
align-items: center;
|
|
4142
|
+
justify-content: center;
|
|
4143
|
+
z-index: 99999;
|
|
4144
|
+
padding: 20px;
|
|
4145
|
+
opacity: 0;
|
|
4146
|
+
transition: opacity 0.3s ease;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
.z-modal-overlay.z-modal-show {
|
|
4150
|
+
opacity: 1;
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
.z-modal-overlay.z-modal-show .z-modal-container {
|
|
4154
|
+
transform: translateY(0) scale(1);
|
|
4155
|
+
opacity: 1;
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
.z-modal-container {
|
|
4159
|
+
background: rgba(30, 30, 35, 0.95);
|
|
4160
|
+
backdrop-filter: blur(20px) saturate(180%);
|
|
4161
|
+
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
|
4162
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
4163
|
+
border-radius: 20px;
|
|
4164
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
4165
|
+
max-width: 90vw;
|
|
4166
|
+
max-height: 90vh;
|
|
4167
|
+
overflow: hidden;
|
|
4168
|
+
display: flex;
|
|
4169
|
+
flex-direction: column;
|
|
4170
|
+
color: #fff;
|
|
4171
|
+
transform: translateY(-30px) scale(0.95);
|
|
4172
|
+
opacity: 0;
|
|
4173
|
+
transition: all 0.3s ease;
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
.z-modal-size-medium {
|
|
4177
|
+
width: 450px;
|
|
4178
|
+
}
|
|
4179
|
+
|
|
4180
|
+
.z-modal-bg-success {
|
|
4181
|
+
background: rgba(16, 185, 129, 0.95);
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
.z-modal-bg-error, .z-modal-bg-warning {
|
|
4185
|
+
background: rgba(239, 68, 68, 0.95);
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
.z-modal-bg-info {
|
|
4189
|
+
background: rgba(59, 130, 246, 0.95);
|
|
4190
|
+
}
|
|
4191
|
+
|
|
4192
|
+
.z-modal-header {
|
|
4193
|
+
display: flex;
|
|
4194
|
+
align-items: center;
|
|
4195
|
+
justify-content: space-between;
|
|
4196
|
+
padding: 24px 24px 16px 24px;
|
|
4197
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4200
|
+
.z-modal-title {
|
|
4201
|
+
margin: 0;
|
|
4202
|
+
font-size: 1.25rem;
|
|
4203
|
+
font-weight: 600;
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
.z-modal-close {
|
|
4207
|
+
background: none;
|
|
4208
|
+
border: none;
|
|
4209
|
+
width: 32px;
|
|
4210
|
+
height: 32px;
|
|
4211
|
+
border-radius: 8px;
|
|
4212
|
+
display: flex;
|
|
4213
|
+
align-items: center;
|
|
4214
|
+
justify-content: center;
|
|
4215
|
+
cursor: pointer;
|
|
4216
|
+
color: currentColor;
|
|
4217
|
+
transition: all 0.2s ease;
|
|
4218
|
+
opacity: 0.7;
|
|
4219
|
+
}
|
|
4220
|
+
|
|
4221
|
+
.z-modal-close:hover {
|
|
4222
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4223
|
+
opacity: 1;
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
.z-modal-body {
|
|
4227
|
+
padding: 24px;
|
|
4228
|
+
text-align: center;
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
.z-modal-icon {
|
|
4232
|
+
font-size: 3rem;
|
|
4233
|
+
margin-bottom: 16px;
|
|
4234
|
+
animation: z-modal-icon-bounce 0.5s ease-out;
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
@keyframes z-modal-icon-bounce {
|
|
4238
|
+
0% { transform: scale(0); }
|
|
4239
|
+
50% { transform: scale(1.1); }
|
|
4240
|
+
100% { transform: scale(1); }
|
|
4241
|
+
}
|
|
4242
|
+
|
|
4243
|
+
.z-modal-message {
|
|
4244
|
+
margin: 0;
|
|
4245
|
+
font-size: 1rem;
|
|
4246
|
+
line-height: 1.6;
|
|
4247
|
+
opacity: 0.95;
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
.z-modal-input-group {
|
|
4251
|
+
margin-top: 20px;
|
|
4252
|
+
text-align: left;
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4255
|
+
.z-modal-label {
|
|
4256
|
+
display: block;
|
|
4257
|
+
margin-bottom: 8px;
|
|
4258
|
+
font-size: 0.9rem;
|
|
4259
|
+
font-weight: 500;
|
|
4260
|
+
opacity: 0.9;
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
.z-modal-input {
|
|
4264
|
+
width: 100%;
|
|
4265
|
+
padding: 12px 16px;
|
|
4266
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
4267
|
+
border-radius: 10px;
|
|
4268
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4269
|
+
color: #fff;
|
|
4270
|
+
font-size: 1rem;
|
|
4271
|
+
transition: all 0.2s ease;
|
|
4272
|
+
box-sizing: border-box;
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
.z-modal-input:focus {
|
|
4276
|
+
outline: none;
|
|
4277
|
+
border-color: rgba(255, 255, 255, 0.4);
|
|
4278
|
+
background: rgba(255, 255, 255, 0.15);
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
.z-modal-input::placeholder {
|
|
4282
|
+
color: rgba(255, 255, 255, 0.5);
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
.z-modal-footer {
|
|
4286
|
+
display: flex;
|
|
4287
|
+
gap: 12px;
|
|
4288
|
+
padding: 16px 24px 24px 24px;
|
|
4289
|
+
justify-content: flex-end;
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
.z-modal-btn {
|
|
4293
|
+
padding: 12px 24px;
|
|
4294
|
+
border: none;
|
|
4295
|
+
border-radius: 10px;
|
|
4296
|
+
font-size: 1rem;
|
|
4297
|
+
font-weight: 500;
|
|
4298
|
+
cursor: pointer;
|
|
4299
|
+
transition: all 0.2s ease;
|
|
4300
|
+
min-width: 100px;
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
.z-modal-btn-cancel {
|
|
4304
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4305
|
+
color: currentColor;
|
|
4306
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
.z-modal-btn-cancel:hover {
|
|
4310
|
+
background: rgba(255, 255, 255, 0.2);
|
|
4311
|
+
transform: translateY(-1px);
|
|
4312
|
+
}
|
|
4313
|
+
|
|
4314
|
+
.z-modal-btn-confirm {
|
|
4315
|
+
background: rgba(255, 255, 255, 0.9);
|
|
4316
|
+
color: #1a1a1a;
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
.z-modal-btn-confirm:hover {
|
|
4320
|
+
background: #fff;
|
|
4321
|
+
transform: translateY(-1px);
|
|
4322
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
4323
|
+
}
|
|
4324
|
+
|
|
4325
|
+
.z-modal-btn-confirm.danger {
|
|
4326
|
+
background: #ef4444;
|
|
4327
|
+
color: white;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
.z-modal-btn-confirm.danger:hover {
|
|
4331
|
+
background: #dc2626;
|
|
4332
|
+
}
|
|
4333
|
+
|
|
4334
|
+
@media (max-width: 768px) {
|
|
4335
|
+
.z-modal-container {
|
|
4336
|
+
width: 100% !important;
|
|
4337
|
+
max-width: 400px;
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
.z-modal-footer {
|
|
4341
|
+
flex-direction: column-reverse;
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
.z-modal-btn {
|
|
4345
|
+
width: 100%;
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
`;
|
|
4349
|
+
document.head.appendChild(style);
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
const modalManager = new ModalManager();
|
|
4353
|
+
function showConfirm(options = {}) {
|
|
4354
|
+
return modalManager.show(__spreadValues({
|
|
4355
|
+
type: "confirm",
|
|
4356
|
+
showCancel: true,
|
|
4357
|
+
showIcon: true,
|
|
4358
|
+
confirmText: "Confirmar",
|
|
4359
|
+
cancelText: "Cancelar"
|
|
4360
|
+
}, options));
|
|
4361
|
+
}
|
|
4362
|
+
function showAlert(options = {}) {
|
|
4363
|
+
const _a = options, { type = "info" } = _a, rest = __objRest(_a, ["type"]);
|
|
4364
|
+
return modalManager.show(__spreadValues({
|
|
4365
|
+
type,
|
|
4366
|
+
showCancel: false,
|
|
4367
|
+
showIcon: true,
|
|
4368
|
+
confirmText: "Entendido"
|
|
4369
|
+
}, rest));
|
|
4370
|
+
}
|
|
4371
|
+
function showPrompt(options = {}) {
|
|
4372
|
+
return modalManager.show(__spreadValues({
|
|
4373
|
+
type: "prompt",
|
|
4374
|
+
showCancel: true,
|
|
4375
|
+
showIcon: false,
|
|
4376
|
+
confirmText: "Aceptar",
|
|
4377
|
+
cancelText: "Cancelar",
|
|
4378
|
+
inputType: "text",
|
|
4379
|
+
inputDefaultValue: ""
|
|
4380
|
+
}, options));
|
|
4381
|
+
}
|
|
4382
|
+
function showSuccess(options = {}) {
|
|
4383
|
+
return showAlert(__spreadValues({
|
|
4384
|
+
type: "success",
|
|
4385
|
+
title: "¡Éxito!",
|
|
4386
|
+
message: "Operación completada correctamente"
|
|
4387
|
+
}, options));
|
|
4388
|
+
}
|
|
4389
|
+
function showError(options = {}) {
|
|
4390
|
+
return showAlert(__spreadValues({
|
|
4391
|
+
type: "error",
|
|
4392
|
+
title: "Error",
|
|
4393
|
+
message: "Ha ocurrido un error"
|
|
4394
|
+
}, options));
|
|
4395
|
+
}
|
|
4396
|
+
function showWarning(options = {}) {
|
|
4397
|
+
return showAlert(__spreadValues({
|
|
4398
|
+
type: "warning",
|
|
4399
|
+
title: "Advertencia"
|
|
4400
|
+
}, options));
|
|
4401
|
+
}
|
|
4402
|
+
function showDeleteConfirm(itemName = "este elemento") {
|
|
4403
|
+
return showConfirm({
|
|
4404
|
+
title: "¿Eliminar?",
|
|
4405
|
+
message: `¿Estás seguro de que deseas eliminar ${itemName}?`,
|
|
4406
|
+
confirmText: "Eliminar",
|
|
4407
|
+
cancelText: "Cancelar",
|
|
4408
|
+
confirmButtonClass: "danger"
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
if (typeof window !== "undefined") {
|
|
4412
|
+
window.ZenModals = {
|
|
4413
|
+
showConfirm,
|
|
4414
|
+
showAlert,
|
|
4415
|
+
showPrompt,
|
|
4416
|
+
showSuccess,
|
|
4417
|
+
showError,
|
|
4418
|
+
showWarning,
|
|
4419
|
+
showDeleteConfirm
|
|
4420
|
+
};
|
|
4421
|
+
}
|
|
2425
4422
|
const ZClockElement = defineCustomElement(ZClockWidget);
|
|
2426
4423
|
const ZSearchElement = defineCustomElement(ZSearchWidget);
|
|
2427
4424
|
const ZTodoElement = defineCustomElement(ZTodoWidget);
|
|
2428
4425
|
const ZMarkedElement = defineCustomElement(ZMarkedWidget);
|
|
4426
|
+
const ZCalendarElement = defineCustomElement(ZCalendarWidget);
|
|
4427
|
+
const ZWeatherElement = defineCustomElement(ZWeatherWidget);
|
|
4428
|
+
const ZNotesElement = defineCustomElement(ZNotesWidget);
|
|
2429
4429
|
if (!customElements.get("z-clock-widget")) {
|
|
2430
4430
|
customElements.define("z-clock-widget", ZClockElement);
|
|
2431
4431
|
}
|
|
@@ -2438,9 +4438,28 @@ if (!customElements.get("z-todo-widget")) {
|
|
|
2438
4438
|
if (!customElements.get("z-marked-widget")) {
|
|
2439
4439
|
customElements.define("z-marked-widget", ZMarkedElement);
|
|
2440
4440
|
}
|
|
4441
|
+
if (!customElements.get("z-calendar-widget")) {
|
|
4442
|
+
customElements.define("z-calendar-widget", ZCalendarElement);
|
|
4443
|
+
}
|
|
4444
|
+
if (!customElements.get("z-weather-widget")) {
|
|
4445
|
+
customElements.define("z-weather-widget", ZWeatherElement);
|
|
4446
|
+
}
|
|
4447
|
+
if (!customElements.get("z-notes-widget")) {
|
|
4448
|
+
customElements.define("z-notes-widget", ZNotesElement);
|
|
4449
|
+
}
|
|
2441
4450
|
export {
|
|
4451
|
+
ZCalendarWidget,
|
|
2442
4452
|
ZClockWidget,
|
|
2443
4453
|
ZMarkedWidget,
|
|
4454
|
+
ZNotesWidget,
|
|
2444
4455
|
ZSearchWidget,
|
|
2445
|
-
ZTodoWidget
|
|
4456
|
+
ZTodoWidget,
|
|
4457
|
+
ZWeatherWidget,
|
|
4458
|
+
showAlert,
|
|
4459
|
+
showConfirm,
|
|
4460
|
+
showDeleteConfirm,
|
|
4461
|
+
showError,
|
|
4462
|
+
showPrompt,
|
|
4463
|
+
showSuccess,
|
|
4464
|
+
showWarning
|
|
2446
4465
|
};
|