@djcali570/component-lib 0.1.93 → 0.1.95
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 +3 -63
- package/dist/ContextMenu5.svelte +10 -14
- package/dist/ContextMenu5.svelte.d.ts +1 -0
- package/dist/DropDown5.svelte +24 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,5 @@
|
|
|
1
|
-
# Svelte library
|
|
1
|
+
# Svelte Component library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
0.1.95
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Creating a project
|
|
8
|
-
|
|
9
|
-
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
# create a new project in the current directory
|
|
13
|
-
npx sv create
|
|
14
|
-
|
|
15
|
-
# create a new project in my-app
|
|
16
|
-
npx sv create my-app
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
To recreate this project with the same configuration:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
# recreate this project
|
|
23
|
-
pnpm dlx sv create --template library --types ts --add prettier eslint sveltekit-adapter="adapter:node" devtools-json --install pnpm component-lib-restored
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Developing
|
|
27
|
-
|
|
28
|
-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
npm run dev
|
|
32
|
-
|
|
33
|
-
# or start the server and open the app in a new browser tab
|
|
34
|
-
npm run dev -- --open
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
38
|
-
|
|
39
|
-
## Building
|
|
40
|
-
|
|
41
|
-
To build your library:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
npm pack
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
To create a production version of your showcase app:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
npm run build
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can preview the production build with `npm run preview`.
|
|
54
|
-
|
|
55
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
56
|
-
|
|
57
|
-
## Publishing
|
|
58
|
-
|
|
59
|
-
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
60
|
-
|
|
61
|
-
To publish your library to [npm](https://www.npmjs.com):
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
npm publish
|
|
65
|
-
```
|
|
5
|
+
- Updated dropdown so onUpdate runs when dropdown is cleared
|
package/dist/ContextMenu5.svelte
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
colorScheme: partialColorScheme = {},
|
|
25
25
|
ariaLabel = 'Open context menu',
|
|
26
26
|
menuAlign = 'right',
|
|
27
|
-
open = $bindable()
|
|
27
|
+
open = $bindable(),
|
|
28
|
+
iconSize = '20px'
|
|
28
29
|
}: {
|
|
29
30
|
icon?: Snippet;
|
|
30
31
|
content: Snippet;
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
ariaLabel?: string;
|
|
33
34
|
menuAlign?: 'left' | 'right';
|
|
34
35
|
open?: boolean;
|
|
36
|
+
iconSize?: string;
|
|
35
37
|
} = $props();
|
|
36
38
|
|
|
37
39
|
// Default colors
|
|
@@ -124,6 +126,7 @@
|
|
|
124
126
|
--context5__IconBorderColor: {colorScheme.iconBorderColor};
|
|
125
127
|
--context5__IconColor: {colorScheme.iconColor};
|
|
126
128
|
--context5__IconFillColor: {colorScheme.iconFillColor};
|
|
129
|
+
--context5__IconSize: {iconSize};
|
|
127
130
|
"
|
|
128
131
|
>
|
|
129
132
|
<button
|
|
@@ -179,28 +182,21 @@ top:{position.y}px;
|
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
.context5__icon {
|
|
182
|
-
width:
|
|
183
|
-
height:
|
|
185
|
+
width: var(--context5__IconSize);
|
|
186
|
+
height: var(--context5__IconSize);
|
|
184
187
|
display: flex;
|
|
185
188
|
align-items: center;
|
|
186
189
|
justify-content: center;
|
|
187
190
|
flex-shrink: 0;
|
|
188
191
|
}
|
|
189
192
|
|
|
190
|
-
.context5__icon :global(*) {
|
|
191
|
-
width: 100% !important;
|
|
192
|
-
height: 100% !important;
|
|
193
|
-
display: block;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
193
|
.context5__btn {
|
|
197
|
-
width:
|
|
198
|
-
height:
|
|
194
|
+
width: var(--context5__IconSize);
|
|
195
|
+
height: var(--context5__IconSize);
|
|
199
196
|
padding: 0;
|
|
200
|
-
border-radius: 50%;
|
|
201
197
|
cursor: pointer;
|
|
202
|
-
background
|
|
203
|
-
border:
|
|
198
|
+
background: none;
|
|
199
|
+
border: none;
|
|
204
200
|
display: flex;
|
|
205
201
|
align-items: center;
|
|
206
202
|
justify-content: center;
|
|
@@ -7,6 +7,7 @@ type $$ComponentProps = {
|
|
|
7
7
|
ariaLabel?: string;
|
|
8
8
|
menuAlign?: 'left' | 'right';
|
|
9
9
|
open?: boolean;
|
|
10
|
+
iconSize?: string;
|
|
10
11
|
};
|
|
11
12
|
declare const ContextMenu5: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
12
13
|
type ContextMenu5 = ReturnType<typeof ContextMenu5>;
|
package/dist/DropDown5.svelte
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// Merge partial colorScheme with defaults
|
|
42
|
-
const colorScheme = { ...defaultColorScheme, ...partialColorScheme };
|
|
42
|
+
const colorScheme = $derived({ ...defaultColorScheme, ...partialColorScheme });
|
|
43
43
|
|
|
44
44
|
const id = generateRandomString();
|
|
45
45
|
let showDropdown = $state(false);
|
|
@@ -108,23 +108,37 @@
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
function selectItem(item: DropDownItem) {
|
|
111
|
+
// Set all bound values
|
|
112
|
+
value = item.value;
|
|
111
113
|
valueKey = item.id ?? '';
|
|
112
114
|
extraValue = item.extraValue ?? '';
|
|
113
|
-
|
|
115
|
+
|
|
116
|
+
// Notify parent
|
|
114
117
|
onUpdate(valueKey, value, extraValue);
|
|
118
|
+
|
|
119
|
+
// Close dropdown
|
|
115
120
|
showDropdown = false;
|
|
116
121
|
}
|
|
122
|
+
|
|
117
123
|
function validateInput() {
|
|
118
|
-
const matchedItem = dropdownItems.find(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
} else if (value !== matchedItem.value) {
|
|
125
|
-
// Set the inputText to the matched item's value if it's different
|
|
124
|
+
const matchedItem = dropdownItems.find(
|
|
125
|
+
(item) => item.value.toLowerCase() === value.toLowerCase()
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
if (matchedItem) {
|
|
129
|
+
// Valid match: sync values
|
|
126
130
|
value = matchedItem.value;
|
|
131
|
+
valueKey = matchedItem.id ?? '';
|
|
132
|
+
extraValue = matchedItem.extraValue ?? '';
|
|
133
|
+
} else {
|
|
134
|
+
// No match: clear all
|
|
135
|
+
value = '';
|
|
136
|
+
valueKey = '';
|
|
137
|
+
extraValue = '';
|
|
127
138
|
}
|
|
139
|
+
|
|
140
|
+
// Always notify parent of the current state
|
|
141
|
+
onUpdate(valueKey, value, extraValue);
|
|
128
142
|
}
|
|
129
143
|
</script>
|
|
130
144
|
|