@assistant-wi/core 0.0.11 → 0.0.12

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.
@@ -0,0 +1 @@
1
+ "use strict";function r(t,o,e){const n={};return v(n,t,o),x(n,t),w(n,t,e),n}function v(t,o,e){for(const n of e)Object.defineProperty(t,n,{value:a=>(o[n]=a,t),enumerable:!1,writable:!1,configurable:!1})}function w(t,o,e){if(!e)return;const n=e(o);for(const a of Object.keys(n))Object.defineProperty(t,a,{value:(...i)=>(n[a]?.(...i),t),enumerable:!1,writable:!1,configurable:!1})}function x(t,o){Object.defineProperty(t,"build",{value:()=>o,enumerable:!1,writable:!1,configurable:!1})}function c(...t){return r({type:"block",nodes:t,width:"auto",align:"start",justify:"start"},["direction","gap","nodes","width","align","justify"],e=>({row(){e.direction="row"},col(){e.direction="col"},addNode(n){e.nodes.push(n)}}))}function l(...t){return c(...t).row()}function d(...t){return c(...t).col()}function f(t){return r({type:"button",text:t},["text","variant","onClick"],e=>({primary(){e.variant="primary"},secondary(){e.variant="secondary"},outline(){e.variant="outline"},ghost(){e.variant="ghost"},destructive(){e.variant="destructive"}}))}function m(...t){return r({type:"form",nodes:t,submitTitle:"Submit"},["title","description","submitTitle","onSubmit","nodes"],e=>({addNode(n){e.nodes.push(n)}}))}function p(t){return r({type:"list",pagination:t??(()=>({items:[],hasMore:!1}))},["pagination","title","totalPages"],e=>({staticPagination(n,a){const i=Math.max(1,Math.floor(a||0)),u=Math.ceil(n.length/i);e.totalPages=u,e.pagination=y=>{if(u===0)return{items:[],hasMore:!1};const h=Math.max(1,Math.floor(y||0)),s=Math.min(h,u);return{items:n.slice((s-1)*i,s*i),hasMore:s<u}}}}))}function b(t){return r({type:"text",text:t,animation:null,color:"primary",weight:"normal",size:"md"},["text","color","weight","size","animation"],e=>({primary(){e.color="primary"},muted(){e.color="muted"},shimmering(n={}){e.animation={type:"shimmering",...n}}}))}function g(t){return r({type:"error",text:t},["text"],()=>({}))}const P=Object.freeze(Object.defineProperty({__proto__:null,block:c,button:f,col:d,error:g,form:m,list:p,row:l,text:b},Symbol.toStringTag,{value:"Module"}));exports.block=c;exports.button=f;exports.col=d;exports.error=g;exports.form=m;exports.index=P;exports.list=p;exports.row=l;exports.text=b;
@@ -1,4 +1,4 @@
1
- function i(t, n, e) {
1
+ function r(t, n, e) {
2
2
  const a = {};
3
3
  return f(a, t, n), p(a, t), m(a, t, e), a;
4
4
  }
@@ -16,7 +16,7 @@ function m(t, n, e) {
16
16
  const a = e(n);
17
17
  for (const o of Object.keys(a))
18
18
  Object.defineProperty(t, o, {
19
- value: (...r) => (a[o]?.(...r), t),
19
+ value: (...i) => (a[o]?.(...i), t),
20
20
  enumerable: !1,
21
21
  writable: !1,
22
22
  configurable: !1
@@ -31,7 +31,7 @@ function p(t, n) {
31
31
  });
32
32
  }
33
33
  function c(...t) {
34
- return i(
34
+ return r(
35
35
  {
36
36
  type: "block",
37
37
  nodes: t,
@@ -60,7 +60,7 @@ function g(...t) {
60
60
  return c(...t).col();
61
61
  }
62
62
  function y(t) {
63
- return i({
63
+ return r({
64
64
  type: "button",
65
65
  text: t
66
66
  }, ["text", "variant", "onClick"], (e) => ({
@@ -82,7 +82,7 @@ function y(t) {
82
82
  }));
83
83
  }
84
84
  function h(...t) {
85
- return i(
85
+ return r(
86
86
  {
87
87
  type: "form",
88
88
  nodes: t,
@@ -97,19 +97,19 @@ function h(...t) {
97
97
  );
98
98
  }
99
99
  function v(t) {
100
- return i({
100
+ return r({
101
101
  type: "list",
102
102
  pagination: t ?? (() => ({ items: [], hasMore: !1 }))
103
103
  }, ["pagination", "title", "totalPages"], (e) => ({
104
104
  staticPagination(a, o) {
105
- const r = Math.max(1, Math.floor(o || 0)), s = Math.ceil(a.length / r);
105
+ const i = Math.max(1, Math.floor(o || 0)), s = Math.ceil(a.length / i);
106
106
  e.totalPages = s, e.pagination = (l) => {
107
107
  if (s === 0) return { items: [], hasMore: !1 };
108
108
  const d = Math.max(1, Math.floor(l || 0)), u = Math.min(d, s);
109
109
  return {
110
110
  items: a.slice(
111
- (u - 1) * r,
112
- u * r
111
+ (u - 1) * i,
112
+ u * i
113
113
  ),
114
114
  hasMore: u < s
115
115
  };
@@ -118,7 +118,7 @@ function v(t) {
118
118
  }));
119
119
  }
120
120
  function w(t) {
121
- return i(
121
+ return r(
122
122
  {
123
123
  type: "text",
124
124
  text: t,
@@ -144,11 +144,18 @@ function w(t) {
144
144
  })
145
145
  );
146
146
  }
147
- const P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
147
+ function P(t) {
148
+ return r({
149
+ type: "error",
150
+ text: t
151
+ }, ["text"], () => ({}));
152
+ }
153
+ const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
148
154
  __proto__: null,
149
155
  block: c,
150
156
  button: y,
151
157
  col: g,
158
+ error: P,
152
159
  form: h,
153
160
  list: v,
154
161
  row: b,
@@ -158,8 +165,9 @@ export {
158
165
  y as a,
159
166
  c as b,
160
167
  g as c,
168
+ P as e,
161
169
  h as f,
162
- P as i,
170
+ x as i,
163
171
  v as l,
164
172
  b as r,
165
173
  w as t
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DMcbwFzr.js"),i=require("./index-Iczub9lN.js");exports.tool=e.index;exports.ui=i.index;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DMcbwFzr.js"),i=require("./index-14BiCzPY.js");exports.tool=e.index;exports.ui=i.index;
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i } from "./index-BXj6EgSG.mjs";
2
- import { i as a } from "./index-CmnEBvxT.mjs";
2
+ import { i as a } from "./index-8Ln_I-xT.mjs";
3
3
  export {
4
4
  i as tool,
5
5
  a as ui
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../index-Iczub9lN.js");exports.block=t.block;exports.button=t.button;exports.col=t.col;exports.form=t.form;exports.list=t.list;exports.row=t.row;exports.text=t.text;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index-14BiCzPY.js");exports.block=o.block;exports.button=o.button;exports.col=o.col;exports.error=o.error;exports.form=o.form;exports.list=o.list;exports.row=o.row;exports.text=o.text;
@@ -4,3 +4,4 @@ export * from './ui-button';
4
4
  export * from './ui-form';
5
5
  export * from './ui-list';
6
6
  export * from './ui-text';
7
+ export * from './ui-error';
@@ -1,8 +1,9 @@
1
- import { b as o, a as t, c as r, f as l, l as b, r as c, t as f } from "../index-CmnEBvxT.mjs";
1
+ import { b as o, a as r, c as t, e, f as l, l as b, r as c, t as f } from "../index-8Ln_I-xT.mjs";
2
2
  export {
3
3
  o as block,
4
- t as button,
5
- r as col,
4
+ r as button,
5
+ t as col,
6
+ e as error,
6
7
  l as form,
7
8
  b as list,
8
9
  c as row,
package/dist/ui/ui.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { UIBlock } from './ui-block';
2
2
  import { UIButton } from './ui-button';
3
+ import { UIError } from './ui-error';
3
4
  import { UIForm } from './ui-form';
4
5
  import { UIList } from './ui-list';
5
6
  import { UIText } from './ui-text';
6
7
  export type UI = UIObject | {
7
8
  build(): UIObject;
8
9
  };
9
- export type UIObject = UIBlock | UIText | UIButton | UIForm | UIList;
10
+ export type UIObject = UIBlock | UIText | UIError | UIButton | UIForm | UIList;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@assistant-wi/core",
3
3
  "private": false,
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "types": "./dist/index.d.ts",
@@ -1 +0,0 @@
1
- "use strict";function i(t,a,e){const n={};return h(n,t,a),w(n,t),v(n,t,e),n}function h(t,a,e){for(const n of e)Object.defineProperty(t,n,{value:o=>(a[n]=o,t),enumerable:!1,writable:!1,configurable:!1})}function v(t,a,e){if(!e)return;const n=e(a);for(const o of Object.keys(n))Object.defineProperty(t,o,{value:(...r)=>(n[o]?.(...r),t),enumerable:!1,writable:!1,configurable:!1})}function w(t,a){Object.defineProperty(t,"build",{value:()=>a,enumerable:!1,writable:!1,configurable:!1})}function c(...t){return i({type:"block",nodes:t,width:"auto",align:"start",justify:"start"},["direction","gap","nodes","width","align","justify"],e=>({row(){e.direction="row"},col(){e.direction="col"},addNode(n){e.nodes.push(n)}}))}function l(...t){return c(...t).row()}function d(...t){return c(...t).col()}function f(t){return i({type:"button",text:t},["text","variant","onClick"],e=>({primary(){e.variant="primary"},secondary(){e.variant="secondary"},outline(){e.variant="outline"},ghost(){e.variant="ghost"},destructive(){e.variant="destructive"}}))}function m(...t){return i({type:"form",nodes:t,submitTitle:"Submit"},["title","description","submitTitle","onSubmit","nodes"],e=>({addNode(n){e.nodes.push(n)}}))}function p(t){return i({type:"list",pagination:t??(()=>({items:[],hasMore:!1}))},["pagination","title","totalPages"],e=>({staticPagination(n,o){const r=Math.max(1,Math.floor(o||0)),u=Math.ceil(n.length/r);e.totalPages=u,e.pagination=g=>{if(u===0)return{items:[],hasMore:!1};const y=Math.max(1,Math.floor(g||0)),s=Math.min(y,u);return{items:n.slice((s-1)*r,s*r),hasMore:s<u}}}}))}function b(t){return i({type:"text",text:t,animation:null,color:"primary",weight:"normal",size:"md"},["text","color","weight","size","animation"],e=>({primary(){e.color="primary"},muted(){e.color="muted"},shimmering(n={}){e.animation={type:"shimmering",...n}}}))}const P=Object.freeze(Object.defineProperty({__proto__:null,block:c,button:f,col:d,form:m,list:p,row:l,text:b},Symbol.toStringTag,{value:"Module"}));exports.block=c;exports.button=f;exports.col=d;exports.form=m;exports.index=P;exports.list=p;exports.row=l;exports.text=b;