@vandenberghinc/volt 1.2.5 → 1.2.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.
Files changed (39) hide show
  1. package/backend/dist/cjs/backend/src/frontend.d.ts +2 -0
  2. package/backend/dist/cjs/backend/src/frontend.js +20 -1
  3. package/backend/dist/cjs/backend/src/server.js +2 -5
  4. package/backend/dist/esm/backend/src/frontend.d.ts +2 -0
  5. package/backend/dist/esm/backend/src/frontend.js +12 -1
  6. package/backend/dist/esm/backend/src/server.js +2 -5
  7. package/frontend/assets/admin/admin.png +0 -0
  8. package/frontend/assets/admin/password.webp +0 -0
  9. package/frontend/assets/icons/arrow.v1.webp +0 -0
  10. package/frontend/assets/icons/copy.webp +0 -0
  11. package/frontend/assets/payments/arrow.long.webp +0 -0
  12. package/frontend/assets/payments/arrow.long2.webp +0 -0
  13. package/frontend/assets/payments/cancelled.webp +0 -0
  14. package/frontend/assets/payments/check.sign.webp +0 -0
  15. package/frontend/assets/payments/check.webp +0 -0
  16. package/frontend/assets/payments/close.webp +0 -0
  17. package/frontend/assets/payments/error.webp +0 -0
  18. package/frontend/assets/payments/exclamation.webp +0 -0
  19. package/frontend/assets/payments/minus.webp +0 -0
  20. package/frontend/assets/payments/party.webp +0 -0
  21. package/frontend/assets/payments/plus.webp +0 -0
  22. package/frontend/assets/payments/shopping_cart.webp +0 -0
  23. package/frontend/assets/payments/trash.webp +0 -0
  24. package/frontend/css/adyen.css +92 -0
  25. package/frontend/css/volt.css +75 -0
  26. package/frontend/dist/backend/src/frontend.d.ts +2 -0
  27. package/frontend/dist/backend/src/frontend.js +12 -1
  28. package/frontend/dist/backend/src/server.js +2 -5
  29. package/package.json +10 -1
  30. package/.libris/config.json +0 -82
  31. package/backend/old/file_watcher.ts +0 -359
  32. package/backend/old/request.deprc.js +0 -626
  33. package/backend/old/response.deprc.js +0 -354
  34. package/frontend/examples/theme/theme.ts +0 -58
  35. package/frontend/tools/bundle_d_ts.js +0 -71
  36. package/frontend/tools/convert_to_jsdoc_input.txt +0 -9452
  37. package/frontend/tools/convert_to_jsdoc_output.txt +0 -7626
  38. package/frontend/tools/convert_to_jsdoc_tmp.js +0 -345
  39. package/frontend/tools/scan_mixed_imports.js +0 -69
