hoci 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.
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
@@ -118,9 +118,14 @@ const selectionItemProps = defineHookProps({
118
118
  const useSelectionItem = defineHookComponent({
119
119
  props: selectionItemProps,
120
120
  setup(props, { slots }) {
121
+ const isActive = vue.inject(IsActiveSymbol, () => false);
122
+ const changeActive = vue.inject(ChangeActiveSymbol, () => {
123
+ });
121
124
  const parentLabel = core.resolveRef(vue.inject(ItemLabelSymbol));
122
125
  function render() {
123
- return vue.renderSlot(slots, "default", {}, () => {
126
+ return vue.renderSlot(slots, "default", {
127
+ active: isActive(props.value)
128
+ }, () => {
124
129
  var _a;
125
130
  let label = (_a = props.label) != null ? _a : parentLabel.value;
126
131
  if (label) {
@@ -150,9 +155,6 @@ const useSelectionItem = defineHookComponent({
150
155
  );
151
156
  vue.onDeactivated(() => remove());
152
157
  }
153
- const isActive = vue.inject(IsActiveSymbol, () => false);
154
- const changeActive = vue.inject(ChangeActiveSymbol, () => {
155
- });
156
158
  const activeClass = vue.computed(
157
159
  () => {
158
160
  var _a, _b;
@@ -392,7 +394,9 @@ const useSelectionList = defineHookComponent({
392
394
  return props.multiple ? children : children[0];
393
395
  }
394
396
  function render() {
395
- return vue.h(props.tag, {}, vue.renderSlot(slots, "default", {}));
397
+ return vue.h(props.tag, {}, vue.renderSlot(slots, "default", {
398
+ isActive
399
+ }));
396
400
  }
397
401
  return {
398
402
  options,
@@ -483,12 +487,12 @@ const useSwitch = defineHookComponent({
483
487
  }
484
488
  });
485
489
  const HiSwitch = vue.defineComponent({
486
- name: "ISwitch",
490
+ name: "HiSwitch",
487
491
  props: switchProps,
488
492
  emits: switchEmits,
489
493
  setup(props, context) {
490
494
  const { slots } = context;
491
- const { switchClass, toggle } = useSwitch(props, context);
495
+ const { switchClass, toggle, modelValue } = useSwitch(props, context);
492
496
  return () => {
493
497
  return vue.h(
494
498
  props.tag,
@@ -496,7 +500,9 @@ const HiSwitch = vue.defineComponent({
496
500
  class: switchClass.value,
497
501
  [`on${vue.capitalize(props.activateEvent)}`]: toggle
498
502
  },
499
- vue.renderSlot(slots, "default")
503
+ vue.renderSlot(slots, "default", {
504
+ active: modelValue.value
505
+ })
500
506
  );
501
507
  };
502
508
  }