not-bulma 2.0.15 → 2.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-bulma",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -1,6 +1,4 @@
1
1
  <script>
2
- import { run } from 'svelte/legacy';
3
-
4
2
  import UIBlock from "./ui.block.svelte";
5
3
  /**
6
4
  * @typedef {Object} Props
@@ -10,14 +8,15 @@
10
8
  */
11
9
 
12
10
  /** @type {Props} */
13
- let { id = $bindable(""), classes = "", children } = $props();
11
+ let { id, class: classes = "", children } = $props();
14
12
 
15
13
  let classesInner;
16
- run(() => {
14
+
15
+ $effect(() => {
17
16
  classesInner = `block-inner-vertical ${classes}`;
18
17
  });
19
18
  </script>
20
19
 
21
- <UIBlock bind:id bind:classes={classesInner}>
20
+ <UIBlock {id} class={classesInner}>
22
21
  {@render children?.()}
23
22
  </UIBlock>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,15 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- {id}
20
- class="block {classes}"
21
- onclick={bubble('click')}
22
- onkeyup={() => dispatch("click")}
23
- role="button"
24
- >
21
+ <div {id} class="block {classes}" {role} {onclick} {onkeyup} {onkeydown}>
25
22
  {@render children?.()}
26
23
  </div>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,15 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- {id}
20
- class="box {classes} "
21
- onclick={bubble('click')}
22
- onkeyup={() => dispatch("click")}
23
- role="button"
24
- >
21
+ <div {id} class="box {classes} " {onclick} {onkeyup} {onkeydown} {role}>
25
22
  {@render children?.()}
26
23
  </div>
@@ -1,9 +1,4 @@
1
1
  <script>
2
- import { createBubbler } from 'svelte/legacy';
3
-
4
- const bubble = createBubbler();
5
- import { createEventDispatcher } from "svelte";
6
- const dispatch = createEventDispatcher();
7
2
  /**
8
3
  * @typedef {Object} Props
9
4
  * @property {string} [id]
@@ -12,16 +7,17 @@
12
7
  */
13
8
 
14
9
  /** @type {Props} */
15
- let { id = "", classes = "", children } = $props();
10
+ let {
11
+ id = "",
12
+ class: classes = "",
13
+ role = "button",
14
+ onclick,
15
+ onkeyup,
16
+ onkeydown,
17
+ children,
18
+ } = $props();
16
19
  </script>
17
20
 
18
- <div
19
- role="button"
20
- tabindex="0"
21
- {id}
22
- class="content {classes}"
23
- onclick={bubble('click')}
24
- onkeyup={() => dispatch("click")}
25
- >
21
+ <div {id} class="content {classes} " {onclick} {onkeyup} {onkeydown} {role}>
26
22
  {@render children?.()}
27
23
  </div>
@@ -34,6 +34,11 @@
34
34
  descriptionComponentProps = {},
35
35
  imageComponent,
36
36
  imageComponentProps = {},
37
+ onclick = () => {},
38
+ onclickContent = () => {},
39
+ onclickDescription = () => {},
40
+ onclickImage = () => {},
41
+ onclickTitle = () => {},
37
42
  } = $props();
38
43
  </script>
39
44
 
@@ -52,15 +57,15 @@
52
57
  listActions={actions}
53
58
  listLinks={links}
54
59
  commonClasses={itemClasses}
55
- bind:value={items[index]}
60
+ bindvalue={items[index]}
56
61
  {index}
57
62
  first={index === 0}
58
63
  last={index === items.length - 1}
59
- on:click
60
- on:clickContent
61
- on:clickDescription
62
- on:clickImage
63
- on:clickTitle
64
+ {onclick}
65
+ {onclickContent}
66
+ {onclickDescription}
67
+ {onclickImage}
68
+ {onclickTitle}
64
69
  />
65
70
  {/each}
66
71
  {/if}
@@ -1,20 +1,12 @@
1
1
  <script>
2
- import { run, preventDefault } from 'svelte/legacy';
2
+ import { preventDefault } from "svelte/legacy";
3
3
 
4
- import { createEventDispatcher, onMount } from "svelte";
5
- const dispatch = createEventDispatcher();
4
+ import { onMount } from "svelte";
6
5
 
7
6
  import UITitle from "../various/ui.title.svelte";
8
7
  import UIButtons from "../button/ui.buttons.svelte";
9
8
  import UILinks from "../link/ui.links.svelte";
10
9
 
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
10
  /**
19
11
  * @typedef {Object} Props
20
12
  * @property {any} title
@@ -58,22 +50,27 @@
58
50
  descriptionComponent,
59
51
  descriptionComponentProps = {},
60
52
  imageComponent,
61
- imageComponentProps = {}
53
+ imageComponentProps = {},
54
+ onclick = () => {},
55
+ onclickImage = () => {},
56
+ onclickContent = () => {},
57
+ onclickTitle = () => {},
58
+ onclickDescription = () => {},
62
59
  } = $props();
63
60
 
64
61
  function onClick() {
65
- dispatch("click", value);
62
+ onclick(value);
66
63
  }
67
64
 
68
65
  let allActions = $state([]);
69
- run(() => {
66
+ $effect(() => {
70
67
  allActions = [...actions, ...listActions].map((btn) => {
71
68
  return { ...btn, action: () => btn.action(value) };
72
69
  });
73
70
  });
74
71
 
75
72
  let allLinks = $state([]);
76
- run(() => {
73
+ $effect(() => {
77
74
  allLinks = [...links, ...listLinks];
78
75
  });
79
76
  </script>
@@ -102,27 +99,21 @@
102
99
  onkeyup={preventDefault((e) => {
103
100
  if (e && e.key == "Enter") {
104
101
  onClick();
105
- dispatch("clickImage", value);
102
+ onclickImage(value);
106
103
  }
107
104
  })}
108
105
  onclick={preventDefault(() => {
109
106
  onClick();
110
- dispatch("clickImage", value);
107
+ onclickImage(value);
111
108
  })}
112
109
  >
113
110
  {#if imageComponent}
114
111
  {#if typeof image === "string"}
115
112
  {@const SvelteComponent = imageComponent}
116
- <SvelteComponent
117
- value={image}
118
- {...imageComponentProps}
119
- />
113
+ <SvelteComponent value={image} {...imageComponentProps} />
120
114
  {:else}
121
115
  {@const SvelteComponent_1 = imageComponent}
122
- <SvelteComponent_1
123
- {...image}
124
- {...imageComponentProps}
125
- />
116
+ <SvelteComponent_1 {...image} {...imageComponentProps} />
126
117
  {/if}
127
118
  {:else}
128
119
  <figure class="image is-64x64">
@@ -137,12 +128,12 @@
137
128
  class="list-item-content"
138
129
  onclick={preventDefault(() => {
139
130
  onClick();
140
- dispatch("clickContent", value);
131
+ onclickContent(value);
141
132
  })}
142
133
  onkeyup={preventDefault((e) => {
143
134
  if (e && e.key == "Enter") {
144
135
  onClick();
145
- dispatch("clickContent", value);
136
+ onclickContent(value);
146
137
  }
147
138
  })}
148
139
  >
@@ -154,12 +145,12 @@
154
145
  onkeyup={preventDefault((e) => {
155
146
  if (e && e.key == "Enter") {
156
147
  onClick();
157
- dispatch("clickTitle", value);
148
+ onclickTitle(value);
158
149
  }
159
150
  })}
160
151
  onclick={preventDefault(() => {
161
152
  onClick();
162
- dispatch("clickTitle", value);
153
+ onclickTitle(value);
163
154
  })}
164
155
  >
165
156
  {#if titleComponent}
@@ -168,14 +159,14 @@
168
159
  <SvelteComponent_2
169
160
  {title}
170
161
  {...titleComponentProps}
171
- on:change
162
+ {onchange}
172
163
  />
173
164
  {:else}
174
165
  {@const SvelteComponent_3 = titleComponent}
175
166
  <SvelteComponent_3
176
167
  {...title}
177
168
  {...titleComponentProps}
178
- on:change
169
+ {onchange}
179
170
  />
180
171
  {/if}
181
172
  {:else}
@@ -190,13 +181,13 @@
190
181
  onkeyup={preventDefault((e) => {
191
182
  if (e && e.key == "Enter") {
192
183
  onClick();
193
- dispatch("clickDescription", value);
184
+ onclickDescription(value);
194
185
  }
195
186
  })}
196
187
  class="list-item-description"
197
188
  onclick={preventDefault(() => {
198
189
  onClick();
199
- dispatch("clickDescription", value);
190
+ onclickDescription(value);
200
191
  })}
201
192
  >
202
193
  {#if descriptionComponent}
@@ -205,16 +196,16 @@
205
196
  <SvelteComponent_4
206
197
  value={description}
207
198
  {...descriptionComponentProps}
208
- on:change
209
- on:click
199
+ {onchange}
200
+ {onclick}
210
201
  />
211
202
  {:else}
212
203
  {@const SvelteComponent_5 = descriptionComponent}
213
204
  <SvelteComponent_5
214
205
  {...description}
215
206
  {...descriptionComponentProps}
216
- on:change
217
- on:click
207
+ {onchange}
208
+ {onclick}
218
209
  />
219
210
  {/if}
220
211
  {:else}
@@ -1,6 +1,6 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
@@ -8,16 +8,6 @@
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
  import UIButtonsSwitchers from "../button/ui.buttons.switchers.svelte";
10
10
 
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
11
  /**
22
12
  * @typedef {Object} Props
23
13
  * @property {string} [fieldname]
@@ -82,11 +72,12 @@ value: variantId
82
72
  listComponentProps = {},
83
73
  actionsList = ["selectAll", "deselectAll"],
84
74
  sublimeValue = (value) => {
85
- return {
86
- groupId: value.group,
87
- valueId: value.id,
88
- };
89
- }
75
+ return {
76
+ groupId: value.group,
77
+ valueId: value.id,
78
+ };
79
+ },
80
+ onchange = () => {},
90
81
  } = $props();
91
82
  //
92
83
 
@@ -187,7 +178,7 @@ value: variantId
187
178
 
188
179
  function triggerChange() {
189
180
  value = getSelectedItems();
190
- dispatch("change", {
181
+ onchange({
191
182
  fieldname,
192
183
  value,
193
184
  });
@@ -200,7 +191,7 @@ value: variantId
200
191
 
201
192
  <SvelteComponent
202
193
  {...listComponentProps}
203
- bind:items={variants}
194
+ items={variants}
204
195
  {titleComponent}
205
196
  {titleComponentProps}
206
197
  {descriptionComponent}
@@ -1,26 +1,12 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
7
7
  import UIImage from "../image/ui.image.svelte";
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
 
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
10
  /**
25
11
  * @typedef {Object} Props
26
12
  * @property {string} [fieldname]
@@ -72,22 +58,23 @@ value:object
72
58
  listComponentProps = {},
73
59
  sublimeValue = (value) => value.id,
74
60
  getItem = ({ valueId }) => {
75
- return variants.find((btnVal) => btnVal.value.id === valueId);
76
- },
61
+ return variants.find((btnVal) => btnVal.value.id === valueId);
62
+ },
77
63
  getItemValue = ({ valueId }) => {
78
- return getItem({ valueId }).value;
79
- },
64
+ return getItem({ valueId }).value;
65
+ },
80
66
  getDefaultItemSublime = () => {
81
- return variants[0].id;
82
- },
67
+ return variants[0].id;
68
+ },
83
69
  uiOn = (item) => {
84
- item.color = "success";
85
- item.outlined = false;
86
- },
70
+ item.color = "success";
71
+ item.outlined = false;
72
+ },
87
73
  uiOff = (item) => {
88
- item.color = false;
89
- item.outlined = true;
90
- }
74
+ item.color = false;
75
+ item.outlined = true;
76
+ },
77
+ onchange = () => {},
91
78
  } = $props();
92
79
 
93
80
  onMount(() => {
@@ -172,7 +159,7 @@ value:object
172
159
  //
173
160
  updateValue();
174
161
  //
175
- dispatch("change", {
162
+ onchange({
176
163
  field: fieldname,
177
164
  value,
178
165
  });
@@ -217,7 +204,7 @@ value:object
217
204
 
218
205
  <SvelteComponent
219
206
  {...listComponentProps}
220
- bind:items={variants}
207
+ items={variants}
221
208
  {titleComponent}
222
209
  {titleComponentProps}
223
210
  {descriptionComponent}
@@ -1,23 +1,12 @@
1
1
  <script>
2
- import { onMount, createEventDispatcher } from "svelte";
3
- const dispatch = createEventDispatcher();
2
+ import { onMount } from "svelte";
3
+
4
4
  //
5
5
  import UIList from "./ui.list.svelte";
6
6
  import UITitle from "../various/ui.title.svelte";
7
7
  import UIImage from "../image/ui.image.svelte";
8
8
  import UIButtons from "../button/ui.buttons.svelte";
9
9
 
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
10
  /**
22
11
  * @typedef {Object} Props
23
12
  * @property {string} [fieldname]
@@ -91,33 +80,36 @@ value: variantId
91
80
  listComponent = UIList,
92
81
  listComponentProps = {},
93
82
  sublimeValue = (value) => {
94
- return {
95
- groupId: value.group,
96
- valueId: value.id,
97
- };
98
- },
83
+ return {
84
+ groupId: value.group,
85
+ valueId: value.id,
86
+ };
87
+ },
99
88
  getItem = ({ groupId, valueId }) => {
100
- return variants
101
- .find((group) => group.id === groupId)
102
- .description.values.find((btnVal) => btnVal.value.id === valueId);
103
- },
89
+ return variants
90
+ .find((group) => group.id === groupId)
91
+ .description.values.find(
92
+ (btnVal) => btnVal.value.id === valueId
93
+ );
94
+ },
104
95
  getItemValue = ({ groupId, valueId }) => {
105
- return getItem({ groupId, valueId }).value;
106
- },
96
+ return getItem({ groupId, valueId }).value;
97
+ },
107
98
  getDefaultItemSublime = () => {
108
- return {
109
- groupId: variants[0].id,
110
- valueId: variants[0].description.values[0].value.id,
111
- };
112
- },
99
+ return {
100
+ groupId: variants[0].id,
101
+ valueId: variants[0].description.values[0].value.id,
102
+ };
103
+ },
113
104
  uiOn = (item) => {
114
- item.color = "success";
115
- item.outlined = false;
116
- },
105
+ item.color = "success";
106
+ item.outlined = false;
107
+ },
117
108
  uiOff = (item) => {
118
- item.color = false;
119
- item.outlined = false;
120
- }
109
+ item.color = false;
110
+ item.outlined = false;
111
+ },
112
+ onchange = () => {},
121
113
  } = $props();
122
114
 
123
115
  onMount(() => {
@@ -236,12 +228,12 @@ value: variantId
236
228
  //
237
229
  function toggle(detail) {
238
230
  let ui = updateSelected(detail);
239
- console.log("image value", value, ui);
231
+
240
232
  updateUI(ui);
241
233
  //
242
234
  updateValue();
243
235
  //
244
- dispatch("change", {
236
+ onchange({
245
237
  field: fieldname,
246
238
  value,
247
239
  });
@@ -313,7 +305,7 @@ value: variantId
313
305
 
314
306
  <SvelteComponent
315
307
  {...listComponentProps}
316
- bind:items={variants}
308
+ items={variants}
317
309
  {titleComponent}
318
310
  {titleComponentProps}
319
311
  {descriptionComponent}
@@ -4,13 +4,8 @@
4
4
  import UIListBlock from "./ui.list.block.svelte";
5
5
  import UITitle from "../various/ui.title.svelte";
6
6
 
7
-
8
-
9
-
10
7
  //customization
11
-
12
-
13
-
8
+
14
9
  /**
15
10
  * @typedef {Object} Props
16
11
  * @property {string} [classes]
@@ -58,7 +53,13 @@
58
53
  descriptionComponent,
59
54
  descriptionComponentProps = {},
60
55
  imageComponent,
61
- imageComponentProps = {}
56
+ imageComponentProps = {},
57
+ onchange = () => {},
58
+ onclick = () => {},
59
+ onclickContent = () => {},
60
+ onclickDescription = () => {},
61
+ onclickImage = () => {},
62
+ onclickTitle = () => {},
62
63
  } = $props();
63
64
  </script>
64
65
 
@@ -87,17 +88,15 @@
87
88
  {imageComponentProps}
88
89
  {actions}
89
90
  {links}
90
- on:change
91
- on:click
92
- on:clickContent
93
- on:clickDescription
94
- on:clickImage
95
- on:clickTitle
91
+ {onchange}
92
+ {onclick}
93
+ {onclickContent}
94
+ {onclickDescription}
95
+ {onclickImage}
96
+ {onclickTitle}
96
97
  />
97
98
  </div>
98
99
  {:else}
99
100
  {@const SvelteComponent = emptyListPlaceholderComponent}
100
- <SvelteComponent
101
- {...emptyListPlaceholderComponentProps}
102
- />
101
+ <SvelteComponent {...emptyListPlaceholderComponentProps} />
103
102
  {/if}