@adaas/are-html 0.0.4 → 0.0.5
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/dist/browser/index.d.mts +11 -3
- package/dist/browser/index.mjs +42 -15
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/engine/AreHTML.compiler.js +10 -0
- package/dist/node/engine/AreHTML.compiler.js.map +1 -1
- package/dist/node/engine/AreHTML.compiler.mjs +10 -0
- package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
- package/dist/node/engine/AreHTML.constants.d.mts +10 -1
- package/dist/node/engine/AreHTML.constants.d.ts +10 -1
- package/dist/node/engine/AreHTML.constants.js +21 -0
- package/dist/node/engine/AreHTML.constants.js.map +1 -1
- package/dist/node/engine/AreHTML.constants.mjs +20 -1
- package/dist/node/engine/AreHTML.constants.mjs.map +1 -1
- package/dist/node/engine/AreHTML.engine.js +8 -0
- package/dist/node/engine/AreHTML.engine.js.map +1 -1
- package/dist/node/engine/AreHTML.engine.mjs +8 -0
- package/dist/node/engine/AreHTML.engine.mjs.map +1 -1
- package/dist/node/engine/AreHTML.interpreter.js +1 -0
- package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
- package/dist/node/engine/AreHTML.interpreter.mjs +1 -0
- package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
- package/dist/node/engine/AreHTML.lifecycle.d.mts +1 -2
- package/dist/node/engine/AreHTML.lifecycle.d.ts +1 -2
- package/dist/node/engine/AreHTML.lifecycle.js +2 -11
- package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
- package/dist/node/engine/AreHTML.lifecycle.mjs +2 -11
- package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/lib/AreRoot/AreRoot.component.js +2 -3
- package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
- package/dist/node/lib/AreRoot/AreRoot.component.mjs +2 -3
- package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
- package/examples/dashboard/dist/index.html +1 -1
- package/examples/dashboard/dist/{mpioi5ab-8c3oa9.js → mpm5e2oi-ghokyu.js} +8 -8
- package/package.json +1 -1
- package/src/engine/AreHTML.compiler.ts +19 -1
- package/src/engine/AreHTML.constants.ts +16 -0
- package/src/engine/AreHTML.engine.ts +10 -0
- package/src/engine/AreHTML.interpreter.ts +3 -0
- package/src/engine/AreHTML.lifecycle.ts +13 -12
- package/src/lib/AreRoot/AreRoot.component.ts +5 -6
package/dist/browser/index.d.mts
CHANGED
|
@@ -311,6 +311,15 @@ declare class AreRoute extends AreSignal<A_Route> {
|
|
|
311
311
|
compare(other: A_Signal<A_Route>): boolean;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Void HTML elements that cannot have children and must not have a closing tag.
|
|
316
|
+
* Per the HTML5 spec these are treated as self-closing even when written as
|
|
317
|
+
* `<input>` (without the trailing slash `/>`).
|
|
318
|
+
*
|
|
319
|
+
* Reference: https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
320
|
+
*/
|
|
321
|
+
declare const VOID_ELEMENTS: Set<string>;
|
|
322
|
+
declare function isVoidElement(tagName: string): boolean;
|
|
314
323
|
/**
|
|
315
324
|
* Boolean HTML attributes whose presence (regardless of value) implies "true",
|
|
316
325
|
* and whose absence implies "false". Setting these via `setAttribute(name, value)`
|
|
@@ -531,8 +540,7 @@ declare class AreHTMLInterpreter extends AreInterpreter {
|
|
|
531
540
|
}
|
|
532
541
|
|
|
533
542
|
declare class AreHTMLLifecycle extends AreLifecycle {
|
|
534
|
-
initComponent(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
|
|
535
|
-
initRoot(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
|
|
543
|
+
initComponent(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
|
|
536
544
|
initText(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
|
|
537
545
|
initInterpolation(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
|
|
538
546
|
updateDirectiveAttribute(directive: AreDirectiveAttribute, scope: A_Scope, feature: A_Feature, logger?: A_Logger, ...args: any[]): void;
|
|
@@ -601,4 +609,4 @@ declare class AreRouteWatcher extends A_Component {
|
|
|
601
609
|
private notify;
|
|
602
610
|
}
|
|
603
611
|
|
|
604
|
-
export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, type AreDirectiveOrderDecoratorParameters, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, type AreHTMLContextConstructor, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, type AreHtmlAddAttributeInstructionPayload, type AreHtmlAddCommentInstructionPayload, type AreHtmlAddElementInstructionPayload, type AreHtmlAddInterpolationInstructionPayload, type AreHtmlAddListenerInstructionPayload, type AreHtmlAddStyleInstructionPayload, type AreHtmlAddTextInstructionPayload, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, type ParsedEventName, isBooleanAttribute, isIDLFormProperty, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
|
|
612
|
+
export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, type AreDirectiveOrderDecoratorParameters, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, type AreHTMLContextConstructor, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, type AreHtmlAddAttributeInstructionPayload, type AreHtmlAddCommentInstructionPayload, type AreHtmlAddElementInstructionPayload, type AreHtmlAddInterpolationInstructionPayload, type AreHtmlAddListenerInstructionPayload, type AreHtmlAddStyleInstructionPayload, type AreHtmlAddTextInstructionPayload, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, type ParsedEventName, VOID_ELEMENTS, isBooleanAttribute, isIDLFormProperty, isVoidElement, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
|
package/dist/browser/index.mjs
CHANGED
|
@@ -821,6 +821,25 @@ AreRoute = __decorateClass([
|
|
|
821
821
|
], AreRoute);
|
|
822
822
|
|
|
823
823
|
// src/engine/AreHTML.constants.ts
|
|
824
|
+
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
825
|
+
"area",
|
|
826
|
+
"base",
|
|
827
|
+
"br",
|
|
828
|
+
"col",
|
|
829
|
+
"embed",
|
|
830
|
+
"hr",
|
|
831
|
+
"img",
|
|
832
|
+
"input",
|
|
833
|
+
"link",
|
|
834
|
+
"meta",
|
|
835
|
+
"param",
|
|
836
|
+
"source",
|
|
837
|
+
"track",
|
|
838
|
+
"wbr"
|
|
839
|
+
]);
|
|
840
|
+
function isVoidElement(tagName) {
|
|
841
|
+
return VOID_ELEMENTS.has(tagName.toLowerCase());
|
|
842
|
+
}
|
|
824
843
|
var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
825
844
|
"allowfullscreen",
|
|
826
845
|
"async",
|
|
@@ -1102,6 +1121,16 @@ var AreHTMLCompiler = class extends AreCompiler {
|
|
|
1102
1121
|
title: "Scene Host Not Found",
|
|
1103
1122
|
description: `No host found for the scene with id: ${scene.id}. Please ensure that the scene is properly initialized and has a host before compiling binding attributes.`
|
|
1104
1123
|
});
|
|
1124
|
+
const content = attribute.content;
|
|
1125
|
+
if (content.includes("{{")) {
|
|
1126
|
+
const transformed = '"' + content.replace(/\{\{([^}]+)\}\}/g, '"+($1)+"') + '"';
|
|
1127
|
+
scene.plan(new AddAttributeInstruction(scene.host, {
|
|
1128
|
+
name: attribute.name,
|
|
1129
|
+
content: transformed,
|
|
1130
|
+
evaluate: true
|
|
1131
|
+
}));
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1105
1134
|
scene.plan(new AddAttributeInstruction(scene.host, {
|
|
1106
1135
|
name: attribute.name,
|
|
1107
1136
|
content: attribute.content
|
|
@@ -1409,6 +1438,7 @@ var AreHTMLInterpreter = class extends AreInterpreter {
|
|
|
1409
1438
|
event.set("args", effectiveArgs);
|
|
1410
1439
|
event.set("element", element);
|
|
1411
1440
|
event.set("instruction", mutation);
|
|
1441
|
+
if (liveEvent) event.set("native", liveEvent);
|
|
1412
1442
|
mutation.owner.emit(event);
|
|
1413
1443
|
};
|
|
1414
1444
|
handlerScope[`$${handler}`] = handlerFn;
|
|
@@ -1725,10 +1755,7 @@ AreHTMLTokenizer = __decorateClass([
|
|
|
1725
1755
|
})
|
|
1726
1756
|
], AreHTMLTokenizer);
|
|
1727
1757
|
var AreHTMLLifecycle = class extends AreLifecycle {
|
|
1728
|
-
initComponent(node, scope, context, logger, ...args) {
|
|
1729
|
-
super.init(node, scope, context, logger, ...args);
|
|
1730
|
-
}
|
|
1731
|
-
initRoot(node, scope, context, signalsContext, logger, ...args) {
|
|
1758
|
+
initComponent(node, scope, context, signalsContext, logger, ...args) {
|
|
1732
1759
|
signalsContext?.subscribe(node);
|
|
1733
1760
|
super.init(node, scope, context, logger, ...args);
|
|
1734
1761
|
}
|
|
@@ -1750,19 +1777,13 @@ var AreHTMLLifecycle = class extends AreLifecycle {
|
|
|
1750
1777
|
};
|
|
1751
1778
|
__decorateClass([
|
|
1752
1779
|
AreLifecycle.Init(AreComponentNode),
|
|
1753
|
-
__decorateParam(0, A_Inject(A_Caller)),
|
|
1754
|
-
__decorateParam(1, A_Inject(A_Scope)),
|
|
1755
|
-
__decorateParam(2, A_Inject(AreHTMLEngineContext)),
|
|
1756
|
-
__decorateParam(3, A_Inject(A_Logger))
|
|
1757
|
-
], AreHTMLLifecycle.prototype, "initComponent", 1);
|
|
1758
|
-
__decorateClass([
|
|
1759
1780
|
AreLifecycle.Init(AreRootNode),
|
|
1760
1781
|
__decorateParam(0, A_Inject(A_Caller)),
|
|
1761
1782
|
__decorateParam(1, A_Inject(A_Scope)),
|
|
1762
1783
|
__decorateParam(2, A_Inject(AreHTMLEngineContext)),
|
|
1763
1784
|
__decorateParam(3, A_Inject(AreSignalsContext)),
|
|
1764
1785
|
__decorateParam(4, A_Inject(A_Logger))
|
|
1765
|
-
], AreHTMLLifecycle.prototype, "
|
|
1786
|
+
], AreHTMLLifecycle.prototype, "initComponent", 1);
|
|
1766
1787
|
__decorateClass([
|
|
1767
1788
|
AreLifecycle.Init(AreText),
|
|
1768
1789
|
__decorateParam(0, A_Inject(A_Caller)),
|
|
@@ -1920,6 +1941,13 @@ var AreHTMLEngine = class extends AreEngine {
|
|
|
1920
1941
|
match2.payload = { entity: tagName, selfClose: true, id };
|
|
1921
1942
|
return match2;
|
|
1922
1943
|
}
|
|
1944
|
+
if (isVoidElement(tagName)) {
|
|
1945
|
+
const raw = source.slice(tagStart, openingTagEnd + 1);
|
|
1946
|
+
const content2 = source.slice(tagStart + tagNameMatch[0].length, openingTagEnd);
|
|
1947
|
+
const match2 = build(raw, content2, tagStart, ">");
|
|
1948
|
+
match2.payload = { entity: tagName, selfClose: true, id };
|
|
1949
|
+
return match2;
|
|
1950
|
+
}
|
|
1923
1951
|
const closingTag = `</${tagName}>`;
|
|
1924
1952
|
let level = 0;
|
|
1925
1953
|
let searchIndex = openingTagEnd + 1;
|
|
@@ -2014,8 +2042,8 @@ var AreRoot = class extends Are {
|
|
|
2014
2042
|
}
|
|
2015
2043
|
}
|
|
2016
2044
|
if (!componentName) {
|
|
2017
|
-
const
|
|
2018
|
-
componentName =
|
|
2045
|
+
const defaultMatch = root.markup?.match(/\bdefault=["']([^"']*)["']/);
|
|
2046
|
+
componentName = defaultMatch?.[1];
|
|
2019
2047
|
}
|
|
2020
2048
|
if (!componentName) {
|
|
2021
2049
|
logger.warning('AreRoot: No component found for initial render. Please ensure a route condition or "default" attribute is set.');
|
|
@@ -2024,7 +2052,6 @@ var AreRoot = class extends Are {
|
|
|
2024
2052
|
root.setContent(`<${componentName}></${componentName}>`);
|
|
2025
2053
|
}
|
|
2026
2054
|
async onSignal(root, vector, store, logger, signalsContext) {
|
|
2027
|
-
console.log("Received signal vector in AreRoot:", root, vector);
|
|
2028
2055
|
const rootId = root.id;
|
|
2029
2056
|
if (signalsContext && !signalsContext.hasRoot(rootId)) {
|
|
2030
2057
|
return;
|
|
@@ -2143,6 +2170,6 @@ AreRouteWatcher = __decorateClass([
|
|
|
2143
2170
|
})
|
|
2144
2171
|
], AreRouteWatcher);
|
|
2145
2172
|
|
|
2146
|
-
export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, isBooleanAttribute, isIDLFormProperty, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
|
|
2173
|
+
export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, VOID_ELEMENTS, isBooleanAttribute, isIDLFormProperty, isVoidElement, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
|
|
2147
2174
|
//# sourceMappingURL=index.mjs.map
|
|
2148
2175
|
//# sourceMappingURL=index.mjs.map
|