@pineui/react 0.1.3 → 0.1.5
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/pineui.es.js +42 -41
- package/dist/pineui.standalone.js +8377 -41
- package/dist/pineui.umd.js +3 -3
- package/dist/style.css +820 -1
- package/package.json +1 -1
package/dist/pineui.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Q, { useState as w, useEffect as W, Component as se } from "react";
|
|
2
2
|
import ie from "react-dom";
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var X = { exports: {} },
|
|
3
|
+
var q = {}, G = ie;
|
|
4
|
+
q.createRoot = G.createRoot, q.hydrateRoot = G.hydrateRoot;
|
|
5
|
+
var X = { exports: {} }, P = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -20,10 +20,10 @@ function ee(e, n, r) {
|
|
|
20
20
|
if (e && e.defaultProps) for (t in n = e.defaultProps, n) s[t] === void 0 && (s[t] = n[t]);
|
|
21
21
|
return { $$typeof: ae, type: e, key: o, ref: a, props: s, _owner: ue.current };
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
X.exports =
|
|
23
|
+
P.Fragment = le;
|
|
24
|
+
P.jsx = ee;
|
|
25
|
+
P.jsxs = ee;
|
|
26
|
+
X.exports = P;
|
|
27
27
|
var i = X.exports;
|
|
28
28
|
function T(e, n) {
|
|
29
29
|
if (typeof e == "string")
|
|
@@ -336,9 +336,9 @@ const ge = ({
|
|
|
336
336
|
};
|
|
337
337
|
return /* @__PURE__ */ i.jsx("span", { className: "pineui-icon", style: s, children: o[e] || e });
|
|
338
338
|
};
|
|
339
|
-
function
|
|
340
|
-
return e === "{{response}}" ? n : typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) =>
|
|
341
|
-
Object.entries(e).map(([r, t]) => [r,
|
|
339
|
+
function J(e, n) {
|
|
340
|
+
return e === "{{response}}" ? n : typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => J(r, n)) : Object.fromEntries(
|
|
341
|
+
Object.entries(e).map(([r, t]) => [r, J(t, n)])
|
|
342
342
|
);
|
|
343
343
|
}
|
|
344
344
|
const _e = ({
|
|
@@ -372,10 +372,10 @@ const _e = ({
|
|
|
372
372
|
try {
|
|
373
373
|
if (k ? S(!0) : E(!0), N(null), s.type === "action.http") {
|
|
374
374
|
let u = s.url;
|
|
375
|
-
u.includes("{{state.") && (u = u.replace(/\{\{state\.([^}]+)\}\}/g, (M,
|
|
376
|
-
const
|
|
375
|
+
u.includes("{{state.") && (u = u.replace(/\{\{state\.([^}]+)\}\}/g, (M, H) => {
|
|
376
|
+
const V = H.split(".");
|
|
377
377
|
let F = m.state;
|
|
378
|
-
for (const re of
|
|
378
|
+
for (const re of V) {
|
|
379
379
|
if (F == null) return "";
|
|
380
380
|
F = F[re];
|
|
381
381
|
}
|
|
@@ -384,7 +384,7 @@ const _e = ({
|
|
|
384
384
|
const x = await (await fetch(u)).json(), I = x.data || x;
|
|
385
385
|
if (j((M) => k ? [...M, ...I] : I), s.onSuccess && m) {
|
|
386
386
|
console.log(`[Collection] onSuccess called with ${I.length} items`);
|
|
387
|
-
const M =
|
|
387
|
+
const M = J(s.onSuccess, I);
|
|
388
388
|
await m.executeAction(M), console.log("[Collection] onSuccess done");
|
|
389
389
|
}
|
|
390
390
|
x.pagination ? (O(x.pagination.hasMore), f(x.pagination.cursor)) : O(!1);
|
|
@@ -510,7 +510,7 @@ const _e = ({
|
|
|
510
510
|
},
|
|
511
511
|
a
|
|
512
512
|
)) });
|
|
513
|
-
},
|
|
513
|
+
}, z = ({
|
|
514
514
|
type: e,
|
|
515
515
|
id: n,
|
|
516
516
|
label: r,
|
|
@@ -769,11 +769,11 @@ const _e = ({
|
|
|
769
769
|
icon: we,
|
|
770
770
|
collection: _e,
|
|
771
771
|
"collection.map": Ne,
|
|
772
|
-
"input.text":
|
|
773
|
-
"input.email":
|
|
774
|
-
"input.password":
|
|
775
|
-
"input.number":
|
|
776
|
-
"input.search":
|
|
772
|
+
"input.text": z,
|
|
773
|
+
"input.email": z,
|
|
774
|
+
"input.password": z,
|
|
775
|
+
"input.number": z,
|
|
776
|
+
"input.search": z,
|
|
777
777
|
divider: Ae,
|
|
778
778
|
conditionalRender: Te,
|
|
779
779
|
"conditional.render": Ee,
|
|
@@ -807,7 +807,7 @@ const _e = ({
|
|
|
807
807
|
renderer: R
|
|
808
808
|
}
|
|
809
809
|
) : (console.warn(`Unknown component type: ${o.type}`), null);
|
|
810
|
-
}, Le = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ i.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ i.jsx(
|
|
810
|
+
}, Le = ({ messages: e, onDismiss: n }) => /* @__PURE__ */ i.jsx("div", { className: "pineui-snackbar-container", children: e.map((r) => /* @__PURE__ */ i.jsx(ze, { message: r, onDismiss: n }, r.id)) }), ze = ({
|
|
811
811
|
message: e,
|
|
812
812
|
onDismiss: n
|
|
813
813
|
}) => {
|
|
@@ -822,7 +822,7 @@ const _e = ({
|
|
|
822
822
|
/* @__PURE__ */ i.jsx("span", { className: "pineui-snackbar__message", children: e.message }),
|
|
823
823
|
e.action && /* @__PURE__ */ i.jsx("button", { className: "pineui-snackbar__action", onClick: e.action.onPress, children: e.action.label })
|
|
824
824
|
] });
|
|
825
|
-
},
|
|
825
|
+
}, Ve = ({
|
|
826
826
|
presentation: e = "modal",
|
|
827
827
|
dismissible: n = !0,
|
|
828
828
|
child: r,
|
|
@@ -848,7 +848,7 @@ const _e = ({
|
|
|
848
848
|
renderer: t
|
|
849
849
|
}) => /* @__PURE__ */ i.jsx(i.Fragment, { children: Object.entries(e).map(
|
|
850
850
|
([s, { visible: o, config: a }]) => o ? /* @__PURE__ */ i.jsx(
|
|
851
|
-
|
|
851
|
+
Ve,
|
|
852
852
|
{
|
|
853
853
|
id: s,
|
|
854
854
|
...a,
|
|
@@ -859,7 +859,7 @@ const _e = ({
|
|
|
859
859
|
s
|
|
860
860
|
) : null
|
|
861
861
|
) });
|
|
862
|
-
function
|
|
862
|
+
function U(e, n) {
|
|
863
863
|
if (n.startsWith("http://") || n.startsWith("https://"))
|
|
864
864
|
return n;
|
|
865
865
|
try {
|
|
@@ -876,18 +876,18 @@ async function Z(e, n) {
|
|
|
876
876
|
if (e.imports.components)
|
|
877
877
|
for (const t of e.imports.components)
|
|
878
878
|
try {
|
|
879
|
-
const s =
|
|
879
|
+
const s = U(n, t), a = await (await fetch(s)).json();
|
|
880
880
|
r.components = {
|
|
881
881
|
...r.components,
|
|
882
882
|
...a
|
|
883
883
|
};
|
|
884
884
|
} catch (s) {
|
|
885
|
-
console.error(`❌ Failed to load component from ${t}:`, s), console.error(` Resolved URL: ${
|
|
885
|
+
console.error(`❌ Failed to load component from ${t}:`, s), console.error(` Resolved URL: ${U(n, t)}`);
|
|
886
886
|
}
|
|
887
887
|
if (e.imports.views)
|
|
888
888
|
for (const t of e.imports.views)
|
|
889
889
|
try {
|
|
890
|
-
const s =
|
|
890
|
+
const s = U(n, t), a = await (await fetch(s)).json();
|
|
891
891
|
r.views = {
|
|
892
892
|
...r.views,
|
|
893
893
|
...a
|
|
@@ -897,7 +897,7 @@ async function Z(e, n) {
|
|
|
897
897
|
}
|
|
898
898
|
return r;
|
|
899
899
|
}
|
|
900
|
-
class
|
|
900
|
+
class Pe extends se {
|
|
901
901
|
constructor(n) {
|
|
902
902
|
super(n), this.state = { hasError: !1, error: null };
|
|
903
903
|
}
|
|
@@ -933,7 +933,7 @@ class He extends se {
|
|
|
933
933
|
] }) : this.props.children;
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function He(e, n) {
|
|
937
937
|
const r = n.split(".");
|
|
938
938
|
let t = e;
|
|
939
939
|
for (const s of r) {
|
|
@@ -942,7 +942,7 @@ function Pe(e, n) {
|
|
|
942
942
|
}
|
|
943
943
|
return t;
|
|
944
944
|
}
|
|
945
|
-
const
|
|
945
|
+
const Ue = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
946
946
|
const [t, s] = w(null), [o, a] = w(!0), [d, c] = w(null), [p, m] = w([]), [y, g] = w({}), j = (e == null ? void 0 : e.state) || {
|
|
947
947
|
currentUser: {
|
|
948
948
|
id: "user_current",
|
|
@@ -1016,7 +1016,7 @@ const qe = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1016
1016
|
const u = l.value;
|
|
1017
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), E((v) => {
|
|
1018
1018
|
const x = { ...v };
|
|
1019
|
-
return
|
|
1019
|
+
return qe(x, l.path, l.value), x;
|
|
1020
1020
|
});
|
|
1021
1021
|
break;
|
|
1022
1022
|
}
|
|
@@ -1043,8 +1043,8 @@ const qe = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1043
1043
|
const u = typeof l.message == "string" && l.message.includes("{{") ? l.message.replace(/\{\{(.+?)\}\}/g, (x, I) => {
|
|
1044
1044
|
const M = I.trim();
|
|
1045
1045
|
if (M.startsWith("state.")) {
|
|
1046
|
-
const
|
|
1047
|
-
return
|
|
1046
|
+
const H = M.substring(6), V = He(b, H);
|
|
1047
|
+
return V != null ? String(V) : "";
|
|
1048
1048
|
}
|
|
1049
1049
|
return "";
|
|
1050
1050
|
}) : l.message, v = {
|
|
@@ -1137,28 +1137,28 @@ const qe = ({ schema: e, schemaUrl: n, baseUrl: r = "" }) => {
|
|
|
1137
1137
|
[f]: { ...h[f], visible: !1 }
|
|
1138
1138
|
}));
|
|
1139
1139
|
};
|
|
1140
|
-
return /* @__PURE__ */ i.jsx(
|
|
1140
|
+
return /* @__PURE__ */ i.jsx(Pe, { children: /* @__PURE__ */ i.jsxs("div", { className: "pineui-root", children: [
|
|
1141
1141
|
/* @__PURE__ */ i.jsx(R, { node: t.screen, context: C }),
|
|
1142
1142
|
/* @__PURE__ */ i.jsx(Le, { messages: p, onDismiss: O }),
|
|
1143
1143
|
/* @__PURE__ */ i.jsx(Re, { overlays: y, onClose: B, context: C, renderer: R })
|
|
1144
1144
|
] }) });
|
|
1145
1145
|
};
|
|
1146
|
-
function
|
|
1146
|
+
function qe(e, n, r) {
|
|
1147
1147
|
const t = n.split(".");
|
|
1148
1148
|
let s = e;
|
|
1149
1149
|
for (let o = 0; o < t.length - 1; o++)
|
|
1150
1150
|
s[t[o]] || (s[t[o]] = {}), s = s[t[o]];
|
|
1151
1151
|
s[t[t.length - 1]] = r;
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1153
|
+
function Je(e) {
|
|
1154
1154
|
var t, s;
|
|
1155
1155
|
const n = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
|
|
1156
1156
|
if (!n) {
|
|
1157
1157
|
console.error("PineUI: Target element not found"), (t = e.onError) == null || t.call(e, new Error("Target element not found"));
|
|
1158
1158
|
return;
|
|
1159
1159
|
}
|
|
1160
|
-
|
|
1161
|
-
Q.createElement(
|
|
1160
|
+
q.createRoot(n).render(
|
|
1161
|
+
Q.createElement(Ue, {
|
|
1162
1162
|
schema: e.schema,
|
|
1163
1163
|
schemaUrl: e.schemaUrl,
|
|
1164
1164
|
baseUrl: e.baseUrl
|
|
@@ -1166,9 +1166,10 @@ function Ue(e) {
|
|
|
1166
1166
|
), (s = e.onReady) == null || s.call(e);
|
|
1167
1167
|
}
|
|
1168
1168
|
typeof window < "u" && (window.PineUI = {
|
|
1169
|
-
render:
|
|
1169
|
+
render: Je
|
|
1170
1170
|
});
|
|
1171
|
+
console.log("%c🍍 PineUI v0.1.5%c — Server-Driven UI for AI-Native Apps", "color:#6750A4;font-weight:700;font-size:14px", "color:#79747E;font-size:12px");
|
|
1171
1172
|
export {
|
|
1172
|
-
|
|
1173
|
-
|
|
1173
|
+
Ue as PineUI,
|
|
1174
|
+
Je as render
|
|
1174
1175
|
};
|