hoci 0.0.8 → 0.0.10
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/LICENSE +21 -21
- package/dist/index.cjs +28 -36
- package/dist/index.d.ts +616 -618
- package/dist/index.esm.js +28 -36
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Chizuki
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Chizuki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -3,25 +3,6 @@
|
|
|
3
3
|
const core = require('@vueuse/core');
|
|
4
4
|
const vue = require('vue');
|
|
5
5
|
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __defProps = Object.defineProperties;
|
|
8
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
6
|
function defineHookProps(props) {
|
|
26
7
|
return props;
|
|
27
8
|
}
|
|
@@ -34,44 +15,49 @@ function defineHookComponent(options) {
|
|
|
34
15
|
isFunction(props) ? core.reactiveComputed(() => props()) : props,
|
|
35
16
|
options.props
|
|
36
17
|
);
|
|
37
|
-
|
|
38
|
-
return __spreadProps(__spreadValues({}, rs), { $props: p });
|
|
18
|
+
return options.setup(p, context);
|
|
39
19
|
};
|
|
40
20
|
}
|
|
41
21
|
function isFunction(value) {
|
|
42
22
|
return typeof value === "function";
|
|
43
23
|
}
|
|
24
|
+
function isConstructor(value) {
|
|
25
|
+
return isFunction(value) && value.prototype !== void 0;
|
|
26
|
+
}
|
|
44
27
|
function withDefaults(props, propsOptions) {
|
|
45
28
|
if (Array.isArray(propsOptions)) {
|
|
46
29
|
return props;
|
|
47
30
|
}
|
|
48
|
-
const
|
|
31
|
+
const newProps = props;
|
|
49
32
|
const options = propsOptions;
|
|
50
33
|
for (const key in options) {
|
|
51
34
|
const k = key;
|
|
52
35
|
const opt = options[k];
|
|
36
|
+
if (newProps[k] !== void 0) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
53
39
|
if (opt === null) {
|
|
54
40
|
continue;
|
|
55
41
|
}
|
|
56
|
-
if (
|
|
42
|
+
if (isConstructor(opt)) {
|
|
57
43
|
if (isExtends(opt, Boolean)) {
|
|
58
|
-
|
|
44
|
+
newProps[key] = false;
|
|
59
45
|
}
|
|
60
46
|
continue;
|
|
61
47
|
}
|
|
62
48
|
if (Array.isArray(opt)) {
|
|
63
49
|
if (opt.some((e) => isExtends(e, Boolean))) {
|
|
64
|
-
|
|
50
|
+
newProps[key] = false;
|
|
65
51
|
}
|
|
66
52
|
continue;
|
|
67
53
|
}
|
|
68
54
|
if (isFunction(opt.default)) {
|
|
69
|
-
|
|
55
|
+
newProps[key] = opt.default(props);
|
|
70
56
|
} else if (opt.default !== void 0) {
|
|
71
|
-
|
|
57
|
+
newProps[key] = opt.default;
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
|
-
return
|
|
60
|
+
return newProps;
|
|
75
61
|
}
|
|
76
62
|
function isExtends(types, value) {
|
|
77
63
|
if (Array.isArray(types)) {
|
|
@@ -132,9 +118,14 @@ const selectionItemProps = defineHookProps({
|
|
|
132
118
|
const useSelectionItem = defineHookComponent({
|
|
133
119
|
props: selectionItemProps,
|
|
134
120
|
setup(props, { slots }) {
|
|
121
|
+
const isActive = vue.inject(IsActiveSymbol, () => false);
|
|
122
|
+
const changeActive = vue.inject(ChangeActiveSymbol, () => {
|
|
123
|
+
});
|
|
135
124
|
const parentLabel = core.resolveRef(vue.inject(ItemLabelSymbol));
|
|
136
125
|
function render() {
|
|
137
|
-
return vue.renderSlot(slots, "default", {
|
|
126
|
+
return vue.renderSlot(slots, "default", {
|
|
127
|
+
active: isActive(props.value)
|
|
128
|
+
}, () => {
|
|
138
129
|
var _a;
|
|
139
130
|
let label = (_a = props.label) != null ? _a : parentLabel.value;
|
|
140
131
|
if (label) {
|
|
@@ -164,9 +155,6 @@ const useSelectionItem = defineHookComponent({
|
|
|
164
155
|
);
|
|
165
156
|
vue.onDeactivated(() => remove());
|
|
166
157
|
}
|
|
167
|
-
const isActive = vue.inject(IsActiveSymbol, () => false);
|
|
168
|
-
const changeActive = vue.inject(ChangeActiveSymbol, () => {
|
|
169
|
-
});
|
|
170
158
|
const activeClass = vue.computed(
|
|
171
159
|
() => {
|
|
172
160
|
var _a, _b;
|
|
@@ -406,7 +394,9 @@ const useSelectionList = defineHookComponent({
|
|
|
406
394
|
return props.multiple ? children : children[0];
|
|
407
395
|
}
|
|
408
396
|
function render() {
|
|
409
|
-
return vue.h(props.tag, {}, vue.renderSlot(slots, "default", {
|
|
397
|
+
return vue.h(props.tag, {}, vue.renderSlot(slots, "default", {
|
|
398
|
+
isActive
|
|
399
|
+
}));
|
|
410
400
|
}
|
|
411
401
|
return {
|
|
412
402
|
options,
|
|
@@ -497,12 +487,12 @@ const useSwitch = defineHookComponent({
|
|
|
497
487
|
}
|
|
498
488
|
});
|
|
499
489
|
const HiSwitch = vue.defineComponent({
|
|
500
|
-
name: "
|
|
490
|
+
name: "HiSwitch",
|
|
501
491
|
props: switchProps,
|
|
502
492
|
emits: switchEmits,
|
|
503
493
|
setup(props, context) {
|
|
504
494
|
const { slots } = context;
|
|
505
|
-
const { switchClass, toggle } = useSwitch(props, context);
|
|
495
|
+
const { switchClass, toggle, modelValue } = useSwitch(props, context);
|
|
506
496
|
return () => {
|
|
507
497
|
return vue.h(
|
|
508
498
|
props.tag,
|
|
@@ -510,7 +500,9 @@ const HiSwitch = vue.defineComponent({
|
|
|
510
500
|
class: switchClass.value,
|
|
511
501
|
[`on${vue.capitalize(props.activateEvent)}`]: toggle
|
|
512
502
|
},
|
|
513
|
-
vue.renderSlot(slots, "default"
|
|
503
|
+
vue.renderSlot(slots, "default", {
|
|
504
|
+
active: modelValue.value
|
|
505
|
+
})
|
|
514
506
|
);
|
|
515
507
|
};
|
|
516
508
|
}
|