@radishland/runtime 0.0.4 → 0.0.6
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/client/index.js +0 -135
- package/package.json +9 -6
package/client/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Signal } from 'signal-polyfill';
|
2
2
|
|
3
3
|
// src/utils.ts
|
4
|
-
var spaces_sep_by_comma = /\s*,\s*/;
|
5
4
|
var booleanAttributes = [
|
6
5
|
"allowfullscreen",
|
7
6
|
// on <iframe>
|
@@ -378,138 +377,4 @@ if (window && !customElements.get("handler-registry")) {
|
|
378
377
|
customElements.define("handler-registry", HandlerRegistry);
|
379
378
|
}
|
380
379
|
|
381
|
-
// src/handlers.ts
|
382
|
-
var bindingsQueryString = Object.keys(bindingConfig).map(
|
383
|
-
(property) => `[\\@bind\\:${property}]`
|
384
|
-
).join(",");
|
385
|
-
setTimeout(() => {
|
386
|
-
customElements?.whenDefined("handler-registry").then(() => {
|
387
|
-
document.querySelectorAll(
|
388
|
-
`[\\@on],[\\@use],[\\@attr],[\\@attr\\|client],[\\@prop],${bindingsQueryString},[\\@text],[\\@html]`
|
389
|
-
).forEach(
|
390
|
-
(entry) => {
|
391
|
-
const events = entry.getAttribute("@on")?.trim()?.split(spaces_sep_by_comma);
|
392
|
-
if (events) {
|
393
|
-
for (const event of events) {
|
394
|
-
const [type, handler] = event.split(":");
|
395
|
-
const onRequest = new CustomEvent("@on-request", {
|
396
|
-
bubbles: true,
|
397
|
-
cancelable: true,
|
398
|
-
composed: true,
|
399
|
-
detail: {
|
400
|
-
type,
|
401
|
-
handler: handler || type
|
402
|
-
}
|
403
|
-
});
|
404
|
-
entry.dispatchEvent(onRequest);
|
405
|
-
}
|
406
|
-
}
|
407
|
-
const hooks = entry.getAttribute("@use")?.trim()?.split(spaces_sep_by_comma);
|
408
|
-
if (hooks) {
|
409
|
-
for (const hook of hooks) {
|
410
|
-
const useRequest = new CustomEvent("@use-request", {
|
411
|
-
bubbles: true,
|
412
|
-
cancelable: true,
|
413
|
-
composed: true,
|
414
|
-
detail: {
|
415
|
-
hook
|
416
|
-
}
|
417
|
-
});
|
418
|
-
entry.dispatchEvent(useRequest);
|
419
|
-
}
|
420
|
-
}
|
421
|
-
const props = entry.getAttribute("@prop")?.trim().split(spaces_sep_by_comma);
|
422
|
-
if (props) {
|
423
|
-
for (const prop of props) {
|
424
|
-
const [key, value] = prop.split(":");
|
425
|
-
const propRequest = new CustomEvent("@prop-request", {
|
426
|
-
bubbles: true,
|
427
|
-
cancelable: true,
|
428
|
-
composed: true,
|
429
|
-
detail: {
|
430
|
-
property: key,
|
431
|
-
identifier: value || key
|
432
|
-
}
|
433
|
-
});
|
434
|
-
entry.dispatchEvent(propRequest);
|
435
|
-
}
|
436
|
-
}
|
437
|
-
const text = entry.hasAttribute("@text");
|
438
|
-
if (text) {
|
439
|
-
const identifier = entry.getAttribute("@text") || "text";
|
440
|
-
const textRequest = new CustomEvent("@text-request", {
|
441
|
-
bubbles: true,
|
442
|
-
cancelable: true,
|
443
|
-
composed: true,
|
444
|
-
detail: {
|
445
|
-
identifier
|
446
|
-
}
|
447
|
-
});
|
448
|
-
entry.dispatchEvent(textRequest);
|
449
|
-
}
|
450
|
-
const html = entry.hasAttribute("@html");
|
451
|
-
if (html) {
|
452
|
-
const identifier = entry.getAttribute("@html") || "html";
|
453
|
-
const htmlRequest = new CustomEvent("@html-request", {
|
454
|
-
bubbles: true,
|
455
|
-
cancelable: true,
|
456
|
-
composed: true,
|
457
|
-
detail: {
|
458
|
-
identifier
|
459
|
-
}
|
460
|
-
});
|
461
|
-
entry.dispatchEvent(htmlRequest);
|
462
|
-
}
|
463
|
-
const classList = entry.hasAttribute("@class");
|
464
|
-
if (classList) {
|
465
|
-
const identifier = entry.getAttribute("@class") || "class";
|
466
|
-
const classRequest = new CustomEvent("@class-request", {
|
467
|
-
bubbles: true,
|
468
|
-
cancelable: true,
|
469
|
-
composed: true,
|
470
|
-
detail: {
|
471
|
-
identifier
|
472
|
-
}
|
473
|
-
});
|
474
|
-
entry.dispatchEvent(classRequest);
|
475
|
-
}
|
476
|
-
const attributes = [
|
477
|
-
...entry.getAttribute("@attr")?.trim().split(spaces_sep_by_comma) ?? [],
|
478
|
-
...entry.getAttribute("@attr|client")?.trim().split(spaces_sep_by_comma) ?? []
|
479
|
-
];
|
480
|
-
if (attributes.length > 0) {
|
481
|
-
for (const attribute of attributes) {
|
482
|
-
const [key, value] = attribute.split(":");
|
483
|
-
const attrRequest = new CustomEvent("@attr-request", {
|
484
|
-
bubbles: true,
|
485
|
-
cancelable: true,
|
486
|
-
composed: true,
|
487
|
-
detail: {
|
488
|
-
attribute: key,
|
489
|
-
identifier: value || key
|
490
|
-
}
|
491
|
-
});
|
492
|
-
entry.dispatchEvent(attrRequest);
|
493
|
-
}
|
494
|
-
}
|
495
|
-
for (const property of Object.keys(bindingConfig)) {
|
496
|
-
if (entry.hasAttribute(`@bind:${property}`)) {
|
497
|
-
const identifier = entry.getAttribute(`@bind:${property}`)?.trim() || property;
|
498
|
-
const bindRequest = new CustomEvent("@bind-request", {
|
499
|
-
bubbles: true,
|
500
|
-
cancelable: true,
|
501
|
-
composed: true,
|
502
|
-
detail: {
|
503
|
-
property,
|
504
|
-
identifier
|
505
|
-
}
|
506
|
-
});
|
507
|
-
entry.dispatchEvent(bindRequest);
|
508
|
-
}
|
509
|
-
}
|
510
|
-
}
|
511
|
-
);
|
512
|
-
});
|
513
|
-
}, 100);
|
514
|
-
|
515
380
|
export { $array, $computed, $effect, $object, $state, HandlerRegistry, ReactiveComputation, ReactiveValue, getValue, isComputed, isState };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@radishland/runtime",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.6",
|
4
4
|
"type": "module",
|
5
5
|
"description": "The Radish runtime",
|
6
6
|
"author": "Frédéric Crozatier",
|
@@ -9,20 +9,23 @@
|
|
9
9
|
"build": "tsup",
|
10
10
|
"prepublishOnly": "pnpm build"
|
11
11
|
},
|
12
|
-
"main": "./client/index.js",
|
13
12
|
"exports": {
|
14
|
-
".":
|
13
|
+
".": {
|
14
|
+
"import": "./client/index.js",
|
15
|
+
"types": "./client/index.d.ts"
|
16
|
+
}
|
15
17
|
},
|
16
18
|
"files": [
|
17
19
|
"./client",
|
18
20
|
"README.md",
|
19
|
-
"LICENCE"
|
21
|
+
"LICENCE",
|
22
|
+
"package.json"
|
20
23
|
],
|
21
24
|
"dependencies": {
|
22
|
-
"signal-polyfill": "^0.2.2"
|
23
|
-
"tsup": "^8.4.0"
|
25
|
+
"signal-polyfill": "^0.2.2"
|
24
26
|
},
|
25
27
|
"devDependencies": {
|
28
|
+
"tsup": "^8.4.0",
|
26
29
|
"typescript": "^5.7.3"
|
27
30
|
}
|
28
31
|
}
|