not-bulma 1.2.16 → 1.2.18

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": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -6,6 +6,7 @@
6
6
  export let size = 64;
7
7
  export let contained = true;
8
8
  export let covered = true;
9
+ export let classes = "";
9
10
 
10
11
  $: sizeStyle = isNaN(size) ? `is-${size}` : `is-${size}x${size}`;
11
12
  $: containedStyle = contained ? "is-contained" : "";
@@ -14,13 +15,15 @@
14
15
 
15
16
  {#if urlFull}
16
17
  <a href={urlFull} alt={title} on:click>
17
- <figure class="image {sizeStyle} {containedStyle} {coveredStyle}">
18
+ <figure
19
+ class="image {sizeStyle} {containedStyle} {coveredStyle} {classes}"
20
+ >
18
21
  <img class="" alt={title} src={url} crossOrigin={cors} />
19
22
  </figure>
20
23
  </a>
21
24
  {:else}
22
25
  <figure
23
- class="image {sizeStyle} {containedStyle} {coveredStyle}"
26
+ class="image {sizeStyle} {containedStyle} {coveredStyle} {classes}"
24
27
  on:click
25
28
  on:keyup
26
29
  role="button"
@@ -1,67 +1,68 @@
1
1
  <script>
2
- import {onMount} from 'svelte';
3
- import notCommon from '../../frame/common';
4
- //if we want to address this indicator
5
- export let id = 'tagId';
2
+ import { onMount } from "svelte";
3
+ import notCommon from "../../frame/common";
4
+ //if we want to address this indicator
5
+ export let id = "tagId";
6
6
 
7
- export let state = 'light';
8
- export let size = 'normal';
9
- export let labels = {
10
- black: 'black',
11
- dark: 'dark',
12
- light: 'light',
13
- white: 'white',
14
- primary: 'primary',
15
- link: 'link',
16
- info: 'info',
17
- success: 'success',
18
- warning: 'warning',
19
- danger: 'danger'
20
- };
21
- export let classes = 'mx-1';
7
+ export let state = "light";
8
+ export let size = "normal";
9
+ export let labels = {
10
+ black: "black",
11
+ dark: "dark",
12
+ light: "light",
13
+ white: "white",
14
+ primary: "primary",
15
+ link: "link",
16
+ info: "info",
17
+ success: "success",
18
+ warning: "warning",
19
+ danger: "danger",
20
+ };
21
+ export let classes = "mx-1";
22
22
 
23
- export let padding = 'normal';
24
- export let bold = false;
23
+ export let padding = "normal";
24
+ export let bold = false;
25
25
 
26
- export let right = false;
27
- export let left = false;
28
- export let top = false;
29
- export let bottom = false;
26
+ export let right = false;
27
+ export let left = false;
28
+ export let top = false;
29
+ export let bottom = false;
30
30
 
31
- let sided = false;
32
- $: sided = right || left || top || bottom;
31
+ let sided = false;
32
+ $: sided = right || left || top || bottom;
33
33
 
34
+ export let events = {}; //events to react on
35
+ //register event handlers
36
+ export let register = notCommon.registerWidgetEvents.bind(notCommon);
37
+ //
38
+ export let onUpdate = (data) => {
39
+ if (Object.hasOwn(data, "state")) {
40
+ state = data.state;
41
+ }
42
+ };
34
43
 
35
- export let events = {}; //events to react on
36
- //register event handlers
37
- export let register = notCommon.registerWidgetEvents.bind(notCommon);
38
- //
39
- export let onUpdate = (data)=>{
40
- if (Object.prototype.hasOwnProperty.call(data, 'state')){
41
- state = data.state;
44
+ function getStandartUpdateEventName() {
45
+ return `indicator-${id}:update`;
42
46
  }
43
- };
44
47
 
45
- function getStandartUpdateEventName(){
46
- return `indicator-${id}:update`;
47
- }
48
-
49
- onMount(()=>{
50
- if (!Object.prototype.hasOwnProperty.call(events, getStandartUpdateEventName())){
51
- events[getStandartUpdateEventName()] = onUpdate;
52
- }
53
- register(events);
54
- });
48
+ onMount(() => {
49
+ if (!Object.hasOwn(events, getStandartUpdateEventName())) {
50
+ events[getStandartUpdateEventName()] = onUpdate;
51
+ }
52
+ register(events);
53
+ });
55
54
  </script>
56
55
 
57
- <span class="tag
56
+ <span
57
+ class="tag
58
58
  is-{size}
59
- {bold?'has-text-weight-bold':''}
60
- {padding!=='normal'?`is-padded-${padding}`:''}
61
- {sided?'is-sided':''}
62
- {right?'is-sided-right':''}
63
- {left?'is-sided-left':''}
64
- {top?'is-sided-top':''}
65
- {bottom?'is-sided-bottom':''}
59
+ {bold ? 'has-text-weight-bold' : ''}
60
+ {padding !== 'normal' ? `is-padded-${padding}` : ''}
61
+ {sided ? 'is-sided' : ''}
62
+ {right ? 'is-sided-right' : ''}
63
+ {left ? 'is-sided-left' : ''}
64
+ {top ? 'is-sided-top' : ''}
65
+ {bottom ? 'is-sided-bottom' : ''}
66
66
  is-{state} {classes}
67
- ">{labels[state]}</span>
67
+ ">{labels[state]}</span
68
+ >
@@ -1,58 +1,56 @@
1
1
  <script>
2
- import {onMount} from 'svelte';
3
- import notCommon from '../../frame/common';
4
-
5
- export let id = 'userCard';
6
- export let image = 'https://bulma.io/images/placeholders/32x32.png';
7
- export let username = 'John Doe';
8
- export let role = 'admin';
9
-
10
- export let events = {}; //events to react on
11
- //register event handlers
12
- export let register = notCommon.registerWidgetEvents;
13
- //
14
- export let onUpdate = (data)=>{
15
- if (Object.prototype.hasOwnProperty.call(data, 'username')){
16
- username = data.username;
2
+ import { onMount } from "svelte";
3
+ import notCommon from "../../frame/common";
4
+
5
+ export let id = "userCard";
6
+ export let image = "https://bulma.io/images/placeholders/32x32.png";
7
+ export let username = "John Doe";
8
+ export let role = "admin";
9
+
10
+ export let events = {}; //events to react on
11
+ //register event handlers
12
+ export let register = notCommon.registerWidgetEvents;
13
+ //
14
+ export let onUpdate = (data) => {
15
+ if (Object.hasOwn(data, "username")) {
16
+ username = data.username;
17
+ }
18
+
19
+ if (Object.hasOwn(data, "role")) {
20
+ role = data.role;
21
+ }
22
+ };
23
+
24
+ function getCompId() {
25
+ return `usercard-${id}`;
17
26
  }
18
27
 
19
- if (Object.prototype.hasOwnProperty.call(data, 'role')){
20
- role = data.role;
28
+ function getStandartUpdateEventName() {
29
+ let compId = getCompId();
30
+ return `${compId}:update`;
21
31
  }
22
32
 
23
- };
24
-
25
- function getCompId(){
26
- return `usercard-${id}`;
27
- }
28
-
29
- function getStandartUpdateEventName(){
30
- let compId = getCompId();
31
- return `${compId}:update`;
32
- }
33
-
34
- onMount(()=>{
35
- if (!Object.prototype.hasOwnProperty.call(events, getStandartUpdateEventName())){
36
- events[getStandartUpdateEventName()] = onUpdate;
37
- }
38
- register(events);
39
- });
33
+ onMount(() => {
34
+ if (!Object.hasOwn(events, getStandartUpdateEventName())) {
35
+ events[getStandartUpdateEventName()] = onUpdate;
36
+ }
37
+ register(events);
38
+ });
40
39
  </script>
41
40
 
42
-
43
- <article id="{getCompId()}" class="media">
44
- <figure class="media-left">
45
- <p class="image is-32x32">
46
- <img src={image} alt="{username}"/>
47
- </p>
48
- </figure>
49
- <div class="media-content">
50
- <div class="content">
51
- <p>
52
- <strong>{username}</strong>
53
- <small>@</small>
54
- <strong>{role}</strong>
55
- </p>
41
+ <article id={getCompId()} class="media">
42
+ <figure class="media-left">
43
+ <p class="image is-32x32">
44
+ <img src={image} alt={username} />
45
+ </p>
46
+ </figure>
47
+ <div class="media-content">
48
+ <div class="content">
49
+ <p>
50
+ <strong>{username}</strong>
51
+ <small>@</small>
52
+ <strong>{role}</strong>
53
+ </p>
54
+ </div>
56
55
  </div>
57
- </div>
58
56
  </article>
package/src/frame/base.js CHANGED
@@ -1,153 +1,152 @@
1
- import EventEmitter from 'wolfy87-eventemitter';
2
- import notPath from 'not-path';
1
+ import EventEmitter from "wolfy87-eventemitter";
2
+ import notPath from "not-path";
3
3
 
4
- import notCommon from './common.js';
4
+ import notCommon from "./common.js";
5
5
 
6
- const META_METHOD_INIT = Symbol('init'),
7
- META_DATA = Symbol('data'),
8
- META_WORKING = Symbol('working'),
9
- META_OPTIONS = Symbol('options');
6
+ const META_METHOD_INIT = Symbol("init"),
7
+ META_DATA = Symbol("data"),
8
+ META_WORKING = Symbol("working"),
9
+ META_OPTIONS = Symbol("options");
10
10
 
11
11
  export default class notBase extends EventEmitter {
12
- constructor(input) {
13
- super();
14
- this[META_DATA] = {};
15
- this[META_WORKING] = {};
16
- this[META_OPTIONS] = {};
17
- this[META_METHOD_INIT](input);
18
- return this;
19
- }
20
-
21
- [META_METHOD_INIT](input) {
22
- if (!input) {
23
- input = {};
12
+ constructor(input) {
13
+ super();
14
+ this[META_DATA] = {};
15
+ this[META_WORKING] = {};
16
+ this[META_OPTIONS] = {};
17
+ this[META_METHOD_INIT](input);
18
+ return this;
24
19
  }
25
20
 
26
- if (Object.prototype.hasOwnProperty.call(input, 'data')) {
27
- this.setData(input.data);
28
- }
21
+ [META_METHOD_INIT](input) {
22
+ if (!input) {
23
+ input = {};
24
+ }
29
25
 
30
- if (Object.prototype.hasOwnProperty.call(input, 'working')) {
31
- this.setWorking(input.working);
32
- }
26
+ if (Object.hasOwn(input, "data")) {
27
+ this.setData(input.data);
28
+ }
33
29
 
34
- if (Object.prototype.hasOwnProperty.call(input,'options')) {
35
- this.setOptions(input.options);
36
- }
30
+ if (Object.hasOwn(input, "working")) {
31
+ this.setWorking(input.working);
32
+ }
37
33
 
38
- this.log = notCommon.genLogMsg(this.getWorking('name'));
39
- this.info = this.log;
40
- this.debug = notCommon.genLogDebug(this.getWorking('name'));
41
- this.error = notCommon.genLogError(this.getWorking('name'));
42
- }
43
-
44
- setCommon(what, args) {
45
- switch (args.length) {
46
- case 1:
47
- {
48
- /* set collection */
49
- what = args[0];
50
- break;
51
- }
52
- case 2:
53
- {
54
- /* set collection element */
55
- notPath.set(args[0] /* path */ , what /* collection */ , undefined /* helpers */ , args[1] /* value */ );
56
- break;
57
- }
58
- }
59
- return this;
60
- }
61
- getCommon(what, args) {
62
- switch (args.length) {
63
- /* if we want get data by path */
64
- case 1:
65
- {
66
- return notPath.get(args[0], what);
67
- }
68
- /* if we want get data by path with default value */
69
- case 2:
70
- {
71
- let res = notPath.get(args[0], what);
72
- if (res === undefined) {
73
- /* no data, return default value */
74
- return args[1];
75
- } else {
76
- /* data, return it */
77
- return res;
78
- }
34
+ if (Object.hasOwn(input, "options")) {
35
+ this.setOptions(input.options);
36
+ }
37
+
38
+ this.log = notCommon.genLogMsg(this.getWorking("name"));
39
+ this.info = this.log;
40
+ this.debug = notCommon.genLogDebug(this.getWorking("name"));
41
+ this.error = notCommon.genLogError(this.getWorking("name"));
79
42
  }
80
- /* return full collection */
81
- default:
82
- {
83
- return what;
43
+
44
+ setCommon(what, args) {
45
+ switch (args.length) {
46
+ case 1: {
47
+ /* set collection */
48
+ what = args[0];
49
+ break;
50
+ }
51
+ case 2: {
52
+ /* set collection element */
53
+ notPath.set(
54
+ args[0] /* path */,
55
+ what /* collection */,
56
+ undefined /* helpers */,
57
+ args[1] /* value */
58
+ );
59
+ break;
60
+ }
61
+ }
62
+ return this;
84
63
  }
64
+ getCommon(what, args) {
65
+ switch (args.length) {
66
+ /* if we want get data by path */
67
+ case 1: {
68
+ return notPath.get(args[0], what);
69
+ }
70
+ /* if we want get data by path with default value */
71
+ case 2: {
72
+ let res = notPath.get(args[0], what);
73
+ if (res === undefined) {
74
+ /* no data, return default value */
75
+ return args[1];
76
+ } else {
77
+ /* data, return it */
78
+ return res;
79
+ }
80
+ }
81
+ /* return full collection */
82
+ default: {
83
+ return what;
84
+ }
85
+ }
85
86
  }
86
- }
87
87
 
88
- /*
88
+ /*
89
89
  CORE OBJECT
90
90
  DATA - information
91
91
  OPTIONS - how to work
92
92
  WORKING - temporarily generated in proccess
93
93
  */
94
94
 
95
- setData() {
96
- if (arguments.length === 1) {
97
- this[META_DATA] = arguments[0];
98
- } else {
99
- this.setCommon(this.getData(), arguments);
95
+ setData() {
96
+ if (arguments.length === 1) {
97
+ this[META_DATA] = arguments[0];
98
+ } else {
99
+ this.setCommon(this.getData(), arguments);
100
+ }
101
+ this.emit("change");
102
+ return this;
100
103
  }
101
- this.emit('change');
102
- return this;
103
- }
104
-
105
- getData() {
106
- return this.getCommon(this[META_DATA], arguments);
107
- }
108
-
109
- setOptions() {
110
- if (arguments.length === 1) {
111
- this[META_OPTIONS] = arguments[0];
112
- } else {
113
- this.setCommon(this.getOptions(), arguments);
104
+
105
+ getData() {
106
+ return this.getCommon(this[META_DATA], arguments);
107
+ }
108
+
109
+ setOptions() {
110
+ if (arguments.length === 1) {
111
+ this[META_OPTIONS] = arguments[0];
112
+ } else {
113
+ this.setCommon(this.getOptions(), arguments);
114
+ }
115
+ return this;
114
116
  }
115
- return this;
116
- }
117
-
118
- getOptions() {
119
- return this.getCommon(this[META_OPTIONS], arguments);
120
- }
121
-
122
- setWorking() {
123
- if (arguments.length === 1) {
124
- this[META_WORKING] = arguments[0];
125
- } else {
126
- this.setCommon(this.getWorking(), arguments);
117
+
118
+ getOptions() {
119
+ return this.getCommon(this[META_OPTIONS], arguments);
127
120
  }
128
- return this;
129
- }
130
121
 
131
- getWorking() {
132
- return this.getCommon(this[META_WORKING], arguments);
133
- }
122
+ setWorking() {
123
+ if (arguments.length === 1) {
124
+ this[META_WORKING] = arguments[0];
125
+ } else {
126
+ this.setCommon(this.getWorking(), arguments);
127
+ }
128
+ return this;
129
+ }
134
130
 
135
- report(e) {
136
- if (notCommon.report) {
137
- notCommon.report(e);
131
+ getWorking() {
132
+ return this.getCommon(this[META_WORKING], arguments);
138
133
  }
139
- }
140
134
 
141
- getApp(){
142
- return notCommon.getApp();
143
- }
135
+ report(e) {
136
+ if (notCommon.report) {
137
+ notCommon.report(e);
138
+ }
139
+ }
144
140
 
145
- destroy(){
146
- this.removeEvent();
147
- this.setOptions(null);
148
- this.setWorking(null);
149
- this.setData(null);
150
- this.emit('destroy');
151
- }
141
+ getApp() {
142
+ return notCommon.getApp();
143
+ }
152
144
 
145
+ destroy() {
146
+ this.removeEvent();
147
+ this.setOptions(null);
148
+ this.setWorking(null);
149
+ this.setData(null);
150
+ this.emit("destroy");
151
+ }
153
152
  }