@vef-framework/shared 1.0.127 → 1.0.129

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.
Files changed (54) hide show
  1. package/cjs/color.cjs +1 -10
  2. package/cjs/constants.cjs +1 -38
  3. package/cjs/context.cjs +1 -35
  4. package/cjs/dom.cjs +1 -22
  5. package/cjs/error.cjs +1 -29
  6. package/cjs/event.cjs +1 -10
  7. package/cjs/expression.cjs +1 -26
  8. package/cjs/function.cjs +1 -15
  9. package/cjs/icons.cjs +1 -135
  10. package/cjs/id.cjs +1 -13
  11. package/cjs/index.cjs +1 -317
  12. package/cjs/json.cjs +1 -17
  13. package/cjs/message.cjs +1 -302
  14. package/cjs/module.cjs +2 -0
  15. package/cjs/path.cjs +1 -39
  16. package/cjs/pinyin.cjs +1 -32
  17. package/cjs/security.cjs +1 -26
  18. package/cjs/store.cjs +1 -103
  19. package/cjs/styles.cjs +1 -54
  20. package/cjs/temporal.cjs +1 -26
  21. package/cjs/theme-variables.cjs +1 -353
  22. package/cjs/types.cjs +0 -2
  23. package/cjs/utils.cjs +1 -322
  24. package/cjs/validation.cjs +1 -188
  25. package/cjs/yaml.cjs +1 -10
  26. package/cjs/zod.cjs +1 -26
  27. package/esm/color.js +1 -8
  28. package/esm/constants.js +1 -30
  29. package/esm/context.js +1 -33
  30. package/esm/dom.js +1 -20
  31. package/esm/error.js +1 -27
  32. package/esm/event.js +1 -8
  33. package/esm/expression.js +1 -22
  34. package/esm/function.js +1 -13
  35. package/esm/icons.js +1 -128
  36. package/esm/id.js +1 -11
  37. package/esm/index.js +1 -31
  38. package/esm/json.js +1 -15
  39. package/esm/message.js +1 -281
  40. package/esm/module.js +2 -0
  41. package/esm/path.js +1 -32
  42. package/esm/pinyin.js +1 -29
  43. package/esm/security.js +1 -23
  44. package/esm/store.js +1 -98
  45. package/esm/styles.js +1 -50
  46. package/esm/temporal.js +1 -22
  47. package/esm/theme-variables.js +1 -351
  48. package/esm/utils.js +1 -110
  49. package/esm/validation.js +1 -150
  50. package/esm/yaml.js +1 -8
  51. package/esm/zod.js +1 -21
  52. package/package.json +1 -1
  53. package/types/index.d.ts +1 -0
  54. package/types/module.d.ts +7 -0
