@digipair/skill-html 0.60.4 → 0.60.7

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.js CHANGED
@@ -23923,14 +23923,14 @@ function indent(str, spaces) {
23923
23923
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23924
23924
  // match is required
23925
23925
  if (!match) {
23926
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23926
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23927
23927
  v: nextMatch1
23928
23928
  };
23929
23929
  }
23930
23930
  var token = match.token, offset = match.offset;
23931
23931
  i1 += offset;
23932
23932
  if (token === " ") {
23933
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23933
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23934
23934
  }
23935
23935
  tokens1 = _to_consumable_array$1(tokens1).concat([
23936
23936
  token
@@ -23949,7 +23949,7 @@ function indent(str, spaces) {
23949
23949
  if (contextKeys.some(function(el) {
23950
23950
  return el.startsWith(name);
23951
23951
  })) {
23952
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23952
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23953
23953
  }
23954
23954
  if (dateTimeIdentifiers.some(function(el) {
23955
23955
  return el === name;
@@ -23968,9 +23968,9 @@ function indent(str, spaces) {
23968
23968
  if (dateTimeIdentifiers.some(function(el) {
23969
23969
  return el.startsWith(name);
23970
23970
  })) {
23971
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23971
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23972
23972
  }
23973
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23973
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23974
23974
  v: nextMatch1
23975
23975
  };
23976
23976
  };
@@ -28038,42 +28038,42 @@ let HtmlService = class HtmlService {
28038
28038
  }
28039
28039
  async parseHtml(params, _pinsSettingsList, context) {
28040
28040
  const { html, execute = [] } = params;
28041
+ const dom = new jsdom.JSDOM(html);
28041
28042
  const result = await executePinsList(execute, {
28042
28043
  context,
28043
- document: html
28044
+ document: {
28045
+ querySelector: (selector)=>this.querySelector(selector, dom.window.document),
28046
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, dom.window.document)
28047
+ }
28044
28048
  });
28045
28049
  return result;
28046
28050
  }
28047
- async selector(params, _pinsSettingsList, context) {
28048
- const { selector, html = context.document } = params;
28049
- const dom = new jsdom.JSDOM(html);
28050
- const element = dom.window.document.querySelector(selector);
28051
- return element;
28052
- }
28053
- async selectorAll(params, _pinsSettingsList, context) {
28054
- const { selector, html = context.document } = params;
28055
- const dom = new jsdom.JSDOM(html);
28056
- const element = dom.window.document.querySelectorAll(selector);
28057
- return element;
28051
+ querySelector(selector, parent) {
28052
+ const element = parent == null ? void 0 : parent.querySelector(selector);
28053
+ return element ? {
28054
+ textContent: element.textContent,
28055
+ querySelector: (selector)=>this.querySelector(selector, element),
28056
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28057
+ getAttribute: (name)=>this.getAttribute(name, element)
28058
+ } : undefined;
28059
+ }
28060
+ querySelectorAll(selector, parent) {
28061
+ const elements = Array.from((parent == null ? void 0 : parent.querySelectorAll(selector)) || []);
28062
+ return elements.map((element)=>({
28063
+ textContent: element.textContent,
28064
+ querySelector: (selector)=>this.querySelector(selector, element),
28065
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28066
+ getAttribute: (name)=>this.getAttribute(name, element)
28067
+ }));
28058
28068
  }
28059
- getAttribute(params, _pinsSettingsList, context) {
28060
- const { selector, attribute, html = context.document } = params;
28061
- const dom = new jsdom.JSDOM(html);
28062
- const element = dom.window.document.querySelectorAll(selector);
28063
- const result = element.getAttribute(attribute);
28064
- return result;
28069
+ getAttribute(name, element) {
28070
+ return element == null ? void 0 : element.getAttribute(name);
28065
28071
  }
28066
28072
  };
28067
28073
  const html2pins = (params, pinsSettingsList, context)=>new HtmlService().html2pins(params, pinsSettingsList, context);
28068
28074
  const pins2html = (params, pinsSettingsList, context)=>new HtmlService().pins2html(params, pinsSettingsList, context);
28069
28075
  const parseHtml = (params, pinsSettingsList, context)=>new HtmlService().parseHtml(params, pinsSettingsList, context);
28070
- const selector = (params, pinsSettingsList, context)=>new HtmlService().selector(params, pinsSettingsList, context);
28071
- const selectorAll = (params, pinsSettingsList, context)=>new HtmlService().selectorAll(params, pinsSettingsList, context);
28072
- const getAttribute = (params, pinsSettingsList, context)=>new HtmlService().getAttribute(params, pinsSettingsList, context);
28073
28076
 
28074
- exports.getAttribute = getAttribute;
28075
28077
  exports.html2pins = html2pins;
28076
28078
  exports.parseHtml = parseHtml;
28077
28079
  exports.pins2html = pins2html;
28078
- exports.selector = selector;
28079
- exports.selectorAll = selectorAll;
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 nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23904
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
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 nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23911
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "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 nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23930
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "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 nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23949
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23950
23950
  }
23951
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23951
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23952
23952
  v: nextMatch1
23953
23953
  };
23954
23954
  };
@@ -28016,37 +28016,40 @@ let HtmlService = class HtmlService {
28016
28016
  }
28017
28017
  async parseHtml(params, _pinsSettingsList, context) {
28018
28018
  const { html, execute = [] } = params;
28019
+ const dom = new JSDOM(html);
28019
28020
  const result = await executePinsList(execute, {
28020
28021
  context,
28021
- document: html
28022
+ document: {
28023
+ querySelector: (selector)=>this.querySelector(selector, dom.window.document),
28024
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, dom.window.document)
28025
+ }
28022
28026
  });
28023
28027
  return result;
28024
28028
  }
28025
- async selector(params, _pinsSettingsList, context) {
28026
- const { selector, html = context.document } = params;
28027
- const dom = new JSDOM(html);
28028
- const element = dom.window.document.querySelector(selector);
28029
- return element;
28030
- }
28031
- async selectorAll(params, _pinsSettingsList, context) {
28032
- const { selector, html = context.document } = params;
28033
- const dom = new JSDOM(html);
28034
- const element = dom.window.document.querySelectorAll(selector);
28035
- return element;
28029
+ querySelector(selector, parent) {
28030
+ const element = parent == null ? void 0 : parent.querySelector(selector);
28031
+ return element ? {
28032
+ textContent: element.textContent,
28033
+ querySelector: (selector)=>this.querySelector(selector, element),
28034
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28035
+ getAttribute: (name)=>this.getAttribute(name, element)
28036
+ } : undefined;
28037
+ }
28038
+ querySelectorAll(selector, parent) {
28039
+ const elements = Array.from((parent == null ? void 0 : parent.querySelectorAll(selector)) || []);
28040
+ return elements.map((element)=>({
28041
+ textContent: element.textContent,
28042
+ querySelector: (selector)=>this.querySelector(selector, element),
28043
+ querySelectorAll: (selector)=>this.querySelectorAll(selector, element),
28044
+ getAttribute: (name)=>this.getAttribute(name, element)
28045
+ }));
28036
28046
  }
28037
- getAttribute(params, _pinsSettingsList, context) {
28038
- const { selector, attribute, html = context.document } = params;
28039
- const dom = new JSDOM(html);
28040
- const element = dom.window.document.querySelectorAll(selector);
28041
- const result = element.getAttribute(attribute);
28042
- return result;
28047
+ getAttribute(name, element) {
28048
+ return element == null ? void 0 : element.getAttribute(name);
28043
28049
  }
28044
28050
  };
28045
28051
  const html2pins = (params, pinsSettingsList, context)=>new HtmlService().html2pins(params, pinsSettingsList, context);
28046
28052
  const pins2html = (params, pinsSettingsList, context)=>new HtmlService().pins2html(params, pinsSettingsList, context);
28047
28053
  const parseHtml = (params, pinsSettingsList, context)=>new HtmlService().parseHtml(params, pinsSettingsList, context);
28048
- const selector = (params, pinsSettingsList, context)=>new HtmlService().selector(params, pinsSettingsList, context);
28049
- const selectorAll = (params, pinsSettingsList, context)=>new HtmlService().selectorAll(params, pinsSettingsList, context);
28050
- const getAttribute = (params, pinsSettingsList, context)=>new HtmlService().getAttribute(params, pinsSettingsList, context);
28051
28054
 
28052
- export { getAttribute, html2pins, parseHtml, pins2html, selector, selectorAll };
28055
+ export { html2pins, parseHtml, pins2html };
@@ -2,6 +2,3 @@ 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.4",
3
+ "version": "0.60.7",
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": {