@assistant-wi/core 0.0.9 → 0.0.11

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.
@@ -30,7 +30,7 @@ function p(t, n) {
30
30
  configurable: !1
31
31
  });
32
32
  }
33
- function u(...t) {
33
+ function c(...t) {
34
34
  return i(
35
35
  {
36
36
  type: "block",
@@ -54,10 +54,10 @@ function u(...t) {
54
54
  );
55
55
  }
56
56
  function b(...t) {
57
- return u(...t).row();
57
+ return c(...t).row();
58
58
  }
59
59
  function g(...t) {
60
- return u(...t).col();
60
+ return c(...t).col();
61
61
  }
62
62
  function y(t) {
63
63
  return i({
@@ -98,19 +98,20 @@ function h(...t) {
98
98
  }
99
99
  function v(t) {
100
100
  return i({
101
+ type: "list",
101
102
  pagination: t ?? (() => ({ items: [], hasMore: !1 }))
102
103
  }, ["pagination", "title", "totalPages"], (e) => ({
103
104
  staticPagination(a, o) {
104
105
  const r = Math.max(1, Math.floor(o || 0)), s = Math.ceil(a.length / r);
105
106
  e.totalPages = s, e.pagination = (l) => {
106
107
  if (s === 0) return { items: [], hasMore: !1 };
107
- const d = Math.max(1, Math.floor(l || 0)), c = Math.min(d, s);
108
+ const d = Math.max(1, Math.floor(l || 0)), u = Math.min(d, s);
108
109
  return {
109
110
  items: a.slice(
110
- (c - 1) * r,
111
- c * r
111
+ (u - 1) * r,
112
+ u * r
112
113
  ),
113
- hasMore: c < s
114
+ hasMore: u < s
114
115
  };
115
116
  };
116
117
  }
@@ -121,7 +122,7 @@ function w(t) {
121
122
  {
122
123
  type: "text",
123
124
  text: t,
124
- animation: "none",
125
+ animation: null,
125
126
  color: "primary",
126
127
  weight: "normal",
127
128
  size: "md"
@@ -145,7 +146,7 @@ function w(t) {
145
146
  }
146
147
  const P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
147
148
  __proto__: null,
148
- block: u,
149
+ block: c,
149
150
  button: y,
150
151
  col: g,
151
152
  form: h,
@@ -155,7 +156,7 @@ const P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
155
156
  }, Symbol.toStringTag, { value: "Module" }));
156
157
  export {
157
158
  y as a,
158
- u as b,
159
+ c as b,
159
160
  g as c,
160
161
  h as f,
161
162
  P as i,
@@ -0,0 +1 @@
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;
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-YOKoR-uY.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-Iczub9lN.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-CHJTMogj.mjs";
2
+ import { i as a } from "./index-CmnEBvxT.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-YOKoR-uY.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 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,4 +1,4 @@
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-CHJTMogj.mjs";
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";
2
2
  export {
3
3
  o as block,
4
4
  t as button,
@@ -0,0 +1,5 @@
1
+ export interface UIError {
2
+ type: 'error';
3
+ text: string;
4
+ }
5
+ export declare function error(text: string): import('./builder').Builder<UIError, "text"[], {}>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export interface UIList {
2
+ type: 'list';
2
3
  pagination: UIListPagination;
3
4
  title?: string;
4
5
  totalPages?: number;
@@ -4,7 +4,7 @@ export interface UIText {
4
4
  color?: 'primary' | 'muted';
5
5
  weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
6
6
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
7
- animation?: 'none' | UITextAnimationShimmering;
7
+ animation?: null | UITextAnimationShimmering;
8
8
  }
9
9
  export type UITextAnimationShimmering = {
10
10
  type: 'shimmering';
package/dist/ui/ui.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { UIBlock } from './ui-block';
2
2
  import { UIButton } from './ui-button';
3
3
  import { UIForm } from './ui-form';
4
+ import { UIList } from './ui-list';
4
5
  import { UIText } from './ui-text';
5
6
  export type UI = UIObject | {
6
7
  build(): UIObject;
7
8
  };
8
- export type UIObject = UIBlock | UIText | UIButton | UIForm;
9
+ export type UIObject = UIBlock | UIText | 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.9",
4
+ "version": "0.0.11",
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,o,e){const n={};return h(n,t,o),w(n,t),v(n,t,e),n}function h(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 v(t,o,e){if(!e)return;const n=e(o);for(const a of Object.keys(n))Object.defineProperty(t,a,{value:(...r)=>(n[a]?.(...r),t),enumerable:!1,writable:!1,configurable:!1})}function w(t,o){Object.defineProperty(t,"build",{value:()=>o,enumerable:!1,writable:!1,configurable:!1})}function u(...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 u(...t).row()}function d(...t){return u(...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({pagination:t??(()=>({items:[],hasMore:!1}))},["pagination","title","totalPages"],e=>({staticPagination(n,a){const r=Math.max(1,Math.floor(a||0)),c=Math.ceil(n.length/r);e.totalPages=c,e.pagination=g=>{if(c===0)return{items:[],hasMore:!1};const y=Math.max(1,Math.floor(g||0)),s=Math.min(y,c);return{items:n.slice((s-1)*r,s*r),hasMore:s<c}}}}))}function b(t){return i({type:"text",text:t,animation:"none",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:u,button:f,col:d,form:m,list:p,row:l,text:b},Symbol.toStringTag,{value:"Module"}));exports.block=u;exports.button=f;exports.col=d;exports.form=m;exports.index=P;exports.list=p;exports.row=l;exports.text=b;