houxit 0.1.11 → 0.1.14
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/houxit.cjs +303 -249
- package/dist/houxit.cjs.map +1 -1
- package/dist/houxit.esm.js +296 -247
- package/dist/houxit.esm.js.map +1 -1
- package/dist/houxit.esm.min.js +1 -1
- package/dist/houxit.global.js +303 -249
- package/dist/houxit.global.js.map +1 -1
- package/dist/houxit.global.min.js +1 -1
- package/dist/houxit.min.cjs +1 -1
- package/package.json +7 -5
- package/dist/houxit.browser.esm.js +0 -11804
- package/dist/houxit.browser.esm.js.map +0 -1
- package/dist/index.cjs +0 -11949
- package/dist/index.cjs.map +0 -1
package/dist/houxit.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
//#region src/index.js
|
|
4
4
|
var log = console.log;
|
|
5
|
-
var version = "0.1.
|
|
6
|
-
var get_version = () => "houxit-0.1.
|
|
5
|
+
var version = "0.1.15";
|
|
6
|
+
var get_version = () => "houxit-0.1.15";
|
|
7
7
|
var isArray = Array.isArray;
|
|
8
8
|
var toString = Object.prototype.toString;
|
|
9
9
|
var _toStringCall = (txt) => toString.call(txt);
|
|
@@ -54,7 +54,7 @@ var isChar = (char) => isString(char) || isSymbol(char);
|
|
|
54
54
|
var isPromise = (prom) => _toStringCall(prom) === "[object Promise]" && isFunction(prom.then) && isFunction(prom.catch);
|
|
55
55
|
var isTrue = (compute) => compute === true;
|
|
56
56
|
var isFalse = (compute) => compute === false;
|
|
57
|
-
var $warner = `<<< Houxit Exception >>> ..... >>>>>>>`;
|
|
57
|
+
var $warner = `<<<[ Houxit Exception ]>>> ..... >>>>>>>`;
|
|
58
58
|
var stringsMonitorRegex = /"(.*?)"|'(.*?)'|`+(.*?\s)`+/gm;
|
|
59
59
|
function debugHandler(msg, self, dictateW = false, txt = "") {
|
|
60
60
|
let DEBUG_ENV = true;
|
|
@@ -311,9 +311,6 @@ var validHouxitWidget = (w) => w && ((is_wuf_class(w) || isObject(w)) && !isProx
|
|
|
311
311
|
function isAsyncFunction(fn) {
|
|
312
312
|
return isPFunction(fn) && fn?.constructor?.name === "AsyncFunction";
|
|
313
313
|
}
|
|
314
|
-
function parseScript(script, args) {
|
|
315
|
-
return new Function(`"use strict"; return (${script})`)(args);
|
|
316
|
-
}
|
|
317
314
|
var isInDomNode = (element) => inBrowserCompiler && element?.getRootNode() === document;
|
|
318
315
|
var GLOBAL_EVENTS = "abort,animationcancel,animationend,animationiteration,animationstart,auxclick,blur,error,focus,canplay,canplaythrough,cancel,change,click,close,contextmenu,dblclick,drag,dragend,dragenter,dragleave,dragover,dragstart,drop,durationchange,emptied,ended,formdata,gotpointercapture,input,invalid,keydown,keypress,load,keyup,loadeddata,loadedmetadata,loadend,loadstart,lostpointercapture,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,mousewheel,wheel,pause,play,playing,pointerdown,pointermove,pointerup,pointercancel,pointerover,pointerout,pointerleave,pointerenter,pointerlockchange,pointerlockerror,progress,ratechange,reset,resize,scroll,securitypolicyviolation,seeked,seeking,select,selectstart,selectionchange,slotchange,stalled,submit,suspend,timeupdate,touchcancel,touchend,touchstart,touchmove,transitioncancel,transitionrun,transitioned,transitionstart,waiting,volumechange,autocompleteerror,autocomplete,hover";
|
|
319
316
|
var IS_VALID_EVENT_HANDLER = (eventName) => _makeMap_(GLOBAL_EVENTS, eventName);
|
|
@@ -372,7 +369,7 @@ function compileToRenderable(value, preserve = true) {
|
|
|
372
369
|
var arrowFNRegex = /^(async[ ]+)?(\(([\w$,.\[\]\{\} ]*)\)|[\w$]+)[ ]*=>[ ]*[{]?\s*/;
|
|
373
370
|
var functionFNRegex = /^(async[ ]+)?(function)?([*]?([ ]*)[\w$]*)?\(([\w$]*)?\)[ ]*\{\s*/m;
|
|
374
371
|
var isArrowFunction = (fn) => isPFunction(fn) && arrowFNRegex.test(fn.toString());
|
|
375
|
-
var isFNString = (str) => isString(str) &&
|
|
372
|
+
var isFNString = (str) => isString(str) && (arrowFNRegex.test(str) || functionFNRegex.test(str));
|
|
376
373
|
var objectDestructureRegex = /^{(.*?)}$/;
|
|
377
374
|
var arrayDestructureRegex = /^\[(.*?)\]$/;
|
|
378
375
|
var isForLoopDestructureRegex = /^((\(|\<)(.*?)(\)|\>))$/;
|
|
@@ -944,89 +941,52 @@ var arrayMM = "push,pop,shift,unshift,splice,sort,reverse,copyWithin,fill";
|
|
|
944
941
|
var setMM = "add,delete,clear";
|
|
945
942
|
var mapMM = "set,delete,clear";
|
|
946
943
|
var tupleMM = "add,delete,clear,shift,unshift,splice,pop,extend,replace,prepend,arrange,exchange";
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return isArray(data) ? arrayMM : isSet(data) ? setMM : isMap(data) ? mapMM : isTuple(data) ? tupleMM : isPObject(data) ? objectMM : "";
|
|
950
|
-
}
|
|
951
|
-
function getAgentMutators(data, prop, model) {
|
|
952
|
-
const value = data;
|
|
953
|
-
data = unwrap(data);
|
|
954
|
-
let mutateArgs = getMutationArgs(data) + "write";
|
|
955
|
-
const mutation_object = createObj("Mutatations");
|
|
956
|
-
for (let name of mutateArgs.split(",").values()) {
|
|
957
|
-
function mutate(arg) {
|
|
958
|
-
let rv = void 0;
|
|
959
|
-
if (validateType(data, [
|
|
960
|
-
Set,
|
|
961
|
-
Tuple,
|
|
962
|
-
Array,
|
|
963
|
-
Map
|
|
964
|
-
])) rv = data[name](arg);
|
|
965
|
-
else if (isPObject(data)) {
|
|
966
|
-
if ("define" === name) rv = define(data, ...arguments);
|
|
967
|
-
else if ("delete" === name) {
|
|
968
|
-
delete data[arg];
|
|
969
|
-
rv = true;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
let assV = rv;
|
|
973
|
-
if ((model || !isPrimitive(value)) && prop && name === "write") assV = set_Object_Value(isModelInstance(model) ? model : !isPrimitive(value) ? value : freeze(), prop, len(arguments) ? arg : data);
|
|
974
|
-
return assV;
|
|
975
|
-
}
|
|
976
|
-
mutate = Function("fn", `
|
|
977
|
-
return function ${name === "delete" ? "del" : name}(value){
|
|
978
|
-
return fn(...arguments);
|
|
979
|
-
}
|
|
980
|
-
`)(mutate);
|
|
981
|
-
define(mutation_object, name, {
|
|
982
|
-
value: mutate,
|
|
983
|
-
enumerable
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
return mutation_object;
|
|
944
|
+
function getMutationArgs(base) {
|
|
945
|
+
return hasPrototype(base, Set) || hasPrototype(base, WeakSet) ? setMM : hasPrototype(base, Array) ? arrayMM : hasPrototype(base, Tuple) ? tupleMM : hasPrototype(base, Map) || hasPrototype(base, WeakMap) ? mapMM : "";
|
|
987
946
|
}
|
|
988
|
-
function _useAgent_(data,
|
|
947
|
+
function _useAgent_(data, config) {
|
|
989
948
|
const dataRead = () => data;
|
|
990
949
|
if (!validateCollectionArgs(arguments, {
|
|
991
950
|
min: 1,
|
|
992
951
|
max: 2,
|
|
993
|
-
validators: [Any, [
|
|
952
|
+
validators: [Any, [Object]],
|
|
994
953
|
name: "useAgent"
|
|
995
954
|
})) return [dataRead, pass];
|
|
996
|
-
|
|
955
|
+
let model = isHouxitBuild(this) ? this.__public_model__ : void 0;
|
|
956
|
+
if (!model && isObject(this)) model = this;
|
|
957
|
+
if (model && (!isChar(data) || !object_Has_Path(model, data))) {
|
|
997
958
|
debugHandler(`[ ] data path at positional argument 1 expects a string/symbol value of an existing model path\n\n.>...$useAgent`);
|
|
998
959
|
return [dataRead, pass];
|
|
999
|
-
} else if (isModelInstance(ModelInstance) && !isChar(data)) {
|
|
1000
|
-
debugHandler(`[ ] data property at positional argument 1 of "useAgent" expects a string/symbol value\n\nMust be a model valid path`);
|
|
1001
|
-
return [dataRead, pass];
|
|
1002
|
-
}
|
|
1003
|
-
const self = isHouxitBuild(this) ? this : isModelInstance(ModelInstance) ? { __public_model__: ModelInstance } : null;
|
|
1004
|
-
ModelInstance = self ? self.__public_model__ : null;
|
|
1005
|
-
if (self && !isHouxitBuild(self)) delete self.__public_model__;
|
|
1006
|
-
let prop = isModelInstance(ModelInstance) ? data : isToken(data) ? data[refInternalEffectKey].accessor : "";
|
|
1007
|
-
if (isModelInstance(ModelInstance) && !object_Has_Path(ModelInstance, prop)) {
|
|
1008
|
-
debugHandler(`[ ] "${prop}" property is not a valid model property`);
|
|
1009
|
-
return [dataRead, pass];
|
|
1010
960
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
let defineCount = 0;
|
|
961
|
+
let prop = model ? data : isToken(data) ? data[refInternalEffectKey].accessor : "";
|
|
962
|
+
data = model && exists(prop) ? () => _$runModelBind(model, prop || "") : data;
|
|
1014
963
|
const unwrappedGetter = () => read(data);
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1022
|
-
|
|
964
|
+
const mutateArgs = {
|
|
965
|
+
get value() {
|
|
966
|
+
return unwrappedGetter();
|
|
967
|
+
},
|
|
968
|
+
write(...args) {
|
|
969
|
+
return write(...args);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
function write(value) {
|
|
973
|
+
return mutate(value, PRIVATE_PROPERTY_KEY);
|
|
974
|
+
}
|
|
975
|
+
function mutate(mutation, p_p_k) {
|
|
976
|
+
if (isPFunction(mutation) && p_p_k !== PRIVATE_PROPERTY_KEY) try {
|
|
1023
977
|
mutation(mutateArgs);
|
|
1024
978
|
} catch (err) {
|
|
1025
|
-
debugHandler(`[ ] Encountered an error during the call of the writer callback\n\n${err}`);
|
|
979
|
+
debugHandler(`[ useAgent write failure ] Encountered an error during the call of the writer callback\n\n${err}`);
|
|
980
|
+
debugHandler(`${err}`);
|
|
1026
981
|
return false;
|
|
1027
982
|
}
|
|
1028
983
|
else if (!isPFunction(mutation)) {
|
|
1029
|
-
|
|
984
|
+
try {
|
|
985
|
+
set_Object_Value(model ? model : !isPrimitive(data) ? data : freeze(), prop, mutation);
|
|
986
|
+
} catch (e) {
|
|
987
|
+
debugHandler(e);
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
1030
990
|
return true;
|
|
1031
991
|
}
|
|
1032
992
|
}
|
|
@@ -1038,8 +998,8 @@ function _useAgent_(data, ModelInstance) {
|
|
|
1038
998
|
}
|
|
1039
999
|
return [reader, writer];
|
|
1040
1000
|
}
|
|
1041
|
-
function useAgent(data,
|
|
1042
|
-
return _useAgent_(...arguments);
|
|
1001
|
+
function useAgent(data, value) {
|
|
1002
|
+
return _useAgent_.call(this, ...arguments);
|
|
1043
1003
|
}
|
|
1044
1004
|
function WRITE(props) {
|
|
1045
1005
|
if (!validateCollectionArgs(arguments, {
|
|
@@ -2208,10 +2168,8 @@ function _createAgent(value, config) {
|
|
|
2208
2168
|
min: 1,
|
|
2209
2169
|
max: 2,
|
|
2210
2170
|
validators: [Any, Object]
|
|
2211
|
-
})) return pass;
|
|
2212
|
-
|
|
2213
|
-
const parameters = [value, assign({ shallow: true }, config || {})];
|
|
2214
|
-
return _useAgent_(!isToken(value) && !isPrimitive(value) ? stream(...parameters) : token(...parameters));
|
|
2171
|
+
})) return [pass, pass];
|
|
2172
|
+
return _useAgent_(token(...[value, assign({ shallow: true }, config || {})]));
|
|
2215
2173
|
}
|
|
2216
2174
|
function agent(value, config) {
|
|
2217
2175
|
return _createAgent(...arguments);
|
|
@@ -2340,35 +2298,10 @@ var FrameworkCompilerOptions = class {
|
|
|
2340
2298
|
scopedStyle = true;
|
|
2341
2299
|
};
|
|
2342
2300
|
var Compiler_Config_Options = new FrameworkCompilerOptions();
|
|
2343
|
-
var
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
}
|
|
2348
|
-
forwardAttrs(forwardAttrs) {
|
|
2349
|
-
if (isFalse(mapSettingCheck(this, "forwardAttrs", forwardAttrs))) return this;
|
|
2350
|
-
Compiler_Config_Options.forwardAttrs = forwardAttrs;
|
|
2351
|
-
}
|
|
2352
|
-
forwardEvents(forwardEvents) {
|
|
2353
|
-
if (isFalse(mapSettingCheck(this, "forwardEvents", forwardEvents))) return this;
|
|
2354
|
-
Compiler_Config_Options.forwardEvents = forwardEvents;
|
|
2355
|
-
}
|
|
2356
|
-
flushType(flushType) {
|
|
2357
|
-
if (isFalse(mapSettingCheck(this, "flushType", flushType))) return this;
|
|
2358
|
-
Compiler_Config_Options.flushType = flushType;
|
|
2359
|
-
}
|
|
2360
|
-
forwardSlot(forwardSlot) {
|
|
2361
|
-
if (isFalse(mapSettingCheck(this, "forwardSlot", forwardSlot))) return this;
|
|
2362
|
-
Compiler_Config_Options.forwardSlot = forwardSlot;
|
|
2363
|
-
}
|
|
2364
|
-
delimiters(delimiters) {
|
|
2365
|
-
if (isFalse(mapSettingCheck(this, "delimiters", delimiters))) return this;
|
|
2366
|
-
Compiler_Config_Options.delimiters = delimiters;
|
|
2367
|
-
}
|
|
2368
|
-
scopedStyle(scopedStyle) {
|
|
2369
|
-
if (isFalse(mapSettingCheck(this, "scopedStyle", scopedStyle))) return this;
|
|
2370
|
-
Compiler_Config_Options.scopedStyle = scopedStyle;
|
|
2371
|
-
}
|
|
2301
|
+
var CompilerConfigOptions = class {};
|
|
2302
|
+
for (let key of keys(Compiler_Config_Options)) CompilerConfigOptions.prototype[key] = function(config) {
|
|
2303
|
+
if (isFalse(mapSettingCheck(this, key, config))) return this;
|
|
2304
|
+
Compiler_Config_Options[key] = config;
|
|
2372
2305
|
};
|
|
2373
2306
|
function isXtruct(func, ...arg) {
|
|
2374
2307
|
try {
|
|
@@ -3589,7 +3522,7 @@ function HydrateSuspenseRender(self, suspense, element, isRerender, config) {
|
|
|
3589
3522
|
var BUILT_IN_TRANSITIONS = {};
|
|
3590
3523
|
var BUILT_IN_ANIMATIONS = {};
|
|
3591
3524
|
var hasMotionInstance = (self, name, mode) => {
|
|
3592
|
-
return _makeMap_(mode === "transitions" ? BUILT_IN_TRANSITIONS : BUILT_IN_ANIMATIONS, name) || _makeMap_(self[$$$register][mode], name) || _wufHas_instance(name);
|
|
3525
|
+
return _makeMap_(mode === "transitions" ? BUILT_IN_TRANSITIONS : BUILT_IN_ANIMATIONS, name) || _makeMap_(self[$$$register][mode], name) || _wufHas_instance(self, name);
|
|
3593
3526
|
};
|
|
3594
3527
|
function normalize_Motion(self, name, mode) {
|
|
3595
3528
|
const BUILT_IN_MOTION = mode === "transitions" ? BUILT_IN_TRANSITIONS : BUILT_IN_ANIMATIONS;
|
|
@@ -3887,7 +3820,7 @@ function debug_unrecognized_tagname(tagname, self) {
|
|
|
3887
3820
|
debugHandler(`[ ] [unexpected template tagname] "${tagname}" is not a valid html element, or a registered widget instance.\n\nif this is a customElement, make sure its defined through the "customElements.define()" method `, self, true);
|
|
3888
3821
|
}
|
|
3889
3822
|
function isCustomElementTagname(tagname) {
|
|
3890
|
-
return
|
|
3823
|
+
return isFunction(customElements.get(tagname));
|
|
3891
3824
|
}
|
|
3892
3825
|
function getBoundary(instance) {
|
|
3893
3826
|
return isHouxitBuild(instance) ? instance[$$$core].virtualNode.filesFilter.suspense : instance?.[isVNodeClass(instance) ? "filesFilter" : "VNodeManager"]?.suspense;
|
|
@@ -4128,6 +4061,7 @@ var HouxitNativeElement = class extends HouxitElement {
|
|
|
4128
4061
|
constructor(vnode) {
|
|
4129
4062
|
super(...arguments);
|
|
4130
4063
|
this.VNodeManager.SSRVnode = new vNodeClass();
|
|
4064
|
+
this.VNodeManager.customEvents = {};
|
|
4131
4065
|
HouxitTemplateGenerators.call(this, ...arguments);
|
|
4132
4066
|
this.prototype_ = vnode.type;
|
|
4133
4067
|
}
|
|
@@ -4335,19 +4269,9 @@ function generateTemplateElement(vnode, self, hx_Element, siblings, IS_RENDERLES
|
|
|
4335
4269
|
}
|
|
4336
4270
|
function _generateTemplateElement(virtualNode, self, hx_Element, siblings, IS_RENDERLESS, customElementsArgs, config) {
|
|
4337
4271
|
const { prototype_ } = virtualNode;
|
|
4338
|
-
if (isString(prototype_)
|
|
4339
|
-
else if (isString(prototype_)) return generateCustomNativeElement(...arguments);
|
|
4272
|
+
if (isString(prototype_)) return _createNativeElement(...arguments);
|
|
4340
4273
|
else return _createWidgetElement(...arguments);
|
|
4341
4274
|
}
|
|
4342
|
-
function generateCustomNativeElement(vnode, self, hx_Element, siblings, IS_RENDERLESS, customElementsArgs, config) {
|
|
4343
|
-
let { type, props, children, key } = vnode;
|
|
4344
|
-
len(arguments);
|
|
4345
|
-
hx_Element?.is_hyperscript;
|
|
4346
|
-
if (self[$$$operands]?.initializedRender) return;
|
|
4347
|
-
const element = document.createElement(type);
|
|
4348
|
-
element._set_compiler_options(...arguments);
|
|
4349
|
-
return element;
|
|
4350
|
-
}
|
|
4351
4275
|
function _createNativeElement(virtualNode, self, hx_Element, siblings, IS_RENDERLESS, customElementsArgs, config, o) {
|
|
4352
4276
|
config = assign({}, config);
|
|
4353
4277
|
let { type, props, children, key } = virtualNode;
|
|
@@ -4415,7 +4339,10 @@ function _createNativeElement(virtualNode, self, hx_Element, siblings, IS_RENDER
|
|
|
4415
4339
|
index++;
|
|
4416
4340
|
}
|
|
4417
4341
|
}
|
|
4418
|
-
if (props)
|
|
4342
|
+
if (props) {
|
|
4343
|
+
if (!IS_VALID_TAGNAME(type)) config.isCustomElement = true;
|
|
4344
|
+
Props_dilation_compile(virtualNode, self, hx_Element, metrics, element, config);
|
|
4345
|
+
}
|
|
4419
4346
|
if (!isRerender && virtualNode.prototype_ === "slot" && !(isSSR ? element?.props.name.trim() : element.name?.trim())) {
|
|
4420
4347
|
slotNamingTRANSITION(self, { value: "default" }, element, hx_Element, {
|
|
4421
4348
|
is_hyperscript,
|
|
@@ -4713,21 +4640,14 @@ function abstractFilterName(filter) {
|
|
|
4713
4640
|
}
|
|
4714
4641
|
var HouxitDirectives = "if,else,else-if,html,text,for,raw,slot,model,bind,on,scoped,provide,transite,animate,clone";
|
|
4715
4642
|
var isHouxitDirective = (dir) => _makeMap_(HouxitDirectives, dir);
|
|
4643
|
+
var commentRegex = /\/\/.*$|\/\*[^]*?\*\//gm;
|
|
4644
|
+
var unsupportedRegex = /(?:\.\.|\bthrow\b|\bdelete\b|\bvoid\b|\bconst\b|\blet\b|\bvar\b|\bwhile\b|\bfor\b|\bof\b|\bif\b|\belse\b|\bimport\b|\bexport\b|\bswitch\b|\bcase\b|\btry\b|\bcatch\b|\bcontinue\b|\bbreak\b|\bwith\b|\bdebugger\b|\blabel\b|\bdo\b|\bfrom\b|\bas\b|\bfinally\b|\benum\b|\bimplements\b|\binterface\b|\bpackage\b|\bprotected\b|\bin\b)/gm;
|
|
4716
4645
|
function _Evaluate_THIS(obj, str, self, optional) {
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
let checkRegex = false;
|
|
4721
|
-
try {
|
|
4722
|
-
parseScript(expressionWithoutComments);
|
|
4723
|
-
} catch (err) {
|
|
4724
|
-
checkRegex = true;
|
|
4725
|
-
}
|
|
4726
|
-
if (checkRegex && unsupportedRegex.test(expressionWithoutComments.replace(stringsMonitorRegex, () => ""))) throw new Error(`Invalid expression: \n\nUnsupported constructs are not allowed.\n\n"${str}"`, self, true);
|
|
4727
|
-
else if (commentRegex.test(str)) {
|
|
4728
|
-
debugHandler(`[ ] Template SyntaxError...\n\nComments not allowed in template expression\n\n"${str}"`, self, true);
|
|
4646
|
+
let expressionWithoutComments = str.replace(commentRegex, "").replace(stringsMonitorRegex, "");
|
|
4647
|
+
if (unsupportedRegex.test(expressionWithoutComments.replace(stringsMonitorRegex, () => ""))) {
|
|
4648
|
+
debugHandler(`Invalid expression: \n\nUnsupported constructs are not allowed.\n\n"${str}"\n\n"${expressionWithoutComments.match(unsupportedRegex).join(", ")}" not supported in an inline bind expression`, self, true);
|
|
4729
4649
|
return;
|
|
4730
|
-
}
|
|
4650
|
+
} else if (commentRegex.test(str.replace(stringsMonitorRegex, () => ""))) str = expressionWithoutComments;
|
|
4731
4651
|
let dexTransform;
|
|
4732
4652
|
if (optional && isPObject(optional) && hasOwn(optional, $$dexTransformKey)) {
|
|
4733
4653
|
dexTransform = optional[$$dexTransformKey];
|
|
@@ -4737,7 +4657,8 @@ function _Evaluate_THIS(obj, str, self, optional) {
|
|
|
4737
4657
|
let compile_Str = `with(obj){
|
|
4738
4658
|
with($$$ctx){
|
|
4739
4659
|
try{
|
|
4740
|
-
|
|
4660
|
+
if(dexTransform) return dexTransform.traverse();
|
|
4661
|
+
else return ${str.trim() || "undefined"};
|
|
4741
4662
|
}catch(err){
|
|
4742
4663
|
throw new Error(err);
|
|
4743
4664
|
}
|
|
@@ -4750,7 +4671,10 @@ function _Evaluate_THIS(obj, str, self, optional) {
|
|
|
4750
4671
|
let value;
|
|
4751
4672
|
try {
|
|
4752
4673
|
value = getValue.call(obj, obj, isPObject(optional) ? optional : {}, dexTransform, self[$$$core].__env__ || {});
|
|
4753
|
-
} catch (error) {
|
|
4674
|
+
} catch (error) {
|
|
4675
|
+
debugHandler(`${error}`, self, true);
|
|
4676
|
+
return;
|
|
4677
|
+
}
|
|
4754
4678
|
return value;
|
|
4755
4679
|
}
|
|
4756
4680
|
function transformDestructureContext(props, sources, vv, metrics = []) {
|
|
@@ -5218,7 +5142,7 @@ function validateListenSpecialEvent(self, bindings) {
|
|
|
5218
5142
|
bindings.modifiers = isString(modifiers) ? modifiers.split("|") : isArray(modifiers) ? modifiers : [];
|
|
5219
5143
|
return true;
|
|
5220
5144
|
}
|
|
5221
|
-
function HTMLAttrsMagnifier(element, bindings, hx_Element, self, metrics) {
|
|
5145
|
+
function HTMLAttrsMagnifier(element, bindings, hx_Element, self, metrics, config) {
|
|
5222
5146
|
let { is_hyperscript, isRerender, vNode, forwardAttrs } = metrics;
|
|
5223
5147
|
const isSSR = isSSRCompiler(self);
|
|
5224
5148
|
let { key, value: attr, src } = bindings;
|
|
@@ -5236,7 +5160,7 @@ function HTMLAttrsMagnifier(element, bindings, hx_Element, self, metrics) {
|
|
|
5236
5160
|
is_hyperscript,
|
|
5237
5161
|
bindings,
|
|
5238
5162
|
forwardAttrs
|
|
5239
|
-
}, hx_Element);
|
|
5163
|
+
}, hx_Element, config);
|
|
5240
5164
|
else if (!isRerender && (isOnListener(key) || isInlineListener(key) || key === "dispatch")) {
|
|
5241
5165
|
if (!click_handler_facading(self, [
|
|
5242
5166
|
key,
|
|
@@ -5250,7 +5174,7 @@ function HTMLAttrsMagnifier(element, bindings, hx_Element, self, metrics) {
|
|
|
5250
5174
|
else if (key === "motion") motionPropFacade(self, bindings, element, hx_Element, metrics);
|
|
5251
5175
|
else {
|
|
5252
5176
|
try {
|
|
5253
|
-
attr = compileToRenderable(unwrap(attr));
|
|
5177
|
+
attr = compileToRenderable(unwrap(attr), config.isCustomElement);
|
|
5254
5178
|
const sp = hx_Element?.VNodeManager?.patchFlags.shapeProps;
|
|
5255
5179
|
if (isSSR || isRerender) {
|
|
5256
5180
|
const props = isRerender ? sp : element.props;
|
|
@@ -5263,10 +5187,10 @@ function HTMLAttrsMagnifier(element, bindings, hx_Element, self, metrics) {
|
|
|
5263
5187
|
}
|
|
5264
5188
|
if (isRerender && !len(bindings.subscribers) || isSSR) return;
|
|
5265
5189
|
const flush = createPriorityFlush(bindings.effect, function(observers) {
|
|
5266
|
-
|
|
5190
|
+
attr = _createElementPropsEffectBlock_(self, {
|
|
5267
5191
|
element,
|
|
5268
5192
|
key,
|
|
5269
|
-
value: compileToRenderable(
|
|
5193
|
+
value: compileToRenderable(attr, config.isCustomElement),
|
|
5270
5194
|
mode: void 0,
|
|
5271
5195
|
effect: bindings.effect
|
|
5272
5196
|
}, observers);
|
|
@@ -5300,6 +5224,7 @@ function isInlineListener(key) {
|
|
|
5300
5224
|
}
|
|
5301
5225
|
function click_handler_facading(self, [key, attr, src], bindings, element, hx_Element, metrics) {
|
|
5302
5226
|
attr = unwrap(attr);
|
|
5227
|
+
const { config } = metrics;
|
|
5303
5228
|
if (key === "dispatch" && !isArray(attr)) {
|
|
5304
5229
|
debugHandler(`[ ] <dispatch> dispatcher expects an array value of events and method\n\nFound "${attr}" of "${getType(attr)}" type`, self, !isNull(self));
|
|
5305
5230
|
return;
|
|
@@ -5312,6 +5237,10 @@ function click_handler_facading(self, [key, attr, src], bindings, element, hx_El
|
|
|
5312
5237
|
bindings.value = attr;
|
|
5313
5238
|
metrics = assign({ options }, metrics);
|
|
5314
5239
|
if (!validateListenSpecialEvent(self, bindings)) return;
|
|
5240
|
+
if (config.isCustomElement) {
|
|
5241
|
+
element[key] = attr;
|
|
5242
|
+
return;
|
|
5243
|
+
}
|
|
5315
5244
|
$$dir_ON(self, bindings, element, hx_Element, metrics);
|
|
5316
5245
|
return true;
|
|
5317
5246
|
}
|
|
@@ -5463,9 +5392,8 @@ function transformAttachProp(self, bindings, element, hx_Element, metrics) {
|
|
|
5463
5392
|
}
|
|
5464
5393
|
function __widget_props_effect(app, metrics, observers) {
|
|
5465
5394
|
if (!isHouxitBuild(app)) return;
|
|
5466
|
-
const { value, effect, key } = metrics;
|
|
5467
|
-
const
|
|
5468
|
-
const newValue = unwrap(transform);
|
|
5395
|
+
const { value, effect, key, config } = metrics;
|
|
5396
|
+
const newValue = unwrap(isEffect(effect) ? effect.runEffect?.().value : effect);
|
|
5469
5397
|
const params = app[$$$ownProperties].$params;
|
|
5470
5398
|
const attrs = app.__public_model__.$attrs;
|
|
5471
5399
|
const mode = hasOwn(params, key) ? "params" : hasOwn(attrs, key) ? "attrs" : void 0;
|
|
@@ -5534,7 +5462,7 @@ function attributes_hydration(props, self, hx_Element, metrics, element, config,
|
|
|
5534
5462
|
else if (bindings.key === "key") {
|
|
5535
5463
|
hx_Element.VNodeManager.vNodeClass.key = bindings.value;
|
|
5536
5464
|
hx_Element.VNodeManager.keyIdBinding = bindings;
|
|
5537
|
-
} else (isW ? widget_props_plugin : HTMLAttrsMagnifier)(element, bindings, hx_Element, self, metrics);
|
|
5465
|
+
} else (isW ? widget_props_plugin : HTMLAttrsMagnifier)(element, bindings, hx_Element, self, metrics, config);
|
|
5538
5466
|
}
|
|
5539
5467
|
function slotNamingTRANSITION(self, bindings, element, hx_Element, metrics) {
|
|
5540
5468
|
let { value } = bindings;
|
|
@@ -5594,7 +5522,7 @@ function SlotContextBindingTRANSITON(self, bindings, element, hx_Element, metric
|
|
|
5594
5522
|
});
|
|
5595
5523
|
}
|
|
5596
5524
|
}
|
|
5597
|
-
function IDLPropsTransform(self, props, element, metrics, hx_Element) {
|
|
5525
|
+
function IDLPropsTransform(self, props, element, metrics, hx_Element, config) {
|
|
5598
5526
|
let [key, attr] = props;
|
|
5599
5527
|
const { is_hyperscript, bindings } = metrics;
|
|
5600
5528
|
const isSSR = isSSRCompiler(self);
|
|
@@ -5610,8 +5538,8 @@ function IDLPropsTransform(self, props, element, metrics, hx_Element) {
|
|
|
5610
5538
|
} else element.className = element.className + " " + transform.join(" ");
|
|
5611
5539
|
} else if (isSSR || isRerender) {
|
|
5612
5540
|
const props = isRerender ? sp : hx_Element.VNodeManager.SSRVnode.props;
|
|
5613
|
-
props[_makeMap_("innerText,textContent", key) ? "innerText" : key] = escapeDecoder(compileToRenderable(attr));
|
|
5614
|
-
} else element[key] = compileToRenderable(attr);
|
|
5541
|
+
props[_makeMap_("innerText,textContent", key) ? "innerText" : key] = config.isCustomElement ? attr : escapeDecoder(compileToRenderable(attr));
|
|
5542
|
+
} else element[key] = compileToRenderable(attr, config.isCustomElement);
|
|
5615
5543
|
if (isRerender && !len(bindings.subscribers) || isSSR) return;
|
|
5616
5544
|
const flush = createPriorityFlush(bindings.effect, function(observers) {
|
|
5617
5545
|
_createElementPropsEffectBlock_(self, {
|
|
@@ -5813,7 +5741,7 @@ function Special_REF_Modifier(self, node, binding, hx_Element, metrics) {
|
|
|
5813
5741
|
self[$$$core].map.is_hyperscript;
|
|
5814
5742
|
let refKey = effect ? effect.value : value;
|
|
5815
5743
|
const templateRefs = self[$$$operands].templateRefsInputs;
|
|
5816
|
-
|
|
5744
|
+
self.__public_model__;
|
|
5817
5745
|
let ref;
|
|
5818
5746
|
if (isString(refKey)) {
|
|
5819
5747
|
if (!hasOwn(templateRefs, refKey)) {
|
|
@@ -5826,7 +5754,7 @@ function Special_REF_Modifier(self, node, binding, hx_Element, metrics) {
|
|
|
5826
5754
|
debugHandler(`[templateRefs reference] not a token. templateRefs expects a token() instance.\nSee [Template Refs] reference`, self, true);
|
|
5827
5755
|
return;
|
|
5828
5756
|
}
|
|
5829
|
-
const [getRef, setRef] =
|
|
5757
|
+
const [getRef, setRef] = useAgent(ref);
|
|
5830
5758
|
let cb = pass;
|
|
5831
5759
|
const current = getRef();
|
|
5832
5760
|
if (current && !isArray(current)) setRef(shallowStream([current]));
|
|
@@ -5957,9 +5885,8 @@ function $$dir_ON(self, bindings, node, hx_Element, metrics) {
|
|
|
5957
5885
|
}, hx_Element, metrics.is_hyperscript);
|
|
5958
5886
|
const funcToken = attr;
|
|
5959
5887
|
effect = _createHouxitEffectFrame(() => {
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
return attr;
|
|
5888
|
+
let res = _$runModelBind(self, attr, hx_Element);
|
|
5889
|
+
return object_Has_Path(self.__public_model__, funcToken) && isPFunction(res) ? res.bind(self.__public_model__) : res;
|
|
5963
5890
|
}, self);
|
|
5964
5891
|
try {
|
|
5965
5892
|
attr = effectRunner(effect).value;
|
|
@@ -5979,21 +5906,19 @@ function $$dir_ON(self, bindings, node, hx_Element, metrics) {
|
|
|
5979
5906
|
if (!isRerender && isWidget) {
|
|
5980
5907
|
const board = vNode.filesFilter.$$$Events;
|
|
5981
5908
|
for (let [ind, ev] of deepKeys.entries()) {
|
|
5982
|
-
|
|
5909
|
+
if (!hasOwn(board, ev)) board[ev] = {
|
|
5983
5910
|
callbacks: new Tuple(),
|
|
5984
5911
|
event: ev,
|
|
5985
5912
|
effect
|
|
5986
5913
|
};
|
|
5987
|
-
if (hasOwn(board, ev)) card = board[ev];
|
|
5988
|
-
else board[ev] = card;
|
|
5989
5914
|
attr.options = options;
|
|
5990
|
-
|
|
5915
|
+
board[ev].callbacks.add(attr);
|
|
5991
5916
|
}
|
|
5992
|
-
} else if (!isRerender && isHydration(self) && isVNodeClass(node) || !isSSR && IS_ELEMENT_NODE(node)) for (let event of deepKeys.values()) if (!IS_VALID_EVENT_HANDLER(event)) debugHandler(`[ ] "${event}" is not a valid event name`, self, true);
|
|
5917
|
+
} else if (!isRerender && isHydration(self) && isVNodeClass(node) || !isSSR && IS_ELEMENT_NODE(node)) for (let event of deepKeys.values()) if (!IS_VALID_EVENT_HANDLER(event) && !metrics.config.isCustomElement) debugHandler(`[ ] "${event}" is not a valid event name`, self, true);
|
|
5993
5918
|
else {
|
|
5994
5919
|
const callbackListen = (element) => {
|
|
5995
5920
|
element.addEventListener(event, (...args) => {
|
|
5996
|
-
(
|
|
5921
|
+
safeCall(listenerHandle, ...args);
|
|
5997
5922
|
}, options);
|
|
5998
5923
|
};
|
|
5999
5924
|
if (isHydration(self)) node.filesFilter.$ssr_kit.hydrationFlushs.add(callbackListen);
|
|
@@ -6001,7 +5926,6 @@ function $$dir_ON(self, bindings, node, hx_Element, metrics) {
|
|
|
6001
5926
|
}
|
|
6002
5927
|
createPriorityFlush(effect, () => {
|
|
6003
5928
|
listenerHandle = effect.runEffect().value;
|
|
6004
|
-
listenerHandle = !isPFunction(listenerHandle) ? pass : listenerHandle;
|
|
6005
5929
|
});
|
|
6006
5930
|
return node;
|
|
6007
5931
|
}
|
|
@@ -6039,10 +5963,6 @@ function normalize_motion_directives(self, bindings, node, hx_Element, metrics,
|
|
|
6039
5963
|
let { value, modifiers, key, directive, deepKeys } = bindings;
|
|
6040
5964
|
modifiers = new Set(modifiers);
|
|
6041
5965
|
hx_Element.is_hyperscript;
|
|
6042
|
-
value = effectRunner(_createHouxitEffectFrame(function() {
|
|
6043
|
-
return _$runModelBind(self, value, hx_Element, !modifiers.has("bind"));
|
|
6044
|
-
}, self)).value;
|
|
6045
|
-
value = unwrap(value);
|
|
6046
5966
|
const obj = hx_Element.VNodeManager.motion_object;
|
|
6047
5967
|
const mode = modifiers.has("in") ? "in," : modifiers.has("out") ? "out" : "both";
|
|
6048
5968
|
const activateMotion = (key, directive) => {
|
|
@@ -6157,13 +6077,12 @@ function $$dir_MODEL(self, bindings, element, hx_Element, metrics) {
|
|
|
6157
6077
|
try {
|
|
6158
6078
|
initVal = updateElementModelValue(self, element, get_I_V($ev.target), item, initVal, modifiers);
|
|
6159
6079
|
} catch (err) {
|
|
6160
|
-
debugHandler(err);
|
|
6161
6080
|
debugHandler(`[ ] ${err}`, self, true);
|
|
6162
6081
|
}
|
|
6163
6082
|
});
|
|
6164
6083
|
}
|
|
6165
6084
|
if (isHydration(self)) element.filesFilter.$ssr_kit.hydrationFlushs.add(flushCallback);
|
|
6166
|
-
else if (!isSSR)
|
|
6085
|
+
else if (!isSSR) flushCallback(element);
|
|
6167
6086
|
createPriorityFlush(effect, () => {
|
|
6168
6087
|
if (localName === "form") return;
|
|
6169
6088
|
applyModelInitialState(self, element, unwrap(effect.runEffect().value), localName);
|
|
@@ -6205,6 +6124,7 @@ function normalize_form_model(self, element, value, modifiers, effect) {
|
|
|
6205
6124
|
try {
|
|
6206
6125
|
initVal = updateElementModelValue(self, control, get_I_V($ev.target), name, initVal, modifiers, value);
|
|
6207
6126
|
} catch (err) {
|
|
6127
|
+
console.error(err);
|
|
6208
6128
|
debugHandler(err);
|
|
6209
6129
|
debugHandler(`[ ] ${err}`, self, true);
|
|
6210
6130
|
}
|
|
@@ -6244,7 +6164,7 @@ function applyModelInitialState(self, element, initVal, localName, inForm) {
|
|
|
6244
6164
|
if (isCollection(initVal) ? genericCollection(initVal).has(value) : !element.hasAttribute("value") ? initVal : value === initVal) element.checked = true;
|
|
6245
6165
|
else element.checked = false;
|
|
6246
6166
|
} else if (type === "file") {
|
|
6247
|
-
debugHandler(`[Houxit $$model Warning]:$$model is not supported on ${escapeDecoder("<input type=\"file\">")}.
|
|
6167
|
+
debugHandler(`[Houxit $$model Warning]:$$model is not supported on ${escapeDecoder("<input type=\"file\">")}. \nUse @change to access event.target.files instead.`);
|
|
6248
6168
|
return;
|
|
6249
6169
|
} else if (!isNull(initVal)) element.value = compileToRenderable(initVal);
|
|
6250
6170
|
}
|
|
@@ -6258,11 +6178,15 @@ function updateElementModelValue(self, element, target_value, path, value, modif
|
|
|
6258
6178
|
return val;
|
|
6259
6179
|
};
|
|
6260
6180
|
if (name === "select") {
|
|
6181
|
+
if (element.multiple && !isCollection(value)) {
|
|
6182
|
+
debugHandler(`[ invalid $$model value ] ${escapeDecoder("<select multiple>")} expects an array/collection value reference`, self, true);
|
|
6183
|
+
return;
|
|
6184
|
+
}
|
|
6261
6185
|
let coll = isCollection(value) && element.multiple ? genericCollection(value) : value;
|
|
6262
6186
|
for (let [index, opt] of entries(element.options)) {
|
|
6263
6187
|
const v = applyModelValueModifiers(opt.value, modifiers);
|
|
6264
6188
|
if (opt.selected && !(element.multiple ? coll.has(v) : v === value)) value = isCollection(value) && element.multiple ? coll.add(v) : setV(v);
|
|
6265
|
-
else if (!opt.selected && (element.multiple ? coll.has(v) : v === value)) value = isCollection(value) && element.multiple ? coll.delete(v) : setV(null);
|
|
6189
|
+
else if (!opt.selected && (element.multiple ? coll.has?.(v) : v === value)) value = isCollection(value) && element.multiple ? coll.delete(v) : setV(null);
|
|
6266
6190
|
}
|
|
6267
6191
|
} else {
|
|
6268
6192
|
if (!element.hasAttribute("value")) current = element.checked ? true : false;
|
|
@@ -6272,7 +6196,7 @@ function updateElementModelValue(self, element, target_value, path, value, modif
|
|
|
6272
6196
|
if (element.checked && !coll.has(current)) coll.add(current);
|
|
6273
6197
|
else if (!element.checked && coll.has(current)) coll.delete(current);
|
|
6274
6198
|
} else if (!cs || cs && isNull(value)) value = setV(current);
|
|
6275
|
-
} else if (!cs || cs && isNull(value)) value = setV(
|
|
6199
|
+
} else if (!cs || cs && isNull(value)) value = setV(target_value);
|
|
6276
6200
|
}
|
|
6277
6201
|
return value;
|
|
6278
6202
|
}
|
|
@@ -6337,7 +6261,7 @@ function applyHouxitAnimation(node, animation, params = {}, options = {}) {
|
|
|
6337
6261
|
fill: "both",
|
|
6338
6262
|
autoplay: false
|
|
6339
6263
|
}, config || {});
|
|
6340
|
-
const { duration, delay, easing, iterations, direction, fill, autoplay, styles, keyframes, frame } = config;
|
|
6264
|
+
const { duration, delay, easing, iterations, direction, fill, autoplay, styles, keyframes, frame, onStart } = config;
|
|
6341
6265
|
if (!frame && isString(easing.css) && keyframes && !isFunction(keyframes.keyframes)) return applyCSSBasedAnimation(node, config, params, options);
|
|
6342
6266
|
let player = null, destroyed = false;
|
|
6343
6267
|
function startRAF() {
|
|
@@ -6365,10 +6289,7 @@ function applyHouxitAnimation(node, animation, params = {}, options = {}) {
|
|
|
6365
6289
|
const rawT = elapsed / duration;
|
|
6366
6290
|
let iterationIndex = Math.floor(rawT);
|
|
6367
6291
|
let iterationProgress = rawT - iterationIndex;
|
|
6368
|
-
if (!started)
|
|
6369
|
-
started = true;
|
|
6370
|
-
onStart?.();
|
|
6371
|
-
}
|
|
6292
|
+
if (!started) started = true;
|
|
6372
6293
|
if (totalIterations !== Infinity && iterationIndex >= totalIterations) {
|
|
6373
6294
|
iterationIndex = totalIterations - 1;
|
|
6374
6295
|
iterationProgress = 1;
|
|
@@ -6420,7 +6341,6 @@ function applyHouxitAnimation(node, animation, params = {}, options = {}) {
|
|
|
6420
6341
|
player.oncancel = () => {
|
|
6421
6342
|
if (!destroyed) oncancel?.();
|
|
6422
6343
|
};
|
|
6423
|
-
onstart?.();
|
|
6424
6344
|
if (!autoplay) player.pause();
|
|
6425
6345
|
return player;
|
|
6426
6346
|
}
|
|
@@ -6473,7 +6393,6 @@ function applyCSSBasedAnimation(node, config, params = {}, options = {}) {
|
|
|
6473
6393
|
document.head.appendChild(style);
|
|
6474
6394
|
function handleStart(e) {
|
|
6475
6395
|
if (e.target !== node) return;
|
|
6476
|
-
onstart?.();
|
|
6477
6396
|
}
|
|
6478
6397
|
function handleEnd(e) {
|
|
6479
6398
|
if (e.target !== node) return;
|
|
@@ -7556,7 +7475,7 @@ function grabSSRVNodSlots(self, vnode, name) {
|
|
|
7556
7475
|
if (name === value.props.name || ssrSmartDefaultToggle(value.props, name)) return value;
|
|
7557
7476
|
}
|
|
7558
7477
|
}
|
|
7559
|
-
function assignSlot(self, slot, content, name, assynedSlots, renderedSlotsList, vnode) {
|
|
7478
|
+
function assignSlot(self, slot, content, name, assynedSlots, renderedSlotsList, vnode, isCustomElement) {
|
|
7560
7479
|
if (content && isHouxitElement(content) && !hasOwn(renderedSlotsList, name)) {
|
|
7561
7480
|
if (isSSRCompiler(self)) {
|
|
7562
7481
|
slot = grabSSRVNodSlots(self, vnode, name);
|
|
@@ -7579,13 +7498,26 @@ var shouldForwwardSlots = (element, slots, self) => {
|
|
|
7579
7498
|
if (isSSRCompiler(self)) return isString(element.type) && !len(element.children) && element?.type !== "slot";
|
|
7580
7499
|
return IS_ELEMENT_NODE(element) && !element.innerHTML.trim() && element?.localName !== "slot";
|
|
7581
7500
|
};
|
|
7501
|
+
function custom_elements_slotting(element, slots, self) {
|
|
7502
|
+
slots.default = new Tuple();
|
|
7503
|
+
for (let [ind, el] of entries(element.children)) {
|
|
7504
|
+
let name = el.slot || "default";
|
|
7505
|
+
if (!hasOwn(slots, name)) slots[name] = new Tuple();
|
|
7506
|
+
slots[name].add(el._hx_Element.hx_Element);
|
|
7507
|
+
if (isInDomNode(el)) el.remove();
|
|
7508
|
+
}
|
|
7509
|
+
for (let [name, content] of entries(slots)) if (len(content) > 1) slots[name] = new HouxitFragmentElement(content.list(), self);
|
|
7510
|
+
else if (len(content)) slots[name] = content.at(0);
|
|
7511
|
+
}
|
|
7582
7512
|
function _$slotHydrationRenderer(self, opts, vnode_build) {
|
|
7583
7513
|
const slots = self[$$$core].slots;
|
|
7584
|
-
|
|
7514
|
+
const $$config = self[$$$compiler].$$config;
|
|
7515
|
+
if (!len(slots) && !$$config?.isCustomElement || !vnode_build || !isHouxitElement(vnode_build) || isHouxitTextElement(vnode_build)) return vnode_build;
|
|
7585
7516
|
const renderedSlotsList = {};
|
|
7586
7517
|
const slot_elements = resolveSlotsFilter(self, vnode_build);
|
|
7587
7518
|
const assynedSlots = new Tuple();
|
|
7588
|
-
|
|
7519
|
+
if ($$config?.isCustomElement) custom_elements_slotting($$config.element, slots, self);
|
|
7520
|
+
for (const [slotN, slot_el] of entries(slot_elements)) if (hasOwn(slots, slotN) && !assynedSlots.has(slotN)) assignSlot(self, slot_el, safeCall(slots[slotN], self), slotN, assynedSlots, renderedSlotsList, vnode_build, $$config.isCustomElement);
|
|
7589
7521
|
if (shouldForwwardSlots(vnode_build?.$element, slot_elements, self) && !len(vnode_build.NodeList)) {
|
|
7590
7522
|
if (self[$$$core].settings.forwardSlot) {
|
|
7591
7523
|
const slotContent = hasOwn(slots, "default") ? slots.default(self) : null;
|
|
@@ -7919,12 +7851,34 @@ function createSignalFromEventObject(self, event) {
|
|
|
7919
7851
|
return merger.call(this, ...arguments);
|
|
7920
7852
|
};
|
|
7921
7853
|
}
|
|
7854
|
+
var HouxitEvents = class extends Event {
|
|
7855
|
+
#properties;
|
|
7856
|
+
constructor(event, properties = {}) {
|
|
7857
|
+
super(event);
|
|
7858
|
+
this.#properties = properties;
|
|
7859
|
+
}
|
|
7860
|
+
get target() {
|
|
7861
|
+
return this.#properties.target_value;
|
|
7862
|
+
}
|
|
7863
|
+
};
|
|
7922
7864
|
function $construct_With_Signals(self, options, in_build = false, vnode) {
|
|
7865
|
+
const $$config = self[$$$compiler].$$config;
|
|
7923
7866
|
if (!self.__public_model__.$events) defineGetter(self.__public_model__, "$events", new Events());
|
|
7924
7867
|
if (in_build) vnode = options;
|
|
7925
7868
|
const $$events = self[$$$core].virtualNode.filesFilter.$$$Events;
|
|
7926
7869
|
const signals = new Tuple(...options.signals || []);
|
|
7927
7870
|
const $signals = self.__public_model__.$signals;
|
|
7871
|
+
const ce_hx_Element = $$config?.element?._hx_Element.hx_Element;
|
|
7872
|
+
if (!in_build && $$config?.isCustomElement) for (let [ev_name, my_event] of entries(ce_hx_Element.VNodeManager.customEvents)) {
|
|
7873
|
+
if (!hasOwn($$events, ev_name)) $$events[ev_name] = {
|
|
7874
|
+
callbacks: new Tuple(),
|
|
7875
|
+
event: ev_name,
|
|
7876
|
+
effect: void 0
|
|
7877
|
+
};
|
|
7878
|
+
$$events[ev_name].callbacks.add(function() {
|
|
7879
|
+
$$config.element.dispatchEvent(my_event);
|
|
7880
|
+
});
|
|
7881
|
+
}
|
|
7928
7882
|
for (const [key, event] of entries($$events)) if (signals.has(key)) $signals[key] = createSignalFromEventObject(self, event);
|
|
7929
7883
|
for (const signal of signals.values()) if (!hasOwn($signals, signal)) $signals[signal] = createSignalFromEventObject(self, { callbacks: [] });
|
|
7930
7884
|
}
|
|
@@ -8153,9 +8107,9 @@ function collectionsPropAssertion(target, prop) {
|
|
|
8153
8107
|
} else if (isMap(target) || isWeakMap(target)) {
|
|
8154
8108
|
if (_makeMap_(mapMM, prop)) response = false;
|
|
8155
8109
|
} else if (isTuple(target)) {
|
|
8156
|
-
if (_makeMap_(tupleMM)) response = false;
|
|
8110
|
+
if (_makeMap_(tupleMM, prop)) response = false;
|
|
8157
8111
|
} else if (isArray(target)) {
|
|
8158
|
-
if (_makeMap_(arrayMM)) response = false;
|
|
8112
|
+
if (_makeMap_(arrayMM, prop)) response = false;
|
|
8159
8113
|
} else if (prop === $$$StreamProxyKey) response = false;
|
|
8160
8114
|
if (isCollection(target)) prop = target;
|
|
8161
8115
|
return [response, prop];
|
|
@@ -8231,6 +8185,7 @@ function transformProxyStream(obj, ReactiveEffect, config) {
|
|
|
8231
8185
|
return reactive;
|
|
8232
8186
|
}
|
|
8233
8187
|
function hasPrototype(obj, prototype) {
|
|
8188
|
+
if (!isClass(obj) && isPObject(obj)) obj instanceof prototype;
|
|
8234
8189
|
obj = obj.prototype;
|
|
8235
8190
|
prototype = prototype.prototype;
|
|
8236
8191
|
while (obj) {
|
|
@@ -8246,7 +8201,7 @@ function streamReactiveHook(X, args, name, ReactiveEffect) {
|
|
|
8246
8201
|
return res;
|
|
8247
8202
|
}
|
|
8248
8203
|
function CollectionsEffectMutationsTrap(BaseStream, ReactiveEffect) {
|
|
8249
|
-
(
|
|
8204
|
+
getMutationArgs(BaseStream).split(",").values().forEach((method) => {
|
|
8250
8205
|
if (!method) return;
|
|
8251
8206
|
BaseStream.prototype[method] = Function("streamReactiveHook", `
|
|
8252
8207
|
return function ${method === "delete" ? "del" : method}(){
|
|
@@ -8697,7 +8652,7 @@ function mapPublicationsTraverse(self, opts, adapter) {
|
|
|
8697
8652
|
}
|
|
8698
8653
|
function receivePublicationPrefix(self, opts, in_build = false) {
|
|
8699
8654
|
if (!hasOwn(opts, "receive")) return;
|
|
8700
|
-
const globalBoard = isInitialBuild(self) ? self[$$$core]?.$globals.transmited : (self[$$$core].$root || {})[$$$core]?.$globals.transmited;
|
|
8655
|
+
const globalBoard = isInitialBuild(self) ? self[$$$core]?.$globals.transmited : (self[$$$core].$root || {})[$$$core]?.$globals.transmited || {};
|
|
8701
8656
|
for (let [key, valueX] of getIterator(opts.receive)) {
|
|
8702
8657
|
let keyName = isArray(opts.receive) ? valueX : key;
|
|
8703
8658
|
if (!validateType(keyName, [String, Symbol])) {
|
|
@@ -8759,7 +8714,7 @@ function applyMixinMergeStrategy(self, options, mixins) {
|
|
|
8759
8714
|
const store = {};
|
|
8760
8715
|
for (const mx of mixins.toReversed().values()) {
|
|
8761
8716
|
if (!validateType(mx, [Function, Object])) {
|
|
8762
|
-
debugHandler(`[
|
|
8717
|
+
debugHandler(`[Houxit Mixin Merge Warn] Mixins expects a plain fuction/object instance/valid Houxit widget instance`, self, true);
|
|
8763
8718
|
return;
|
|
8764
8719
|
} else if (applied_mixins.has(mx)) continue;
|
|
8765
8720
|
applied_mixins.prepend(mx);
|
|
@@ -9780,7 +9735,10 @@ function Render_Effect_Reactive_Transform(self, observer) {
|
|
|
9780
9735
|
is_hyperscript,
|
|
9781
9736
|
observer
|
|
9782
9737
|
});
|
|
9783
|
-
}).catch((e) =>
|
|
9738
|
+
}).catch((e) => {
|
|
9739
|
+
console.error(e);
|
|
9740
|
+
debugHandler(e);
|
|
9741
|
+
});
|
|
9784
9742
|
} catch (e) {
|
|
9785
9743
|
RenderEffect_$Warn(self, e);
|
|
9786
9744
|
}
|
|
@@ -10190,7 +10148,7 @@ function installTransformersArgumentations(self, child, hx_Element, vNode) {
|
|
|
10190
10148
|
define(child[$$$core], "$root", { value: root });
|
|
10191
10149
|
define(child[$$$core], "$parent", { value: hx_Element.compiler_options.parent });
|
|
10192
10150
|
define(child[$$$core], "$owner", { value: self });
|
|
10193
|
-
for (let [prop, content] of entries(root[$$$core]
|
|
10151
|
+
for (let [prop, content] of entries(root?.[$$$core]?.$globals?.register || {})) child[$$$core].$globals.register[prop] = assign(child[$$$core].$globals.register[prop], content);
|
|
10194
10152
|
}
|
|
10195
10153
|
function resolveInstanceWidgetNormalizer(self, vNode) {
|
|
10196
10154
|
const tagname = isBlockTag(vNode.type) ? getBlockTagName(vNode.type) : vNode.type;
|
|
@@ -10256,16 +10214,18 @@ function $compilerEngine(self, virtualNode, hx_Element, slotsCompilerArgs, confi
|
|
|
10256
10214
|
virtualNode.filesFilter.useSSRCompiler = true;
|
|
10257
10215
|
if (isHydration(self)) virtualNode.filesFilter.isHydration = true;
|
|
10258
10216
|
}
|
|
10259
|
-
return initializedRenderBuild(self, hx_Element, virtualNode).mount(_createFragment());
|
|
10217
|
+
return initializedRenderBuild(self, hx_Element, virtualNode, config).mount(_createFragment());
|
|
10260
10218
|
}
|
|
10261
|
-
function initializedRenderBuild(self, hx_Element, virtualNode) {
|
|
10219
|
+
function initializedRenderBuild(self, hx_Element, virtualNode, config) {
|
|
10262
10220
|
const child = new HouxitBuild(virtualNode);
|
|
10221
|
+
child[$$$compiler].$$config = config;
|
|
10263
10222
|
integrateUseInstallProto(child);
|
|
10264
10223
|
if (hx_Element) hx_Element.widget_instance = child;
|
|
10265
10224
|
if (self) {
|
|
10266
10225
|
controllerHydration(self, child, hx_Element, virtualNode);
|
|
10267
10226
|
child.install(controllerGlobalPlugin, { self });
|
|
10268
10227
|
}
|
|
10228
|
+
if (config.isCustomElement) for (let callback of config.configureApp.values()) callback.call(config.element, child);
|
|
10269
10229
|
return child;
|
|
10270
10230
|
}
|
|
10271
10231
|
function integrateUseInstallProto(self) {
|
|
@@ -10478,7 +10438,7 @@ function isDynamicPropTag(tag) {
|
|
|
10478
10438
|
var isOpenEmptyTag = (tag) => /(\<[ ]*\>)/.test(tag);
|
|
10479
10439
|
var isCloseEmptyTag = (tag) => /(\<\/[ ]*\>)/.test(tag);
|
|
10480
10440
|
var openingTagsRegex = /(\<[ ]*\>|\<\/[ ]*\>)|(<(\/)?([\w\-\$!:\#\@.()[\]%?\/&]+)(\s+[^>]*?(?:(?:[\w]+[_!@#$'"%^&*()+\-\[\]{};:\\|,.<\/?~`]*)|(?:'[^']*'[^>\s]*)|(?:"[^"]*"[^>\s]*)))*\s*(\/)?>)|([\w \s!@#$'"%^&*()+\-\[\]{};:\\|,.>=\/?`~]+)/gm;
|
|
10481
|
-
var openingTagRegex = /<([\w\-\$!:\#\@.()[\]%?&]+)(\s+[^>]*?(?:(?:[\w]+[_!@#$'"%^&*()+\-\[\]{}
|
|
10441
|
+
var openingTagRegex = /<([\w\-\$!:\#\@.()[\]%?&]+)(\s+[^>]*?(?:(?:[\w]+[_!@#$'"%^&*()+\-\[\]{};:\\|,.<\/?=`~]*)|(?:'[^']*'[^>\s]*)|(?:"[^"]*"[^>\s]*)))*\s*(\/)?>/m;
|
|
10482
10442
|
var isOpeningTag = (source) => openingTagRegex.test(source);
|
|
10483
10443
|
var closingTagRegex = /<[\/]([\w$.:\-\@()[\]%&?\\\/]+)[ ]*>/;
|
|
10484
10444
|
var isClosingTag = (source) => closingTagRegex.test(source);
|
|
@@ -10487,7 +10447,7 @@ var openingTagAttrRegex = /^<[\w\-\$!\@:.()[\]%?&]+([\s\S]*[^\/>])?\s*(\/)?>\s*$
|
|
|
10487
10447
|
var JSXParserRegex = /hx:\(\(__(\d)__\)\)/;
|
|
10488
10448
|
var isOpeningCommentTag = (tag) => /<!-->/.test(tag);
|
|
10489
10449
|
var isClosingCommentTag = (tag) => /<\/-->/.test(tag);
|
|
10490
|
-
var
|
|
10450
|
+
var tempCommentRegex = /((<!--)|(-->))/g;
|
|
10491
10451
|
function compelToResolveTagname(self, vNode, config = {}) {
|
|
10492
10452
|
if (isHouxitBuild(self) && isString(vNode.type) && !IS_VALID_TAGNAME(vNode.type)) resolveInstanceWidgetNormalizer(self, vNode);
|
|
10493
10453
|
else if (config.JSXParser && isString(vNode.type) && JSXParserRegex.test(vNode.type)) {
|
|
@@ -10540,7 +10500,7 @@ function normalize_jsx_props(vnode, config) {
|
|
|
10540
10500
|
else if (JSXParserRegex.test(value)) {
|
|
10541
10501
|
const instance = normalizeJSXPropValue(config, key);
|
|
10542
10502
|
if (!isString(instance)) {
|
|
10543
|
-
debugHandler(`[ ] property key value passed to the "
|
|
10503
|
+
debugHandler(`[ ] property key value passed to the "htx" macro is not a valid prop name\n\ntype of "${typeof instance}" found >>>> Expects a "string" value`);
|
|
10544
10504
|
return;
|
|
10545
10505
|
}
|
|
10546
10506
|
vnode.props[instance] = vnode.props[key];
|
|
@@ -10617,7 +10577,7 @@ function openingTagHydrate(tagMatch, NodeList, setup, metrics) {
|
|
|
10617
10577
|
function parserSourceInitializer(source, self) {
|
|
10618
10578
|
return source.replace(generateBlockTagRegex(isHouxitBuild(self) ? self[$$$core].settings.delimiters : void 0), (match, timing, ClosingTag, name, value, selfClosed) => {
|
|
10619
10579
|
return `<${ClosingTag === "/" ? "/" : ""}::@_(${name})_ ${ClosingTag === "@" ? "exp=\"" + escapeDecoder(value) + "\"" : ""} ${selfClosed ? "/" : ""}>`;
|
|
10620
|
-
}).replace(
|
|
10580
|
+
}).replace(tempCommentRegex, (match, path, r) => /<!--/.test(match) ? "<!-->" : /-->/.test(match) ? "</-->" : match);
|
|
10621
10581
|
}
|
|
10622
10582
|
function __HouxitHTMLParser__(source, NodeList = [], config = {}, self) {
|
|
10623
10583
|
if (!isString(source) && !source.trim()) return !isArray(NodeList) ? [] : NodeList;
|
|
@@ -11130,7 +11090,7 @@ function blockConstPreprocessor(self, node, blockN, metrics, [children, exp], co
|
|
|
11130
11090
|
debugHandler(`[ ] "${variable}" is an invalid identifier`, self, true);
|
|
11131
11091
|
return [];
|
|
11132
11092
|
}
|
|
11133
|
-
|
|
11093
|
+
let data = _$runModelBind(self, expression?.trim(), hx_Element || context);
|
|
11134
11094
|
if (isDestructureSyntax(variable)) {
|
|
11135
11095
|
if (isFalse(destructWarn(variable, data, self))) return [];
|
|
11136
11096
|
smartDextCtxMerging(fall, { [$$dexTransformKey]: {
|
|
@@ -11179,12 +11139,12 @@ function blockForProcessor(self, node, blockN, metrics, [children, exp], isWidge
|
|
|
11179
11139
|
count: index
|
|
11180
11140
|
}, options);
|
|
11181
11141
|
else if (!is_hyperscript) {
|
|
11182
|
-
if (isForLoopDestructureRegex.test(provide
|
|
11183
|
-
options = wrapNamespaceBind(self, options, provide
|
|
11142
|
+
if (isForLoopDestructureRegex.test(provide?.value)) provide.value = "[" + provide.value.slice(1, -1) + "]";
|
|
11143
|
+
options = wrapNamespaceBind(self, options, provide?.value, arrayDestructureRegex.test(provide?.value) ? loopState : loopState[0]);
|
|
11184
11144
|
}
|
|
11185
11145
|
config.loop_context = loopState;
|
|
11186
11146
|
const createElement = () => {
|
|
11187
|
-
let src = children.map((child) => factoryRender(options, config, safeCall(child, loopState))).filter((v) => isHouxitElement(v));
|
|
11147
|
+
let src = children.map((child) => factoryRender(options, config, safeCall(child, ...loopState))).filter((v) => isHouxitElement(v));
|
|
11188
11148
|
src = len(src) < 2 ? src[0] : new HouxitFragmentElement(src, self, hx_Element, null, value);
|
|
11189
11149
|
return src;
|
|
11190
11150
|
};
|
|
@@ -11471,12 +11431,12 @@ function normalizePreJSXFormat(strings, values) {
|
|
|
11471
11431
|
}
|
|
11472
11432
|
return __HouxitHTMLParser__(boundJoin.join(""), [], { JSXParser: { sources: values } });
|
|
11473
11433
|
}
|
|
11474
|
-
function
|
|
11434
|
+
function htx(strings, ...values) {
|
|
11475
11435
|
return __EncodeJSXParser__(strings, values);
|
|
11476
11436
|
}
|
|
11477
11437
|
function __EncodeJSXParser__(strings, values) {
|
|
11478
11438
|
if (!isFunction(strings.reduce)) {
|
|
11479
|
-
debugHandler(`[ ]
|
|
11439
|
+
debugHandler(`[ ] htx macro can only be called with backticks embeded directly to method name\n\n"htx\`<templates>\`" instead of "htx()"\nCheck htx macro call`);
|
|
11480
11440
|
return;
|
|
11481
11441
|
}
|
|
11482
11442
|
if (len(values)) return normalizePreJSXFormat(strings, values);
|
|
@@ -11485,13 +11445,15 @@ function __EncodeJSXParser__(strings, values) {
|
|
|
11485
11445
|
return acc + str + value;
|
|
11486
11446
|
}, "");
|
|
11487
11447
|
if (!isString(html)) {
|
|
11488
|
-
debugHandler(`[ ]
|
|
11448
|
+
debugHandler(`[ ] htx parser macro expects strings values`);
|
|
11489
11449
|
return null;
|
|
11490
11450
|
}
|
|
11491
11451
|
return __HouxitHTMLParser__(html, [], { trim: true }, null);
|
|
11492
11452
|
}
|
|
11493
|
-
function MKDParser(mkd) {
|
|
11494
|
-
|
|
11453
|
+
function MKDParser(mkd) {
|
|
11454
|
+
return MKDParser(mkd);
|
|
11455
|
+
}
|
|
11456
|
+
function mdx(mkd, ...values) {
|
|
11495
11457
|
if (!isString(mkd)) {
|
|
11496
11458
|
debugHandler(`[ ] markdown helper expects strings values`);
|
|
11497
11459
|
return null;
|
|
@@ -11500,76 +11462,158 @@ function markdown(mkd, ...values) {
|
|
|
11500
11462
|
function createCustomElement(options) {
|
|
11501
11463
|
return _createCustomElement.call({}, ...arguments);
|
|
11502
11464
|
}
|
|
11503
|
-
function
|
|
11465
|
+
function __observeAttributes() {
|
|
11466
|
+
this.__attributeObserver = new MutationObserver((mutations) => {
|
|
11467
|
+
for (const mutation of mutations) {
|
|
11468
|
+
if (mutation.type !== "attributes") continue;
|
|
11469
|
+
const name = mutation.attributeName;
|
|
11470
|
+
const newValue = this.getAttribute(name);
|
|
11471
|
+
const oldValue = mutation.oldValue;
|
|
11472
|
+
if (oldValue === newValue) continue;
|
|
11473
|
+
__widget_props_effect(this.__app, {
|
|
11474
|
+
value: oldValue,
|
|
11475
|
+
effect: newValue,
|
|
11476
|
+
key: name
|
|
11477
|
+
});
|
|
11478
|
+
}
|
|
11479
|
+
});
|
|
11480
|
+
}
|
|
11481
|
+
function generateCustomNativeElementConstructor(setup, self) {
|
|
11504
11482
|
if (!inBrowserCompiler) return;
|
|
11505
|
-
return class
|
|
11483
|
+
return class HouxitCustomElement extends HTMLElement {
|
|
11506
11484
|
constructor() {
|
|
11507
11485
|
super();
|
|
11486
|
+
__observeAttributes.call(this);
|
|
11487
|
+
}
|
|
11488
|
+
static get observedAttributes() {
|
|
11489
|
+
return [];
|
|
11490
|
+
}
|
|
11491
|
+
__app = void 0;
|
|
11492
|
+
get __eventsMap() {
|
|
11493
|
+
return new Tuple();
|
|
11494
|
+
}
|
|
11495
|
+
addEventListener(e, h, o) {
|
|
11496
|
+
const customEvents = this._hx_Element.hx_Element.VNodeManager.customEvents;
|
|
11497
|
+
if (!hasOwn(customEvents, e)) customEvents[e] = new HouxitEvents(e, { target_value: this });
|
|
11498
|
+
return super.addEventListener(e, h, o);
|
|
11508
11499
|
}
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11500
|
+
dispatchEvent(e) {
|
|
11501
|
+
return super.dispatchEvent(e);
|
|
11502
|
+
}
|
|
11503
|
+
connectedCallback(...args) {
|
|
11504
|
+
for (let hooks of setup.connected.values()) hooks.call(this, ...args);
|
|
11505
|
+
}
|
|
11506
|
+
disConnectedCallback(...args) {
|
|
11507
|
+
for (let hooks of setup.disconnected.values()) hooks.call(this, ...args);
|
|
11508
|
+
}
|
|
11509
|
+
adoptedCallback(...args) {
|
|
11510
|
+
for (let hooks of setup.adopted.values()) hooks.call(this, ...args);
|
|
11511
|
+
}
|
|
11512
|
+
attributeChangedCallback(...args) {
|
|
11513
|
+
for (let hooks of setup.attrChanged.values()) hooks.call(this, ...args);
|
|
11512
11514
|
}
|
|
11513
11515
|
};
|
|
11514
11516
|
}
|
|
11515
|
-
function generateCustomElementConstructor(name) {
|
|
11517
|
+
function generateCustomElementConstructor(name, HouxitCustomElement) {
|
|
11516
11518
|
name = ToPascalCase(name);
|
|
11517
11519
|
if (!isValidIdentifier(name)) {
|
|
11518
11520
|
debugHandler(`[ ] unable to parse the customElements tag name\n\n
|
|
11519
11521
|
seems to have been an invalid identifier`);
|
|
11520
11522
|
return;
|
|
11521
11523
|
}
|
|
11522
|
-
return Function("
|
|
11523
|
-
return class ${name} extends
|
|
11524
|
+
return Function("HouxitCustomElement", `
|
|
11525
|
+
return class ${name} extends HouxitCustomElement{
|
|
11524
11526
|
constructor(){
|
|
11525
11527
|
super(...arguments);
|
|
11526
11528
|
}
|
|
11527
11529
|
}
|
|
11528
|
-
`)(
|
|
11529
|
-
}
|
|
11530
|
-
|
|
11530
|
+
`)(HouxitCustomElement);
|
|
11531
|
+
}
|
|
11532
|
+
var configOpts = {
|
|
11533
|
+
shadowMode: [String, Boolean],
|
|
11534
|
+
nonce: String,
|
|
11535
|
+
configureElement: Function,
|
|
11536
|
+
configureApp: Function,
|
|
11537
|
+
connected: Function,
|
|
11538
|
+
adopted: Function,
|
|
11539
|
+
attrChanged: Function,
|
|
11540
|
+
disconnected: Function
|
|
11541
|
+
};
|
|
11542
|
+
var ce_lch = "connected,disconnected,adopted,attrChanged,configureApp,configureElement";
|
|
11543
|
+
function _createCustomElement(opts, config) {
|
|
11531
11544
|
this.is_Custom_Node = true;
|
|
11532
11545
|
if (!validateCollectionArgs(arguments, {
|
|
11533
|
-
|
|
11534
|
-
|
|
11546
|
+
min: 1,
|
|
11547
|
+
max: 2,
|
|
11548
|
+
validators: [[Function, Object], Object],
|
|
11535
11549
|
name: "createCustomElement"
|
|
11536
11550
|
})) return;
|
|
11537
|
-
const
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11551
|
+
const setup = {
|
|
11552
|
+
connected: [],
|
|
11553
|
+
disconnected: [],
|
|
11554
|
+
adopted: [],
|
|
11555
|
+
attrChanged: [],
|
|
11556
|
+
configureApp: [],
|
|
11557
|
+
configureElement: []
|
|
11558
|
+
};
|
|
11559
|
+
for (let [name, type] of entries(configOpts)) {
|
|
11560
|
+
if (!hasOwn(config, name)) continue;
|
|
11561
|
+
const value = config[name];
|
|
11562
|
+
if (!validateType(value, type)) {
|
|
11563
|
+
debugHandler(`[ createCustomElement options ] customElements config options fails to meet type validation\n"${name}" option`);
|
|
11564
|
+
continue;
|
|
11547
11565
|
}
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
CustomNativeElement.prototype.connectedCallback = connectedCallback;
|
|
11566
|
+
if (name === "shadowMode" && isString(value) && !_makeMap_("closed,open", value)) debugHandler(`"shadowMode" config option of createCustomElement expects only valid type of 'open' | 'closed'\n\nmay output Unexpected result`);
|
|
11567
|
+
if (_makeMap_(ce_lch, name)) setup[name].push(value);
|
|
11568
|
+
}
|
|
11569
|
+
let { shadowMode = "open", nonce = "" } = config || {};
|
|
11570
|
+
const HouxitCustomElement = generateCustomNativeElementConstructor(setup);
|
|
11554
11571
|
function connectedCallback() {
|
|
11555
11572
|
let props = {};
|
|
11573
|
+
const compiler_options = {};
|
|
11556
11574
|
if (len(keys(this.attributes))) for (const [key, attr] of entries(this.attributes)) {
|
|
11557
|
-
|
|
11575
|
+
let { name, value } = attr;
|
|
11576
|
+
if (isOnListener(name)) {
|
|
11577
|
+
const customEvents = this._hx_Element.hx_Element.VNodeManager.customEvents;
|
|
11578
|
+
name = name.slice(2);
|
|
11579
|
+
if (!hasOwn(customEvents, name)) customEvents[name] = new HouxitEvents(name, { target_value: this });
|
|
11580
|
+
continue;
|
|
11581
|
+
}
|
|
11558
11582
|
props[name] = value;
|
|
11559
11583
|
}
|
|
11560
|
-
let
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11584
|
+
let shadow;
|
|
11585
|
+
if (isBoolean(shadowMode)) if (!shadowMode) shadowMode = "closed";
|
|
11586
|
+
else shadowMode = "open";
|
|
11587
|
+
if (isString(shadowMode)) shadow = this.attachShadow({ mode: shadowMode });
|
|
11588
|
+
let vnode = h(opts, props);
|
|
11589
|
+
const createElement = () => {
|
|
11590
|
+
return $compilerEngine(null, vnode, null, {}, {
|
|
11591
|
+
isCustomElement: true,
|
|
11592
|
+
element: this,
|
|
11593
|
+
shadow,
|
|
11594
|
+
compiler_options,
|
|
11595
|
+
configureApp: setup.configureApp
|
|
11596
|
+
}).$build;
|
|
11597
|
+
};
|
|
11598
|
+
setup.configureApp.unshift(function(app) {
|
|
11599
|
+
defineGetter(this, "__app", app);
|
|
11600
|
+
});
|
|
11565
11601
|
const template = createElement();
|
|
11566
11602
|
shadow.appendChild(template.$element);
|
|
11567
|
-
|
|
11603
|
+
this.__attributeObserver.observe(this, {
|
|
11604
|
+
attributes: true,
|
|
11605
|
+
attributeOldValue: true
|
|
11606
|
+
});
|
|
11568
11607
|
}
|
|
11569
|
-
|
|
11570
|
-
|
|
11608
|
+
setup.connected.unshift(connectedCallback);
|
|
11609
|
+
setup.disconnected.unshift(function() {
|
|
11610
|
+
this.__attributeObserver.disconnect();
|
|
11611
|
+
});
|
|
11612
|
+
for (let hks of setup.configureElement.values()) hks.call(this);
|
|
11613
|
+
HouxitCustomElement.define = function define(name, inherit) {
|
|
11614
|
+
return __define.call(this, name, inherit, HouxitCustomElement);
|
|
11571
11615
|
};
|
|
11572
|
-
function __define(name, inherit) {
|
|
11616
|
+
function __define(name, inherit, HouxitCustomElement) {
|
|
11573
11617
|
if (!validateCollectionArgs(arguments, {
|
|
11574
11618
|
name: "customElements.define()",
|
|
11575
11619
|
min: 1,
|
|
@@ -11581,15 +11625,15 @@ function _createCustomElement(opts) {
|
|
|
11581
11625
|
return;
|
|
11582
11626
|
}
|
|
11583
11627
|
if (inherit && !isString(inherit) && !IS_HTML_TAG(inherit)) {
|
|
11584
|
-
debugHandler(`[ ] problem with the inherit value, \n\n may not be a string value or a valid HTML tagName`);
|
|
11628
|
+
debugHandler(`[ ] problem with the inherit value, \n\n may not be a string value or a valid HTML tagName signature`);
|
|
11585
11629
|
debugHandler(`[ ] CustomElement registration failed`);
|
|
11586
11630
|
return;
|
|
11587
11631
|
}
|
|
11588
|
-
const CustomElementsInstance = generateCustomElementConstructor(name);
|
|
11632
|
+
const CustomElementsInstance = generateCustomElementConstructor(name, HouxitCustomElement);
|
|
11589
11633
|
if (inBrowserCompiler) customElements.define(name, CustomElementsInstance, inherit ? { extends: inherit } : {});
|
|
11590
11634
|
return CustomElementsInstance;
|
|
11591
11635
|
}
|
|
11592
|
-
return
|
|
11636
|
+
return HouxitCustomElement;
|
|
11593
11637
|
}
|
|
11594
11638
|
function _asyncWidget(callback, config) {
|
|
11595
11639
|
if (!validateCollectionArgs(arguments, {
|
|
@@ -11664,7 +11708,7 @@ function createSSRStreamHack(vnodePlate, ssrConfig) {
|
|
|
11664
11708
|
}
|
|
11665
11709
|
function _renderToStringCompiler(build, config) {
|
|
11666
11710
|
if (!isSSRCompiler(build)) {
|
|
11667
|
-
debugHandler(`[ ] "renderToString" macro was called on a non SSR
|
|
11711
|
+
debugHandler(`[ ] "renderToString" macro was called on a non SSR App build...\n\nuse "initSSRBuild" instead for an SSR App`);
|
|
11668
11712
|
return;
|
|
11669
11713
|
}
|
|
11670
11714
|
return new Promise((resolve) => {
|
|
@@ -11707,6 +11751,11 @@ function compileSSRProps(props, ctx) {
|
|
|
11707
11751
|
else src += " " + key + (value.trim() ? "=\"" + value + "\"" : "");
|
|
11708
11752
|
return src;
|
|
11709
11753
|
}
|
|
11754
|
+
function renderToNodeStream(app) {}
|
|
11755
|
+
function renderToNodeWritable(app, writable) {}
|
|
11756
|
+
function renderToWebWritable(app, writable) {}
|
|
11757
|
+
function renderToWebStream(app) {}
|
|
11758
|
+
function renderToSimpleStream(app, cbs) {}
|
|
11710
11759
|
function _createInitSSRBuild_(options, props, children) {
|
|
11711
11760
|
const vNode = createSSRStreamHack(arguments, {
|
|
11712
11761
|
type: "stream",
|
|
@@ -11799,6 +11848,7 @@ exports.Any = Any;
|
|
|
11799
11848
|
exports.Arguments = Arguments;
|
|
11800
11849
|
exports.Build = Build;
|
|
11801
11850
|
exports.Class = Class;
|
|
11851
|
+
exports.CompilerConfigOptions = CompilerConfigOptions;
|
|
11802
11852
|
exports.Else = Else;
|
|
11803
11853
|
exports.ElseIf = ElseIf;
|
|
11804
11854
|
exports.Exception = Exception;
|
|
@@ -11806,7 +11856,6 @@ exports.For = For;
|
|
|
11806
11856
|
exports.Fragment = Fragment;
|
|
11807
11857
|
exports.HTMLParser = HTMLParser;
|
|
11808
11858
|
exports.HTMLPropsParser = HTMLPropsParser;
|
|
11809
|
-
exports.HouxitCompilerSetup = HouxitCompilerSetup;
|
|
11810
11859
|
exports.If = If;
|
|
11811
11860
|
exports.MKDParser = MKDParser;
|
|
11812
11861
|
exports.Memo = Memo;
|
|
@@ -11861,7 +11910,7 @@ exports.generateTemplateElement = generateTemplateElement;
|
|
|
11861
11910
|
exports.generateUUID = generateUUID;
|
|
11862
11911
|
exports.get_version = get_version;
|
|
11863
11912
|
exports.h = h;
|
|
11864
|
-
exports.
|
|
11913
|
+
exports.htx = htx;
|
|
11865
11914
|
exports.initBuild = initBuild;
|
|
11866
11915
|
exports.initSSRBuild = initSSRBuild;
|
|
11867
11916
|
exports.isComputed = isComputed;
|
|
@@ -11879,7 +11928,7 @@ exports.isToken = isToken;
|
|
|
11879
11928
|
exports.len = len;
|
|
11880
11929
|
exports.log = log;
|
|
11881
11930
|
exports.markRaw = markRaw;
|
|
11882
|
-
exports.
|
|
11931
|
+
exports.mdx = mdx;
|
|
11883
11932
|
exports.memMove = memMove;
|
|
11884
11933
|
exports.mergeProps = mergeProps;
|
|
11885
11934
|
exports.observe = observe;
|
|
@@ -11900,7 +11949,12 @@ exports.raise = raise;
|
|
|
11900
11949
|
exports.read = read;
|
|
11901
11950
|
exports.readonly = readonly;
|
|
11902
11951
|
exports.readonlyStream = readonlyStream;
|
|
11952
|
+
exports.renderToNodeStream = renderToNodeStream;
|
|
11953
|
+
exports.renderToNodeWritable = renderToNodeWritable;
|
|
11954
|
+
exports.renderToSimpleStream = renderToSimpleStream;
|
|
11903
11955
|
exports.renderToString = renderToString;
|
|
11956
|
+
exports.renderToWebStream = renderToWebStream;
|
|
11957
|
+
exports.renderToWebWritable = renderToWebWritable;
|
|
11904
11958
|
exports.resolve = resolve;
|
|
11905
11959
|
exports.scaffold = scaffold;
|
|
11906
11960
|
exports.scopeEffectHook = scopeEffectHook;
|