@hardanonymous/marquee-selector 0.0.4 โ†’ 0.0.5

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 (2) hide show
  1. package/README.md +31 -32
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -34,25 +34,25 @@ yarn add @hardanonymous/marquee-selector
34
34
  ## ๐Ÿš€ ๅฟซ้€Ÿ้–‹ๅง‹
35
35
 
36
36
  ```typescript
37
- import { MarqueeSelector } from '@hardanonymous/marquee-selector';
38
- import '@hardanonymous/marquee-selector/style.css';
37
+ import { MarqueeSelector } from "@hardanonymous/marquee-selector";
38
+ import "@hardanonymous/marquee-selector/style.css";
39
39
 
40
40
  // 1. ๅˆๅง‹ๅŒ–
41
41
  const marquee = new MarqueeSelector({
42
- container: document.body
42
+ container: document.body,
43
43
  });
44
44
 
45
45
  // 2. ๆทปๅŠ ็›ฎๆจ™้…็ฝฎ
46
46
  marquee.addTarget({
47
- selector: '.item',
47
+ selector: ".item",
48
48
  onSelectionChange: (elements) => {
49
- console.log('้ธๅ–่ฎŠๅŒ–:', elements);
50
- elements.forEach(el => el.classList.add('selected'));
49
+ console.log("้ธๅ–่ฎŠๅŒ–:", elements);
50
+ elements.forEach((el) => el.classList.add("selected"));
51
51
  },
52
52
  onClearClick: (elements) => {
53
- console.log('ๆธ…้™ค้ธๅ–');
54
- elements.forEach(el => el.classList.remove('selected'));
55
- }
53
+ console.log("ๆธ…้™ค้ธๅ–");
54
+ elements.forEach((el) => el.classList.remove("selected"));
55
+ },
56
56
  });
57
57
 
58
58
  // 3. ๅ•Ÿ็”จๆก†้ธ
@@ -65,9 +65,9 @@ marquee.enable();
65
65
 
66
66
  ```vue
67
67
  <script setup lang="ts">
68
- import { ref, onMounted, onUnmounted } from 'vue';
69
- import { MarqueeSelector } from '@hardanonymous/marquee-selector';
70
- import '@hardanonymous/marquee-selector/style.css';
68
+ import { ref, onMounted, onUnmounted } from "vue";
69
+ import { MarqueeSelector } from "@hardanonymous/marquee-selector";
70
+ import "@hardanonymous/marquee-selector/style.css";
71
71
 
72
72
  const containerRef = ref<HTMLElement>();
73
73
  const selectedIds = ref<number[]>([]);
@@ -76,16 +76,16 @@ let marquee: MarqueeSelector | null = null;
76
76
  onMounted(() => {
77
77
  if (containerRef.value) {
78
78
  marquee = new MarqueeSelector({
79
- container: containerRef.value
79
+ container: containerRef.value,
80
80
  });
81
81
 
82
82
  marquee.addTarget({
83
- selector: '.item',
83
+ selector: ".item",
84
84
  onSelectionChange: (elements) => {
85
- selectedIds.value = elements.map(el =>
86
- Number(el.getAttribute('data-id'))
85
+ selectedIds.value = elements.map((el) =>
86
+ Number(el.getAttribute("data-id"))
87
87
  );
88
- }
88
+ },
89
89
  });
90
90
 
91
91
  marquee.enable();
@@ -99,8 +99,8 @@ onUnmounted(() => {
99
99
 
100
100
  <template>
101
101
  <div ref="containerRef">
102
- <div
103
- v-for="item in items"
102
+ <div
103
+ v-for="item in items"
104
104
  :key="item.id"
105
105
  :data-id="item.id"
106
106
  class="item"
@@ -115,9 +115,9 @@ onUnmounted(() => {
115
115
  ### React
116
116
 
117
117
  ```tsx
118
- import { useEffect, useRef, useState } from 'react';
119
- import { MarqueeSelector } from '@hardanonymous/marquee-selector';
120
- import '@hardanonymous/marquee-selector/style.css';
118
+ import { useEffect, useRef, useState } from "react";
119
+ import { MarqueeSelector } from "@hardanonymous/marquee-selector";
120
+ import "@hardanonymous/marquee-selector/style.css";
121
121
 
122
122
  function App() {
123
123
  const containerRef = useRef<HTMLDivElement>(null);
@@ -127,17 +127,15 @@ function App() {
127
127
  if (!containerRef.current) return;
128
128
 
129
129
  const marquee = new MarqueeSelector({
130
- container: containerRef.current
130
+ container: containerRef.current,
131
131
  });
132
132
 
133
133
  marquee.addTarget({
134
- selector: '.item',
134
+ selector: ".item",
135
135
  onSelectionChange: (elements) => {
136
- const ids = elements.map(el =>
137
- Number(el.getAttribute('data-id'))
138
- );
136
+ const ids = elements.map((el) => Number(el.getAttribute("data-id")));
139
137
  setSelectedIds(ids);
140
- }
138
+ },
141
139
  });
142
140
 
143
141
  marquee.enable();
@@ -147,11 +145,11 @@ function App() {
147
145
 
148
146
  return (
149
147
  <div ref={containerRef}>
150
- {items.map(item => (
148
+ {items.map((item) => (
151
149
  <div
152
150
  key={item.id}
153
151
  data-id={item.id}
154
- className={`item ${selectedIds.includes(item.id) ? 'selected' : ''}`}
152
+ className={`item ${selectedIds.includes(item.id) ? "selected" : ""}`}
155
153
  >
156
154
  {item.name}
157
155
  </div>
@@ -164,6 +162,7 @@ function App() {
164
162
  ## ๐Ÿ“– ๅฎŒๆ•ดๆ–‡ๆช”
165
163
 
166
164
  ๆŸฅ็œ‹ [ๅฎŒๆ•ดๆ–‡ๆช”](./docs/README.md) ไบ†่งฃ๏ผš
165
+
167
166
  - ่ฉณ็ดฐ็š„ API ๅƒ่€ƒ
168
167
  - ้€ฒ้šŽไฝฟ็”จๆ–นๅผ
169
168
  - ่ˆ‡ๆ‹–ๆ‹ฝๅŠŸ่ƒฝๆ•ดๅˆ
@@ -195,6 +194,6 @@ MIT License - ่ฉณ่ฆ‹ [LICENSE](./LICENSE) ๆ–‡ไปถ
195
194
 
196
195
  ## ๐Ÿ”— ็›ธ้—œ้€ฃ็ต
197
196
 
198
- - [GitHub Repository](https://github.com/hardanonymous/marquee-selector)
197
+ - [GitHub Repository](https://github.com/hard25670559/marquee-selection)
199
198
  - [npm Package](https://www.npmjs.com/package/@hardanonymous/marquee-selector)
200
- - [ๅ•้กŒๅ›žๅ ฑ](https://github.com/hardanonymous/marquee-selector/issues)
199
+ - [ๅ•้กŒๅ›žๅ ฑ](https://github.com/hard25670559/marquee-selection/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardanonymous/marquee-selector",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A framework-agnostic marquee selection library with drag & text selection protection",
5
5
  "author": "hardanonymous <hard25670559@gmail.com>",
6
6
  "publishConfig": {