@pequity/squirrel 1.0.23 → 1.0.24

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/README.md CHANGED
@@ -56,7 +56,7 @@ If you are using Jest for unit testing, you will need to add the following to yo
56
56
  ```js
57
57
  {
58
58
  moduleNameMapper: {
59
- '^@pequity/squirrel$': '<rootDir>/node_modules/@pequity/squirrel/dist/squirrel.cjs.js'
59
+ '^@pequity/squirrel$': '<rootDir>/node_modules/@pequity/squirrel/dist/cjs',
60
60
  }
61
61
  }
62
62
  ```
package/dist/cjs/p-btn.js CHANGED
@@ -2,196 +2,8 @@
2
2
  const pRingLoader_vue_vue_type_script_setup_true_lang = require("./chunks/p-ring-loader.js");
3
3
  const tailwind = require("./tailwind.js");
4
4
  const vue = require("vue");
5
+ const vueRouter = require("vue-router");
5
6
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
6
- /*!
7
- * vue-router v4.3.0
8
- * (c) 2024 Eduardo San Martin Morote
9
- * @license MIT
10
- */
11
- const isBrowser = typeof document !== "undefined";
12
- const noop = () => {
13
- };
14
- const isArray = Array.isArray;
15
- function isSameRouteRecord(a, b) {
16
- return (a.aliasOf || a) === (b.aliasOf || b);
17
- }
18
- function isSameRouteLocationParams(a, b) {
19
- if (Object.keys(a).length !== Object.keys(b).length)
20
- return false;
21
- for (const key in a) {
22
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
23
- return false;
24
- }
25
- return true;
26
- }
27
- function isSameRouteLocationParamsValue(a, b) {
28
- return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
29
- }
30
- function isEquivalentArray(a, b) {
31
- return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
32
- }
33
- var NavigationType;
34
- (function(NavigationType2) {
35
- NavigationType2["pop"] = "pop";
36
- NavigationType2["push"] = "push";
37
- })(NavigationType || (NavigationType = {}));
38
- var NavigationDirection;
39
- (function(NavigationDirection2) {
40
- NavigationDirection2["back"] = "back";
41
- NavigationDirection2["forward"] = "forward";
42
- NavigationDirection2["unknown"] = "";
43
- })(NavigationDirection || (NavigationDirection = {}));
44
- Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
45
- var NavigationFailureType;
46
- (function(NavigationFailureType2) {
47
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
48
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
49
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
50
- })(NavigationFailureType || (NavigationFailureType = {}));
51
- Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
52
- Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
53
- const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
54
- const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
55
- Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
56
- function useLink(props) {
57
- const router = vue.inject(routerKey);
58
- const currentRoute = vue.inject(routeLocationKey);
59
- const route = vue.computed(() => router.resolve(vue.unref(props.to)));
60
- const activeRecordIndex = vue.computed(() => {
61
- const { matched } = route.value;
62
- const { length } = matched;
63
- const routeMatched = matched[length - 1];
64
- const currentMatched = currentRoute.matched;
65
- if (!routeMatched || !currentMatched.length)
66
- return -1;
67
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
68
- if (index > -1)
69
- return index;
70
- const parentRecordPath = getOriginalPath(matched[length - 2]);
71
- return (
72
- // we are dealing with nested routes
73
- length > 1 && // if the parent and matched route have the same path, this link is
74
- // referring to the empty child. Or we currently are on a different
75
- // child of the same parent
76
- getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
77
- currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
78
- );
79
- });
80
- const isActive = vue.computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
81
- const isExactActive = vue.computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
82
- function navigate(e = {}) {
83
- if (guardEvent(e)) {
84
- return router[vue.unref(props.replace) ? "replace" : "push"](
85
- vue.unref(props.to)
86
- // avoid uncaught errors are they are logged anyway
87
- ).catch(noop);
88
- }
89
- return Promise.resolve();
90
- }
91
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
92
- const instance = vue.getCurrentInstance();
93
- if (instance) {
94
- const linkContextDevtools = {
95
- route: route.value,
96
- isActive: isActive.value,
97
- isExactActive: isExactActive.value
98
- };
99
- instance.__vrl_devtools = instance.__vrl_devtools || [];
100
- instance.__vrl_devtools.push(linkContextDevtools);
101
- vue.watchEffect(() => {
102
- linkContextDevtools.route = route.value;
103
- linkContextDevtools.isActive = isActive.value;
104
- linkContextDevtools.isExactActive = isExactActive.value;
105
- }, { flush: "post" });
106
- }
107
- }
108
- return {
109
- route,
110
- href: vue.computed(() => route.value.href),
111
- isActive,
112
- isExactActive,
113
- navigate
114
- };
115
- }
116
- const RouterLinkImpl = /* @__PURE__ */ vue.defineComponent({
117
- name: "RouterLink",
118
- compatConfig: { MODE: 3 },
119
- props: {
120
- to: {
121
- type: [String, Object],
122
- required: true
123
- },
124
- replace: Boolean,
125
- activeClass: String,
126
- // inactiveClass: String,
127
- exactActiveClass: String,
128
- custom: Boolean,
129
- ariaCurrentValue: {
130
- type: String,
131
- default: "page"
132
- }
133
- },
134
- useLink,
135
- setup(props, { slots }) {
136
- const link = vue.reactive(useLink(props));
137
- const { options } = vue.inject(routerKey);
138
- const elClass = vue.computed(() => ({
139
- [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
140
- // [getLinkClass(
141
- // props.inactiveClass,
142
- // options.linkInactiveClass,
143
- // 'router-link-inactive'
144
- // )]: !link.isExactActive,
145
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
146
- }));
147
- return () => {
148
- const children = slots.default && slots.default(link);
149
- return props.custom ? children : vue.h("a", {
150
- "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
151
- href: link.href,
152
- // this would override user added attrs but Vue will still add
153
- // the listener, so we end up triggering both
154
- onClick: link.navigate,
155
- class: elClass.value
156
- }, children);
157
- };
158
- }
159
- });
160
- const RouterLink = RouterLinkImpl;
161
- function guardEvent(e) {
162
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
163
- return;
164
- if (e.defaultPrevented)
165
- return;
166
- if (e.button !== void 0 && e.button !== 0)
167
- return;
168
- if (e.currentTarget && e.currentTarget.getAttribute) {
169
- const target = e.currentTarget.getAttribute("target");
170
- if (/\b_blank\b/i.test(target))
171
- return;
172
- }
173
- if (e.preventDefault)
174
- e.preventDefault();
175
- return true;
176
- }
177
- function includesParams(outer, inner) {
178
- for (const key in inner) {
179
- const innerValue = inner[key];
180
- const outerValue = outer[key];
181
- if (typeof innerValue === "string") {
182
- if (innerValue !== outerValue)
183
- return false;
184
- } else {
185
- if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
186
- return false;
187
- }
188
- }
189
- return true;
190
- }
191
- function getOriginalPath(record) {
192
- return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
193
- }
194
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
195
7
  const BUTTON_TYPES = {
196
8
  PRIMARY: "primary",
197
9
  SECONDARY: "secondary",
@@ -244,7 +56,7 @@ const _sfc_main = vue.defineComponent({
244
56
  name: "PBtn",
245
57
  components: {
246
58
  PRingLoader: pRingLoader_vue_vue_type_script_setup_true_lang._sfc_main,
247
- RouterLink
59
+ RouterLink: vueRouter.RouterLink
248
60
  },
249
61
  inheritAttrs: false,
250
62
  props: {
package/dist/es/p-btn.js CHANGED
@@ -1,196 +1,8 @@
1
1
  import { _ as _sfc_main$1 } from "./chunks/p-ring-loader.js";
2
2
  import { getColorDeep } from "./tailwind.js";
3
- import { defineComponent, reactive, inject, computed, h, unref, getCurrentInstance, watchEffect, resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, withCtx, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
3
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, withCtx, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
4
+ import { RouterLink } from "vue-router";
4
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
- /*!
6
- * vue-router v4.3.0
7
- * (c) 2024 Eduardo San Martin Morote
8
- * @license MIT
9
- */
10
- const isBrowser = typeof document !== "undefined";
11
- const noop = () => {
12
- };
13
- const isArray = Array.isArray;
14
- function isSameRouteRecord(a, b) {
15
- return (a.aliasOf || a) === (b.aliasOf || b);
16
- }
17
- function isSameRouteLocationParams(a, b) {
18
- if (Object.keys(a).length !== Object.keys(b).length)
19
- return false;
20
- for (const key in a) {
21
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
22
- return false;
23
- }
24
- return true;
25
- }
26
- function isSameRouteLocationParamsValue(a, b) {
27
- return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
28
- }
29
- function isEquivalentArray(a, b) {
30
- return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
31
- }
32
- var NavigationType;
33
- (function(NavigationType2) {
34
- NavigationType2["pop"] = "pop";
35
- NavigationType2["push"] = "push";
36
- })(NavigationType || (NavigationType = {}));
37
- var NavigationDirection;
38
- (function(NavigationDirection2) {
39
- NavigationDirection2["back"] = "back";
40
- NavigationDirection2["forward"] = "forward";
41
- NavigationDirection2["unknown"] = "";
42
- })(NavigationDirection || (NavigationDirection = {}));
43
- Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
44
- var NavigationFailureType;
45
- (function(NavigationFailureType2) {
46
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
47
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
48
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
49
- })(NavigationFailureType || (NavigationFailureType = {}));
50
- Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
51
- Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
52
- const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
53
- const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
54
- Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
55
- function useLink(props) {
56
- const router = inject(routerKey);
57
- const currentRoute = inject(routeLocationKey);
58
- const route = computed(() => router.resolve(unref(props.to)));
59
- const activeRecordIndex = computed(() => {
60
- const { matched } = route.value;
61
- const { length } = matched;
62
- const routeMatched = matched[length - 1];
63
- const currentMatched = currentRoute.matched;
64
- if (!routeMatched || !currentMatched.length)
65
- return -1;
66
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
67
- if (index > -1)
68
- return index;
69
- const parentRecordPath = getOriginalPath(matched[length - 2]);
70
- return (
71
- // we are dealing with nested routes
72
- length > 1 && // if the parent and matched route have the same path, this link is
73
- // referring to the empty child. Or we currently are on a different
74
- // child of the same parent
75
- getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
76
- currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
77
- );
78
- });
79
- const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
80
- const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
81
- function navigate(e = {}) {
82
- if (guardEvent(e)) {
83
- return router[unref(props.replace) ? "replace" : "push"](
84
- unref(props.to)
85
- // avoid uncaught errors are they are logged anyway
86
- ).catch(noop);
87
- }
88
- return Promise.resolve();
89
- }
90
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
91
- const instance = getCurrentInstance();
92
- if (instance) {
93
- const linkContextDevtools = {
94
- route: route.value,
95
- isActive: isActive.value,
96
- isExactActive: isExactActive.value
97
- };
98
- instance.__vrl_devtools = instance.__vrl_devtools || [];
99
- instance.__vrl_devtools.push(linkContextDevtools);
100
- watchEffect(() => {
101
- linkContextDevtools.route = route.value;
102
- linkContextDevtools.isActive = isActive.value;
103
- linkContextDevtools.isExactActive = isExactActive.value;
104
- }, { flush: "post" });
105
- }
106
- }
107
- return {
108
- route,
109
- href: computed(() => route.value.href),
110
- isActive,
111
- isExactActive,
112
- navigate
113
- };
114
- }
115
- const RouterLinkImpl = /* @__PURE__ */ defineComponent({
116
- name: "RouterLink",
117
- compatConfig: { MODE: 3 },
118
- props: {
119
- to: {
120
- type: [String, Object],
121
- required: true
122
- },
123
- replace: Boolean,
124
- activeClass: String,
125
- // inactiveClass: String,
126
- exactActiveClass: String,
127
- custom: Boolean,
128
- ariaCurrentValue: {
129
- type: String,
130
- default: "page"
131
- }
132
- },
133
- useLink,
134
- setup(props, { slots }) {
135
- const link = reactive(useLink(props));
136
- const { options } = inject(routerKey);
137
- const elClass = computed(() => ({
138
- [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
139
- // [getLinkClass(
140
- // props.inactiveClass,
141
- // options.linkInactiveClass,
142
- // 'router-link-inactive'
143
- // )]: !link.isExactActive,
144
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
145
- }));
146
- return () => {
147
- const children = slots.default && slots.default(link);
148
- return props.custom ? children : h("a", {
149
- "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
150
- href: link.href,
151
- // this would override user added attrs but Vue will still add
152
- // the listener, so we end up triggering both
153
- onClick: link.navigate,
154
- class: elClass.value
155
- }, children);
156
- };
157
- }
158
- });
159
- const RouterLink = RouterLinkImpl;
160
- function guardEvent(e) {
161
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
162
- return;
163
- if (e.defaultPrevented)
164
- return;
165
- if (e.button !== void 0 && e.button !== 0)
166
- return;
167
- if (e.currentTarget && e.currentTarget.getAttribute) {
168
- const target = e.currentTarget.getAttribute("target");
169
- if (/\b_blank\b/i.test(target))
170
- return;
171
- }
172
- if (e.preventDefault)
173
- e.preventDefault();
174
- return true;
175
- }
176
- function includesParams(outer, inner) {
177
- for (const key in inner) {
178
- const innerValue = inner[key];
179
- const outerValue = outer[key];
180
- if (typeof innerValue === "string") {
181
- if (innerValue !== outerValue)
182
- return false;
183
- } else {
184
- if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
185
- return false;
186
- }
187
- }
188
- return true;
189
- }
190
- function getOriginalPath(record) {
191
- return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
192
- }
193
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
194
6
  const BUTTON_TYPES = {
195
7
  PRIMARY: "primary",
196
8
  SECONDARY: "secondary",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "1.0.23",
4
+ "version": "1.0.24",
5
5
  "packageManager": "pnpm@8.9.2",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -39,13 +39,14 @@
39
39
  "module": "./dist/es/index.js",
40
40
  "dependencies": {
41
41
  "@popperjs/core": "2.11.8",
42
- "@tanstack/vue-virtual": "3.2.1",
42
+ "@tanstack/vue-virtual": "3.3.0",
43
43
  "dayjs": "1.11.10",
44
44
  "floating-vue": "5.2.2",
45
45
  "lodash-es": "4.17.21",
46
46
  "v-calendar": "3.1.2",
47
- "vue": "3.4.21",
47
+ "vue": "3.4.23",
48
48
  "vue-currency-input": "3.1.0",
49
+ "vue-router": "4.3.0",
49
50
  "vue-toastification": "2.0.0-rc.5"
50
51
  },
51
52
  "peerDependencies": {
@@ -57,13 +58,14 @@
57
58
  "v-calendar": "^3.1.2",
58
59
  "vue": "^3.4.21",
59
60
  "vue-currency-input": "^3.1.0",
61
+ "vue-router": "^4.3.0",
60
62
  "vue-toastification": "^2.0.0-rc.5"
61
63
  },
62
64
  "devDependencies": {
63
65
  "@babel/core": "^7.24.4",
64
66
  "@babel/preset-env": "^7.24.4",
65
- "@commitlint/cli": "^19.2.1",
66
- "@commitlint/config-conventional": "^19.1.0",
67
+ "@commitlint/cli": "^19.2.2",
68
+ "@commitlint/config-conventional": "^19.2.2",
67
69
  "@pequity/eslint-config": "^0.0.12",
68
70
  "@semantic-release/changelog": "^6.0.3",
69
71
  "@semantic-release/git": "^10.0.1",
@@ -85,7 +87,7 @@
85
87
  "@types/lodash-es": "^4.17.12",
86
88
  "@types/node": "^20.12.7",
87
89
  "@vitejs/plugin-vue": "^5.0.4",
88
- "@vue/compiler-sfc": "3.4.21",
90
+ "@vue/compiler-sfc": "3.4.23",
89
91
  "@vue/test-utils": "^2.4.5",
90
92
  "@vue/vue3-jest": "^29.2.6",
91
93
  "autoprefixer": "^10.4.19",
@@ -100,7 +102,7 @@
100
102
  "make-coverage-badge": "^1.2.0",
101
103
  "postcss": "^8.4.38",
102
104
  "prettier": "^3.2.5",
103
- "prettier-plugin-tailwindcss": "^0.5.13",
105
+ "prettier-plugin-tailwindcss": "^0.5.14",
104
106
  "resolve-tspaths": "^0.8.18",
105
107
  "rimraf": "^5.0.5",
106
108
  "sass": "^1.75.0",
@@ -110,7 +112,7 @@
110
112
  "tailwindcss": "^3.4.3",
111
113
  "ts-jest": "^29.1.2",
112
114
  "typescript": "5.4.5",
113
- "vite": "^5.2.8",
115
+ "vite": "^5.2.9",
114
116
  "vue-router": "^4.3.0",
115
117
  "vue-tsc": "2.0.13"
116
118
  }