hyperclayjs 1.1.0 → 1.1.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/hyperclay.js +287 -39
- package/package.json +2 -2
package/hyperclay.js
CHANGED
|
@@ -25,13 +25,27 @@
|
|
|
25
25
|
(async function() {
|
|
26
26
|
'use strict';
|
|
27
27
|
|
|
28
|
+
// Create a promise that resolves when hyperclay is ready
|
|
29
|
+
let hyperclayReadyResolve;
|
|
30
|
+
window.hyperclayReady = new Promise(resolve => {
|
|
31
|
+
hyperclayReadyResolve = resolve;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Initialize namespaces
|
|
35
|
+
window.hyperclay = window.hyperclay || {};
|
|
36
|
+
|
|
28
37
|
// Module dependency map - AUTO-GENERATED
|
|
29
38
|
const moduleDependencies = {
|
|
30
39
|
"save-core": {
|
|
31
40
|
"path": "./core/savePageCore.js",
|
|
32
41
|
"dependencies": [
|
|
33
42
|
"cookie"
|
|
34
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"exports": {
|
|
45
|
+
"savePage": [
|
|
46
|
+
"hyperclay"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
35
49
|
},
|
|
36
50
|
"save": {
|
|
37
51
|
"path": "./core/savePage.js",
|
|
@@ -40,62 +54,120 @@
|
|
|
40
54
|
"toast",
|
|
41
55
|
"mutation",
|
|
42
56
|
"throttle"
|
|
43
|
-
]
|
|
57
|
+
],
|
|
58
|
+
"exports": {
|
|
59
|
+
"beforeSave": [
|
|
60
|
+
"hyperclay"
|
|
61
|
+
],
|
|
62
|
+
"savePage": [
|
|
63
|
+
"hyperclay"
|
|
64
|
+
],
|
|
65
|
+
"replacePageWith": [
|
|
66
|
+
"hyperclay"
|
|
67
|
+
],
|
|
68
|
+
"initHyperclaySaveButton": [
|
|
69
|
+
"hyperclay"
|
|
70
|
+
],
|
|
71
|
+
"initSaveKeyboardShortcut": [
|
|
72
|
+
"hyperclay"
|
|
73
|
+
],
|
|
74
|
+
"initSavePageOnChange": [
|
|
75
|
+
"hyperclay"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
44
78
|
},
|
|
45
79
|
"admin": {
|
|
46
80
|
"path": "./core/adminSystem.js",
|
|
47
81
|
"dependencies": [
|
|
48
82
|
"save",
|
|
49
83
|
"dom-ready"
|
|
50
|
-
]
|
|
84
|
+
],
|
|
85
|
+
"exports": {}
|
|
51
86
|
},
|
|
52
87
|
"persist": {
|
|
53
88
|
"path": "./core/enablePersistentFormInputValues.js",
|
|
54
89
|
"dependencies": [
|
|
55
90
|
"save"
|
|
56
|
-
]
|
|
91
|
+
],
|
|
92
|
+
"exports": {
|
|
93
|
+
"enablePersistentFormInputValues": [
|
|
94
|
+
"hyperclay"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
57
97
|
},
|
|
58
98
|
"options": {
|
|
59
99
|
"path": "./core/optionVisibilityRuleGenerator.js",
|
|
60
100
|
"dependencies": [
|
|
61
101
|
"mutation"
|
|
62
|
-
]
|
|
102
|
+
],
|
|
103
|
+
"exports": {
|
|
104
|
+
"optionVisibilityRuleGenerator": [
|
|
105
|
+
"window",
|
|
106
|
+
"hyperclay"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
63
109
|
},
|
|
64
110
|
"editmode": {
|
|
65
111
|
"path": "./core/editmodeSystem.js",
|
|
66
112
|
"dependencies": [
|
|
67
113
|
"save",
|
|
68
114
|
"dom-ready"
|
|
69
|
-
]
|
|
115
|
+
],
|
|
116
|
+
"exports": {
|
|
117
|
+
"toggleEditMode": [
|
|
118
|
+
"hyperclay"
|
|
119
|
+
],
|
|
120
|
+
"isEditMode": [
|
|
121
|
+
"hyperclay"
|
|
122
|
+
],
|
|
123
|
+
"isOwner": [
|
|
124
|
+
"hyperclay"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
70
127
|
},
|
|
71
128
|
"events": {
|
|
72
129
|
"path": "./custom-attributes/events.js",
|
|
73
130
|
"dependencies": [
|
|
74
131
|
"mutation",
|
|
75
132
|
"window-load"
|
|
76
|
-
]
|
|
133
|
+
],
|
|
134
|
+
"exports": {}
|
|
77
135
|
},
|
|
78
136
|
"ajax": {
|
|
79
137
|
"path": "./custom-attributes/ajaxElements.js",
|
|
80
138
|
"dependencies": [
|
|
81
139
|
"get-data-from-form"
|
|
82
|
-
]
|
|
140
|
+
],
|
|
141
|
+
"exports": {}
|
|
83
142
|
},
|
|
84
143
|
"sortable": {
|
|
85
144
|
"path": "./custom-attributes/sortable.js",
|
|
86
145
|
"dependencies": [
|
|
87
146
|
"mutation"
|
|
88
|
-
]
|
|
147
|
+
],
|
|
148
|
+
"exports": {
|
|
149
|
+
"Sortable": [
|
|
150
|
+
"window",
|
|
151
|
+
"hyperclay"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
89
154
|
},
|
|
90
155
|
"helpers": {
|
|
91
156
|
"path": "./custom-attributes/domHelpers.js",
|
|
92
157
|
"dependencies": [
|
|
93
158
|
"nearest"
|
|
94
|
-
]
|
|
159
|
+
],
|
|
160
|
+
"exports": {
|
|
161
|
+
"initCustomAttributes": [
|
|
162
|
+
"window",
|
|
163
|
+
"hyperclay"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
95
166
|
},
|
|
96
167
|
"inputs": {
|
|
97
168
|
"path": "./custom-attributes/inputHelpers.js",
|
|
98
|
-
"dependencies": []
|
|
169
|
+
"dependencies": [],
|
|
170
|
+
"exports": {}
|
|
99
171
|
},
|
|
100
172
|
"prompts": {
|
|
101
173
|
"path": "./ui/prompts.js",
|
|
@@ -104,92 +176,219 @@
|
|
|
104
176
|
"copy-to-clipboard",
|
|
105
177
|
"modals",
|
|
106
178
|
"toast"
|
|
107
|
-
]
|
|
179
|
+
],
|
|
180
|
+
"exports": {
|
|
181
|
+
"ask": [
|
|
182
|
+
"window",
|
|
183
|
+
"hyperclay"
|
|
184
|
+
],
|
|
185
|
+
"consent": [
|
|
186
|
+
"window",
|
|
187
|
+
"hyperclay"
|
|
188
|
+
],
|
|
189
|
+
"tell": [
|
|
190
|
+
"window",
|
|
191
|
+
"hyperclay"
|
|
192
|
+
],
|
|
193
|
+
"snippet": [
|
|
194
|
+
"hyperclay"
|
|
195
|
+
],
|
|
196
|
+
"showApiKey": [
|
|
197
|
+
"hyperclay"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
108
200
|
},
|
|
109
201
|
"toast": {
|
|
110
202
|
"path": "./ui/toast.js",
|
|
111
|
-
"dependencies": []
|
|
203
|
+
"dependencies": [],
|
|
204
|
+
"exports": {
|
|
205
|
+
"toast": [
|
|
206
|
+
"window",
|
|
207
|
+
"hyperclay"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
112
210
|
},
|
|
113
211
|
"modals": {
|
|
114
212
|
"path": "./ui/theModal.js",
|
|
115
|
-
"dependencies": []
|
|
213
|
+
"dependencies": [],
|
|
214
|
+
"exports": {
|
|
215
|
+
"themodal": [
|
|
216
|
+
"window",
|
|
217
|
+
"hyperclay"
|
|
218
|
+
]
|
|
219
|
+
}
|
|
116
220
|
},
|
|
117
221
|
"info": {
|
|
118
222
|
"path": "./ui/info.js",
|
|
119
223
|
"dependencies": [
|
|
120
224
|
"dom-ready",
|
|
121
225
|
"modals"
|
|
122
|
-
]
|
|
226
|
+
],
|
|
227
|
+
"exports": {
|
|
228
|
+
"info": [
|
|
229
|
+
"window",
|
|
230
|
+
"hyperclay"
|
|
231
|
+
]
|
|
232
|
+
}
|
|
123
233
|
},
|
|
124
234
|
"tailwind-play": {
|
|
125
235
|
"path": "./vendor/tailwind-play.js",
|
|
126
236
|
"dependencies": [
|
|
127
237
|
"style-injection"
|
|
128
|
-
]
|
|
238
|
+
],
|
|
239
|
+
"exports": {}
|
|
129
240
|
},
|
|
130
241
|
"mutation": {
|
|
131
242
|
"path": "./utilities/mutation.js",
|
|
132
|
-
"dependencies": []
|
|
243
|
+
"dependencies": [],
|
|
244
|
+
"exports": {
|
|
245
|
+
"Mutation": [
|
|
246
|
+
"window",
|
|
247
|
+
"hyperclay"
|
|
248
|
+
]
|
|
249
|
+
}
|
|
133
250
|
},
|
|
134
251
|
"nearest": {
|
|
135
252
|
"path": "./utilities/nearest.js",
|
|
136
|
-
"dependencies": []
|
|
253
|
+
"dependencies": [],
|
|
254
|
+
"exports": {
|
|
255
|
+
"nearest": [
|
|
256
|
+
"window",
|
|
257
|
+
"hyperclay"
|
|
258
|
+
]
|
|
259
|
+
}
|
|
137
260
|
},
|
|
138
261
|
"cookie": {
|
|
139
262
|
"path": "./utilities/cookie.js",
|
|
140
|
-
"dependencies": []
|
|
263
|
+
"dependencies": [],
|
|
264
|
+
"exports": {
|
|
265
|
+
"cookie": [
|
|
266
|
+
"window",
|
|
267
|
+
"hyperclay"
|
|
268
|
+
]
|
|
269
|
+
}
|
|
141
270
|
},
|
|
142
271
|
"throttle": {
|
|
143
272
|
"path": "./utilities/throttle.js",
|
|
144
|
-
"dependencies": []
|
|
273
|
+
"dependencies": [],
|
|
274
|
+
"exports": {
|
|
275
|
+
"throttle": [
|
|
276
|
+
"hyperclay"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
145
279
|
},
|
|
146
280
|
"debounce": {
|
|
147
281
|
"path": "./utilities/debounce.js",
|
|
148
|
-
"dependencies": []
|
|
282
|
+
"dependencies": [],
|
|
283
|
+
"exports": {
|
|
284
|
+
"debounce": [
|
|
285
|
+
"hyperclay"
|
|
286
|
+
]
|
|
287
|
+
}
|
|
149
288
|
},
|
|
150
289
|
"dom-ready": {
|
|
151
290
|
"path": "./dom-utilities/onDomReady.js",
|
|
152
|
-
"dependencies": []
|
|
291
|
+
"dependencies": [],
|
|
292
|
+
"exports": {
|
|
293
|
+
"onDomReady": [
|
|
294
|
+
"hyperclay"
|
|
295
|
+
]
|
|
296
|
+
}
|
|
153
297
|
},
|
|
154
298
|
"window-load": {
|
|
155
299
|
"path": "./dom-utilities/onLoad.js",
|
|
156
|
-
"dependencies": []
|
|
300
|
+
"dependencies": [],
|
|
301
|
+
"exports": {
|
|
302
|
+
"onLoad": [
|
|
303
|
+
"hyperclay"
|
|
304
|
+
]
|
|
305
|
+
}
|
|
157
306
|
},
|
|
158
307
|
"jquery-like": {
|
|
159
308
|
"path": "./dom-utilities/All.js",
|
|
160
|
-
"dependencies": []
|
|
309
|
+
"dependencies": [],
|
|
310
|
+
"exports": {
|
|
311
|
+
"All": [
|
|
312
|
+
"window",
|
|
313
|
+
"hyperclay"
|
|
314
|
+
]
|
|
315
|
+
}
|
|
161
316
|
},
|
|
162
317
|
"style-injection": {
|
|
163
318
|
"path": "./dom-utilities/insertStyleTag.js",
|
|
164
|
-
"dependencies": []
|
|
319
|
+
"dependencies": [],
|
|
320
|
+
"exports": {
|
|
321
|
+
"insertStyleTag": [
|
|
322
|
+
"window",
|
|
323
|
+
"hyperclay"
|
|
324
|
+
]
|
|
325
|
+
}
|
|
165
326
|
},
|
|
166
327
|
"get-data-from-form": {
|
|
167
328
|
"path": "./dom-utilities/getDataFromForm.js",
|
|
168
|
-
"dependencies": []
|
|
329
|
+
"dependencies": [],
|
|
330
|
+
"exports": {
|
|
331
|
+
"getDataFromForm": [
|
|
332
|
+
"window",
|
|
333
|
+
"hyperclay"
|
|
334
|
+
]
|
|
335
|
+
}
|
|
169
336
|
},
|
|
170
337
|
"dom-morphing": {
|
|
171
338
|
"path": "./vendor/idiomorph.min.js",
|
|
172
|
-
"dependencies": []
|
|
339
|
+
"dependencies": [],
|
|
340
|
+
"exports": {
|
|
341
|
+
"Idiomorph": [
|
|
342
|
+
"hyperclay"
|
|
343
|
+
]
|
|
344
|
+
}
|
|
173
345
|
},
|
|
174
346
|
"slugify": {
|
|
175
347
|
"path": "./string-utilities/slugify.js",
|
|
176
|
-
"dependencies": []
|
|
348
|
+
"dependencies": [],
|
|
349
|
+
"exports": {
|
|
350
|
+
"slugify": [
|
|
351
|
+
"window",
|
|
352
|
+
"hyperclay"
|
|
353
|
+
]
|
|
354
|
+
}
|
|
177
355
|
},
|
|
178
356
|
"emmet-html": {
|
|
179
357
|
"path": "./string-utilities/emmet-html.js",
|
|
180
|
-
"dependencies": []
|
|
358
|
+
"dependencies": [],
|
|
359
|
+
"exports": {
|
|
360
|
+
"emmet": [
|
|
361
|
+
"hyperclay"
|
|
362
|
+
]
|
|
363
|
+
}
|
|
181
364
|
},
|
|
182
365
|
"copy-to-clipboard": {
|
|
183
366
|
"path": "./string-utilities/copy-to-clipboard.js",
|
|
184
|
-
"dependencies": []
|
|
367
|
+
"dependencies": [],
|
|
368
|
+
"exports": {
|
|
369
|
+
"copyToClipboard": [
|
|
370
|
+
"hyperclay"
|
|
371
|
+
]
|
|
372
|
+
}
|
|
185
373
|
},
|
|
186
374
|
"query-parser": {
|
|
187
375
|
"path": "./string-utilities/query.js",
|
|
188
|
-
"dependencies": []
|
|
376
|
+
"dependencies": [],
|
|
377
|
+
"exports": {
|
|
378
|
+
"query": [
|
|
379
|
+
"window",
|
|
380
|
+
"hyperclay"
|
|
381
|
+
]
|
|
382
|
+
}
|
|
189
383
|
},
|
|
190
384
|
"behavior-collector": {
|
|
191
385
|
"path": "./communication/behaviorCollector.js",
|
|
192
|
-
"dependencies": []
|
|
386
|
+
"dependencies": [],
|
|
387
|
+
"exports": {
|
|
388
|
+
"behaviorCollector": [
|
|
389
|
+
"hyperclay"
|
|
390
|
+
]
|
|
391
|
+
}
|
|
193
392
|
},
|
|
194
393
|
"send-message": {
|
|
195
394
|
"path": "./communication/sendMessage.js",
|
|
@@ -197,7 +396,12 @@
|
|
|
197
396
|
"behavior-collector",
|
|
198
397
|
"get-data-from-form",
|
|
199
398
|
"toast"
|
|
200
|
-
]
|
|
399
|
+
],
|
|
400
|
+
"exports": {
|
|
401
|
+
"sendMessage": [
|
|
402
|
+
"hyperclay"
|
|
403
|
+
]
|
|
404
|
+
}
|
|
201
405
|
},
|
|
202
406
|
"file-upload": {
|
|
203
407
|
"path": "./communication/uploadFile.js",
|
|
@@ -205,7 +409,18 @@
|
|
|
205
409
|
"copy-to-clipboard",
|
|
206
410
|
"toast",
|
|
207
411
|
"debounce"
|
|
208
|
-
]
|
|
412
|
+
],
|
|
413
|
+
"exports": {
|
|
414
|
+
"uploadFile": [
|
|
415
|
+
"hyperclay"
|
|
416
|
+
],
|
|
417
|
+
"createFile": [
|
|
418
|
+
"hyperclay"
|
|
419
|
+
],
|
|
420
|
+
"uploadFileBasic": [
|
|
421
|
+
"hyperclay"
|
|
422
|
+
]
|
|
423
|
+
}
|
|
209
424
|
}
|
|
210
425
|
};
|
|
211
426
|
|
|
@@ -387,11 +602,6 @@
|
|
|
387
602
|
loaded.init();
|
|
388
603
|
}
|
|
389
604
|
|
|
390
|
-
// Make module available globally if it exports to window
|
|
391
|
-
if (loaded.exportToWindow && typeof loaded.exportToWindow === 'function') {
|
|
392
|
-
loaded.exportToWindow();
|
|
393
|
-
}
|
|
394
|
-
|
|
395
605
|
return loaded;
|
|
396
606
|
} catch (error) {
|
|
397
607
|
console.error(`HyperclayJS: Failed to load ${feature}:`, error);
|
|
@@ -426,6 +636,39 @@
|
|
|
426
636
|
// Store loaded modules globally for access
|
|
427
637
|
window.hyperclayModules = loadedModules;
|
|
428
638
|
|
|
639
|
+
// Attach exports to window based on module configuration
|
|
640
|
+
for (const feature of loadOrder) {
|
|
641
|
+
const module = loadedModules[feature];
|
|
642
|
+
const moduleConfig = moduleDependencies[feature];
|
|
643
|
+
|
|
644
|
+
if (!module || !moduleConfig.exports) continue;
|
|
645
|
+
|
|
646
|
+
// For each export in the module's configuration
|
|
647
|
+
for (const [exportName, locations] of Object.entries(moduleConfig.exports)) {
|
|
648
|
+
// Try to get the export - check both named export and default export
|
|
649
|
+
let exportValue = module[exportName];
|
|
650
|
+
|
|
651
|
+
// If not found as named export, try default export
|
|
652
|
+
if (!exportValue && module.default) {
|
|
653
|
+
exportValue = module.default;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (!exportValue) continue;
|
|
657
|
+
|
|
658
|
+
// Attach to each configured location
|
|
659
|
+
locations.forEach(location => {
|
|
660
|
+
if (location === 'window') {
|
|
661
|
+
window[exportName] = exportValue;
|
|
662
|
+
} else if (location === 'hyperclay') {
|
|
663
|
+
window.hyperclay[exportName] = exportValue;
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// Create window.h alias
|
|
670
|
+
window.h = window.hyperclay;
|
|
671
|
+
|
|
429
672
|
// Fire custom event when loading is complete
|
|
430
673
|
window.dispatchEvent(new CustomEvent('hyperclayReady', {
|
|
431
674
|
detail: {
|
|
@@ -434,6 +677,11 @@
|
|
|
434
677
|
}
|
|
435
678
|
}));
|
|
436
679
|
|
|
680
|
+
// Resolve the ready promise
|
|
681
|
+
if (hyperclayReadyResolve) {
|
|
682
|
+
hyperclayReadyResolve(window.hyperclay);
|
|
683
|
+
}
|
|
684
|
+
|
|
437
685
|
console.log('HyperclayJS: All modules loaded successfully');
|
|
438
686
|
|
|
439
687
|
// Show feature summary - AUTO-GENERATED
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperclayjs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Modular JavaScript library for building interactive HTML applications with Hyperclay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "hyperclay.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"format": "prettier --write .",
|
|
44
44
|
"release": "./scripts/release.sh",
|
|
45
45
|
"prepublishOnly": "npm run build && npm test",
|
|
46
|
-
"postpublish": "open http://127.0.0.1:3535/load-jsdelivr.html"
|
|
46
|
+
"postpublish": "test -n \"$SKIP_POSTPUBLISH\" || open http://127.0.0.1:3535/load-jsdelivr.html"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|