@@ -1,345 +0,0 @@
1
- function convertToJSDoc(code) {
2
- // Helper function to clean and format multi-line text
3
- const formatMultilineText = (text, indent) => {
4
- return text
5
- .split('\n')
6
- .map(l => l.replace(/^\s*\*\s?/, '').trim())
7
- .filter(Boolean)
8
- .join("\n" + indent + ' * ');
9
- };
10
-
11
- // Helper: convert old docstring to JSDoc format
12
- const convertDocstring = (docstring, indent = ' ') => {
13
- // Support @desc: or @description:
14
- const titleMatch = docstring.match(/@title:\s*([^\n]*)/i);
15
- const descMatch = docstring.match(/@(desc|descr|description):\s*([\s\S]+?)(?=@param:|@return:|@funcs:|\*\/)/i);
16
-
17
-
18
- // Support @descr: or @description: inside @param:
19
- const paramNameMatch = docstring.match(/@param:[\s\S]*?@name:\s*([^\n]*)/i);
20
- const paramDescrMatch = docstring.match(/@param:[\s\S]*?@(desc|descr|description):\s*:?\s*([\s\S]+?)(?=@return:|@funcs:|\*\/)/i);
21
-
22
- // Allow optional colon after @description and trim before @funcs or */
23
- const returnDescMatch = docstring.match(/@return:[\s\S]*?@(desc|descr|description)\s*:?\s*([\s\S]+?)(?=@funcs:|\*\/)/i);
24
-
25
- const lines = [];
26
- lines.push(indent + '/**');
27
-
28
- // Build summary from title + description if present
29
- const title = titleMatch ? titleMatch[1].trim() : '';
30
- const desc = descMatch ? formatMultilineText(descMatch[2].trim(), indent) : '';
31
- if (!desc) {
32
- throw new Error("No description found for docstring:\n" + fullDocstring);
33
- }
34
- lines.push(indent + ' * {' + title + "}");
35
- lines.push(indent + ' * ' + desc);
36
- // if (title || desc) {
37
- // const summary = [title, desc].filter(Boolean).join(' — ');
38
- // lines.push(indent + ' * ' + summary);
39
- // }
40
-
41
- if (paramNameMatch && paramDescrMatch) {
42
- const cleanParamDescr = formatMultilineText(paramDescrMatch[2].trim(), indent);
43
- lines.push(indent + ` * @param ${paramNameMatch[1].trim()} ${cleanParamDescr}`);
44
- }
45
-
46
- if (returnDescMatch) {
47
- const cleanReturnDesc = formatMultilineText(returnDescMatch[2].trim(), indent);
48
- lines.push(indent + ` * @returns ${cleanReturnDesc}`);
49
- }
50
-
51
- lines.push(indent + ' * @docs');
52
- lines.push(indent + ' */');
53
-
54
- return lines.join('\n');
55
- };
56
-
57
- // Split code into lines for easier processing
58
- const lines = code.split('\n');
59
- const result = [];
60
- let i = 0;
61
-
62
- while (i < lines.length) {
63
- const line = lines[i];
64
-
65
- // Check if this line starts a docstring
66
- if (line.trim().startsWith('/**') && i + 1 < lines.length) {
67
- // Find the end of the docstring
68
- let docEnd = i;
69
- let docContent = [line];
70
-
71
- for (let j = i + 1; j < lines.length; j++) {
72
- docContent.push(lines[j]);
73
- if (lines[j].trim().endsWith('*/')) {
74
- docEnd = j;
75
- break;
76
- }
77
- }
78
-
79
- const fullDocstring = docContent.join('\n');
80
-
81
- // Check if it's an old-format docstring
82
- if (fullDocstring.includes('@docs:')) {
83
- // This is an old-format docstring that needs conversion
84
-
85
- // Look ahead to find function signatures
86
- let searchIdx = docEnd + 1;
87
- let functionName = null;
88
- let overloads = [];
89
- let implementation = null;
90
- let implLineIdx = -1;
91
-
92
- while (searchIdx < lines.length) {
93
- const searchLine = lines[searchIdx].trim();
94
-
95
- if (searchLine === '') {
96
- searchIdx++;
97
- continue;
98
- }
99
-
100
- // Check if this looks like a function signature
101
- const funcMatch = searchLine.match(/^(\w+)\s*\([^)]*\)[^;{]*([;{])/);
102
-
103
- if (funcMatch) {
104
- const funcName = funcMatch[1];
105
- const isImpl = funcMatch[2] === '{' ||
106
- (searchIdx + 1 < lines.length && lines[searchIdx + 1].trim().startsWith('{'));
107
-
108
- if (!functionName) {
109
- functionName = funcName;
110
- }
111
-
112
- if (funcName === functionName) {
113
- if (!isImpl) {
114
- overloads.push({
115
- line: searchLine,
116
- lineIdx: searchIdx
117
- });
118
- } else {
119
- implementation = searchLine;
120
- implLineIdx = searchIdx;
121
- break;
122
- }
123
- } else {
124
- // Different function, stop
125
- break;
126
- }
127
- } else {
128
- // Not a function signature, stop
129
- break;
130
- }
131
-
132
- searchIdx++;
133
- }
134
-
135
- // Get the indent from the implementation line or first overload
136
- let indent = ' ';
137
- if (implLineIdx > -1) {
138
- const leadingSpace = lines[implLineIdx].match(/^(\s*)/);
139
- if (leadingSpace) {
140
- indent = leadingSpace[1];
141
- }
142
- } else if (overloads.length > 0) {
143
- const leadingSpace = lines[overloads[0].lineIdx].match(/^(\s*)/);
144
- if (leadingSpace) {
145
- indent = leadingSpace[1];
146
- }
147
- }
148
-
149
- // Convert the docstring
150
- const jsdoc = convertDocstring(fullDocstring, indent);
151
-
152
- if (implLineIdx > -1 && overloads.length > 0) {
153
- // We have overloads and implementation - don't add docstring yet
154
- // Add the overloads without docstring
155
- for (const overload of overloads) {
156
- result.push(lines[overload.lineIdx]);
157
- }
158
-
159
- // Add the JSDoc before implementation
160
- result.push(jsdoc);
161
- result.push(lines[implLineIdx]);
162
-
163
- // Skip past all the lines we've processed
164
- i = implLineIdx + 1;
165
- } else {
166
- // No overloads or no implementation - put JSDoc in place
167
- result.push(jsdoc);
168
-
169
- // Add any functions we found
170
- if (overloads.length > 0) {
171
- for (const overload of overloads) {
172
- result.push(lines[overload.lineIdx]);
173
- }
174
- i = overloads[overloads.length - 1].lineIdx + 1;
175
- } else if (implLineIdx > -1) {
176
- result.push(lines[implLineIdx]);
177
- i = implLineIdx + 1;
178
- } else {
179
- i = docEnd + 1;
180
- }
181
- }
182
- } else {
183
- // Not an old-format docstring, keep as-is
184
- for (const docLine of docContent) {
185
- result.push(docLine);
186
- }
187
- i = docEnd + 1;
188
- }
189
- } else {
190
- // Not a docstring line, keep as-is
191
- result.push(line);
192
- i++;
193
- }
194
- }
195
-
196
- const convertedCode = result.join('\n');
197
-
198
- // Check for any remaining old-format patterns
199
- const checkPatterns = [
200
- /@docs:/g,
201
- /@title:/g,
202
- /@param:\s*\n\s*@name:/g,
203
- /@return:\s*\n\s*@description/g,
204
- /@funcs:/g
205
- ];
206
-
207
- let hasRemaining = false;
208
- checkPatterns.forEach(pattern => {
209
- if (pattern.test(convertedCode)) {
210
- hasRemaining = true;
211
- }
212
- });
213
-
214
- if (hasRemaining) {
215
- console.log('āš ļø Some old-format patterns may remain in the converted code');
216
- } else {
217
- console.log('āœ… All docstrings successfully converted!');
218
- }
219
-
220
- return convertedCode;
221
- }
222
-
223
-
224
- // Example usage
225
- const test_code = `
226
- /**
227
- * @docs:
228
- * @title: On Suspend
229
- * @desc: Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason. The equivalent of HTML attribute \`onsuspend\`.
230
- * @param:
231
- * @name: callback
232
- * @descr: The function to be executed when the suspend event occurs. The first parameter of the callback is the \`VElement\` object.
233
- * @return:
234
- * @description Returns the \`VElement\` object. Unless parameter \`value\` is \`null\`, then the attribute's value is returned.
235
- * @funcs: 2
236
- */
237
- on_suspend(): Function | undefined;
238
- on_suspend(callback: Function): this;
239
- on_suspend(callback?: Function): this | Function | undefined {
240
- if (callback == null) { return this.onsuspend ?? undefined; }
241
- const e = this;
242
- this.onsuspend = (t) => callback(e, t);
243
- return this;
244
- }
245
-
246
- /**
247
- * @docs:
248
- * @title: On Time Update
249
- * @desc: Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media). The equivalent of HTML attribute \`ontimeupdate\`.
250
- * @param:
251
- * @name: callback
252
- * @descr: The callback function to execute when the time updates. The first parameter of the callback is the \`VElement\` object.
253
- * @return:
254
- * @description Returns the \`VElement\` object. Unless parameter \`callback\` is \`null\`, then the attribute's value is returned.
255
- * @funcs: 2
256
- */
257
- on_time_update(): Function | undefined;
258
- on_time_update(callback: ElementEvent<this>): this;
259
- on_time_update(callback?: ElementEvent<this>): this | Function | undefined {
260
- if (callback == null) { return this.ontimeupdate ?? undefined; }
261
- const e = this;
262
- this.ontimeupdate = (t) => callback(e, t);
263
- return this;
264
- }
265
-
266
- /**
267
- * @docs:
268
- * @title: On Volume Change
269
- * @desc: Script to be run each time the volume is changed which includes setting the volume to "mute".
270
- * The equivalent of HTML attribute \`onvolumechange\`. The first parameter of the callback is the \`VElement\` object.
271
- * @param:
272
- * @name: callback
273
- * @descr: The callback function to execute on volume change.
274
- * @return:
275
- * @description Returns the \`VElement\` object for chaining unless parameter \`value\` is \`null\`, then the attribute's value is returned.
276
- * @funcs: 2
277
- */
278
- on_volume_change(): Function | undefined;
279
- on_volume_change(callback: ElementEvent<this>): this;
280
- on_volume_change(callback?: ElementEvent<this>): this | Function | undefined {
281
- if (callback == null) { return this.onvolumechange ?? undefined; }
282
- const e = this;
283
- this.onvolumechange = (t) => callback(e, t);
284
- return this;
285
- }
286
-
287
- /**
288
- * @docs:
289
- * @title: On Waiting
290
- * @desc: Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data). The equivalent of HTML attribute \`onwaiting\`.
291
- * @param:
292
- * @name: callback
293
- * @descr: The callback function to execute when the media is waiting.
294
- * @return:
295
- * @description Returns the \`VElement\` object unless parameter \`callback\` is \`null\`, then the attribute's value is returned.
296
- * @funcs: 2
297
- */
298
- on_waiting(): Function | undefined;
299
- on_waiting(callback: (element: this, time: any) => any): this;
300
- on_waiting(callback?: (element: this, time: any) => any): this | Function | undefined {
301
- if (callback == null) { return this.onwaiting ?? undefined; }
302
- const e = this;
303
- this.onwaiting = (t) => callback(e, t);
304
- return this;
305
- }
306
-
307
- /**
308
- * @docs:
309
- * @title: On toggle
310
- * @desc: Fires when the user opens or closes the \<details> element.
311
- * The equivalent of HTML attribute \`ontoggle\`.
312
- * The first parameter of the callback is the \`VElement\` object.
313
- * @param:
314
- * @name: value
315
- * @descr: The value to assign. Leave \`null\` to retrieve the attribute's value.
316
- * @return:
317
- * @description Returns the \`VElement\` object. Unless parameter \`value\` is \`null\`, then the attribute's value is returned.
318
- * @funcs: 2
319
- */
320
- on_toggle() : Function | undefined;
321
- on_toggle(callback: ElementEvent<this>): this;
322
- on_toggle(callback?: ElementEvent<this>): this | Function | undefined {
323
- if (callback == null) { return this.ontoggle ?? undefined; }
324
- const e = this;
325
- this.ontoggle = (t) => callback(e, t);
326
- return this;
327
- }
328
-
329
-
330
- `;
331
-
332
- // Convert the code
333
- // const convertedCode = convertToJSDoc(test_code);
334
- // console.log('\nšŸ“„ Converted Code:=======================\n'+convertedCode + "\n=====================");
335
-
336
- // From file.
337
- import { fileURLToPath } from 'url';
338
- import * as path from 'path';
339
- const __filename = fileURLToPath(import.meta.url);
340
- const __dirname = path.dirname(__filename);
341
- import * as vlib from "@vandenberghinc/vlib"
342
-
343
- const data = new vlib.Path(__dirname + "/convert_to_jsdoc_input.txt").load_sync();
344
- const converted = convertToJSDoc(data);
345
- new vlib.Path(__dirname + "/convert_to_jsdoc_output.txt").save_sync(converted);
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env node
2
- // scan-mixed-imports.js
3
- // ESM script to detect mixed import specifiers resolving to the same real file
4
-
5
- import { existsSync } from 'fs';
6
- import fs from 'fs/promises';
7
- import path from 'path';
8
- import { glob } from 'glob';
9
- import resolve from 'resolve';
10
-
11
- async function main() {
12
- // Adjust pattern to match your source directories
13
- // const target = `/Users/administrator/persistance/private/dev/libris/libris/src/frontend`;
14
- const target = `src`;
15
- if (!existsSync(target)) {
16
- console.error(`Target directory does not exist: ${target}`);
17
- process.exit(1);
18
- }
19
- const patterns = [target + '/**/*.{js,jsx,ts,tsx}'];
20
- const files = await glob(patterns, { nodir: true });
21
-
22
- // Map real absolute file path -> Set of import specifiers
23
- const realMap = new Map();
24
-
25
- for (const file of files) {
26
- const code = await fs.readFile(file, 'utf8');
27
- // Regexes for static import, require(), and dynamic import()
28
- const staticRe = /import\s+(?:[\w*\s{},]+\s+from\s+)?['"]([^'"]+)['"]/g;
29
- const requireRe = /require\(\s*['"]([^'"]+)['"]\s*\)/g;
30
- const dynamicRe = /import\(\s*['"]([^'"]+)['"]\s*\)/g;
31
-
32
-
33
- for (const re of [staticRe, requireRe, dynamicRe]) {
34
- let match;
35
- // console.log(re, re.exec(code))
36
- while ((match = re.exec(code))) {
37
- const spec = match[1];
38
- try {
39
- const realPath = resolve.sync(spec, { basedir: path.dirname(file) });
40
- const absPath = path.resolve(realPath);
41
- if (!realMap.has(absPath)) realMap.set(absPath, new Set());
42
- realMap.get(absPath).add(spec);
43
- } catch {
44
- // Ignore unresolved (built-in or external)
45
- }
46
- }
47
- }
48
- }
49
-
50
- let found = false;
51
- for (const [realPath, specs] of realMap) {
52
- if (specs.size > 1) {
53
- found = true;
54
- console.log(`\nāš ļø Mixed imports for: ${realPath}`);
55
- console.log(` Specifiers: ${[...specs].map(s => `'${s}'`).join(', ')}`);
56
- }
57
- }
58
-
59
- if (!found) {
60
- console.log('āœ… No mixed import paths detected.');
61
- } else {
62
- process.exitCode = 1;
63
- }
64
- }
65
-
66
- main().catch(err => {
67
- console.error(err);
68
- process.exit(1);
69
- });