@pineui/react 0.1.0 → 0.1.2
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/Avatar.d.ts +1 -1
- package/dist/components/Card.d.ts +4 -2
- package/dist/components/CollectionMap.d.ts +15 -0
- package/dist/components/ConditionalMap.d.ts +16 -0
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Input.d.ts +4 -1
- package/dist/pineui.es.js +524 -467
- package/dist/pineui.standalone.js +10 -10
- package/dist/pineui.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/pineui.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Q, { useState as b, useEffect as W, Component as se } from "react";
|
|
2
2
|
import ie from "react-dom";
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
3
|
+
var J = {}, G = ie;
|
|
4
|
+
J.createRoot = G.createRoot, J.hydrateRoot = G.hydrateRoot;
|
|
5
|
+
var X = { exports: {} }, H = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,76 +12,68 @@ var te = { exports: {} }, T = {};
|
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
|
-
var oe =
|
|
16
|
-
function
|
|
17
|
-
var t,
|
|
15
|
+
var oe = Q, ae = Symbol.for("react.element"), le = Symbol.for("react.fragment"), ce = Object.prototype.hasOwnProperty, ue = oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, de = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
16
|
+
function ee(e, n, r) {
|
|
17
|
+
var t, s = {}, o = null, a = null;
|
|
18
18
|
r !== void 0 && (o = "" + r), n.key !== void 0 && (o = "" + n.key), n.ref !== void 0 && (a = n.ref);
|
|
19
|
-
for (t in n) ce.call(n, t) && !
|
|
20
|
-
if (e && e.defaultProps) for (t in n = e.defaultProps, n)
|
|
21
|
-
return { $$typeof: ae, type: e, key: o, ref: a, props:
|
|
19
|
+
for (t in n) ce.call(n, t) && !de.hasOwnProperty(t) && (s[t] = n[t]);
|
|
20
|
+
if (e && e.defaultProps) for (t in n = e.defaultProps, n) s[t] === void 0 && (s[t] = n[t]);
|
|
21
|
+
return { $$typeof: ae, type: e, key: o, ref: a, props: s, _owner: ue.current };
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
function
|
|
23
|
+
H.Fragment = le;
|
|
24
|
+
H.jsx = ee;
|
|
25
|
+
H.jsxs = ee;
|
|
26
|
+
X.exports = H;
|
|
27
|
+
var i = X.exports;
|
|
28
|
+
function S(e, n) {
|
|
29
29
|
if (typeof e == "string")
|
|
30
30
|
return pe(e, n);
|
|
31
31
|
if (Array.isArray(e))
|
|
32
|
-
return e.map((r) =>
|
|
32
|
+
return e.map((r) => S(r, n));
|
|
33
33
|
if (e && typeof e == "object") {
|
|
34
34
|
const r = {};
|
|
35
35
|
for (const t in e)
|
|
36
|
-
r[t] =
|
|
36
|
+
r[t] = S(e[t], n);
|
|
37
37
|
return r;
|
|
38
38
|
}
|
|
39
39
|
return e;
|
|
40
40
|
}
|
|
41
41
|
function pe(e, n) {
|
|
42
|
-
const r = e.
|
|
43
|
-
if (r) {
|
|
44
|
-
const
|
|
45
|
-
return (
|
|
42
|
+
const r = e.indexOf("}}");
|
|
43
|
+
if (e.startsWith("{{") && e.endsWith("}}") && r === e.length - 2) {
|
|
44
|
+
const s = e.slice(2, -2).trim();
|
|
45
|
+
return (s === "item" || s.startsWith("item.")) && (!("item" in n) || n.item === void 0) || (s === "props" || s.startsWith("props.")) && (!("props" in n) || n.props === void 0) || (s === "response" || s.startsWith("response.")) && !("response" in n) ? e : K(s, n);
|
|
46
46
|
}
|
|
47
|
-
return e.replace(/\{\{(.+?)\}\}/g, (
|
|
48
|
-
const
|
|
49
|
-
return
|
|
47
|
+
return e.replace(/\{\{(.+?)\}\}/g, (s, o) => {
|
|
48
|
+
const a = K(o.trim(), n);
|
|
49
|
+
return a != null ? String(a) : "";
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function K(e, n) {
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
if (/^[\w.]+$/.test(e))
|
|
55
|
+
return te(n, e);
|
|
56
|
+
if (e.includes("|") && !e.includes("||"))
|
|
57
|
+
return fe(e, n);
|
|
58
|
+
const r = Object.keys(n).filter((o) => /^[a-zA-Z_$][\w$]*$/.test(o)), t = r.map((o) => n[o]);
|
|
59
|
+
return new Function(...r, `"use strict"; try { return (${e}); } catch(e) { return undefined; }`)(...t);
|
|
55
60
|
} catch (r) {
|
|
56
61
|
console.warn(`Failed to evaluate expression: ${e}`, r);
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
function
|
|
65
|
+
function te(e, n) {
|
|
61
66
|
const r = n.split(".");
|
|
62
67
|
let t = e;
|
|
63
|
-
for (const
|
|
68
|
+
for (const s of r) {
|
|
64
69
|
if (t == null) return;
|
|
65
|
-
t = t[
|
|
70
|
+
t = t[s];
|
|
66
71
|
}
|
|
67
72
|
return t;
|
|
68
73
|
}
|
|
69
74
|
function fe(e, n) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (e.includes("!= null")) {
|
|
73
|
-
const r = e.split("!=")[0].trim();
|
|
74
|
-
return M(n, r) != null;
|
|
75
|
-
}
|
|
76
|
-
if (e.includes("==")) {
|
|
77
|
-
const [r, t] = e.split("==").map((a) => a.trim()), i = M(n, r), o = t.startsWith("'") || t.startsWith('"') ? t.slice(1, -1) : M(n, t);
|
|
78
|
-
return i == o;
|
|
79
|
-
}
|
|
80
|
-
return !1;
|
|
81
|
-
}
|
|
82
|
-
function he(e, n) {
|
|
83
|
-
const [r, t] = e.split("|").map((o) => o.trim()), i = M(n, r);
|
|
84
|
-
return t === "timeAgo" ? me(i) : i;
|
|
75
|
+
const [r, t] = e.split("|").map((o) => o.trim()), s = te(n, r);
|
|
76
|
+
return t === "timeAgo" ? me(s) : s;
|
|
85
77
|
}
|
|
86
78
|
function me(e) {
|
|
87
79
|
if (!e) return "";
|
|
@@ -90,102 +82,102 @@ function me(e) {
|
|
|
90
82
|
const t = Math.floor(((/* @__PURE__ */ new Date()).getTime() - n.getTime()) / 1e3);
|
|
91
83
|
return t < 60 ? `${t}s` : t < 3600 ? `${Math.floor(t / 60)}m` : t < 86400 ? `${Math.floor(t / 3600)}h` : t < 2592e3 ? `${Math.floor(t / 86400)}d` : t < 31536e3 ? `${Math.floor(t / 2592e3)}mo` : `${Math.floor(t / 31536e3)}y`;
|
|
92
84
|
}
|
|
93
|
-
function
|
|
85
|
+
function ne(e) {
|
|
94
86
|
var n, r, t = "";
|
|
95
87
|
if (typeof e == "string" || typeof e == "number") t += e;
|
|
96
88
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
97
|
-
var
|
|
98
|
-
for (n = 0; n <
|
|
89
|
+
var s = e.length;
|
|
90
|
+
for (n = 0; n < s; n++) e[n] && (r = ne(e[n])) && (t && (t += " "), t += r);
|
|
99
91
|
} else for (r in e) e[r] && (t && (t += " "), t += r);
|
|
100
92
|
return t;
|
|
101
93
|
}
|
|
102
|
-
function
|
|
103
|
-
for (var e, n, r = 0, t = "",
|
|
94
|
+
function F() {
|
|
95
|
+
for (var e, n, r = 0, t = "", s = arguments.length; r < s; r++) (e = arguments[r]) && (n = ne(e)) && (t && (t += " "), t += n);
|
|
104
96
|
return t;
|
|
105
97
|
}
|
|
106
|
-
const
|
|
98
|
+
const he = ({
|
|
107
99
|
content: e,
|
|
108
100
|
style: n = "bodyMedium",
|
|
109
101
|
color: r,
|
|
110
102
|
fontWeight: t,
|
|
111
|
-
maxLines:
|
|
103
|
+
maxLines: s
|
|
112
104
|
}) => {
|
|
113
|
-
const o =
|
|
105
|
+
const o = F("pineui-text", `pineui-text--${n}`, {
|
|
114
106
|
"pineui-text--bold": t === "bold"
|
|
115
107
|
}), a = {
|
|
116
108
|
color: r ? `var(--md-sys-color-${r}, ${r})` : void 0,
|
|
117
|
-
WebkitLineClamp:
|
|
118
|
-
display:
|
|
119
|
-
WebkitBoxOrient:
|
|
120
|
-
overflow:
|
|
109
|
+
WebkitLineClamp: s ?? void 0,
|
|
110
|
+
display: s ? "-webkit-box" : void 0,
|
|
111
|
+
WebkitBoxOrient: s ? "vertical" : void 0,
|
|
112
|
+
overflow: s ? "hidden" : void 0
|
|
121
113
|
};
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
},
|
|
114
|
+
return /* @__PURE__ */ i.jsx("p", { className: o, style: a, children: e || "(empty)" });
|
|
115
|
+
}, L = ({
|
|
124
116
|
type: e,
|
|
125
117
|
label: n,
|
|
126
118
|
icon: r,
|
|
127
119
|
enabled: t = !0,
|
|
128
|
-
loading:
|
|
120
|
+
loading: s = !1,
|
|
129
121
|
onPress: o,
|
|
130
122
|
context: a,
|
|
131
123
|
size: d = "medium",
|
|
132
124
|
color: c
|
|
133
125
|
}) => {
|
|
134
|
-
const
|
|
135
|
-
if (!t ||
|
|
136
|
-
const
|
|
137
|
-
await a.executeAction(
|
|
138
|
-
},
|
|
126
|
+
const p = async () => {
|
|
127
|
+
if (!t || s || !o || !a) return;
|
|
128
|
+
const g = S(o, a);
|
|
129
|
+
await a.executeAction(g);
|
|
130
|
+
}, m = F("pineui-button", `pineui-button--${e.split(".")[1]}`, {
|
|
139
131
|
"pineui-button--disabled": !t,
|
|
140
|
-
"pineui-button--loading":
|
|
132
|
+
"pineui-button--loading": s,
|
|
141
133
|
[`pineui-button--${d}`]: d
|
|
142
134
|
}), y = {
|
|
143
135
|
color: c ? `var(--md-sys-color-${c}, ${c})` : void 0
|
|
144
136
|
};
|
|
145
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ i.jsxs(
|
|
146
138
|
"button",
|
|
147
139
|
{
|
|
148
|
-
className:
|
|
149
|
-
onClick:
|
|
150
|
-
disabled: !t ||
|
|
140
|
+
className: m,
|
|
141
|
+
onClick: p,
|
|
142
|
+
disabled: !t || s,
|
|
151
143
|
style: y,
|
|
152
144
|
children: [
|
|
153
|
-
|
|
154
|
-
n && /* @__PURE__ */
|
|
145
|
+
s ? /* @__PURE__ */ i.jsx("span", { className: "pineui-button__spinner", children: "⏳" }) : r ? /* @__PURE__ */ i.jsx("span", { className: "pineui-button__icon", children: r }) : null,
|
|
146
|
+
n && /* @__PURE__ */ i.jsx("span", { className: "pineui-button__label", children: n })
|
|
155
147
|
]
|
|
156
148
|
}
|
|
157
149
|
);
|
|
158
|
-
},
|
|
150
|
+
}, Y = ({
|
|
159
151
|
type: e,
|
|
160
152
|
children: n = [],
|
|
161
153
|
spacing: r = 0,
|
|
162
154
|
padding: t = 0,
|
|
163
|
-
mainAxisAlignment:
|
|
155
|
+
mainAxisAlignment: s = "start",
|
|
164
156
|
crossAxisAlignment: o = "start",
|
|
165
157
|
flex: a,
|
|
166
158
|
width: d,
|
|
167
159
|
height: c,
|
|
168
|
-
maxWidth:
|
|
169
|
-
overflow:
|
|
160
|
+
maxWidth: p,
|
|
161
|
+
overflow: m,
|
|
170
162
|
backgroundColor: y,
|
|
171
|
-
border:
|
|
172
|
-
borderRadius:
|
|
173
|
-
elevation:
|
|
174
|
-
borderRight:
|
|
175
|
-
borderLeft:
|
|
176
|
-
borderTop:
|
|
177
|
-
borderBottom:
|
|
178
|
-
onPress:
|
|
179
|
-
context:
|
|
180
|
-
renderer:
|
|
163
|
+
border: g,
|
|
164
|
+
borderRadius: j,
|
|
165
|
+
elevation: w,
|
|
166
|
+
borderRight: T,
|
|
167
|
+
borderLeft: $,
|
|
168
|
+
borderTop: E,
|
|
169
|
+
borderBottom: _,
|
|
170
|
+
onPress: N,
|
|
171
|
+
context: C,
|
|
172
|
+
renderer: O
|
|
181
173
|
}) => {
|
|
182
|
-
if (!
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
await
|
|
174
|
+
if (!O || !C) return null;
|
|
175
|
+
const B = async () => {
|
|
176
|
+
if (N && C) {
|
|
177
|
+
const A = S(N, C);
|
|
178
|
+
await C.executeAction(A);
|
|
187
179
|
}
|
|
188
|
-
}, f = e === "layout.column", h =
|
|
180
|
+
}, f = e === "layout.column", h = F("pineui-layout", {
|
|
189
181
|
"pineui-layout--column": f,
|
|
190
182
|
"pineui-layout--row": !f
|
|
191
183
|
}), l = {
|
|
@@ -193,26 +185,26 @@ const ve = ({
|
|
|
193
185
|
flexDirection: f ? "column" : "row",
|
|
194
186
|
gap: `${r}px`,
|
|
195
187
|
padding: `${t}px`,
|
|
196
|
-
justifyContent: ye(
|
|
197
|
-
alignItems:
|
|
188
|
+
justifyContent: ye(s),
|
|
189
|
+
alignItems: ve(o),
|
|
198
190
|
flex: a,
|
|
199
191
|
width: d !== void 0 ? typeof d == "number" ? `${d}px` : d : void 0,
|
|
200
192
|
height: c !== void 0 ? typeof c == "number" ? `${c}px` : c : void 0,
|
|
201
|
-
maxWidth:
|
|
202
|
-
overflow:
|
|
193
|
+
maxWidth: p !== void 0 ? typeof p == "number" ? `${p}px` : p : void 0,
|
|
194
|
+
overflow: m,
|
|
203
195
|
backgroundColor: y,
|
|
204
|
-
border:
|
|
205
|
-
borderRadius:
|
|
206
|
-
boxShadow:
|
|
207
|
-
borderRight:
|
|
208
|
-
borderLeft:
|
|
209
|
-
borderTop:
|
|
210
|
-
borderBottom:
|
|
196
|
+
border: g,
|
|
197
|
+
borderRadius: j !== void 0 ? `${j}px` : void 0,
|
|
198
|
+
boxShadow: w ? xe(w) : void 0,
|
|
199
|
+
borderRight: T,
|
|
200
|
+
borderLeft: $,
|
|
201
|
+
borderTop: E,
|
|
202
|
+
borderBottom: _,
|
|
211
203
|
minWidth: 0,
|
|
212
204
|
// Permite que flex shrink funcione corretamente
|
|
213
|
-
cursor:
|
|
205
|
+
cursor: N ? "pointer" : void 0
|
|
214
206
|
};
|
|
215
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ i.jsx("div", { className: h, style: l, onClick: N ? B : void 0, children: n.map((A, k) => /* @__PURE__ */ i.jsx(O, { node: A, context: C }, k)) });
|
|
216
208
|
};
|
|
217
209
|
function ye(e) {
|
|
218
210
|
return {
|
|
@@ -223,7 +215,7 @@ function ye(e) {
|
|
|
223
215
|
spaceAround: "space-around"
|
|
224
216
|
}[e] || "flex-start";
|
|
225
217
|
}
|
|
226
|
-
function
|
|
218
|
+
function ve(e) {
|
|
227
219
|
return {
|
|
228
220
|
start: "flex-start",
|
|
229
221
|
center: "center",
|
|
@@ -241,33 +233,39 @@ function xe(e) {
|
|
|
241
233
|
};
|
|
242
234
|
return n[e] || n[1];
|
|
243
235
|
}
|
|
244
|
-
const
|
|
236
|
+
const ge = ({
|
|
245
237
|
child: e,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
238
|
+
children: n,
|
|
239
|
+
elevation: r = 1,
|
|
240
|
+
padding: t = 16,
|
|
241
|
+
variant: s,
|
|
242
|
+
onPress: o,
|
|
243
|
+
context: a,
|
|
244
|
+
renderer: d
|
|
251
245
|
}) => {
|
|
252
|
-
if (!
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
const
|
|
256
|
-
await
|
|
246
|
+
if (!d || !a) return null;
|
|
247
|
+
const c = async () => {
|
|
248
|
+
if (o && a) {
|
|
249
|
+
const j = S(o, a);
|
|
250
|
+
await a.executeAction(j);
|
|
257
251
|
}
|
|
258
|
-
},
|
|
259
|
-
"pineui-card--clickable": !!
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
252
|
+
}, m = F("pineui-card", `pineui-card--elevation-${s === "outlined" || s === "filled" ? 0 : r}`, {
|
|
253
|
+
"pineui-card--clickable": !!o,
|
|
254
|
+
"pineui-card--outlined": s === "outlined",
|
|
255
|
+
"pineui-card--filled": s === "filled"
|
|
256
|
+
}), y = {
|
|
257
|
+
padding: `${t}px`,
|
|
258
|
+
...s === "outlined" ? { border: "1px solid var(--md-sys-color-outline)" } : {},
|
|
259
|
+
...s === "filled" ? { background: "var(--md-sys-color-surfaceVariant)" } : {}
|
|
260
|
+
}, g = e ? /* @__PURE__ */ i.jsx(d, { node: e, context: a }) : n ? /* @__PURE__ */ i.jsx(i.Fragment, { children: n.map((j, w) => /* @__PURE__ */ i.jsx(d, { node: j, context: a }, w)) }) : null;
|
|
261
|
+
return /* @__PURE__ */ i.jsx("div", { className: m, style: y, onClick: o ? c : void 0, children: g });
|
|
262
|
+
}, be = ({
|
|
265
263
|
src: e,
|
|
266
264
|
alt: n = "",
|
|
267
265
|
aspectRatio: r,
|
|
268
266
|
borderRadius: t = 0,
|
|
269
|
-
loading:
|
|
270
|
-
|
|
267
|
+
loading: s = "lazy",
|
|
268
|
+
onPress: o,
|
|
271
269
|
context: a
|
|
272
270
|
}) => {
|
|
273
271
|
const d = async () => {
|
|
@@ -279,24 +277,24 @@ const be = ({
|
|
|
279
277
|
objectFit: "cover",
|
|
280
278
|
cursor: o ? "pointer" : void 0
|
|
281
279
|
};
|
|
282
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ i.jsx(
|
|
283
281
|
"img",
|
|
284
282
|
{
|
|
285
283
|
className: "pineui-image",
|
|
286
284
|
src: e,
|
|
287
285
|
alt: n,
|
|
288
|
-
loading:
|
|
286
|
+
loading: s,
|
|
289
287
|
style: c,
|
|
290
288
|
onClick: o ? d : void 0
|
|
291
289
|
}
|
|
292
290
|
);
|
|
293
|
-
},
|
|
291
|
+
}, je = ({
|
|
294
292
|
src: e,
|
|
295
293
|
size: n = 40,
|
|
296
|
-
|
|
294
|
+
onPress: r,
|
|
297
295
|
context: t
|
|
298
296
|
}) => {
|
|
299
|
-
const
|
|
297
|
+
const s = async () => {
|
|
300
298
|
r && t && await t.executeAction(r);
|
|
301
299
|
}, o = {
|
|
302
300
|
width: `${n}px`,
|
|
@@ -305,14 +303,14 @@ const be = ({
|
|
|
305
303
|
objectFit: "cover",
|
|
306
304
|
cursor: r ? "pointer" : void 0
|
|
307
305
|
};
|
|
308
|
-
return /* @__PURE__ */
|
|
306
|
+
return /* @__PURE__ */ i.jsx(
|
|
309
307
|
"img",
|
|
310
308
|
{
|
|
311
309
|
className: "pineui-avatar",
|
|
312
310
|
src: e,
|
|
313
311
|
alt: "Avatar",
|
|
314
312
|
style: o,
|
|
315
|
-
onClick: r ?
|
|
313
|
+
onClick: r ? s : void 0
|
|
316
314
|
}
|
|
317
315
|
);
|
|
318
316
|
}, we = ({
|
|
@@ -322,7 +320,7 @@ const be = ({
|
|
|
322
320
|
visible: t = !0
|
|
323
321
|
}) => {
|
|
324
322
|
if (!t) return null;
|
|
325
|
-
const
|
|
323
|
+
const s = {
|
|
326
324
|
fontSize: `${n}px`,
|
|
327
325
|
color: r ? `var(--md-sys-color-${r}, ${r})` : void 0
|
|
328
326
|
}, o = {
|
|
@@ -336,53 +334,72 @@ const be = ({
|
|
|
336
334
|
iosShare: "↗️",
|
|
337
335
|
moreVert: "⋮"
|
|
338
336
|
};
|
|
339
|
-
return /* @__PURE__ */
|
|
340
|
-
}
|
|
337
|
+
return /* @__PURE__ */ i.jsx("span", { className: "pineui-icon", style: s, children: o[e] || e });
|
|
338
|
+
};
|
|
339
|
+
function U(e, n) {
|
|
340
|
+
return e === "{{response}}" ? n : typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => U(r, n)) : Object.fromEntries(
|
|
341
|
+
Object.entries(e).map(([r, t]) => [r, U(t, n)])
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
const _e = ({
|
|
341
345
|
id: e,
|
|
342
346
|
layout: n = "list",
|
|
343
347
|
columns: r = 3,
|
|
344
348
|
spacing: t = 16,
|
|
345
|
-
data:
|
|
349
|
+
data: s,
|
|
346
350
|
itemTemplate: o,
|
|
347
351
|
loadingState: a,
|
|
348
352
|
emptyState: d,
|
|
349
353
|
errorState: c,
|
|
350
|
-
refreshable:
|
|
351
|
-
context:
|
|
354
|
+
refreshable: p = !1,
|
|
355
|
+
context: m,
|
|
352
356
|
renderer: y
|
|
353
357
|
}) => {
|
|
354
|
-
const [
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
const [g, j] = b([]), [w, T] = b(!0), [$, E] = b(!1), [_, N] = b(null), [C, O] = b(!0), [B, f] = b(null), h = s.type === "action.http" && m ? s.url.replace(/\{\{state\.([^}]+)\}\}/g, (k, u) => {
|
|
359
|
+
const v = u.split(".");
|
|
360
|
+
let x = m.state;
|
|
361
|
+
for (const I of v) {
|
|
362
|
+
if (x == null) return "";
|
|
363
|
+
x = x[I];
|
|
364
|
+
}
|
|
365
|
+
return x != null ? String(x) : "";
|
|
366
|
+
}) : "";
|
|
367
|
+
W(() => {
|
|
368
|
+
l();
|
|
369
|
+
}, [h]);
|
|
370
|
+
const l = async (k = !1) => {
|
|
371
|
+
if (m)
|
|
360
372
|
try {
|
|
361
|
-
if (
|
|
362
|
-
let
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
let
|
|
366
|
-
for (const
|
|
367
|
-
if (
|
|
368
|
-
|
|
373
|
+
if (k ? E(!0) : T(!0), N(null), s.type === "action.http") {
|
|
374
|
+
let u = s.url;
|
|
375
|
+
u.includes("{{state.") && (u = u.replace(/\{\{state\.([^}]+)\}\}/g, (M, P) => {
|
|
376
|
+
const z = P.split(".");
|
|
377
|
+
let D = m.state;
|
|
378
|
+
for (const re of z) {
|
|
379
|
+
if (D == null) return "";
|
|
380
|
+
D = D[re];
|
|
369
381
|
}
|
|
370
|
-
return
|
|
371
|
-
})),
|
|
372
|
-
const
|
|
373
|
-
|
|
382
|
+
return D != null ? String(D) : "";
|
|
383
|
+
})), k && B && (u += `${u.includes("?") ? "&" : "?"}after=${B}`);
|
|
384
|
+
const x = await (await fetch(u)).json(), I = x.data || x;
|
|
385
|
+
if (j((M) => k ? [...M, ...I] : I), s.onSuccess && m) {
|
|
386
|
+
console.log(`[Collection] onSuccess called with ${I.length} items`);
|
|
387
|
+
const M = U(s.onSuccess, I);
|
|
388
|
+
await m.executeAction(M), console.log("[Collection] onSuccess done");
|
|
389
|
+
}
|
|
390
|
+
x.pagination ? (O(x.pagination.hasMore), f(x.pagination.cursor)) : O(!1);
|
|
374
391
|
}
|
|
375
|
-
} catch (
|
|
376
|
-
|
|
392
|
+
} catch (u) {
|
|
393
|
+
N(u);
|
|
377
394
|
} finally {
|
|
378
|
-
|
|
395
|
+
T(!1), E(!1);
|
|
379
396
|
}
|
|
380
|
-
},
|
|
381
|
-
|
|
397
|
+
}, A = () => {
|
|
398
|
+
!$ && C && l(!0);
|
|
382
399
|
};
|
|
383
|
-
return !y || !
|
|
384
|
-
|
|
385
|
-
/* @__PURE__ */
|
|
400
|
+
return !y || !m ? null : w && a ? /* @__PURE__ */ i.jsx(y, { node: a, context: m }) : _ && c ? /* @__PURE__ */ i.jsx(y, { node: c, context: m }) : g.length === 0 && d ? /* @__PURE__ */ i.jsx(y, { node: d, context: m }) : /* @__PURE__ */ i.jsxs("div", { className: "pineui-collection", "data-collection-id": e, children: [
|
|
401
|
+
p && /* @__PURE__ */ i.jsx("div", { className: "pineui-collection__refresh", children: /* @__PURE__ */ i.jsx("button", { onClick: () => l(!1), children: "Refresh" }) }),
|
|
402
|
+
/* @__PURE__ */ i.jsx(
|
|
386
403
|
"div",
|
|
387
404
|
{
|
|
388
405
|
className: `pineui-collection__${n}`,
|
|
@@ -391,150 +408,170 @@ const be = ({
|
|
|
391
408
|
gridTemplateColumns: `repeat(${r}, 1fr)`,
|
|
392
409
|
gap: `${t}px`
|
|
393
410
|
} : void 0,
|
|
394
|
-
children:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
return (b = o.type) != null && b.startsWith("pattern.") && (($ = o.props) == null ? void 0 : $.post) === "{{item}}" ? m = {
|
|
398
|
-
...o,
|
|
399
|
-
props: {
|
|
400
|
-
...o.props,
|
|
401
|
-
post: g
|
|
402
|
-
}
|
|
403
|
-
} : (N = o.type) != null && N.startsWith("pattern.") && ((L = o.props) == null ? void 0 : L.course) === "{{item}}" ? m = {
|
|
404
|
-
...o,
|
|
405
|
-
props: {
|
|
406
|
-
...o.props,
|
|
407
|
-
course: g
|
|
408
|
-
}
|
|
409
|
-
} : (O = o.type) != null && O.startsWith("pattern.") && ((S = o.props) == null ? void 0 : S.conversation) === "{{item}}" ? m = {
|
|
410
|
-
...o,
|
|
411
|
-
props: {
|
|
412
|
-
...o.props,
|
|
413
|
-
conversation: g
|
|
414
|
-
}
|
|
415
|
-
} : (F = o.type) != null && F.startsWith("pattern.") && ((q = o.props) == null ? void 0 : q.message) === "{{item}}" ? m = {
|
|
416
|
-
...o,
|
|
417
|
-
props: {
|
|
418
|
-
...o.props,
|
|
419
|
-
message: g
|
|
420
|
-
}
|
|
421
|
-
} : (G = o.type) != null && G.startsWith("pattern.") && ((Y = o.props) == null ? void 0 : Y.profile) === "{{item}}" && (m = {
|
|
422
|
-
...o,
|
|
423
|
-
props: {
|
|
424
|
-
...o.props,
|
|
425
|
-
profile: g
|
|
426
|
-
}
|
|
427
|
-
}), /* @__PURE__ */ s.jsx("div", { className: `pineui-collection__item ${n === "grid" ? "pineui-collection__item--grid" : ""}`, children: /* @__PURE__ */ s.jsx(y, { node: m, context: v, parentData: g }) }, g.id || p);
|
|
411
|
+
children: g.map((k, u) => {
|
|
412
|
+
const v = { ...m, item: k, index: u };
|
|
413
|
+
return /* @__PURE__ */ i.jsx("div", { className: `pineui-collection__item ${n === "grid" ? "pineui-collection__item--grid" : ""}`, children: /* @__PURE__ */ i.jsx(y, { node: o, context: v }) }, k.id || u);
|
|
428
414
|
})
|
|
429
415
|
}
|
|
430
416
|
),
|
|
431
|
-
|
|
417
|
+
C && !w && /* @__PURE__ */ i.jsx("div", { className: "pineui-collection__load-more", style: { padding: "16px", textAlign: "center" }, children: /* @__PURE__ */ i.jsx(
|
|
432
418
|
"button",
|
|
433
419
|
{
|
|
434
|
-
onClick:
|
|
435
|
-
disabled:
|
|
420
|
+
onClick: A,
|
|
421
|
+
disabled: $,
|
|
436
422
|
style: {
|
|
437
423
|
padding: "12px 24px",
|
|
438
424
|
fontSize: "14px",
|
|
439
425
|
fontWeight: 500,
|
|
440
|
-
cursor:
|
|
441
|
-
opacity:
|
|
426
|
+
cursor: $ ? "not-allowed" : "pointer",
|
|
427
|
+
opacity: $ ? 0.6 : 1
|
|
442
428
|
},
|
|
443
|
-
children:
|
|
429
|
+
children: $ ? "Carregando..." : "Carregar mais"
|
|
444
430
|
}
|
|
445
431
|
) })
|
|
446
432
|
] });
|
|
433
|
+
}, Ne = ({
|
|
434
|
+
data: e,
|
|
435
|
+
template: n,
|
|
436
|
+
itemTemplate: r,
|
|
437
|
+
layout: t = "list",
|
|
438
|
+
columns: s = 3,
|
|
439
|
+
spacing: o = 16,
|
|
440
|
+
context: a,
|
|
441
|
+
renderer: d
|
|
442
|
+
}) => {
|
|
443
|
+
if (!d || !a) return null;
|
|
444
|
+
const c = n || r;
|
|
445
|
+
if (!c) return null;
|
|
446
|
+
const p = Array.isArray(e) ? e : [];
|
|
447
|
+
if (p.length === 0) return null;
|
|
448
|
+
const m = t === "grid" ? { display: "grid", gridTemplateColumns: `repeat(${s}, 1fr)`, gap: `${o}px` } : { display: "flex", flexDirection: "column", gap: `${o}px` };
|
|
449
|
+
return /* @__PURE__ */ i.jsx("div", { style: m, children: p.map((y, g) => {
|
|
450
|
+
const j = { ...a, item: y, index: g };
|
|
451
|
+
return /* @__PURE__ */ i.jsx(
|
|
452
|
+
d,
|
|
453
|
+
{
|
|
454
|
+
node: c,
|
|
455
|
+
context: j
|
|
456
|
+
},
|
|
457
|
+
y.id ?? g
|
|
458
|
+
);
|
|
459
|
+
}) });
|
|
447
460
|
}, ke = ({
|
|
448
461
|
appBar: e,
|
|
449
462
|
body: n,
|
|
450
463
|
floatingActionButton: r,
|
|
451
464
|
bottomNavigationBar: t,
|
|
452
|
-
context:
|
|
465
|
+
context: s,
|
|
453
466
|
renderer: o
|
|
454
|
-
}) => !o || !
|
|
455
|
-
e && /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
r && /* @__PURE__ */
|
|
458
|
-
t && /* @__PURE__ */
|
|
467
|
+
}) => !o || !s ? null : /* @__PURE__ */ i.jsxs("div", { className: "pineui-scaffold", children: [
|
|
468
|
+
e && /* @__PURE__ */ i.jsx("header", { className: "pineui-scaffold__appbar", children: /* @__PURE__ */ i.jsx(o, { node: e, context: s }) }),
|
|
469
|
+
/* @__PURE__ */ i.jsx("main", { className: "pineui-scaffold__body", children: /* @__PURE__ */ i.jsx(o, { node: n, context: s }) }),
|
|
470
|
+
r && /* @__PURE__ */ i.jsx("div", { className: "pineui-scaffold__fab", children: /* @__PURE__ */ i.jsx(o, { node: r, context: s }) }),
|
|
471
|
+
t && /* @__PURE__ */ i.jsx("footer", { className: "pineui-scaffold__bottomnav", children: /* @__PURE__ */ i.jsx(o, { node: t, context: s }) })
|
|
459
472
|
] }), $e = ({
|
|
460
473
|
title: e,
|
|
461
474
|
leading: n,
|
|
462
475
|
actions: r = [],
|
|
463
476
|
context: t,
|
|
464
|
-
renderer:
|
|
465
|
-
}) => !
|
|
466
|
-
n && /* @__PURE__ */
|
|
467
|
-
e && /* @__PURE__ */
|
|
468
|
-
r.length > 0 && /* @__PURE__ */
|
|
477
|
+
renderer: s
|
|
478
|
+
}) => !s || !t ? null : /* @__PURE__ */ i.jsxs("div", { className: "pineui-appbar", children: [
|
|
479
|
+
n && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__leading", children: /* @__PURE__ */ i.jsx(s, { node: n, context: t }) }),
|
|
480
|
+
e && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__title", children: /* @__PURE__ */ i.jsx(s, { node: e, context: t }) }),
|
|
481
|
+
r.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "pineui-appbar__actions", children: r.map((o, a) => /* @__PURE__ */ i.jsx(s, { node: o, context: t }, a)) })
|
|
469
482
|
] }), Ce = ({
|
|
470
483
|
items: e,
|
|
471
484
|
currentIndex: n,
|
|
472
485
|
onItemTap: r,
|
|
473
486
|
context: t
|
|
474
487
|
}) => {
|
|
475
|
-
const
|
|
488
|
+
const s = async (o) => {
|
|
476
489
|
if (!t) return;
|
|
477
490
|
const a = JSON.parse(
|
|
478
491
|
JSON.stringify(r).replace(/\{\{item\.(\w+)\}\}/g, (d, c) => {
|
|
479
|
-
const
|
|
480
|
-
return
|
|
492
|
+
const p = o[c];
|
|
493
|
+
return p != null ? String(p) : "";
|
|
481
494
|
})
|
|
482
495
|
);
|
|
483
496
|
await t.executeAction(a);
|
|
484
497
|
};
|
|
485
|
-
return /* @__PURE__ */
|
|
498
|
+
return /* @__PURE__ */ i.jsx("nav", { className: "pineui-bottomnav", children: e.map((o, a) => /* @__PURE__ */ i.jsxs(
|
|
486
499
|
"button",
|
|
487
500
|
{
|
|
488
501
|
className: `pineui-bottomnav__item ${a === n ? "pineui-bottomnav__item--active" : ""}`,
|
|
489
|
-
onClick: () =>
|
|
502
|
+
onClick: () => s(o),
|
|
490
503
|
children: [
|
|
491
|
-
/* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
o.badge && o.badge > 0 && /* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ i.jsxs("div", { className: "pineui-bottomnav__icon-container", children: [
|
|
505
|
+
/* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__icon", children: o.icon }),
|
|
506
|
+
o.badge && o.badge > 0 && /* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__badge", children: o.badge })
|
|
494
507
|
] }),
|
|
495
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ i.jsx("span", { className: "pineui-bottomnav__label", children: o.label })
|
|
496
509
|
]
|
|
497
510
|
},
|
|
498
511
|
a
|
|
499
512
|
)) });
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
513
|
+
}, V = ({
|
|
514
|
+
type: e,
|
|
515
|
+
id: n,
|
|
516
|
+
label: r,
|
|
517
|
+
placeholder: t = "",
|
|
518
|
+
value: s = "",
|
|
519
|
+
error: o,
|
|
520
|
+
multiline: a = !1,
|
|
521
|
+
maxLines: d = 1,
|
|
522
|
+
maxLength: c,
|
|
523
|
+
autofocus: p = !1,
|
|
524
|
+
onChanged: m,
|
|
525
|
+
onChange: y,
|
|
526
|
+
context: g
|
|
510
527
|
}) => {
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
528
|
+
const j = y || m, w = async (_) => {
|
|
529
|
+
!j || !g || await g.executeAction(j, { event: { value: _.target.value }, value: _.target.value });
|
|
530
|
+
}, $ = {
|
|
531
|
+
"input.email": "email",
|
|
532
|
+
"input.password": "password",
|
|
533
|
+
"input.number": "number",
|
|
534
|
+
"input.search": "search",
|
|
535
|
+
"input.text": "text"
|
|
536
|
+
}[e] || "text", E = {
|
|
537
|
+
id: n,
|
|
538
|
+
placeholder: t,
|
|
539
|
+
defaultValue: s,
|
|
540
|
+
maxLength: c,
|
|
541
|
+
autoFocus: p,
|
|
542
|
+
onChange: w,
|
|
543
|
+
className: `pineui-input${o ? " pineui-input--error" : ""}`
|
|
525
544
|
};
|
|
526
|
-
return
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
545
|
+
return /* @__PURE__ */ i.jsxs("div", { className: "pineui-input-wrapper", style: { width: "100%" }, children: [
|
|
546
|
+
r && /* @__PURE__ */ i.jsx(
|
|
547
|
+
"label",
|
|
548
|
+
{
|
|
549
|
+
htmlFor: n,
|
|
550
|
+
style: {
|
|
551
|
+
display: "block",
|
|
552
|
+
fontSize: "12px",
|
|
553
|
+
fontWeight: 500,
|
|
554
|
+
color: o ? "var(--md-sys-color-error)" : "var(--md-sys-color-onSurfaceVariant)",
|
|
555
|
+
marginBottom: "4px"
|
|
556
|
+
},
|
|
557
|
+
children: r
|
|
534
558
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
559
|
+
),
|
|
560
|
+
a ? /* @__PURE__ */ i.jsx(
|
|
561
|
+
"textarea",
|
|
562
|
+
{
|
|
563
|
+
...E,
|
|
564
|
+
rows: d,
|
|
565
|
+
style: { resize: "none", minHeight: `${d * 24}px` }
|
|
566
|
+
}
|
|
567
|
+
) : /* @__PURE__ */ i.jsx("input", { ...E, type: $ }),
|
|
568
|
+
o && /* @__PURE__ */ i.jsx("p", { style: {
|
|
569
|
+
fontSize: "12px",
|
|
570
|
+
color: "var(--md-sys-color-error)",
|
|
571
|
+
marginTop: "4px"
|
|
572
|
+
}, children: o })
|
|
573
|
+
] });
|
|
574
|
+
}, Ae = ({
|
|
538
575
|
thickness: e = 1,
|
|
539
576
|
color: n = "surfaceVariant"
|
|
540
577
|
}) => {
|
|
@@ -544,117 +581,127 @@ const be = ({
|
|
|
544
581
|
border: "none",
|
|
545
582
|
margin: 0
|
|
546
583
|
};
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
},
|
|
584
|
+
return /* @__PURE__ */ i.jsx("hr", { className: "pineui-divider", style: r });
|
|
585
|
+
}, Te = ({
|
|
549
586
|
conditions: e,
|
|
550
587
|
context: n,
|
|
551
588
|
renderer: r
|
|
552
589
|
}) => {
|
|
553
590
|
if (!r || !n) return null;
|
|
554
591
|
for (const t of e) {
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
return /* @__PURE__ */
|
|
592
|
+
const s = S({ when: t.when }, n);
|
|
593
|
+
if (s.when === !0 || s.when === "true")
|
|
594
|
+
return /* @__PURE__ */ i.jsx(r, { node: t.render, context: n });
|
|
558
595
|
}
|
|
559
596
|
return null;
|
|
560
|
-
},
|
|
597
|
+
}, Ee = ({
|
|
598
|
+
condition: e,
|
|
599
|
+
children: n,
|
|
600
|
+
child: r,
|
|
601
|
+
context: t,
|
|
602
|
+
renderer: s
|
|
603
|
+
}) => {
|
|
604
|
+
if (!s || !t) return null;
|
|
605
|
+
const o = S({ condition: e }, t);
|
|
606
|
+
return o.condition === !0 || o.condition === "true" || o.condition === 1 ? r ? /* @__PURE__ */ i.jsx(s, { node: r, context: t }) : n ? /* @__PURE__ */ i.jsx(i.Fragment, { children: n.map((d, c) => /* @__PURE__ */ i.jsx(s, { node: d, context: t }, c)) }) : null : null;
|
|
607
|
+
}, Se = ({
|
|
561
608
|
tabs: e,
|
|
562
609
|
defaultTab: n,
|
|
563
610
|
context: r,
|
|
564
611
|
renderer: t
|
|
565
612
|
}) => {
|
|
566
613
|
var d;
|
|
567
|
-
const [
|
|
614
|
+
const [s, o] = b(n || ((d = e[0]) == null ? void 0 : d.id));
|
|
568
615
|
if (!t || !r) return null;
|
|
569
|
-
const a = e.find((c) => c.id ===
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */
|
|
616
|
+
const a = e.find((c) => c.id === s);
|
|
617
|
+
return /* @__PURE__ */ i.jsxs("div", { className: "pineui-tabs", children: [
|
|
618
|
+
/* @__PURE__ */ i.jsx("div", { className: "pineui-tabs__header", children: e.map((c) => /* @__PURE__ */ i.jsxs(
|
|
572
619
|
"button",
|
|
573
620
|
{
|
|
574
|
-
className: `pineui-tabs__tab ${
|
|
621
|
+
className: `pineui-tabs__tab ${s === c.id ? "pineui-tabs__tab--active" : ""}`,
|
|
575
622
|
onClick: () => o(c.id),
|
|
576
623
|
children: [
|
|
577
|
-
c.icon && /* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
c.badge !== void 0 && c.badge > 0 && /* @__PURE__ */
|
|
624
|
+
c.icon && /* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__icon", children: c.icon }),
|
|
625
|
+
/* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__label", children: c.label }),
|
|
626
|
+
c.badge !== void 0 && c.badge > 0 && /* @__PURE__ */ i.jsx("span", { className: "pineui-tabs__badge", children: c.badge })
|
|
580
627
|
]
|
|
581
628
|
},
|
|
582
629
|
c.id
|
|
583
630
|
)) }),
|
|
584
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ i.jsx("div", { className: "pineui-tabs__content", children: a && /* @__PURE__ */ i.jsx(t, { node: a.content, context: r }) })
|
|
585
632
|
] });
|
|
586
|
-
},
|
|
633
|
+
}, Ie = ({
|
|
587
634
|
label: e,
|
|
588
635
|
variant: n = "default",
|
|
589
636
|
size: r = "medium"
|
|
590
637
|
}) => {
|
|
591
|
-
const t =
|
|
638
|
+
const t = F(
|
|
592
639
|
"pineui-badge",
|
|
593
640
|
`pineui-badge--${n}`,
|
|
594
641
|
`pineui-badge--${r}`
|
|
595
642
|
);
|
|
596
|
-
return /* @__PURE__ */
|
|
597
|
-
},
|
|
643
|
+
return /* @__PURE__ */ i.jsx("span", { className: t, children: e });
|
|
644
|
+
}, Oe = ({
|
|
598
645
|
label: e,
|
|
599
646
|
icon: n,
|
|
600
647
|
selected: r = !1,
|
|
601
648
|
onPress: t,
|
|
602
|
-
context:
|
|
649
|
+
context: s
|
|
603
650
|
}) => {
|
|
604
651
|
const o = async () => {
|
|
605
|
-
t &&
|
|
606
|
-
}, a =
|
|
652
|
+
t && s && await s.executeAction(t);
|
|
653
|
+
}, a = F("pineui-chip", {
|
|
607
654
|
"pineui-chip--selected": r
|
|
608
655
|
});
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
n && /* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ i.jsxs("button", { className: a, onClick: o, children: [
|
|
657
|
+
n && /* @__PURE__ */ i.jsx("span", { className: "pineui-chip__icon", children: n }),
|
|
658
|
+
/* @__PURE__ */ i.jsx("span", { className: "pineui-chip__label", children: e })
|
|
612
659
|
] });
|
|
613
|
-
},
|
|
660
|
+
}, Me = ({
|
|
614
661
|
children: e,
|
|
615
662
|
columns: n = 3,
|
|
616
663
|
spacing: r = 16,
|
|
617
664
|
context: t,
|
|
618
|
-
renderer:
|
|
665
|
+
renderer: s
|
|
619
666
|
}) => {
|
|
620
|
-
if (!
|
|
667
|
+
if (!s || !t) return null;
|
|
621
668
|
const o = {
|
|
622
669
|
display: "grid",
|
|
623
670
|
gridTemplateColumns: `repeat(${n}, 1fr)`,
|
|
624
671
|
gap: `${r}px`
|
|
625
672
|
};
|
|
626
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ i.jsx("div", { className: "pineui-grid", style: o, children: e.map((a, d) => /* @__PURE__ */ i.jsx(s, { node: a, context: t }, d)) });
|
|
627
674
|
}, Be = ({
|
|
628
675
|
value: e,
|
|
629
676
|
label: n,
|
|
630
677
|
showPercentage: r = !1,
|
|
631
678
|
color: t = "primary"
|
|
632
679
|
}) => {
|
|
633
|
-
const
|
|
634
|
-
return /* @__PURE__ */
|
|
635
|
-
(n || r) && /* @__PURE__ */
|
|
636
|
-
n && /* @__PURE__ */
|
|
637
|
-
r && /* @__PURE__ */
|
|
638
|
-
|
|
680
|
+
const s = Math.min(100, Math.max(0, e));
|
|
681
|
+
return /* @__PURE__ */ i.jsxs("div", { className: "pineui-progress", children: [
|
|
682
|
+
(n || r) && /* @__PURE__ */ i.jsxs("div", { className: "pineui-progress__header", children: [
|
|
683
|
+
n && /* @__PURE__ */ i.jsx("span", { className: "pineui-progress__label", children: n }),
|
|
684
|
+
r && /* @__PURE__ */ i.jsxs("span", { className: "pineui-progress__percentage", children: [
|
|
685
|
+
s,
|
|
639
686
|
"%"
|
|
640
687
|
] })
|
|
641
688
|
] }),
|
|
642
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ i.jsx("div", { className: "pineui-progress__track", children: /* @__PURE__ */ i.jsx(
|
|
643
690
|
"div",
|
|
644
691
|
{
|
|
645
692
|
className: `pineui-progress__fill pineui-progress__fill--${t}`,
|
|
646
|
-
style: { width: `${
|
|
693
|
+
style: { width: `${s}%` }
|
|
647
694
|
}
|
|
648
695
|
) })
|
|
649
696
|
] });
|
|
650
|
-
},
|
|
697
|
+
}, We = ({
|
|
651
698
|
columns: e,
|
|
652
699
|
data: n,
|
|
653
700
|
context: r,
|
|
654
701
|
renderer: t
|
|
655
702
|
}) => {
|
|
656
|
-
const [
|
|
657
|
-
|
|
703
|
+
const [s, o] = b([]), [a, d] = b(!0);
|
|
704
|
+
W(() => {
|
|
658
705
|
c();
|
|
659
706
|
}, []);
|
|
660
707
|
const c = async () => {
|
|
@@ -665,147 +712,154 @@ const be = ({
|
|
|
665
712
|
}
|
|
666
713
|
if (n.type === "action.http")
|
|
667
714
|
try {
|
|
668
|
-
const
|
|
669
|
-
method:
|
|
715
|
+
const p = n, y = await (await fetch(p.url, {
|
|
716
|
+
method: p.method || "GET",
|
|
670
717
|
headers: {
|
|
671
718
|
"Content-Type": "application/json"
|
|
672
719
|
},
|
|
673
|
-
body:
|
|
720
|
+
body: p.body ? JSON.stringify(p.body) : void 0
|
|
674
721
|
})).json();
|
|
675
722
|
o(y.data || y), d(!1);
|
|
676
|
-
} catch (
|
|
677
|
-
console.error("Table data fetch error:",
|
|
723
|
+
} catch (p) {
|
|
724
|
+
console.error("Table data fetch error:", p), d(!1);
|
|
678
725
|
}
|
|
679
726
|
}
|
|
680
727
|
};
|
|
681
|
-
return !t || !r ? null : a ? /* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
728
|
+
return !t || !r ? null : a ? /* @__PURE__ */ i.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ i.jsx("p", { style: { padding: "16px", textAlign: "center" }, children: "Loading..." }) }) : /* @__PURE__ */ i.jsx("div", { className: "pineui-table", children: /* @__PURE__ */ i.jsxs("table", { children: [
|
|
729
|
+
/* @__PURE__ */ i.jsx("thead", { children: /* @__PURE__ */ i.jsx("tr", { children: e.map((p) => /* @__PURE__ */ i.jsx(
|
|
683
730
|
"th",
|
|
684
731
|
{
|
|
685
|
-
style: { width:
|
|
732
|
+
style: { width: p.width },
|
|
686
733
|
className: "pineui-table__header",
|
|
687
|
-
children:
|
|
734
|
+
children: p.label
|
|
688
735
|
},
|
|
689
|
-
|
|
736
|
+
p.key
|
|
690
737
|
)) }) }),
|
|
691
|
-
/* @__PURE__ */
|
|
738
|
+
/* @__PURE__ */ i.jsx("tbody", { children: s.map((p, m) => /* @__PURE__ */ i.jsx("tr", { className: "pineui-table__row", children: e.map((y) => /* @__PURE__ */ i.jsx("td", { className: "pineui-table__cell", children: y.template ? /* @__PURE__ */ i.jsx(
|
|
692
739
|
t,
|
|
693
740
|
{
|
|
694
741
|
node: y.template,
|
|
695
742
|
context: r,
|
|
696
|
-
parentData:
|
|
743
|
+
parentData: p
|
|
697
744
|
}
|
|
698
|
-
) : /* @__PURE__ */
|
|
745
|
+
) : /* @__PURE__ */ i.jsx("span", { children: p[y.key] }) }, y.key)) }, m)) })
|
|
699
746
|
] }) });
|
|
700
|
-
},
|
|
747
|
+
}, Fe = ({ name: e, context: n, renderer: r, flex: t, width: s, height: o }) => {
|
|
701
748
|
var c;
|
|
702
749
|
const a = (c = n == null ? void 0 : n.views) == null ? void 0 : c[e];
|
|
703
750
|
if (!a)
|
|
704
751
|
return console.warn(`View not found: ${e}`), null;
|
|
705
752
|
const d = {};
|
|
706
|
-
return t && (d.flex = t),
|
|
707
|
-
},
|
|
708
|
-
text:
|
|
709
|
-
"button.filled":
|
|
710
|
-
"button.text":
|
|
711
|
-
"button.
|
|
712
|
-
"button.
|
|
713
|
-
"
|
|
714
|
-
"layout.
|
|
753
|
+
return t && (d.flex = t), s && (d.width = s), o && (d.height = o), /* @__PURE__ */ i.jsx("div", { className: "pineui-view", style: d, children: /* @__PURE__ */ i.jsx(r, { node: a.screen, context: n }) });
|
|
754
|
+
}, De = {
|
|
755
|
+
text: he,
|
|
756
|
+
"button.filled": L,
|
|
757
|
+
"button.text": L,
|
|
758
|
+
"button.outlined": L,
|
|
759
|
+
"button.icon": L,
|
|
760
|
+
"button.fab": L,
|
|
761
|
+
"layout.column": Y,
|
|
762
|
+
"layout.row": Y,
|
|
715
763
|
"layout.scaffold": ke,
|
|
716
764
|
"layout.appBar": $e,
|
|
717
765
|
"layout.bottomNav": Ce,
|
|
718
|
-
card:
|
|
719
|
-
image:
|
|
720
|
-
avatar:
|
|
766
|
+
card: ge,
|
|
767
|
+
image: be,
|
|
768
|
+
avatar: je,
|
|
721
769
|
icon: we,
|
|
722
|
-
collection:
|
|
723
|
-
"
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
770
|
+
collection: _e,
|
|
771
|
+
"collection.map": Ne,
|
|
772
|
+
"input.text": V,
|
|
773
|
+
"input.email": V,
|
|
774
|
+
"input.password": V,
|
|
775
|
+
"input.number": V,
|
|
776
|
+
"input.search": V,
|
|
777
|
+
divider: Ae,
|
|
778
|
+
conditionalRender: Te,
|
|
779
|
+
"conditional.render": Ee,
|
|
780
|
+
tabs: Se,
|
|
781
|
+
badge: Ie,
|
|
782
|
+
chip: Oe,
|
|
783
|
+
grid: Me,
|
|
730
784
|
progress: Be,
|
|
731
|
-
table:
|
|
732
|
-
view:
|
|
733
|
-
},
|
|
785
|
+
table: We,
|
|
786
|
+
view: Fe
|
|
787
|
+
}, R = ({ node: e, context: n, parentData: r }) => {
|
|
734
788
|
if (!e || !e.type)
|
|
735
789
|
return null;
|
|
736
|
-
const t = r !== void 0 ? Object.assign({}, n, { item: r }) : n, o = e.type !== "collection" ?
|
|
790
|
+
const t = r !== void 0 ? Object.assign({}, n, { item: r }) : n, o = e.type !== "collection" ? S(e, t) : e;
|
|
737
791
|
if (o.type.startsWith("component.")) {
|
|
738
792
|
const d = o.type, c = n.components[d];
|
|
739
793
|
if (!c)
|
|
740
794
|
return console.warn(`Component not found: ${d}`), null;
|
|
741
|
-
const
|
|
795
|
+
const p = {
|
|
742
796
|
...t,
|
|
743
797
|
props: o.props
|
|
744
798
|
};
|
|
745
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ i.jsx(R, { node: c.definition, context: p, parentData: r });
|
|
746
800
|
}
|
|
747
|
-
const a =
|
|
748
|
-
return a ? /* @__PURE__ */
|
|
801
|
+
const a = De[o.type];
|
|
802
|
+
return a ? /* @__PURE__ */ i.jsx(
|
|
749
803
|
a,
|
|
750
804
|
{
|
|
751
805
|
...o,
|
|
752
806
|
context: n,
|
|
753
|
-
renderer:
|
|
807
|
+
renderer: R
|
|
754
808
|
}
|
|
755
809
|
) : (console.warn(`Unknown component type: ${o.type}`), null);
|
|
756
|
-
},
|
|
810
|
+
}, Le = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ i.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ i.jsx(Ve, { message: r, onDismiss: n }, r.id)) }), Ve = ({
|
|
757
811
|
message: e,
|
|
758
812
|
onDismiss: n
|
|
759
813
|
}) => {
|
|
760
|
-
const [r, t] =
|
|
761
|
-
return
|
|
814
|
+
const [r, t] = b(!1);
|
|
815
|
+
return W(() => {
|
|
762
816
|
setTimeout(() => t(!0), 10);
|
|
763
|
-
const
|
|
817
|
+
const s = setTimeout(() => {
|
|
764
818
|
t(!1), setTimeout(() => n(e.id), 300);
|
|
765
819
|
}, e.duration || 3e3);
|
|
766
|
-
return () => clearTimeout(
|
|
767
|
-
}, [e, n]), /* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
e.action && /* @__PURE__ */
|
|
820
|
+
return () => clearTimeout(s);
|
|
821
|
+
}, [e, n]), /* @__PURE__ */ i.jsxs("div", { className: `pineui-snackbar ${r ? "pineui-snackbar--visible" : ""}`, children: [
|
|
822
|
+
/* @__PURE__ */ i.jsx("span", { className: "pineui-snackbar__message", children: e.message }),
|
|
823
|
+
e.action && /* @__PURE__ */ i.jsx("button", { className: "pineui-snackbar__action", onClick: e.action.onPress, children: e.action.label })
|
|
770
824
|
] });
|
|
771
|
-
},
|
|
825
|
+
}, ze = ({
|
|
772
826
|
presentation: e = "modal",
|
|
773
827
|
dismissible: n = !0,
|
|
774
828
|
child: r,
|
|
775
829
|
onClose: t,
|
|
776
|
-
context:
|
|
830
|
+
context: s,
|
|
777
831
|
renderer: o
|
|
778
832
|
}) => {
|
|
779
|
-
if (
|
|
833
|
+
if (W(() => (document.body.style.overflow = "hidden", () => {
|
|
780
834
|
document.body.style.overflow = "";
|
|
781
|
-
}), []), !o || !
|
|
782
|
-
const a = (
|
|
783
|
-
n &&
|
|
784
|
-
}, d = (
|
|
785
|
-
n &&
|
|
835
|
+
}), []), !o || !s) return null;
|
|
836
|
+
const a = (p) => {
|
|
837
|
+
n && p.target === p.currentTarget && t();
|
|
838
|
+
}, d = (p) => {
|
|
839
|
+
n && p.key === "Escape" && t();
|
|
786
840
|
};
|
|
787
|
-
|
|
841
|
+
W(() => (window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d)), [n]);
|
|
788
842
|
const c = e === "bottomSheet" ? "pineui-modal-backdrop pineui-modal-backdrop--bottomSheet" : "pineui-modal-backdrop";
|
|
789
|
-
return /* @__PURE__ */
|
|
790
|
-
},
|
|
843
|
+
return /* @__PURE__ */ i.jsx("div", { className: c, onClick: a, children: /* @__PURE__ */ i.jsx("div", { className: `pineui-modal pineui-modal--${e}`, children: /* @__PURE__ */ i.jsx(o, { node: r, context: s }) }) });
|
|
844
|
+
}, Re = ({
|
|
791
845
|
overlays: e,
|
|
792
846
|
onClose: n,
|
|
793
847
|
context: r,
|
|
794
848
|
renderer: t
|
|
795
|
-
}) => /* @__PURE__ */
|
|
796
|
-
([
|
|
797
|
-
|
|
849
|
+
}) => /* @__PURE__ */ i.jsx(i.Fragment, { children: Object.entries(e).map(
|
|
850
|
+
([s, { visible: o, config: a }]) => o ? /* @__PURE__ */ i.jsx(
|
|
851
|
+
ze,
|
|
798
852
|
{
|
|
799
|
-
id:
|
|
853
|
+
id: s,
|
|
800
854
|
...a,
|
|
801
|
-
onClose: () => n(
|
|
855
|
+
onClose: () => n(s),
|
|
802
856
|
context: r,
|
|
803
857
|
renderer: t
|
|
804
858
|
},
|
|
805
|
-
|
|
859
|
+
s
|
|
806
860
|
) : null
|
|
807
861
|
) });
|
|
808
|
-
function
|
|
862
|
+
function q(e, n) {
|
|
809
863
|
if (n.startsWith("http://") || n.startsWith("https://"))
|
|
810
864
|
return n;
|
|
811
865
|
try {
|
|
@@ -822,28 +876,28 @@ async function Z(e, n) {
|
|
|
822
876
|
if (e.imports.components)
|
|
823
877
|
for (const t of e.imports.components)
|
|
824
878
|
try {
|
|
825
|
-
const
|
|
879
|
+
const s = q(n, t), a = await (await fetch(s)).json();
|
|
826
880
|
r.components = {
|
|
827
881
|
...r.components,
|
|
828
882
|
...a
|
|
829
883
|
};
|
|
830
|
-
} catch (
|
|
831
|
-
console.error(`❌ Failed to load component from ${t}:`,
|
|
884
|
+
} catch (s) {
|
|
885
|
+
console.error(`❌ Failed to load component from ${t}:`, s), console.error(` Resolved URL: ${q(n, t)}`);
|
|
832
886
|
}
|
|
833
887
|
if (e.imports.views)
|
|
834
888
|
for (const t of e.imports.views)
|
|
835
889
|
try {
|
|
836
|
-
const
|
|
890
|
+
const s = q(n, t), a = await (await fetch(s)).json();
|
|
837
891
|
r.views = {
|
|
838
892
|
...r.views,
|
|
839
893
|
...a
|
|
840
894
|
};
|
|
841
|
-
} catch (
|
|
842
|
-
console.error(`Failed to load view from ${t}:`,
|
|
895
|
+
} catch (s) {
|
|
896
|
+
console.error(`Failed to load view from ${t}:`, s);
|
|
843
897
|
}
|
|
844
898
|
return r;
|
|
845
899
|
}
|
|
846
|
-
class
|
|
900
|
+
class He extends se {
|
|
847
901
|
constructor(n) {
|
|
848
902
|
super(n), this.state = { hasError: !1, error: null };
|
|
849
903
|
}
|
|
@@ -855,11 +909,11 @@ class ze extends se {
|
|
|
855
909
|
}
|
|
856
910
|
render() {
|
|
857
911
|
var n;
|
|
858
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
912
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ i.jsxs("div", { className: "pineui-error", style: { padding: "24px", textAlign: "center" }, children: [
|
|
913
|
+
/* @__PURE__ */ i.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "⚠️" }),
|
|
914
|
+
/* @__PURE__ */ i.jsx("h3", { style: { marginBottom: "8px", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
|
|
915
|
+
/* @__PURE__ */ i.jsx("p", { style: { color: "#79747E", fontSize: "14px", marginBottom: "16px" }, children: ((n = this.state.error) == null ? void 0 : n.message) || "An unexpected error occurred" }),
|
|
916
|
+
/* @__PURE__ */ i.jsx(
|
|
863
917
|
"button",
|
|
864
918
|
{
|
|
865
919
|
onClick: () => window.location.reload(),
|
|
@@ -879,17 +933,17 @@ class ze extends se {
|
|
|
879
933
|
] }) : this.props.children;
|
|
880
934
|
}
|
|
881
935
|
}
|
|
882
|
-
function
|
|
936
|
+
function Pe(e, n) {
|
|
883
937
|
const r = n.split(".");
|
|
884
938
|
let t = e;
|
|
885
|
-
for (const
|
|
939
|
+
for (const s of r) {
|
|
886
940
|
if (t == null) return;
|
|
887
|
-
t = t[
|
|
941
|
+
t = t[s];
|
|
888
942
|
}
|
|
889
943
|
return t;
|
|
890
944
|
}
|
|
891
|
-
const
|
|
892
|
-
const [t,
|
|
945
|
+
const qe = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
946
|
+
const [t, s] = b(null), [o, a] = b(!0), [d, c] = b(null), [p, m] = b([]), [y, g] = b({}), j = (e == null ? void 0 : e.state) || {
|
|
893
947
|
currentUser: {
|
|
894
948
|
id: "user_current",
|
|
895
949
|
username: "currentuser",
|
|
@@ -902,84 +956,82 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
902
956
|
posting: !1
|
|
903
957
|
},
|
|
904
958
|
testInput: ""
|
|
905
|
-
}, [
|
|
906
|
-
|
|
907
|
-
n && !e ?
|
|
959
|
+
}, [w, T] = b(j);
|
|
960
|
+
W(() => {
|
|
961
|
+
n && !e ? E() : e && $();
|
|
908
962
|
}, [n, e, r]);
|
|
909
|
-
const
|
|
963
|
+
const $ = async () => {
|
|
910
964
|
try {
|
|
911
965
|
a(!0);
|
|
912
966
|
let f = e;
|
|
913
|
-
f.imports && r && (console.log("Loading imports for initial schema...", f.imports), f = await Z(f, r), console.log("Imports loaded! Components:", Object.keys(f.components || {}))),
|
|
967
|
+
f.imports && r && (console.log("Loading imports for initial schema...", f.imports), f = await Z(f, r), console.log("Imports loaded! Components:", Object.keys(f.components || {}))), s(f), f.state && T((h) => ({ ...h, ...f.state }));
|
|
914
968
|
} catch (f) {
|
|
915
969
|
c(f);
|
|
916
970
|
} finally {
|
|
917
971
|
a(!1);
|
|
918
972
|
}
|
|
919
|
-
},
|
|
973
|
+
}, E = async () => {
|
|
920
974
|
try {
|
|
921
975
|
a(!0);
|
|
922
976
|
let h = await (await fetch(n)).json();
|
|
923
|
-
h.imports && r && (h = await Z(h, r)),
|
|
977
|
+
h.imports && r && (h = await Z(h, r)), s(h), h.state && T((l) => ({ ...l, ...h.state }));
|
|
924
978
|
} catch (f) {
|
|
925
979
|
c(f);
|
|
926
980
|
} finally {
|
|
927
981
|
a(!1);
|
|
928
982
|
}
|
|
929
|
-
},
|
|
930
|
-
var
|
|
931
|
-
console.log(
|
|
932
|
-
|
|
933
|
-
if (h) {
|
|
934
|
-
const m = JSON.stringify(f).replace(/\{\{([^}]+)\}\}/g, (b, $) => {
|
|
935
|
-
const N = $.trim();
|
|
936
|
-
return h[N] !== void 0 ? String(h[N]) : "";
|
|
937
|
-
});
|
|
938
|
-
l = JSON.parse(m);
|
|
939
|
-
}
|
|
983
|
+
}, _ = async (f, h) => {
|
|
984
|
+
var A, k;
|
|
985
|
+
(f.type === "action.sequence" || f.intent && f.intent.startsWith("course")) && console.log(`[executeAction] type=${f.intent || f.type}, courseList.length=${((A = w.courseList) == null ? void 0 : A.length) ?? "N/A"}, selectedCourseIndex=${w.selectedCourseIndex}`);
|
|
986
|
+
const l = S(f, { state: w, ...h });
|
|
940
987
|
if (l.intent) {
|
|
941
|
-
const
|
|
942
|
-
return delete
|
|
988
|
+
const u = l.intent, v = { ...h, ...l };
|
|
989
|
+
return delete v.intent, N(u, v);
|
|
990
|
+
}
|
|
991
|
+
if (l.type === "intent" && l.name) {
|
|
992
|
+
const u = { ...h, ...l };
|
|
993
|
+
return delete u.type, delete u.name, N(l.name, u);
|
|
943
994
|
}
|
|
944
995
|
if (l.type && l.type.startsWith("intent.")) {
|
|
945
|
-
const
|
|
946
|
-
return delete
|
|
996
|
+
const u = l.type.substring(7), v = { ...h, ...l };
|
|
997
|
+
return delete v.type, N(u, v);
|
|
947
998
|
}
|
|
948
999
|
switch (l.type) {
|
|
949
1000
|
case "action.http": {
|
|
950
1001
|
try {
|
|
951
|
-
const
|
|
1002
|
+
const u = l.url.startsWith("http") ? l.url : `${r}${l.url}`, x = await (await fetch(u, {
|
|
952
1003
|
method: l.method || "GET",
|
|
953
1004
|
headers: {
|
|
954
1005
|
"Content-Type": "application/json"
|
|
955
1006
|
},
|
|
956
1007
|
body: l.body ? JSON.stringify(l.body) : void 0
|
|
957
1008
|
})).json();
|
|
958
|
-
console.log("HTTP action result:",
|
|
959
|
-
} catch (
|
|
960
|
-
console.error("HTTP action error:",
|
|
1009
|
+
console.log("HTTP action result:", x);
|
|
1010
|
+
} catch (u) {
|
|
1011
|
+
console.error("HTTP action error:", u);
|
|
961
1012
|
}
|
|
962
1013
|
break;
|
|
963
1014
|
}
|
|
964
1015
|
case "action.state.patch": {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1016
|
+
const u = l.value;
|
|
1017
|
+
console.log(`[patch] ${l.path} =`, typeof u == "object" && u !== null ? Array.isArray(u) ? `Array(${u.length})` : `{id: ${u == null ? void 0 : u.id}, title: ${u == null ? void 0 : u.title}}` : u), T((v) => {
|
|
1018
|
+
const x = { ...v };
|
|
1019
|
+
return Je(x, l.path, l.value), x;
|
|
968
1020
|
});
|
|
969
1021
|
break;
|
|
970
1022
|
}
|
|
971
1023
|
case "action.overlay.open": {
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
...
|
|
975
|
-
[l.overlayId]: { visible: !0, config:
|
|
1024
|
+
const u = (k = t == null ? void 0 : t.overlays) == null ? void 0 : k[l.overlayId];
|
|
1025
|
+
u ? g((v) => ({
|
|
1026
|
+
...v,
|
|
1027
|
+
[l.overlayId]: { visible: !0, config: u }
|
|
976
1028
|
})) : console.warn("Overlay not found:", l.overlayId);
|
|
977
1029
|
break;
|
|
978
1030
|
}
|
|
979
1031
|
case "action.overlay.close": {
|
|
980
|
-
|
|
981
|
-
...
|
|
982
|
-
[l.overlayId]: { ...
|
|
1032
|
+
g((u) => ({
|
|
1033
|
+
...u,
|
|
1034
|
+
[l.overlayId]: { ...u[l.overlayId], visible: !1 }
|
|
983
1035
|
}));
|
|
984
1036
|
break;
|
|
985
1037
|
}
|
|
@@ -988,34 +1040,39 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
988
1040
|
break;
|
|
989
1041
|
}
|
|
990
1042
|
case "action.snackbar.show": {
|
|
991
|
-
const
|
|
992
|
-
const
|
|
993
|
-
if (
|
|
994
|
-
const
|
|
995
|
-
return
|
|
1043
|
+
const u = typeof l.message == "string" && l.message.includes("{{") ? l.message.replace(/\{\{(.+?)\}\}/g, (x, I) => {
|
|
1044
|
+
const M = I.trim();
|
|
1045
|
+
if (M.startsWith("state.")) {
|
|
1046
|
+
const P = M.substring(6), z = Pe(w, P);
|
|
1047
|
+
return z != null ? String(z) : "";
|
|
996
1048
|
}
|
|
997
1049
|
return "";
|
|
998
|
-
}) : l.message,
|
|
1050
|
+
}) : l.message, v = {
|
|
999
1051
|
id: `snackbar-${Date.now()}`,
|
|
1000
|
-
message:
|
|
1052
|
+
message: u,
|
|
1001
1053
|
duration: l.duration || 3e3,
|
|
1002
1054
|
action: l.action ? {
|
|
1003
1055
|
label: l.action.label,
|
|
1004
|
-
onPress: () =>
|
|
1056
|
+
onPress: () => _(l.action.onPress)
|
|
1005
1057
|
} : void 0
|
|
1006
1058
|
};
|
|
1007
|
-
|
|
1059
|
+
m((x) => [...x, v]);
|
|
1008
1060
|
break;
|
|
1009
1061
|
}
|
|
1010
1062
|
case "action.delay": {
|
|
1011
|
-
const
|
|
1012
|
-
await new Promise((
|
|
1063
|
+
const u = l.duration || 1e3;
|
|
1064
|
+
await new Promise((v) => setTimeout(v, u));
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
case "action.sequence": {
|
|
1068
|
+
for (const u of l.actions ?? [])
|
|
1069
|
+
await _(u, h);
|
|
1013
1070
|
break;
|
|
1014
1071
|
}
|
|
1015
1072
|
default:
|
|
1016
1073
|
console.warn("Unknown action type:", l.type);
|
|
1017
1074
|
}
|
|
1018
|
-
},
|
|
1075
|
+
}, N = async (f, h) => {
|
|
1019
1076
|
if (console.log("Executing intent:", f, h), !(t != null && t.intents)) return;
|
|
1020
1077
|
const l = t.intents[f];
|
|
1021
1078
|
if (!l) {
|
|
@@ -1023,22 +1080,22 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1023
1080
|
return;
|
|
1024
1081
|
}
|
|
1025
1082
|
if (Array.isArray(l.handler))
|
|
1026
|
-
for (const
|
|
1027
|
-
await
|
|
1083
|
+
for (const A of l.handler)
|
|
1084
|
+
await _(A, h);
|
|
1028
1085
|
else
|
|
1029
|
-
await
|
|
1030
|
-
},
|
|
1031
|
-
state:
|
|
1086
|
+
await _(l.handler, h);
|
|
1087
|
+
}, C = {
|
|
1088
|
+
state: w,
|
|
1032
1089
|
data: {},
|
|
1033
1090
|
components: (t == null ? void 0 : t.components) || {},
|
|
1034
1091
|
views: (t == null ? void 0 : t.views) || {},
|
|
1035
1092
|
intents: (t == null ? void 0 : t.intents) || {},
|
|
1036
1093
|
schema: t,
|
|
1037
|
-
executeAction:
|
|
1038
|
-
executeIntent:
|
|
1094
|
+
executeAction: _,
|
|
1095
|
+
executeIntent: N
|
|
1039
1096
|
};
|
|
1040
1097
|
if (o)
|
|
1041
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ i.jsxs("div", { className: "pineui-loading", style: {
|
|
1042
1099
|
display: "flex",
|
|
1043
1100
|
flexDirection: "column",
|
|
1044
1101
|
alignItems: "center",
|
|
@@ -1047,7 +1104,7 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1047
1104
|
gap: "16px",
|
|
1048
1105
|
color: "#79747E"
|
|
1049
1106
|
}, children: [
|
|
1050
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ i.jsx("div", { style: {
|
|
1051
1108
|
width: "40px",
|
|
1052
1109
|
height: "40px",
|
|
1053
1110
|
border: "4px solid #E7E0EC",
|
|
@@ -1055,8 +1112,8 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1055
1112
|
borderRadius: "50%",
|
|
1056
1113
|
animation: "pineui-spin 1s linear infinite"
|
|
1057
1114
|
} }),
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ i.jsx("p", { style: { margin: 0, fontSize: "14px", fontWeight: 500 }, children: "Loading application..." }),
|
|
1116
|
+
/* @__PURE__ */ i.jsx("style", { dangerouslySetInnerHTML: {
|
|
1060
1117
|
__html: `
|
|
1061
1118
|
@keyframes pineui-spin {
|
|
1062
1119
|
0% { transform: rotate(0deg); }
|
|
@@ -1066,52 +1123,52 @@ const He = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1066
1123
|
} })
|
|
1067
1124
|
] });
|
|
1068
1125
|
if (d)
|
|
1069
|
-
return /* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */ i.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ i.jsxs("p", { children: [
|
|
1070
1127
|
"Error loading schema: ",
|
|
1071
1128
|
d.message
|
|
1072
1129
|
] }) });
|
|
1073
1130
|
if (!t)
|
|
1074
|
-
return /* @__PURE__ */
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1077
|
-
},
|
|
1078
|
-
|
|
1131
|
+
return /* @__PURE__ */ i.jsx("div", { className: "pineui-error", children: /* @__PURE__ */ i.jsx("p", { children: "No schema provided" }) });
|
|
1132
|
+
const O = (f) => {
|
|
1133
|
+
m((h) => h.filter((l) => l.id !== f));
|
|
1134
|
+
}, B = (f) => {
|
|
1135
|
+
g((h) => ({
|
|
1079
1136
|
...h,
|
|
1080
1137
|
[f]: { ...h[f], visible: !1 }
|
|
1081
1138
|
}));
|
|
1082
1139
|
};
|
|
1083
|
-
return /* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ i.jsx(He, { children: /* @__PURE__ */ i.jsxs("div", { className: "pineui-root", children: [
|
|
1141
|
+
/* @__PURE__ */ i.jsx(R, { node: t.screen, context: C }),
|
|
1142
|
+
/* @__PURE__ */ i.jsx(Le, { messages: p, onDismiss: O }),
|
|
1143
|
+
/* @__PURE__ */ i.jsx(Re, { overlays: y, onClose: B, context: C, renderer: R })
|
|
1087
1144
|
] }) });
|
|
1088
1145
|
};
|
|
1089
|
-
function
|
|
1146
|
+
function Je(e, n, r) {
|
|
1090
1147
|
const t = n.split(".");
|
|
1091
|
-
let
|
|
1148
|
+
let s = e;
|
|
1092
1149
|
for (let o = 0; o < t.length - 1; o++)
|
|
1093
|
-
|
|
1094
|
-
|
|
1150
|
+
s[t[o]] || (s[t[o]] = {}), s = s[t[o]];
|
|
1151
|
+
s[t[t.length - 1]] = r;
|
|
1095
1152
|
}
|
|
1096
|
-
function
|
|
1097
|
-
var t,
|
|
1153
|
+
function Ue(e) {
|
|
1154
|
+
var t, s;
|
|
1098
1155
|
const n = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
|
|
1099
1156
|
if (!n) {
|
|
1100
1157
|
console.error("PineUI: Target element not found"), (t = e.onError) == null || t.call(e, new Error("Target element not found"));
|
|
1101
1158
|
return;
|
|
1102
1159
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1160
|
+
J.createRoot(n).render(
|
|
1161
|
+
Q.createElement(qe, {
|
|
1105
1162
|
schema: e.schema,
|
|
1106
1163
|
schemaUrl: e.schemaUrl,
|
|
1107
1164
|
baseUrl: e.baseUrl
|
|
1108
1165
|
})
|
|
1109
|
-
), (
|
|
1166
|
+
), (s = e.onReady) == null || s.call(e);
|
|
1110
1167
|
}
|
|
1111
1168
|
typeof window < "u" && (window.PineUI = {
|
|
1112
|
-
render:
|
|
1169
|
+
render: Ue
|
|
1113
1170
|
});
|
|
1114
1171
|
export {
|
|
1115
|
-
|
|
1116
|
-
|
|
1172
|
+
qe as PineUI,
|
|
1173
|
+
Ue as render
|
|
1117
1174
|
};
|