package/cjs/color.cjs CHANGED
@@ -1,11 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- var colord = require('colord');
5
-
6
- "use strict";
7
- function isValidColor(color) {
8
- return colord.colord(color).isValid();
9
- }
10
-
11
- exports.isValidColor = isValidColor;
2
+ "use strict";var i=require("colord");function o(r){return i.colord(r).isValid()}exports.isValidColor=o;
package/cjs/constants.cjs CHANGED
@@ -1,39 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- "use strict";
5
- const defaultColorTypes = [
6
- "blue",
7
- "purple",
8
- "cyan",
9
- "green",
10
- "magenta",
11
- "pink",
12
- "red",
13
- "orange",
14
- "yellow",
15
- "volcano",
16
- "geekblue",
17
- "gold",
18
- "lime"
19
- ];
20
- const semanticColorTypes = [
21
- "primary",
22
- "info",
23
- "success",
24
- "warning",
25
- "error"
26
- ];
27
- const colorTypes = [...defaultColorTypes, ...semanticColorTypes];
28
- const creationFormScene = "creation";
29
- const updateFormScene = "update";
30
- const auditFormScene = "audit";
31
- const presetFormScenes = [creationFormScene, updateFormScene, auditFormScene];
32
-
33
- exports.auditFormScene = auditFormScene;
34
- exports.colorTypes = colorTypes;
35
- exports.creationFormScene = creationFormScene;
36
- exports.defaultColorTypes = defaultColorTypes;
37
- exports.presetFormScenes = presetFormScenes;
38
- exports.semanticColorTypes = semanticColorTypes;
39
- exports.updateFormScene = updateFormScene;
2
+ "use strict";const e=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","gold","lime"],o=["primary","info","success","warning","error"],t=[...e,...o],r="creation",n="update",c="audit",a=[r,n,c];exports.auditFormScene=c,exports.colorTypes=t,exports.creationFormScene=r,exports.defaultColorTypes=e,exports.presetFormScenes=a,exports.semanticColorTypes=o,exports.updateFormScene=n;
package/cjs/context.cjs CHANGED
@@ -1,36 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- var react = require('react');
5
- var useContextSelector = require('use-context-selector');
6
- require('./utils.cjs');
7
- var radashi = require('radashi');
8
- var shallow = require('zustand/shallow');
9
-
10
- "use strict";
11
- function createSelectableContext(defaultValue) {
12
- const context = useContextSelector.createContext(defaultValue);
13
- const ContextProvider = context.Provider;
14
- const useContextSelector$1 = (selector) => {
15
- const lastSelectedValueRef = react.useRef();
16
- return useContextSelector.useContextSelector(context, (value) => {
17
- if (radashi.isNullish(value)) {
18
- return;
19
- }
20
- const selectedValue = selector(value);
21
- if (lastSelectedValueRef.current && shallow.shallow(selectedValue, lastSelectedValueRef.current)) {
22
- return lastSelectedValueRef.current;
23
- }
24
- lastSelectedValueRef.current = selectedValue;
25
- return selectedValue;
26
- });
27
- };
28
- const useContext = () => useContextSelector.useContext(context);
29
- return {
30
- ContextProvider,
31
- useContextSelector: useContextSelector$1,
32
- useContext
33
- };
34
- }
35
-
36
- exports.createSelectableContext = createSelectableContext;
2
+ "use strict";var s=require("react"),u=require("use-context-selector");require("./utils.cjs");var a=require("radashi"),i=require("zustand/shallow");function l(c){const r=u.createContext(c);return{ContextProvider:r.Provider,useContextSelector:o=>{const e=s.useRef();return u.useContextSelector(r,n=>{if(a.isNullish(n))return;const t=o(n);return e.current&&i.shallow(t,e.current)?e.current:(e.current=t,t)})},useContext:()=>u.useContext(r)}}exports.createSelectableContext=l;
package/cjs/dom.cjs CHANGED
@@ -1,23 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- "use strict";
5
- function getElementHeight(element, selector, includeMargin = false) {
6
- if (selector) {
7
- const subElement = element.querySelector(selector);
8
- if (!subElement) {
9
- return 0;
10
- }
11
- element = subElement;
12
- }
13
- const height = element.offsetHeight;
14
- if (!includeMargin) {
15
- return height;
16
- }
17
- const styleMap = element.computedStyleMap();
18
- const marginTop = styleMap.get("margin-top").value;
19
- const marginBottom = styleMap.get("margin-bottom").value;
20
- return height + marginTop + marginBottom;
21
- }
22
-
23
- exports.getElementHeight = getElementHeight;
2
+ "use strict";function c(t,e,o=!1){if(e){const i=t.querySelector(e);if(!i)return 0;t=i}const n=t.offsetHeight;if(!o)return n;const r=t.computedStyleMap(),g=r.get("margin-top").value,u=r.get("margin-bottom").value;return n+g+u}exports.getElementHeight=c;
package/cjs/error.cjs CHANGED
@@ -1,30 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- "use strict";
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- class VefError extends Error {
9
- /**
10
- * Constructs a new VefError.
11
- *
12
- * @param code - The code of the error.
13
- * @param message - The message of the error.
14
- */
15
- constructor(code, message) {
16
- super(message);
17
- /**
18
- * The code of the error.
19
- */
20
- __publicField(this, "code");
21
- Object.defineProperty(this, "code", {
22
- value: code,
23
- writable: false,
24
- configurable: false,
25
- enumerable: true
26
- });
27
- }
28
- }
29
-
30
- exports.VefError = VefError;
2
+ "use strict";var s=Object.defineProperty,a=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,o=(r,e,t)=>a(r,typeof e!="symbol"?e+"":e,t);class c extends Error{constructor(e,t){super(t),o(this,"code"),Object.defineProperty(this,"code",{value:e,writable:!1,configurable:!1,enumerable:!0})}}exports.VefError=c;
package/cjs/event.cjs CHANGED
@@ -1,11 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- var mitt = require('mitt');
5
-
6
- "use strict";
7
- function createEventEmitter() {
8
- return mitt();
9
- }
10
-
11
- exports.createEventEmitter = createEventEmitter;
2
+ "use strict";var t=require("mitt");function e(){return t()}exports.createEventEmitter=e;
@@ -1,27 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- require('./utils.cjs');
5
- var radashi = require('radashi');
6
-
7
- "use strict";
8
- const dynamicFnCache = /* @__PURE__ */ new WeakMap();
9
- function isExpression(value) {
10
- return radashi.isObject(value) && "expression" in value && radashi.isString(value.expression);
11
- }
12
- function isFunctionOrExpression(value) {
13
- return radashi.isFunction(value) || isExpression(value);
14
- }
15
- function compileDynamicFn(key, ...args) {
16
- const fn = dynamicFnCache.get(key);
17
- if (fn) {
18
- return fn;
19
- }
20
- const newFn = new Function(...args);
21
- dynamicFnCache.set(key, newFn);
22
- return newFn;
23
- }
24
-
25
- exports.compileDynamicFn = compileDynamicFn;
26
- exports.isExpression = isExpression;
27
- exports.isFunctionOrExpression = isFunctionOrExpression;
2
+ "use strict";require("./utils.cjs");var n=require("radashi");const r=new WeakMap;function t(i){return n.isObject(i)&&"expression"in i&&n.isString(i.expression)}function c(i){return n.isFunction(i)||t(i)}function u(i,...o){const s=r.get(i);if(s)return s;const e=new Function(...o);return r.set(i,e),e}exports.compileDynamicFn=u,exports.isExpression=t,exports.isFunctionOrExpression=c;
package/cjs/function.cjs CHANGED
@@ -1,16 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- "use strict";
5
- function mergeFns(...fns) {
6
- const fn = (...args) => {
7
- for (const fn2 of fns) {
8
- if (fn2) {
9
- fn2(...args);
10
- }
11
- }
12
- };
13
- return fn;
14
- }
15
-
16
- exports.mergeFns = mergeFns;
2
+ "use strict";function s(...n){return(...r)=>{for(const e of n)e&&e(...r)}}exports.mergeFns=s;
package/cjs/icons.cjs CHANGED
@@ -1,136 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- var jsxRuntime = require('@emotion/react/jsx-runtime');
5
-
6
- "use strict";
7
- function IconTick(props) {
8
- return /* @__PURE__ */ jsxRuntime.jsx(
9
- "svg",
10
- {
11
- "aria-hidden": true,
12
- fill: "none",
13
- focusable: false,
14
- viewBox: "0 0 24 24",
15
- xmlns: "http://www.w3.org/2000/svg",
16
- ...props,
17
- children: /* @__PURE__ */ jsxRuntime.jsx(
18
- "path",
19
- {
20
- clipRule: "evenodd",
21
- d: "M21.35 4.27c.68.47.86 1.4.38 2.08l-10 14.5a1.5 1.5 0 0 1-2.33.17l-6.5-7a1.5 1.5 0 0 1 2.2-2.04l5.23 5.63 8.94-12.96a1.5 1.5 0 0 1 2.08-.38Z",
22
- fill: "currentColor",
23
- fillRule: "evenodd"
24
- }
25
- )
26
- }
27
- );
28
- }
29
- function IconTickCircle(props) {
30
- return /* @__PURE__ */ jsxRuntime.jsx(
31
- "svg",
32
- {
33
- "aria-hidden": true,
34
- fill: "none",
35
- focusable: false,
36
- viewBox: "0 0 24 24",
37
- xmlns: "http://www.w3.org/2000/svg",
38
- ...props,
39
- children: /* @__PURE__ */ jsxRuntime.jsx(
40
- "path",
41
- {
42
- clipRule: "evenodd",
43
- d: "M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm5.88-13.18-6.2 7.6a1.5 1.5 0 0 1-2.37 0l-3.5-4a1.5 1.5 0 1 1 2.37-1.84l2.3 2.46L15.5 8a1.5 1.5 0 1 1 2.38 1.82Z",
44
- fill: "currentColor",
45
- fillRule: "evenodd"
46
- }
47
- )
48
- }
49
- );
50
- }
51
- function IconInfoCircle(props) {
52
- return /* @__PURE__ */ jsxRuntime.jsx(
53
- "svg",
54
- {
55
- "aria-hidden": true,
56
- fill: "none",
57
- focusable: false,
58
- viewBox: "0 0 24 24",
59
- xmlns: "http://www.w3.org/2000/svg",
60
- ...props,
61
- children: /* @__PURE__ */ jsxRuntime.jsx(
62
- "path",
63
- {
64
- clipRule: "evenodd",
65
- d: "M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm2-16a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-5 3.75c0-.41.34-.75.75-.75h2.75a1 1 0 0 1 1 1v5.5h.75a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5h.75v-5h-.75a.75.75 0 0 1-.75-.75Z",
66
- fill: "currentColor",
67
- fillRule: "evenodd"
68
- }
69
- )
70
- }
71
- );
72
- }
73
- function IconAlertCircle(props) {
74
- return /* @__PURE__ */ jsxRuntime.jsx(
75
- "svg",
76
- {
77
- "aria-hidden": true,
78
- fill: "none",
79
- focusable: false,
80
- viewBox: "0 0 24 24",
81
- xmlns: "http://www.w3.org/2000/svg",
82
- ...props,
83
- children: /* @__PURE__ */ jsxRuntime.jsx(
84
- "path",
85
- {
86
- clipRule: "evenodd",
87
- d: "M23 12a11 11 0 1 1-22 0 11 11 0 0 1 22 0Zm-9.5 5.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0ZM12 5a1.9 1.9 0 0 0-1.89 2l.3 5.5a1.59 1.59 0 0 0 3.17 0l.3-5.5c.07-1.09-.8-2-1.88-2Z",
88
- fill: "currentColor",
89
- fillRule: "evenodd"
90
- }
91
- )
92
- }
93
- );
94
- }
95
- function IconAlertTriangle(props) {
96
- return /* @__PURE__ */ jsxRuntime.jsx(
97
- "svg",
98
- {
99
- "aria-hidden": true,
100
- fill: "none",
101
- focusable: false,
102
- viewBox: "0 0 24 24",
103
- xmlns: "http://www.w3.org/2000/svg",
104
- ...props,
105
- children: /* @__PURE__ */ jsxRuntime.jsx(
106
- "path",
107
- {
108
- clipRule: "evenodd",
109
- d: "m10.23 2.4-8.7 16.67A2 2 0 0 0 3.3 22h17.4a2 2 0 0 0 1.77-2.93L13.77 2.4a2 2 0 0 0-3.54 0ZM13.14 14a1.15 1.15 0 0 1-2.28 0l-.58-4.03a1.73 1.73 0 1 1 3.44 0l-.58 4.03Zm.36 4.49a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",
110
- fill: "currentColor",
111
- fillRule: "evenodd"
112
- }
113
- )
114
- }
115
- );
116
- }
117
- function IconCheck(props) {
118
- return /* @__PURE__ */ jsxRuntime.jsx(
119
- "svg",
120
- {
121
- "aria-hidden": true,
122
- focusable: false,
123
- viewBox: "0 0 24 24",
124
- xmlns: "http://www.w3.org/2000/svg",
125
- ...props,
126
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6L9 17l-5-5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 })
127
- }
128
- );
129
- }
130
-
131
- exports.IconAlertCircle = IconAlertCircle;
132
- exports.IconAlertTriangle = IconAlertTriangle;
133
- exports.IconCheck = IconCheck;
134
- exports.IconInfoCircle = IconInfoCircle;
135
- exports.IconTick = IconTick;
136
- exports.IconTickCircle = IconTickCircle;
2
+ "use strict";var e=require("@emotion/react/jsx-runtime");function n(l){return e.jsx("svg",{"aria-hidden":!0,fill:"none",focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{clipRule:"evenodd",d:"M21.35 4.27c.68.47.86 1.4.38 2.08l-10 14.5a1.5 1.5 0 0 1-2.33.17l-6.5-7a1.5 1.5 0 0 1 2.2-2.04l5.23 5.63 8.94-12.96a1.5 1.5 0 0 1 2.08-.38Z",fill:"currentColor",fillRule:"evenodd"})})}function o(l){return e.jsx("svg",{"aria-hidden":!0,fill:"none",focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm5.88-13.18-6.2 7.6a1.5 1.5 0 0 1-2.37 0l-3.5-4a1.5 1.5 0 1 1 2.37-1.84l2.3 2.46L15.5 8a1.5 1.5 0 1 1 2.38 1.82Z",fill:"currentColor",fillRule:"evenodd"})})}function i(l){return e.jsx("svg",{"aria-hidden":!0,fill:"none",focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm2-16a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-5 3.75c0-.41.34-.75.75-.75h2.75a1 1 0 0 1 1 1v5.5h.75a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5h.75v-5h-.75a.75.75 0 0 1-.75-.75Z",fill:"currentColor",fillRule:"evenodd"})})}function r(l){return e.jsx("svg",{"aria-hidden":!0,fill:"none",focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{clipRule:"evenodd",d:"M23 12a11 11 0 1 1-22 0 11 11 0 0 1 22 0Zm-9.5 5.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0ZM12 5a1.9 1.9 0 0 0-1.89 2l.3 5.5a1.59 1.59 0 0 0 3.17 0l.3-5.5c.07-1.09-.8-2-1.88-2Z",fill:"currentColor",fillRule:"evenodd"})})}function c(l){return e.jsx("svg",{"aria-hidden":!0,fill:"none",focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{clipRule:"evenodd",d:"m10.23 2.4-8.7 16.67A2 2 0 0 0 3.3 22h17.4a2 2 0 0 0 1.77-2.93L13.77 2.4a2 2 0 0 0-3.54 0ZM13.14 14a1.15 1.15 0 0 1-2.28 0l-.58-4.03a1.73 1.73 0 1 1 3.44 0l-.58 4.03Zm.36 4.49a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",fill:"currentColor",fillRule:"evenodd"})})}function a(l){return e.jsx("svg",{"aria-hidden":!0,focusable:!1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...l,children:e.jsx("path",{d:"M20 6L9 17l-5-5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2})})}exports.IconAlertCircle=r,exports.IconAlertTriangle=c,exports.IconCheck=a,exports.IconInfoCircle=i,exports.IconTick=n,exports.IconTickCircle=o;
package/cjs/id.cjs CHANGED
@@ -1,14 +1,2 @@
1
1
  "use strict";
2
- 'use strict';
3
-
4
- var nanoid = require('nanoid');
5
-
6
- "use strict";
7
- const alphabets = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
8
- const length = 18;
9
- const nanoId = nanoid.customAlphabet(alphabets, length);
10
- function generateId() {
11
- return nanoId();
12
- }
13
-
14
- exports.generateId = generateId;
2
+ "use strict";var e=require("nanoid");const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n=18,r=e.customAlphabet(t,n);function s(){return r()}exports.generateId=s;