@digipair/skill-web-interact 0.2.1

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/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ let DomService = class DomService {
6
+ async setAttribute(params, _pinsSettingsList, _context) {
7
+ const { selector, attribute, value } = params;
8
+ const element = document.querySelector(selector);
9
+ if (attribute === 'textContent') {
10
+ element.textContent = value;
11
+ } else if (attribute === 'value') {
12
+ element.value = value;
13
+ } else if (typeof value === 'string') {
14
+ element.setAttribute(attribute, value);
15
+ } else {
16
+ element['__' + attribute] = value;
17
+ element.requestUpdate();
18
+ }
19
+ return;
20
+ }
21
+ async dispatchEvent(params, _pinsSettingsList, _context) {
22
+ const { selector, name, detail } = params;
23
+ const element = document.querySelector(selector);
24
+ element.dispatchEvent(new CustomEvent(name, {
25
+ detail
26
+ }));
27
+ return;
28
+ }
29
+ };
30
+ const setAttribute = (params, pinsSettingsList, context)=>new DomService().setAttribute(params, pinsSettingsList, context);
31
+ const dispatchEvent = (params, pinsSettingsList, context)=>new DomService().dispatchEvent(params, pinsSettingsList, context);
32
+
33
+ exports.dispatchEvent = dispatchEvent;
34
+ exports.setAttribute = setAttribute;
@@ -0,0 +1 @@
1
+ export * from './lib/skill-web-interact';
@@ -0,0 +1,4 @@
1
+ type PinsSettings = any;
2
+ export declare const setAttribute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
+ export declare const dispatchEvent: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ export {};
@@ -0,0 +1 @@
1
+ export * from './dom.skill';
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@digipair/skill-web-interact",
3
+ "version": "0.2.1",
4
+ "dependencies": {},
5
+ "type": "commonjs",
6
+ "main": "./index.cjs.js",
7
+ "module": "./index.js"
8
+ }