@kronos-integration/svelte-components 2.4.92 → 2.4.94

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019-2022 by Kronos-Integration
1
+ Copyright (c) 2019-2023 by Kronos-Integration
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Svelte v3](https://img.shields.io/badge/svelte-v3-orange.svg)](https://svelte.dev)
2
2
  [![npm](https://img.shields.io/npm/v/@kronos-integration/svelte-components.svg)](https://www.npmjs.com/package/@kronos-integration/svelte-components)
3
3
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
4
- [![minified size](https://badgen.net/bundlephobia/min/@kronos-integration/svelte-components)](https://bundlephobia.com/result?p=@kronos-integration/svelte-components)
4
+ [![bundlejs](https://deno.bundlejs.com/?q=@kronos-integration/svelte-components\&badge=detailed)](https://bundlejs.com/?q=@kronos-integration/svelte-components)
5
5
  [![downloads](http://img.shields.io/npm/dm/@kronos-integration/svelte-components.svg?style=flat-square)](https://npmjs.org/package/@kronos-integration/svelte-components)
6
6
  [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/svelte-components.svg?style=flat-square)](https://github.com/Kronos-Integration/svelte-components/issues)
7
7
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FKronos-Integration%2Fsvelte-components%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/Kronos-Integration/svelte-components/goto)
@@ -26,5 +26,5 @@
26
26
 
27
27
  ### Properties
28
28
 
29
- * `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
30
- * `state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
29
+ * `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
30
+ * `state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
package/package.json CHANGED
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "name": "@kronos-integration/svelte-components",
3
- "version": "2.4.92",
3
+ "version": "2.4.94",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "svelte": "./src/index.svelte",
7
+ "exports": {
8
+ ".": {
9
+ "svelte": "./src/index.svelte"
10
+ }
11
+ },
8
12
  "description": "Svelte components for Kronos",
9
13
  "keywords": [
10
14
  "component",
11
15
  "kronos-integration",
12
16
  "svelte",
17
+ "vite",
13
18
  "web"
14
19
  ],
15
20
  "contributors": [
@@ -20,43 +25,103 @@
20
25
  ],
21
26
  "license": "BSD-2-Clause",
22
27
  "scripts": {
23
- "start": "rollup -c tests/app/rollup.config.mjs -w",
28
+ "prepare": "vite build",
29
+ "start": "vite",
24
30
  "test": "npm run test:cafe",
25
- "test:cafe": "testcafe $BROWSER:headless tests/cafe/*.js -s build/test --page-request-timeout 9000 --app-init-delay 3000 --app \"rollup -c tests/app/rollup.config.mjs -w\"",
31
+ "test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs --esm -s build/test --page-request-timeout 5000 --app-init-delay 8000 --app vite",
26
32
  "docs": "documentation readme --section=API ./src/**/*.mjs",
27
33
  "lint": "npm run lint:docs",
28
- "lint:docs": "documentation lint ./src/**/*.mjs"
34
+ "lint:docs": "documentation lint ./src/**/*.mjs",
35
+ "preview": "vite preview"
29
36
  },
30
37
  "dependencies": {
31
- "@kronos-integration/endpoint": "^9.4.32",
32
- "@kronos-integration/service": "^10.4.26",
33
- "svelte-guard-history-router": "^4.6.23"
38
+ "@kronos-integration/endpoint": "^9.4.42",
39
+ "@kronos-integration/service": "^10.4.47",
40
+ "svelte-guard-history-router": "^5.5.40"
34
41
  },
35
42
  "devDependencies": {
36
- "@rollup/plugin-node-resolve": "^13.3.0",
37
- "@rollup/plugin-virtual": "^2.1.0",
38
- "documentation": "^13.2.5",
39
- "postcss": "^8.4.14",
40
- "postcss-import": "^14.1.0",
41
- "rollup": "^2.75.7",
42
- "rollup-plugin-dev": "^2.0.0",
43
- "rollup-plugin-postcss": "^4.0.2",
44
- "rollup-plugin-svelte": "^7.1.0",
45
- "semantic-release": "^19.0.3",
46
- "svelte": "^3.48.0",
47
- "testcafe": "^1.19.0"
43
+ "@semantic-release/commit-analyzer": "^10.0.1",
44
+ "@semantic-release/exec": "^6.0.3",
45
+ "@semantic-release/release-notes-generator": "^11.0.4",
46
+ "@sveltejs/vite-plugin-svelte": "^2.4.2",
47
+ "documentation": "^14.0.2",
48
+ "npm-pkgbuild": "^11.8.14",
49
+ "semantic-release": "^21.0.7",
50
+ "svelte": "^4.0.5",
51
+ "testcafe": "^3.0.1",
52
+ "vite": "^4.4.2"
53
+ },
54
+ "optionalDependencies": {
55
+ "mf-hosting-frontend": "^1.10.0"
48
56
  },
49
57
  "repository": {
50
58
  "type": "git",
51
- "url": "https://github.com/Kronos-Integration/svelte-components.git"
59
+ "url": "https://github.com/Kronos-Integration/svelte-components"
52
60
  },
53
61
  "bugs": {
54
62
  "url": "https://github.com/Kronos-Integration/svelte-components/issues"
55
63
  },
56
64
  "homepage": "https://github.com/Kronos-Integration/svelte-components#readme",
65
+ "pkgbuild": {
66
+ "content": {
67
+ "${install.dir}": "build/"
68
+ },
69
+ "example": true,
70
+ "frontend": true,
71
+ "name": "kronos-svelte-components"
72
+ },
73
+ "release": {
74
+ "plugins": [
75
+ "@semantic-release/commit-analyzer",
76
+ "@semantic-release/release-notes-generator",
77
+ "@semantic-release/npm",
78
+ [
79
+ "@semantic-release/exec",
80
+ {
81
+ "publishCmd": "npx npm-pkgbuild --available --continue --publish dist"
82
+ }
83
+ ],
84
+ [
85
+ "@semantic-release/github",
86
+ {
87
+ "assets": [
88
+ {
89
+ "path": "dist/*.deb",
90
+ "label": "any Debian Package"
91
+ },
92
+ {
93
+ "path": "dist/*any.pkg.*",
94
+ "label": "any Arch Linux Package"
95
+ },
96
+ {
97
+ "path": "dist/*x86_64.pkg.*",
98
+ "label": "x86_64 Arch Linux Package"
99
+ },
100
+ {
101
+ "path": "dist/*aarch64.pkg.*",
102
+ "label": "arm64 Arch Linux Package"
103
+ },
104
+ {
105
+ "path": "dist/*noarch.rpm",
106
+ "label": "noarch RPM"
107
+ },
108
+ {
109
+ "path": "dist/*x86_64.rpm",
110
+ "label": "x86_64 RPM"
111
+ },
112
+ {
113
+ "path": "dist/*aarch64.rpm",
114
+ "label": "arm64 RPM"
115
+ }
116
+ ]
117
+ }
118
+ ]
119
+ ]
120
+ },
57
121
  "template": {
58
122
  "inheritFrom": [
59
123
  "arlac77/template-arlac77-github",
124
+ "arlac77/template-pacman",
60
125
  "arlac77/template-svelte-component"
61
126
  ]
62
127
  }
@@ -7,13 +7,14 @@
7
7
  </script>
8
8
 
9
9
  <Route path="service" component={ServicesPage} objectInstance={Service}>
10
- <Route path="/:service" propertyMapping={{ service: 'name' }}>
10
+ <Route path="/:service" propertyMapping={{ service: "name" }}>
11
11
  <Route path="/endpoint" objectInstance={Endpoint}>
12
- <Route path="/:endpoint" propertyMapping={{ endpoint: 'name' }}>
12
+ <Route path="/:endpoint" propertyMapping={{ endpoint: "name" }}>
13
13
  <Route path="interceptor" objectInstance={Interceptor}>
14
14
  <Route
15
15
  path="/:interceptor"
16
- propertyMapping={{ interceptor: 'type' }} />
16
+ propertyMapping={{ interceptor: "type" }}
17
+ />
17
18
  </Route>
18
19
  </Route>
19
20
  </Route>
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import {connectionPath} from "../util.mjs";
2
+ import { connectionPath } from "../util.mjs";
3
3
  export let from;
4
4
  export let to;
5
5
  </script>
@@ -9,4 +9,5 @@
9
9
  class="connection"
10
10
  d={connectionPath(from, to)}
11
11
  marker-end="url(#arrow)"
12
- marker-start="url(#dot)" />
12
+ marker-start="url(#dot)"
13
+ />
@@ -20,11 +20,11 @@
20
20
  id={endpoint.identifier}
21
21
  class="endpoint"
22
22
  on:click={click}
23
- transform="translate({endpoint.x},{endpoint.y})">
24
-
23
+ transform="translate({endpoint.x},{endpoint.y})"
24
+ >
25
25
  <text x="-6px" y="1px">{endpoint.name}</text>
26
- <circle r="3"/>
27
-
26
+ <circle r="3" />
27
+
28
28
  {#each endpoint.interceptors as interceptor, i}
29
29
  <Interceptor on:interceptorAction {interceptor} x={10 + 10 * i} y={0} />
30
30
  {/each}
@@ -15,9 +15,16 @@
15
15
  });
16
16
  }
17
17
 
18
- const knownInterceptorTypes = new Set(["live-probe","ctx","ctx-jwt-verify","ctx-body-param" ]);
18
+ const knownInterceptorTypes = new Set([
19
+ "live-probe",
20
+ "ctx",
21
+ "ctx-jwt-verify",
22
+ "ctx-body-param"
23
+ ]);
19
24
 
20
- const href = knownInterceptorTypes.has(interceptor.type) ? '#' + interceptor.type : "#interceptor"
25
+ const href = knownInterceptorTypes.has(interceptor.type)
26
+ ? "#" + interceptor.type
27
+ : "#interceptor";
21
28
  </script>
22
29
 
23
- <use {href} {x} {y} on:click={click}/>
30
+ <use {href} {x} {y} on:click={click} />
@@ -6,9 +6,7 @@
6
6
  const y = owner.y + request.endpoint.y;
7
7
  </script>
8
8
 
9
- <g
10
- class="request"
11
- transform="translate({x},{y})">
9
+ <g class="request" transform="translate({x},{y})">
12
10
  <text y="-6">0</text>
13
11
  <rect x="-4" y="-4" width="8" height="8" />
14
- </g>
12
+ </g>
@@ -51,7 +51,8 @@
51
51
  id={service.name}
52
52
  class="service"
53
53
  transform="translate({service.x},{service.y})"
54
- on:click={click}>
54
+ on:click={click}
55
+ >
55
56
  <rect width={service.w} height={service.h} rx="4" />
56
57
  <text x="8" y="14">{service.name}</text>
57
58
  {#each Object.values(service.endpoints) as endpoint}
@@ -55,10 +55,12 @@
55
55
  <symbol id="live-probe" y="-78" viewbox="0 0 1200 1200">
56
56
  <path
57
57
  d="M2.25 10C2.25 5.71979 5.71979 2.25 10 2.25C14.2802 2.25 17.75 5.71979 17.75 10C17.75 14.2802 14.2802 17.75 10 17.75C5.71979 17.75 2.25 14.2802 2.25 10Z"
58
- fill="black" />
58
+ fill="black"
59
+ />
59
60
  <path
60
61
  d="M16.8214 15.618C17.1645 15.2749 17.7044 15.2276 18.1019 15.5059L21.9536 18.2021C22.8451 18.8261 22.957 20.1037 22.1875 20.8731L21.8731 21.1875C21.1037 21.957 19.8261 21.8451 19.2021 20.9536L16.5059 17.1019C16.2276 16.7044 16.2749 16.1645 16.618 15.8214L16.8214 15.618Z"
61
- fill="black" />
62
+ fill="black"
63
+ />
62
64
  </symbol>
63
65
  <symbol id="ctx" y="-3">
64
66
  <path d="M0 -3L6 6L0 6L6 -3z" />
@@ -68,7 +70,8 @@
68
70
  fill-rule="evenodd"
69
71
  clip-rule="evenodd"
70
72
  d="M7.25 8C7.25 5.37665 9.37665 3.25 12 3.25C14.6234 3.25 16.75 5.37665 16.75 8V9.3525C17.0611 9.40539 17.3506 9.48823 17.6271 9.62137C18.3925 9.98997 19.01 10.6075 19.3786 11.3729C19.5844 11.8002 19.67 12.2587 19.7106 12.7797C19.75 13.2859 19.75 13.91 19.75 14.6837V14.7457C19.75 15.7853 19.75 16.6092 19.6982 17.2743C19.6453 17.9543 19.5349 18.5309 19.2796 19.0609C18.8127 20.0305 18.0305 20.8127 17.0609 21.2796C16.5309 21.5349 15.9543 21.6453 15.2743 21.6982C14.6092 21.75 13.7853 21.75 12.7457 21.75H11.2543C10.2147 21.75 9.39078 21.75 8.72566 21.6982C8.04571 21.6453 7.46914 21.5349 6.93905 21.2796C5.96954 20.8127 5.18729 20.0305 4.7204 19.0609C4.46512 18.5309 4.35472 17.9543 4.30178 17.2743C4.24999 16.6092 4.25 15.7853 4.25 14.7457V14.6837C4.24999 13.91 4.24999 13.2859 4.2894 12.7797C4.32996 12.2587 4.41561 11.8002 4.62137 11.3729C4.98997 10.6075 5.60753 9.98997 6.37294 9.62137C6.64939 9.48823 6.93893 9.40539 7.25 9.3525V8ZM15.25 8V9.25331C14.9657 9.24999 14.6554 9.25 14.3163 9.25H9.68375C9.34468 9.25 9.03427 9.24999 8.75 9.25331V8C8.75 6.20507 10.2051 4.75 12 4.75C13.7949 4.75 15.25 6.20507 15.25 8ZM14 14C14 14.784 13.5489 15.4626 12.8921 15.7905L13.1913 17.5856C13.2814 18.1261 13.3264 18.3964 13.1766 18.5732C13.0268 18.75 12.7529 18.75 12.2049 18.75H11.7951C11.2471 18.75 10.9732 18.75 10.8234 18.5732C10.6736 18.3964 10.7186 18.1261 10.8087 17.5856L11.1079 15.7905C10.4511 15.4626 10 14.784 10 14C10 12.8954 10.8954 12 12 12C13.1046 12 14 12.8954 14 14Z"
71
- fill="black" />
73
+ fill="black"
74
+ />
72
75
  </symbol>
73
76
  <symbol id="ctx-body-param" y="-3">
74
77
  <path d="M0 -3L6 6L0 6L6 -3z" />
@@ -81,7 +84,8 @@
81
84
  refY="3"
82
85
  markerWidth="6"
83
86
  markerHeight="6"
84
- orient="auto-start-reverse">
87
+ orient="auto-start-reverse"
88
+ >
85
89
  <path d="M0 0L6 3L0 6z" />
86
90
  </marker>
87
91
  <marker
@@ -90,7 +94,8 @@
90
94
  refX="4"
91
95
  refY="4"
92
96
  markerWidth="4"
93
- markerHeight="4">
97
+ markerHeight="4"
98
+ >
94
99
  <circle cx="4" cy="4" r="3" />
95
100
  </marker>
96
101
  </defs>
@@ -101,7 +106,8 @@
101
106
  {service}
102
107
  on:endpointAction={endpointAction}
103
108
  on:interceptorAction={interceptorAction}
104
- on:serviceAction={serviceAction} />
109
+ on:serviceAction={serviceAction}
110
+ />
105
111
  {/each}
106
112
  </g>
107
113
 
package/src/dragging.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export function makeDraggable(el,cb) {
1
+ export function makeDraggable(el, cb) {
2
2
  let svg = el;
3
3
  while (svg && svg.tagName != "svg") svg = svg.parentNode;
4
4
  const pt = svg.createSVGPoint(),
@@ -42,7 +42,7 @@ export function makeDraggable(el,cb) {
42
42
  root.removeEventListener("pointerup", finishMove, false);
43
43
  fireEvent("dragend");
44
44
 
45
- cb(xlate.matrix.e,xlate.matrix.f);
45
+ cb(xlate.matrix.e, xlate.matrix.f);
46
46
  }
47
47
 
48
48
  function fireEvent(eventName) {
@@ -1,25 +1,26 @@
1
1
  import { Interceptor } from "@kronos-integration/interceptor";
2
2
 
3
3
  export class MockInterceptor extends Interceptor {
4
+
5
+ #type;
6
+ #config;
7
+
4
8
  constructor(config) {
5
9
  super(config);
6
10
  if (config == undefined || config == null) {
7
11
  config = {};
8
12
  }
9
- this._config = config;
10
- this._type = config.type;
11
- //delete config.type;
12
-
13
- //console.log(Object.keys(this._config));
13
+ this.#config = config;
14
+ this.#type = config.type;
14
15
 
15
- this._ca = Object.fromEntries(Object.keys(this._config).map(k => [k, {}]));
16
+ this._ca = Object.fromEntries(Object.keys(this.#config).map(k => [k, {}]));
16
17
  }
17
18
 
18
19
  get type() {
19
- return this._type;
20
+ return this.#type;
20
21
  }
21
22
 
22
23
  get configurationAttributes() {
23
24
  return this._ca || super.configurationAttributes;
24
25
  }
25
- }
26
+ }
@@ -1,14 +1,16 @@
1
1
  import { ServiceLogger } from "@kronos-integration/service";
2
2
 
3
3
  export class MockLogger extends ServiceLogger {
4
+ #state;
5
+
4
6
  async logEntry(entry) {}
5
7
 
6
8
  async configure(config) {
7
9
  super.configure(config);
8
- this._state = config.state;
10
+ this.#state = config.state;
9
11
  }
10
12
 
11
13
  get state() {
12
- return this._state || super.state;
14
+ return this.#state || super.state;
13
15
  }
14
16
  }
@@ -1,5 +1,4 @@
1
1
  import { Service } from "@kronos-integration/service";
2
-
3
2
  import { MockInterceptor } from "./mock-interceptor.mjs";
4
3
 
5
4
  /**
@@ -13,11 +12,11 @@ export class MockService extends Service {
13
12
  }
14
13
 
15
14
  get state() {
16
- return this.config ? this.config.state : super.state;
15
+ return this.config?.state || super.state;
17
16
  }
18
17
 
19
18
  get type() {
20
- return this.config ? this.config.type : super.type;
19
+ return this.config?.type || super.type;
21
20
  }
22
21
 
23
22
  instantiateInterceptor(def) {
@@ -25,10 +25,13 @@ export class ServiceProvider extends ServiceProviderMixin(
25
25
  MockService,
26
26
  MockLogger
27
27
  ) {
28
+ subscriptions = new Set();
29
+ requests = [];
30
+ width = 500;
31
+ height = 500;
32
+
28
33
  constructor(serviceStore, requestsStore) {
29
34
  super({}, new NoneWaitingInitializationContext());
30
- this.subscriptions = new Set();
31
- this.requests = [];
32
35
 
33
36
  if (serviceStore) {
34
37
  this.serviceStore = serviceStore;
@@ -39,9 +42,6 @@ export class ServiceProvider extends ServiceProviderMixin(
39
42
  this.requestsStore = requestsStore;
40
43
  requestsStore.subscribe(request => this.addRequest(request));
41
44
  }
42
-
43
- this.width = 500;
44
- this.height = 500;
45
45
  }
46
46
 
47
47
  subscribe(cb) {
@@ -51,9 +51,7 @@ export class ServiceProvider extends ServiceProviderMixin(
51
51
  }
52
52
 
53
53
  fireSubscriptions() {
54
- if (this.subscriptions) {
55
- this.subscriptions.forEach(s => s(this));
56
- }
54
+ this.subscriptions.forEach(s => s(this));
57
55
  }
58
56
 
59
57
  async initialize(json) {
@@ -105,7 +103,7 @@ export class ServiceProvider extends ServiceProviderMixin(
105
103
  for (const service of Object.values(this.services)) {
106
104
  for (const endpoint of Object.values(service.endpoints)) {
107
105
  for (const connection of endpoint.connections()) {
108
- if(!connection.x || !connection.y || !endpoint.x || !endpoint.y) {
106
+ if (!connection.x || !connection.y || !endpoint.x || !endpoint.y) {
109
107
  //console.log(endpoint.identifier, "no valid connection", connection);
110
108
  continue;
111
109
  }
package/src/util.mjs CHANGED
@@ -3,12 +3,12 @@ export const SERVICE = "_SERVICE";
3
3
  export const ENDPOINT = "_ENDPOINT";
4
4
  export const INTERCEPTOR = "_INTERCEPTOR";
5
5
 
6
-
7
6
  export function connectionPath(from, to) {
8
- const fx = from.x + from.owner.x;
9
- const fy = from.y + from.owner.y;
10
- const tx = to.x + to.owner.x;
11
- const ty = to.y + to.owner.y;
7
+ const fx = from.x + from.owner.x;
8
+ const fy = from.y + from.owner.y;
9
+ const tx = to.x + to.owner.x;
10
+ const ty = to.y + to.owner.y;
12
11
 
13
- return `M${fx} ${fy}H${fx+from.rx}V${ty}H${tx + 2}`;
14
- }
12
+ const rx = from.rx === undefined ? 16 : from.rx; //TODO why
13
+ return `M${fx} ${fy}H${fx + rx}V${ty}H${tx + 2}`;
14
+ }