@digipair/skill-html 0.60.6 → 0.60.8

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.esm.js CHANGED
@@ -23901,14 +23901,14 @@ function indent(str, spaces) {
23901
23901
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23902
23902
  // match is required
23903
23903
  if (!match) {
23904
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23904
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23905
23905
  v: nextMatch1
23906
23906
  };
23907
23907
  }
23908
23908
  var token = match.token, offset = match.offset;
23909
23909
  i1 += offset;
23910
23910
  if (token === " ") {
23911
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23911
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23912
23912
  }
23913
23913
  tokens1 = _to_consumable_array$1(tokens1).concat([
23914
23914
  token
@@ -23927,7 +23927,7 @@ function indent(str, spaces) {
23927
23927
  if (contextKeys.some(function(el) {
23928
23928
  return el.startsWith(name);
23929
23929
  })) {
23930
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23930
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23931
23931
  }
23932
23932
  if (dateTimeIdentifiers.some(function(el) {
23933
23933
  return el === name;
@@ -23946,9 +23946,9 @@ function indent(str, spaces) {
23946
23946
  if (dateTimeIdentifiers.some(function(el) {
23947
23947
  return el.startsWith(name);
23948
23948
  })) {
23949
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23949
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23950
23950
  }
23951
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23951
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23952
23952
  v: nextMatch1
23953
23953
  };
23954
23954
  };
@@ -27955,6 +27955,7 @@ const preparePinsSettings = async (settings, context)=>{
27955
27955
  });
27956
27956
  };
27957
27957
 
27958
+ /* eslint-disable @typescript-eslint/no-unused-vars */ // import { PinsSettings, executePinsList } from '@digipair/engine';
27958
27959
  let HtmlService = class HtmlService {
27959
27960
  async html2pins(params, _pinsSettingsList, _context) {
27960
27961
  const { html, library = 'web' } = params;
@@ -28015,37 +28016,39 @@ let HtmlService = class HtmlService {
28015
28016
  }
28016
28017
  async parseHtml(params, _pinsSettingsList, context) {
28017
28018
  const { html, execute = [] } = params;
28018
- const result = await executePinsList(execute, {
28019
- context,
28020
- document: html
28021
- });
28022
- return result;
28023
- }
28024
- async selector(params, _pinsSettingsList, context) {
28025
- const { selector, html = context.document } = params;
28026
28019
  const dom = new JSDOM(html);
28027
- const element = dom.window.document.querySelector(selector);
28028
- return element;
28020
+ const result = await executePinsList(execute, _extends({}, context, {
28021
+ document: {
28022
+ querySelector: (selector)=>this.querySelector(selector, dom.window.document),
28023
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, dom.window.document)
28024
+ }
28025
+ }));
28026
+ return result;
28029
28027
  }
28030
- async selectorAll(params, _pinsSettingsList, context) {
28031
- const { selector, html = context.document } = params;
28032
- const dom = new JSDOM(html);
28033
- const element = dom.window.document.querySelectorAll(selector);
28034
- return element;
28028
+ querySelector(selector, parent) {
28029
+ const element = parent == null ? void 0 : parent.querySelector(selector);
28030
+ return element ? {
28031
+ textContent: element.textContent,
28032
+ querySelector: (selector)=>this.querySelector(selector, element),
28033
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28034
+ getAttribute: (name)=>this.getAttribute(name, element)
28035
+ } : undefined;
28036
+ }
28037
+ querySelectorAll(selector, parent) {
28038
+ const elements = Array.from((parent == null ? void 0 : parent.querySelectorAll(selector)) || []);
28039
+ return elements.map((element)=>({
28040
+ textContent: element.textContent,
28041
+ querySelector: (selector)=>this.querySelector(selector, element),
28042
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28043
+ getAttribute: (name)=>this.getAttribute(name, element)
28044
+ }));
28035
28045
  }
28036
- getAttribute(params, _pinsSettingsList, context) {
28037
- const { selector, attribute, html = context.document } = params;
28038
- const dom = new JSDOM(html);
28039
- const element = dom.window.document.querySelectorAll(selector);
28040
- const result = element.getAttribute(attribute);
28041
- return result;
28046
+ getAttribute(name, element) {
28047
+ return element == null ? void 0 : element.getAttribute(name);
28042
28048
  }
28043
28049
  };
28044
28050
  const html2pins = (params, pinsSettingsList, context)=>new HtmlService().html2pins(params, pinsSettingsList, context);
28045
28051
  const pins2html = (params, pinsSettingsList, context)=>new HtmlService().pins2html(params, pinsSettingsList, context);
28046
28052
  const parseHtml = (params, pinsSettingsList, context)=>new HtmlService().parseHtml(params, pinsSettingsList, context);
28047
- const selector = (params, pinsSettingsList, context)=>new HtmlService().selector(params, pinsSettingsList, context);
28048
- const selectorAll = (params, pinsSettingsList, context)=>new HtmlService().selectorAll(params, pinsSettingsList, context);
28049
- const getAttribute = (params, pinsSettingsList, context)=>new HtmlService().getAttribute(params, pinsSettingsList, context);
28050
28053
 
28051
- export { getAttribute, html2pins, parseHtml, pins2html, selector, selectorAll };
28054
+ export { html2pins, parseHtml, pins2html };
@@ -0,0 +1,2 @@
1
+ export * from './lib/engine';
2
+ export * from './lib/pins-settings.interface';
@@ -0,0 +1,9 @@
1
+ export interface Alias {
2
+ name: string;
3
+ library: string;
4
+ element: string;
5
+ properties: {
6
+ library: string;
7
+ element: string;
8
+ };
9
+ }
@@ -0,0 +1,12 @@
1
+ import { PinsSettings } from './pins-settings.interface';
2
+ type CONFIG_KEY = 'BASE_URL' | 'LIBRARIES' | 'ALIAS';
3
+ export declare const config: {
4
+ set: (key: CONFIG_KEY, value: any) => void;
5
+ };
6
+ export declare const applyTemplate: (value: any, context: any) => any;
7
+ export declare const executePinsList: (pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
+ export declare const generateElementFromPins: (pinsSettings: PinsSettings, parent: Element, context: any, document?: Document, options?: {
9
+ import: boolean;
10
+ }) => Promise<Element | void>;
11
+ export declare const preparePinsSettings: (settings: PinsSettings, context: any) => Promise<PinsSettings>;
12
+ export {};
@@ -0,0 +1,15 @@
1
+ export interface PinsSettings {
2
+ library: string;
3
+ element: string;
4
+ properties?: {
5
+ [key: string]: any;
6
+ };
7
+ conditions?: {
8
+ if?: boolean;
9
+ each?: any[];
10
+ };
11
+ pins?: PinsSettings[];
12
+ events?: {
13
+ [key: string]: PinsSettings[];
14
+ };
15
+ }
@@ -1,7 +1,4 @@
1
- import { PinsSettings } from '@digipair/engine';
1
+ import { PinsSettings } from '../../../engine/src';
2
2
  export declare const html2pins: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
3
  export declare const pins2html: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
4
  export declare const parseHtml: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
- export declare const selector: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
6
- export declare const selectorAll: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
- export declare const getAttribute: (params: any, pinsSettingsList: PinsSettings[], context: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-html",
3
- "version": "0.60.6",
3
+ "version": "0.60.8",
4
4
  "dependencies": {
5
5
  "jsdom": "^25.0.1"
6
6
  },
package/schema.fr.json CHANGED
@@ -82,96 +82,6 @@
82
82
  ],
83
83
  "x-events": []
84
84
  }
85
- },
86
- "/selector": {
87
- "post": {
88
- "tags": ["service"],
89
- "summary": "Sélectionner un élément",
90
- "parameters": [
91
- {
92
- "name": "selector",
93
- "summary": "Sélecteur",
94
- "required": true,
95
- "description": "Sélecteur CSS",
96
- "schema": {
97
- "type": "string"
98
- }
99
- },
100
- {
101
- "name": "html",
102
- "summary": "HTML",
103
- "required": false,
104
- "description": "Code HTML",
105
- "schema": {
106
- "type": "string"
107
- }
108
- }
109
- ],
110
- "x-events": []
111
- }
112
- },
113
- "/selectorAll": {
114
- "post": {
115
- "tags": ["service"],
116
- "summary": "Sélectionner des éléments",
117
- "parameters": [
118
- {
119
- "name": "selector",
120
- "summary": "Sélecteur",
121
- "required": true,
122
- "description": "Sélecteur CSS",
123
- "schema": {
124
- "type": "string"
125
- }
126
- },
127
- {
128
- "name": "html",
129
- "summary": "HTML",
130
- "required": false,
131
- "description": "Code HTML",
132
- "schema": {
133
- "type": "string"
134
- }
135
- }
136
- ],
137
- "x-events": []
138
- }
139
- },
140
- "/getAttribute": {
141
- "post": {
142
- "tags": ["service"],
143
- "summary": "Récupérer un attribut",
144
- "parameters": [
145
- {
146
- "name": "selector",
147
- "summary": "Sélecteur",
148
- "required": true,
149
- "description": "Sélecteur CSS",
150
- "schema": {
151
- "type": "string"
152
- }
153
- },
154
- {
155
- "name": "attribute",
156
- "summary": "Attribut",
157
- "required": true,
158
- "description": "Nom de l'attribut",
159
- "schema": {
160
- "type": "string"
161
- }
162
- },
163
- {
164
- "name": "html",
165
- "summary": "HTML",
166
- "required": false,
167
- "description": "Code HTML",
168
- "schema": {
169
- "type": "string"
170
- }
171
- }
172
- ],
173
- "x-events": []
174
- }
175
85
  }
176
86
  },
177
87
  "components": {
package/schema.json CHANGED
@@ -82,87 +82,6 @@
82
82
  ],
83
83
  "x-events": []
84
84
  }
85
- },
86
- "/selector": {
87
- "post": {
88
- "tags": ["service"],
89
- "summary": "Select an Element",
90
- "parameters": [
91
- {
92
- "name": "selector",
93
- "summary": "Selector",
94
- "required": true,
95
- "description": "CSS Selector",
96
- "schema": {
97
- "type": "string"
98
- }
99
- },
100
- {
101
- "name": "element",
102
- "summary": "Element",
103
- "required": false,
104
- "description": "Parent Element",
105
- "schema": {
106
- "type": "object"
107
- }
108
- }
109
- ],
110
- "x-events": []
111
- }
112
- },
113
- "/selectorAll": {
114
- "post": {
115
- "tags": ["service"],
116
- "summary": "Select Elements",
117
- "parameters": [
118
- {
119
- "name": "selector",
120
- "summary": "Selector",
121
- "required": true,
122
- "description": "CSS Selector",
123
- "schema": {
124
- "type": "string"
125
- }
126
- },
127
- {
128
- "name": "element",
129
- "summary": "Element",
130
- "required": false,
131
- "description": "Parent Element",
132
- "schema": {
133
- "type": "object"
134
- }
135
- }
136
- ],
137
- "x-events": []
138
- }
139
- },
140
- "/getAttribute": {
141
- "post": {
142
- "tags": ["service"],
143
- "summary": "Retrieve an Attribute",
144
- "parameters": [
145
- {
146
- "name": "element",
147
- "summary": "Element",
148
- "required": true,
149
- "description": "Element",
150
- "schema": {
151
- "type": "object"
152
- }
153
- },
154
- {
155
- "name": "attribute",
156
- "summary": "Attribute",
157
- "required": true,
158
- "description": "Attribute Name",
159
- "schema": {
160
- "type": "string"
161
- }
162
- }
163
- ],
164
- "x-events": []
165
- }
166
85
  }
167
86
  },
168
87
  "components": {