not-bulma 1.2.16 → 1.2.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": "1.2.16",
3
+ "version": "1.2.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,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
  }
@@ -158,8 +158,7 @@ class notCommon {
158
158
  static isError(e) {
159
159
  return (
160
160
  e instanceof Error ||
161
- (Object.prototype.hasOwnProperty.call(e, "status") &&
162
- e.status === "error")
161
+ (Object.hasOwn(e, "status") && e.status === "error")
163
162
  );
164
163
  }
165
164
 
@@ -195,7 +194,7 @@ class notCommon {
195
194
  * @return {boolean} if object contains field with name
196
195
  **/
197
196
  static objHas(obj, name) {
198
- return Object.prototype.hasOwnProperty.call(obj, name);
197
+ return Object.hasOwn(obj, name);
199
198
  }
200
199
 
201
200
  /**
@@ -575,7 +574,7 @@ class notCommon {
575
574
  continue;
576
575
  }
577
576
  if (typeof notCommon.get(`absorb.${prop}`) === "function") {
578
- if (!Object.prototype.hasOwnProperty.call(targets, prop)) {
577
+ if (!Object.hasOwn(targets, prop)) {
579
578
  targets[prop] = {};
580
579
  notCommon.log(
581
580
  `WARNING: no accamulator object provided for '${prop}' collection`
@@ -583,18 +582,13 @@ class notCommon {
583
582
  }
584
583
  notCommon.get(`absorb.${prop}`)(targets[prop], mod[prop]);
585
584
  } else if (prop.indexOf("nc") === 0) {
586
- if (
587
- !Object.prototype.hasOwnProperty.call(
588
- defaultConf,
589
- "controllers"
590
- )
591
- ) {
585
+ if (!Object.hasOwn(defaultConf, "controllers")) {
592
586
  defaultConf.controllers = {};
593
587
  }
594
588
  defaultConf.controllers[prop] = mod[prop];
595
589
  } else {
596
590
  //in case of some other stuff presented, isolating it in special var
597
- if (!Object.prototype.hasOwnProperty.call(window, "notEnv")) {
591
+ if (!Object.hasOwn(window, "notEnv")) {
598
592
  // @ts-ignore
599
593
  window.notEnv = {};
600
594
  }
@@ -606,7 +600,7 @@ class notCommon {
606
600
  }
607
601
 
608
602
  static defineIfNotExists(obj, key, defaultValue) {
609
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
603
+ if (!Object.hasOwn(obj, key)) {
610
604
  obj[key] = defaultValue;
611
605
  }
612
606
  }
@@ -618,16 +612,16 @@ class notCommon {
618
612
  }
619
613
 
620
614
  static get(key) {
621
- return Object.prototype.hasOwnProperty.call(notCommon.registry, key)
615
+ return Object.hasOwn(notCommon.registry, key)
622
616
  ? notCommon.registry[key]
623
617
  : null;
624
618
  }
625
619
 
626
- static moveItem(array, old_index, new_index) {
627
- const inRange = num => num < array.length && num > -1;
628
- if(inRange(new_index)&&inRange(old_index)){
620
+ static moveItem(array, old_index, new_index) {
621
+ const inRange = (num) => num < array.length && num > -1;
622
+ if (inRange(new_index) && inRange(old_index)) {
629
623
  array.splice(new_index, 0, array.splice(old_index, 1)[0]);
630
- }
624
+ }
631
625
  }
632
626
 
633
627
  static stripProxy(obj) {
@@ -639,7 +633,7 @@ class notCommon {
639
633
  obj = Object.assign({}, obj);
640
634
  }
641
635
  for (let t in obj) {
642
- if (Object.prototype.hasOwnProperty.call(obj, t)) {
636
+ if (Object.hasOwn(obj, t)) {
643
637
  obj[t] = notCommon.stripProxy(obj[t]);
644
638
  }
645
639
  }
@@ -712,7 +706,7 @@ class notCommon {
712
706
  function absorbServices(target, src) {
713
707
  if (target) {
714
708
  for (let serv in src) {
715
- if (Object.prototype.hasOwnProperty.call(target, serv)) {
709
+ if (Object.hasOwn(target, serv)) {
716
710
  notCommon.logError(`services property duplication ${serv}`);
717
711
  }
718
712
  target[serv] = src[serv];
@@ -721,7 +715,7 @@ function absorbServices(target, src) {
721
715
  }
722
716
 
723
717
  function extendWSClient(wcs, wscName, wscOptions) {
724
- if (!Object.prototype.hasOwnProperty.call(wcs, wscName)) {
718
+ if (!Object.hasOwn(wcs, wscName)) {
725
719
  wcs[wscName] = {
726
720
  connection: {},
727
721
  router: {
@@ -731,15 +725,10 @@ function extendWSClient(wcs, wscName, wscOptions) {
731
725
  };
732
726
  }
733
727
  let target = wcs[wscName];
734
- if (Object.prototype.hasOwnProperty.call(wscOptions, "router")) {
735
- if (Object.prototype.hasOwnProperty.call(wscOptions.router, "routes")) {
728
+ if (Object.hasOwn(wscOptions, "router")) {
729
+ if (Object.hasOwn(wscOptions.router, "routes")) {
736
730
  for (let routeType in wscOptions.router.routes) {
737
- if (
738
- !Object.prototype.hasOwnProperty.call(
739
- target.router.routes,
740
- routeType
741
- )
742
- ) {
731
+ if (!Object.hasOwn(target.router.routes, routeType)) {
743
732
  target.router.routes[routeType] = {};
744
733
  }
745
734
  Object.assign(target.router.routes[routeType], {
@@ -748,14 +737,14 @@ function extendWSClient(wcs, wscName, wscOptions) {
748
737
  }
749
738
  }
750
739
  }
751
- if (Object.prototype.hasOwnProperty.call(wscOptions, "messenger")) {
740
+ if (Object.hasOwn(wscOptions, "messenger")) {
752
741
  Object.assign(target.messenger, { ...wscOptions.messenger });
753
742
  }
754
- if (Object.prototype.hasOwnProperty.call(wscOptions, "connection")) {
743
+ if (Object.hasOwn(wscOptions, "connection")) {
755
744
  Object.assign(target.connection, { ...wscOptions.connection });
756
745
  }
757
746
  for (let t of ["name", "getToken", "logger", "identity", "credentials"]) {
758
- if (Object.prototype.hasOwnProperty.call(wscOptions, t)) {
747
+ if (Object.hasOwn(wscOptions, t)) {
759
748
  target[t] = wscOptions[t];
760
749
  }
761
750
  }
@@ -772,7 +761,7 @@ function absorbWSC(target, src) {
772
761
  function absorbUIs(target, src) {
773
762
  if (target) {
774
763
  for (let ui in src) {
775
- if (Object.prototype.hasOwnProperty.call(target, ui)) {
764
+ if (Object.hasOwn(target, ui)) {
776
765
  notCommon.logError(`uis property duplication ${ui}`);
777
766
  }
778
767
  target[ui] = src[ui];
@@ -783,7 +772,7 @@ function absorbUIs(target, src) {
783
772
  function absorbFields(target, src) {
784
773
  if (target) {
785
774
  for (let ui in src) {
786
- if (Object.prototype.hasOwnProperty.call(target, ui)) {
775
+ if (Object.hasOwn(target, ui)) {
787
776
  notCommon.logError(`fields property duplication ${ui}`);
788
777
  }
789
778
  target[ui] = src[ui];