@pisapp/reactive-dom 7.0.0-dev.20260916-153034
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 +28 -0
- package/README.md +68 -0
- package/THIRD-PARTY-NOTICES.txt +43 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +25 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
PRODUCT INFORMATION SERVICES (PIS) PROPRIETARY SOFTWARE LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ABB Asea Brown Boveri Ltd. All rights reserved.
|
|
4
|
+
|
|
5
|
+
The Product Information Services (PIS) software package and its documentation
|
|
6
|
+
(the "Software") are proprietary to ABB Asea Brown Boveri Ltd and its
|
|
7
|
+
licensors.
|
|
8
|
+
|
|
9
|
+
Subject to a valid written agreement between ABB and you or the organization
|
|
10
|
+
you represent that authorizes use of PIS (the "Applicable Agreement"), ABB
|
|
11
|
+
grants you a non-exclusive, non-transferable, non-sublicensable, limited
|
|
12
|
+
license to install and use the Software solely to develop, test, and run
|
|
13
|
+
applications that access PIS services as authorized by the Applicable
|
|
14
|
+
Agreement.
|
|
15
|
+
|
|
16
|
+
Except to the extent that mandatory law does not allow a restriction, you may
|
|
17
|
+
not copy, modify, distribute, publish, sublicense, rent, lease, sell, or
|
|
18
|
+
otherwise make the Software available to a third party. You may not remove or
|
|
19
|
+
alter proprietary notices or reverse engineer the Software except as expressly
|
|
20
|
+
permitted by mandatory law.
|
|
21
|
+
|
|
22
|
+
If no Applicable Agreement authorizes your use of PIS, no license to use the
|
|
23
|
+
Software is granted. Your right to use the Software ends when the Applicable
|
|
24
|
+
Agreement ends or your authorization under it is withdrawn.
|
|
25
|
+
|
|
26
|
+
The Applicable Agreement controls if it conflicts with this notice. The
|
|
27
|
+
Software is provided subject to the warranties, limitations of liability, and
|
|
28
|
+
other terms in the Applicable Agreement.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @pisapp/reactive-dom
|
|
2
|
+
|
|
3
|
+
The reactive engine behind PIS v7 template render functions (decisions
|
|
4
|
+
D-JsLock / D-JsReactivity / D-N2). `reactiveMount(render)` wraps a plain-DOM
|
|
5
|
+
render function in Vue's `effect()` so that every reactive `ctx.*` field it
|
|
6
|
+
reads is tracked and the render re-runs when those fields change — on the same
|
|
7
|
+
reactivity core the PIS `ctx` is already built on.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @pisapp/core @pisapp/reactive-dom vue
|
|
13
|
+
# npm install @pisapp/core @pisapp/reactive-dom vue
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Peer dependencies
|
|
17
|
+
|
|
18
|
+
| Package | Range | Notes |
|
|
19
|
+
| -------------- | ---------- | -------------------------------------------------------- |
|
|
20
|
+
| `@pisapp/core` | `^7.0.0` | The component runtime; types the render pairs slot into. |
|
|
21
|
+
| `vue` | `>=3.5.17` | Provides `effect` / `effectScope`. |
|
|
22
|
+
|
|
23
|
+
## When you need this package
|
|
24
|
+
|
|
25
|
+
Usually **never**: assigning a bare render function `(container, ctx) =>
|
|
26
|
+
cleanup | void` directly to a `*Template` option wraps it in `reactiveMount`
|
|
27
|
+
automatically (core's `MountPoint` does it for you), with contextual typing at
|
|
28
|
+
the option site.
|
|
29
|
+
|
|
30
|
+
Import `reactiveMount` directly only when you build the render function as a
|
|
31
|
+
**standalone value reused across several slots** and want one explicit wrapper
|
|
32
|
+
around it.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { reactiveMount } from '@pisapp/reactive-dom';
|
|
38
|
+
|
|
39
|
+
const stockCell = reactiveMount((container, ctx) => {
|
|
40
|
+
const btn = document.createElement('button');
|
|
41
|
+
btn.disabled = ctx.item.stock < 1; // reactive — re-runs when stock changes
|
|
42
|
+
btn.addEventListener('click', () => ctx.emit('app:AddToCart', ctx.item));
|
|
43
|
+
container.replaceChildren(btn);
|
|
44
|
+
return () => btn.replaceWith(); // useEffect-style cleanup
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
columns.push({ dataField: 'ProductId', cellTemplate: stockCell });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`reactiveMount(render)` returns a `{ mount, unmount }` pair assignable to any
|
|
51
|
+
`*Template` slot:
|
|
52
|
+
|
|
53
|
+
- `render(container, ctx)` runs inside a Vue `effect`; tracked `ctx.*` reads
|
|
54
|
+
re-run the render body in place (the cell is not restarted, preserving any
|
|
55
|
+
component state — auto re-mount stays rejected, D-N2).
|
|
56
|
+
- A returned cleanup function runs before each re-render and on unmount
|
|
57
|
+
(useEffect semantics).
|
|
58
|
+
- `unmount(container)` stops the effect scope deterministically — no leaked
|
|
59
|
+
effects or listeners.
|
|
60
|
+
|
|
61
|
+
CSP-safe: `effect` tracking relies on Proxies, not `eval`/`Function`, so this
|
|
62
|
+
works under strict Content-Security-Policy.
|
|
63
|
+
|
|
64
|
+
The package also re-exports `effect`, `effectScope`, and `onScopeDispose` from
|
|
65
|
+
`vue` for advanced standalone use.
|
|
66
|
+
|
|
67
|
+
See the [JavaScript template guide](../../PisNextGenDocs/src/migration/web-components/javascript.md)
|
|
68
|
+
for the full render-function authoring model.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
THIRD-PARTY NOTICES
|
|
2
|
+
|
|
3
|
+
Product Information Services (PIS) packages may include or depend on the
|
|
4
|
+
third-party software listed below. The applicable third-party license terms
|
|
5
|
+
apply to that software.
|
|
6
|
+
|
|
7
|
+
Bootstrap 5.3.2
|
|
8
|
+
Copyright (c) 2011-2023 The Bootstrap Authors
|
|
9
|
+
|
|
10
|
+
vue-virtual-scroller 2.0.1
|
|
11
|
+
Copyright (c) 2020 guillaume.b.chau@gmail.com
|
|
12
|
+
|
|
13
|
+
Vue 3.5.40
|
|
14
|
+
Copyright (c) 2018-present, Yuxi (Evan) You
|
|
15
|
+
|
|
16
|
+
vue3-runtime-template 1.0.2
|
|
17
|
+
Copyright (c) 2018 Alex Jover
|
|
18
|
+
|
|
19
|
+
The components listed above are licensed under the MIT License:
|
|
20
|
+
|
|
21
|
+
MIT License
|
|
22
|
+
|
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
25
|
+
in the Software without restriction, including without limitation the rights
|
|
26
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
27
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
28
|
+
furnished to do so, subject to the following conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be included in all
|
|
31
|
+
copies or substantial portions of the Software.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
34
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
35
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
36
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
37
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
38
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
|
+
SOFTWARE.
|
|
40
|
+
|
|
41
|
+
ABBvoice font assets are proprietary ABB assets. They are not redistributed in
|
|
42
|
+
these npm packages. PIS CSS references the ABB-hosted font service at:
|
|
43
|
+
https://external.productinformation.abb.com/PisApp/current/fonts/
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A render function: mutates the container; may return a cleanup (useEffect-style). */
|
|
2
|
+
export type RenderFn<C> = (container: HTMLElement, ctx: C) => (() => void) | void;
|
|
3
|
+
/** The pair returned by `reactiveMount`. Assign to a `*Template` slot value. */
|
|
4
|
+
export interface ReactiveMountPair<C> {
|
|
5
|
+
mount: (container: HTMLElement, ctx: C) => void;
|
|
6
|
+
unmount: (container: HTMLElement) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Wrap a render function into a reactive template pair (D-JsLock).
|
|
10
|
+
*
|
|
11
|
+
* - `render(container, ctx)` runs inside a Vue `effect`: any reactive `ctx.*`
|
|
12
|
+
* field it reads is tracked, and the render re-runs when those fields change.
|
|
13
|
+
* - The render body may return a cleanup function (useEffect-style); it runs
|
|
14
|
+
* before each re-render and on unmount.
|
|
15
|
+
* - The effect is owned by an `effectScope` so `unmount` tears down everything
|
|
16
|
+
* deterministically (no leaked effect, no leaked listeners if cleanup removed them).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { reactiveMount } from '@pisapp/reactive-dom';
|
|
20
|
+
* columns.push({
|
|
21
|
+
* cellTemplate: reactiveMount((container, ctx) => {
|
|
22
|
+
* const btn = document.createElement('button');
|
|
23
|
+
* btn.disabled = ctx.item.stock < 1; // reactive ✅
|
|
24
|
+
* btn.addEventListener('click', onClick);
|
|
25
|
+
* container.replaceChildren(btn);
|
|
26
|
+
* return () => btn.removeEventListener('click', onClick); // cleanup
|
|
27
|
+
* })
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
export declare function reactiveMount<C>(render: RenderFn<C>): ReactiveMountPair<C>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { effect as e, effectScope as t, onScopeDispose as n } from "vue";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
function r(r) {
|
|
4
|
+
let i = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
return {
|
|
6
|
+
mount: (a, o) => {
|
|
7
|
+
if (i.has(a)) return;
|
|
8
|
+
let s = t(), c = { scope: s };
|
|
9
|
+
i.set(a, c), s.run(() => {
|
|
10
|
+
let t;
|
|
11
|
+
c.runner = e(() => {
|
|
12
|
+
t?.();
|
|
13
|
+
let e = r(a, o);
|
|
14
|
+
t = typeof e == "function" ? e : void 0;
|
|
15
|
+
}), n(() => t?.());
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
unmount: (e) => {
|
|
19
|
+
let t = i.get(e);
|
|
20
|
+
t && (t.scope.stop(), i.delete(e));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { r as reactiveMount };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pisapp/reactive-dom",
|
|
3
|
+
"version": "7.0.0-dev.20260916-153034",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
5
|
+
"author": "ABB Asea Brown Boveri Ltd",
|
|
6
|
+
"description": "PIS v7 reactive template engine — reactiveMount wraps a render function in @vue/reactivity's effect() so cells built from a reactive ctx re-render on change. MountPoint wraps every plain-DOM render function in it (decisions D-JsReactivity / D-JsLock).",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"THIRD-PARTY-NOTICES.txt"
|
|
20
|
+
],
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"vue": ">=3.5.17 <4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "~6.0.3",
|
|
26
|
+
"vue": ">=3.5.17 <4",
|
|
27
|
+
"vitest": "^4.1.10",
|
|
28
|
+
"jsdom": "^25.0.1"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"pisRelease": {
|
|
34
|
+
"version": "7.0.0-dev.20260916-153034",
|
|
35
|
+
"channel": "dev",
|
|
36
|
+
"commit": "3cfd54cc87975b643036674bfb2d000d81973ac5"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "node ../../scripts/build-library.mjs --package @pisapp/reactive-dom",
|
|
40
|
+
"lint": "eslint . --max-warnings 0",
|
|
41
|
+
"lint:fix": "eslint . --fix",
|
|
42
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
43
|
+
"test": "vitest run"
|
|
44
|
+
}
|
|
45
|
+
}
|