taggedjs 2.8.30 → 2.8.32
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/bundle.js +1 -1
- package/bundle.js.map +1 -1
- package/js/index.d.ts +1 -0
- package/js/index.js +1 -0
- package/js/index.js.map +1 -1
- package/js/interpolations/attributes/processNameValueAttribute.function.d.ts +4 -4
- package/js/interpolations/attributes/processNameValueAttribute.function.js.map +1 -1
- package/js/interpolations/attributes/specialAttribute.d.ts +2 -2
- package/js/interpolations/attributes/specialAttribute.js.map +1 -1
- package/js/interpolations/attributes/updateAttribute.function.d.ts +3 -3
- package/js/interpolations/attributes/updateAttribute.function.js.map +1 -1
- package/js/interpolations/interpolateTemplate.d.ts +0 -4
- package/js/interpolations/optimizers/attachDynamicDom.function.d.ts +3 -3
- package/js/interpolations/optimizers/attachDynamicDom.function.js.map +1 -1
- package/js/interpolations/optimizers/domProcessContextItem.function.d.ts +3 -3
- package/js/interpolations/optimizers/domProcessContextItem.function.js.map +1 -1
- package/js/render/attributes/processAttribute.function.d.ts +7 -6
- package/js/render/attributes/processAttribute.function.js +55 -38
- package/js/render/attributes/processAttribute.function.js.map +1 -1
- package/js/render/attributes/processUpdateAttrContext.function.d.ts +1 -1
- package/js/render/attributes/processUpdateAttrContext.function.js.map +1 -1
- package/js/render/buildBeforeElement.function.d.ts +3 -3
- package/js/render/buildBeforeElement.function.js +1 -5
- package/js/render/buildBeforeElement.function.js.map +1 -1
- package/js/render/dom/attachDomElements.function.d.ts +3 -3
- package/js/render/dom/attachDomElements.function.js +3 -3
- package/js/render/dom/attachDomElements.function.js.map +1 -1
- package/js/render/paint.function.d.ts +4 -0
- package/js/render/paint.function.js +21 -3
- package/js/render/paint.function.js.map +1 -1
- package/js/render/renderExistingTag.function.d.ts +1 -1
- package/js/render/renderExistingTag.function.js.map +1 -1
- package/js/render/renderTagElement.function.d.ts +1 -1
- package/js/render/renderTagElement.function.js +2 -2
- package/js/render/renderTagElement.function.js.map +1 -1
- package/js/render/renderTagOnly.function.d.ts +1 -1
- package/js/render/renderWithSupport.function.d.ts +1 -1
- package/js/render/update/processRenderOnceInit.function.d.ts +4 -4
- package/js/render/update/processRenderOnceInit.function.js +0 -2
- package/js/render/update/processRenderOnceInit.function.js.map +1 -1
- package/js/render/update/processTag.function.d.ts +4 -4
- package/js/render/update/processTag.function.js +1 -1
- package/js/render/update/processTag.function.js.map +1 -1
- package/js/render/update/updateExistingTagComponent.function.d.ts +1 -1
- package/js/render/update/updateExistingTagComponent.function.js +1 -1
- package/js/render/update/updateExistingTagComponent.function.js.map +1 -1
- package/js/state/index.d.ts +1 -1
- package/js/state/index.js +1 -1
- package/js/state/index.js.map +1 -1
- package/js/state/subscribe.function.d.ts +1 -1
- package/js/state/subscribeWith.function.d.ts +1 -1
- package/js/state/subscribeWith.function.js +6 -0
- package/js/state/subscribeWith.function.js.map +1 -1
- package/js/subject/signal.function.d.ts +1 -1
- package/js/tag/AdvancedContextItem.type.d.ts +5 -0
- package/js/tag/AdvancedContextItem.type.js +2 -0
- package/js/tag/AdvancedContextItem.type.js.map +1 -0
- package/js/tag/BaseSupport.type.d.ts +2 -1
- package/js/tag/Context.types.d.ts +3 -32
- package/js/tag/ContextItem.type.d.ts +26 -0
- package/js/tag/ContextItem.type.js +2 -0
- package/js/tag/ContextItem.type.js.map +1 -0
- package/js/tag/ProcessInit.type.d.ts +6 -0
- package/js/tag/ProcessInit.type.js +2 -0
- package/js/tag/ProcessInit.type.js.map +1 -0
- package/js/tag/StringTag.type.d.ts +3 -2
- package/js/tag/SupportContextItem.type.d.ts +7 -0
- package/js/tag/SupportContextItem.type.js +2 -0
- package/js/tag/SupportContextItem.type.js.map +1 -0
- package/js/tag/Tag.type.d.ts +9 -5
- package/js/tag/TagCounts.type.d.ts +4 -0
- package/js/tag/TagCounts.type.js +2 -0
- package/js/tag/TagCounts.type.js.map +1 -0
- package/js/tag/TemplateValue.type.d.ts +7 -0
- package/js/tag/TemplateValue.type.js +2 -0
- package/js/tag/TemplateValue.type.js.map +1 -0
- package/js/tag/checkDestroyPrevious.function.d.ts +2 -1
- package/js/tag/checkDestroyPrevious.function.js +5 -3
- package/js/tag/checkDestroyPrevious.function.js.map +1 -1
- package/js/tag/checkSimpleValueChange.function.d.ts +1 -1
- package/js/tag/checkTagValueChange.function.d.ts +4 -4
- package/js/tag/checkTagValueChange.function.js +2 -2
- package/js/tag/createHtmlSupport.function.d.ts +2 -7
- package/js/tag/createHtmlSupport.function.js.map +1 -1
- package/js/tag/createSupport.function.d.ts +1 -1
- package/js/tag/createSupport.function.js.map +1 -1
- package/js/tag/destroyContext.function.d.ts +1 -1
- package/js/tag/destroyContext.function.js +3 -2
- package/js/tag/destroyContext.function.js.map +1 -1
- package/js/tag/gaurenteeInserBefore.function.d.ts +4 -0
- package/js/tag/gaurenteeInserBefore.function.js +18 -0
- package/js/tag/gaurenteeInserBefore.function.js.map +1 -0
- package/js/tag/getDomTag.function.d.ts +3 -1
- package/js/tag/getDomTag.function.js +72 -17
- package/js/tag/getDomTag.function.js.map +1 -1
- package/js/tag/getTagWrap.function.js +1 -1
- package/js/tag/getTagWrap.function.js.map +1 -1
- package/js/tag/getTemplaterResult.function.d.ts +9 -5
- package/js/tag/getTemplaterResult.function.js +3 -0
- package/js/tag/getTemplaterResult.function.js.map +1 -1
- package/js/tag/guaranteeInsertBefore.function.d.ts +4 -0
- package/js/tag/guaranteeInsertBefore.function.js +18 -0
- package/js/tag/guaranteeInsertBefore.function.js.map +1 -0
- package/js/tag/hasPropChanges.function.d.ts +1 -1
- package/js/tag/hasPropChanges.function.js +1 -1
- package/js/tag/hasPropChanges.function.js.map +1 -1
- package/js/tag/html.js +1 -1
- package/js/tag/html.js.map +1 -1
- package/js/tag/index.d.ts +10 -3
- package/js/tag/index.js +4 -3
- package/js/tag/index.js.map +1 -1
- package/js/tag/loadNewBaseSupport.function.d.ts +1 -1
- package/js/tag/loadNewBaseSupport.function.js.map +1 -1
- package/js/tag/processUpdateContext.function.d.ts +1 -1
- package/js/tag/processUpdateContext.function.js +2 -0
- package/js/tag/processUpdateContext.function.js.map +1 -1
- package/js/tag/props/alterProp.function.d.ts +3 -4
- package/js/tag/props/alterProp.function.js +6 -7
- package/js/tag/props/alterProp.function.js.map +1 -1
- package/js/tag/props/clonePropsBy.function.js +1 -1
- package/js/tag/props/clonePropsBy.function.js.map +1 -1
- package/js/tag/tag.function.js +1 -1
- package/js/tag/tag.function.js.map +1 -1
- package/js/tag/tagElement.js +10 -3
- package/js/tag/tagElement.js.map +1 -1
- package/js/tag/update/SubContext.type.d.ts +16 -0
- package/js/tag/update/SubContext.type.js +2 -0
- package/js/tag/update/SubContext.type.js.map +1 -0
- package/js/tag/update/checkSubContext.function.d.ts +3 -0
- package/js/tag/update/checkSubContext.function.js +18 -0
- package/js/tag/update/checkSubContext.function.js.map +1 -0
- package/js/tag/update/compareArrayItems.function.d.ts +6 -5
- package/js/tag/update/compareArrayItems.function.js.map +1 -1
- package/js/tag/update/createAndProcessContextItem.function.d.ts +4 -4
- package/js/tag/update/createAndProcessContextItem.function.js +2 -3
- package/js/tag/update/createAndProcessContextItem.function.js.map +1 -1
- package/js/tag/update/deleteSubContext.function.d.ts +3 -0
- package/js/tag/update/deleteSubContext.function.js +25 -0
- package/js/tag/update/deleteSubContext.function.js.map +1 -0
- package/js/tag/update/forceUpdateExistingValue.function.d.ts +3 -3
- package/js/tag/update/forceUpdateExistingValue.function.js +2 -1
- package/js/tag/update/forceUpdateExistingValue.function.js.map +1 -1
- package/js/tag/update/getNewGlobal.function.d.ts +1 -1
- package/js/tag/update/handleStillTag.function.d.ts +2 -2
- package/js/tag/update/handleStillTag.function.js.map +1 -1
- package/js/tag/update/index.d.ts +5 -0
- package/js/tag/update/index.js +5 -0
- package/js/tag/update/index.js.map +1 -0
- package/js/tag/update/onFirstSubContext.function.d.ts +7 -0
- package/js/tag/update/onFirstSubContext.function.js +8 -0
- package/js/tag/update/onFirstSubContext.function.js.map +1 -0
- package/js/tag/update/oneRenderToSupport.function.d.ts +1 -1
- package/js/tag/update/oneRenderToSupport.function.js +1 -1
- package/js/tag/update/oneRenderToSupport.function.js.map +1 -1
- package/js/tag/update/processDomTagInit.function.d.ts +7 -6
- package/js/tag/update/processDomTagInit.function.js +2 -4
- package/js/tag/update/processDomTagInit.function.js.map +1 -1
- package/js/tag/update/processFirstSubject.utils.d.ts +1 -6
- package/js/tag/update/processFirstSubjectComponent.function.d.ts +4 -4
- package/js/tag/update/processFirstSubjectComponent.function.js.map +1 -1
- package/js/tag/update/processFirstSubjectValue.function.d.ts +6 -6
- package/js/tag/update/processFirstSubjectValue.function.js +4 -30
- package/js/tag/update/processFirstSubjectValue.function.js.map +1 -1
- package/js/tag/update/processNewSubjectTag.function.d.ts +3 -3
- package/js/tag/update/processNewSubjectTag.function.js +0 -2
- package/js/tag/update/processNewSubjectTag.function.js.map +1 -1
- package/js/tag/update/processRegularValue.function.d.ts +2 -2
- package/js/tag/update/processRegularValue.function.js +8 -9
- package/js/tag/update/processRegularValue.function.js.map +1 -1
- package/js/tag/update/processSubscribe.function.d.ts +8 -8
- package/js/tag/update/processSubscribe.function.js +1 -1
- package/js/tag/update/processSubscribe.function.js.map +1 -1
- package/js/tag/update/processTagArray.d.ts +5 -5
- package/js/tag/update/processTagArray.js.map +1 -1
- package/js/tag/update/processTagComponentInit.function.d.ts +5 -4
- package/js/tag/update/processTagComponentInit.function.js +0 -2
- package/js/tag/update/processTagComponentInit.function.js.map +1 -1
- package/js/tag/update/processTagInit.function.d.ts +4 -3
- package/js/tag/update/processTagInit.function.js +0 -2
- package/js/tag/update/processTagInit.function.js.map +1 -1
- package/js/tag/update/processTagResult.function.d.ts +4 -4
- package/js/tag/update/processTagResult.function.js +0 -2
- package/js/tag/update/processTagResult.function.js.map +1 -1
- package/js/tag/update/setupSubscribe.function.d.ts +9 -21
- package/js/tag/update/setupSubscribe.function.js +28 -80
- package/js/tag/update/setupSubscribe.function.js.map +1 -1
- package/js/tag/update/tagValueUpdateHandler.function.d.ts +3 -3
- package/js/tag/update/tagValueUpdateHandler.function.js.map +1 -1
- package/js/tag/update/tryUpdateToTag.function.d.ts +2 -2
- package/js/tag/update/tryUpdateToTag.function.js.map +1 -1
- package/js/tag/update/updateToDiffValue.function.d.ts +3 -3
- package/js/tag/update/updateToDiffValue.function.js +2 -0
- package/js/tag/update/updateToDiffValue.function.js.map +1 -1
- package/js/tag/update/valueToTagJsVar.function.d.ts +5 -0
- package/js/tag/update/valueToTagJsVar.function.js +55 -0
- package/js/tag/update/valueToTagJsVar.function.js.map +1 -0
- package/js/tagJsTypes/getInnerHTML.function.d.ts +13 -0
- package/js/tagJsTypes/getInnerHTML.function.js +35 -0
- package/js/tagJsTypes/getInnerHTML.function.js.map +1 -0
- package/js/tagJsTypes/index.d.ts +3 -0
- package/js/tagJsTypes/index.js +4 -0
- package/js/tagJsTypes/index.js.map +1 -0
- package/js/tagJsTypes/subscribe.function.d.ts +20 -0
- package/js/tagJsTypes/subscribe.function.js +15 -0
- package/js/tagJsTypes/subscribe.function.js.map +1 -0
- package/js/tagJsTypes/tag.function.d.ts +46 -0
- package/js/tagJsTypes/tag.function.js +110 -0
- package/js/tagJsTypes/tag.function.js.map +1 -0
- package/js/tagJsTypes/tagJsType.type.d.ts +7 -0
- package/js/tagJsTypes/tagJsType.type.js +2 -0
- package/js/tagJsTypes/tagJsType.type.js.map +1 -0
- package/js/tagJsVars/getArrayTagJsVar.function.d.ts +2 -0
- package/js/tagJsVars/getArrayTagJsVar.function.js +18 -0
- package/js/tagJsVars/getArrayTagJsVar.function.js.map +1 -0
- package/js/tagJsVars/getInnerHTML.function.d.ts +2 -0
- package/js/tagJsVars/getInnerHTML.function.js +35 -0
- package/js/tagJsVars/getInnerHTML.function.js.map +1 -0
- package/js/tagJsVars/getSimpleTagVar.function.d.ts +14 -0
- package/js/tagJsVars/getSimpleTagVar.function.js +49 -0
- package/js/tagJsVars/getSimpleTagVar.function.js.map +1 -0
- package/js/tagJsVars/index.d.ts +4 -0
- package/js/tagJsVars/index.js +5 -0
- package/js/tagJsVars/index.js.map +1 -0
- package/js/tagJsVars/subscribe.function.d.ts +21 -0
- package/js/tagJsVars/subscribe.function.js +21 -0
- package/js/tagJsVars/subscribe.function.js.map +1 -0
- package/js/tagJsVars/tag.function.d.ts +47 -0
- package/js/tagJsVars/tag.function.js +95 -0
- package/js/tagJsVars/tag.function.js.map +1 -0
- package/js/tagJsVars/tagJsVar.type.d.ts +12 -0
- package/js/tagJsVars/tagJsVar.type.js +2 -0
- package/js/tagJsVars/tagJsVar.type.js.map +1 -0
- package/js/tagJsVars/valueToTagJsVar.function.d.ts +4 -0
- package/js/tagJsVars/valueToTagJsVar.function.js +17 -0
- package/js/tagJsVars/valueToTagJsVar.function.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// taggedjs-no-compile
|
|
2
|
+
import { setUseMemory } from '../state/index.js';
|
|
3
|
+
import { getTemplaterResult } from '../tag/getTemplaterResult.function.js';
|
|
4
|
+
import { tags } from '../tag/tag.utils.js';
|
|
5
|
+
import { getTagWrap } from '../tag/getTagWrap.function.js';
|
|
6
|
+
import { ValueTypes } from '../tag/ValueTypes.enum.js';
|
|
7
|
+
import { processRenderOnceInit } from '../render/update/processRenderOnceInit.function.js';
|
|
8
|
+
import { processTagComponentInit } from '../tag/update/processTagComponentInit.function.js';
|
|
9
|
+
let tagCount = 0;
|
|
10
|
+
/** How to handle checking for prop changes aka argument changes */
|
|
11
|
+
export var PropWatches;
|
|
12
|
+
(function (PropWatches) {
|
|
13
|
+
PropWatches["DEEP"] = "deep";
|
|
14
|
+
/** checks all values up to 2 levels deep */
|
|
15
|
+
PropWatches["SHALLOW"] = "shallow";
|
|
16
|
+
PropWatches["NONE"] = "none";
|
|
17
|
+
PropWatches["IMMUTABLE"] = "immutable";
|
|
18
|
+
})(PropWatches || (PropWatches = {}));
|
|
19
|
+
/** Wraps a function tag in a state manager and calls wrapped function on event cycles
|
|
20
|
+
* For single rendering, no event cycles, use: tag.renderOnce = (props) => html``
|
|
21
|
+
*/
|
|
22
|
+
export function tag(tagComponent, propWatch = PropWatches.SHALLOW) {
|
|
23
|
+
/** function developer triggers */
|
|
24
|
+
const parentWrap = function tagWrapper(...props) {
|
|
25
|
+
const templater = getTemplaterResult(propWatch, props);
|
|
26
|
+
templater.tagJsType = ValueTypes.tagComponent;
|
|
27
|
+
templater.processInit = processTagComponentInit;
|
|
28
|
+
// attach memory back to original function that contains developer display logic
|
|
29
|
+
const innerTagWrap = getTagWrap(templater, parentWrap);
|
|
30
|
+
innerTagWrap.original = tagComponent;
|
|
31
|
+
/*
|
|
32
|
+
if(!innerTagWrap.parentWrap) {
|
|
33
|
+
innerTagWrap.parentWrap = parentWrap as TagWrapper<unknown>
|
|
34
|
+
}
|
|
35
|
+
*/
|
|
36
|
+
templater.wrapper = innerTagWrap;
|
|
37
|
+
return templater;
|
|
38
|
+
}; // we override the function provided and pretend original is what's returned
|
|
39
|
+
const tag = tagComponent;
|
|
40
|
+
parentWrap.original = tagComponent;
|
|
41
|
+
// group tags together and have hmr pickup
|
|
42
|
+
tag.tags = tags;
|
|
43
|
+
tag.setUse = setUseMemory;
|
|
44
|
+
tag.ValueTypes = ValueTypes;
|
|
45
|
+
tag.tagIndex = tagCount++; // needed for things like HMR
|
|
46
|
+
tags.push(parentWrap);
|
|
47
|
+
return parentWrap;
|
|
48
|
+
}
|
|
49
|
+
tag.renderOnce = renderOnceFn;
|
|
50
|
+
function renderOnceFn() {
|
|
51
|
+
throw new Error('Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `');
|
|
52
|
+
}
|
|
53
|
+
/** Used to create variable scoping when calling a function that lives within a prop container function */
|
|
54
|
+
function tagUseFn() {
|
|
55
|
+
throw new Error('Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `');
|
|
56
|
+
}
|
|
57
|
+
/** @deprecated use tag.use() instead */
|
|
58
|
+
;
|
|
59
|
+
tag.state = tagUseFn;
|
|
60
|
+
tag.use = tagUseFn;
|
|
61
|
+
tag.route = routeFn;
|
|
62
|
+
function routeFn(_routeProps) {
|
|
63
|
+
throw new Error('Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `');
|
|
64
|
+
}
|
|
65
|
+
/** Use to structure and define a browser tag route handler
|
|
66
|
+
* Example: export default tag.route = (routeProps: RouteProps) => (state) => html``
|
|
67
|
+
*/
|
|
68
|
+
;
|
|
69
|
+
tag.app = function (_routeTag) {
|
|
70
|
+
throw new Error('Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `');
|
|
71
|
+
};
|
|
72
|
+
tag.deepPropWatch = tag;
|
|
73
|
+
tag.immutableProps = function immutableProps(tagComponent) {
|
|
74
|
+
return tag(tagComponent, PropWatches.IMMUTABLE);
|
|
75
|
+
};
|
|
76
|
+
tag.watchProps = function watchProps(tagComponent) {
|
|
77
|
+
return tag(tagComponent, PropWatches.SHALLOW);
|
|
78
|
+
};
|
|
79
|
+
/* BELOW: Cast functions into setters with no getters */
|
|
80
|
+
Object.defineProperty(tag, 'renderOnce', {
|
|
81
|
+
set(oneRenderFunction) {
|
|
82
|
+
;
|
|
83
|
+
oneRenderFunction.tagJsType = ValueTypes.renderOnce;
|
|
84
|
+
oneRenderFunction.processInit = processRenderOnceInit;
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
// TODO: deprecate this in favor of tag.use
|
|
88
|
+
Object.defineProperty(tag, 'state', {
|
|
89
|
+
set(renderFunction) {
|
|
90
|
+
console.warn('deprecated, use tag.use instead of tag.state');
|
|
91
|
+
renderFunction.original = {
|
|
92
|
+
setUse: setUseMemory,
|
|
93
|
+
tags,
|
|
94
|
+
};
|
|
95
|
+
renderFunction.tagJsType = ValueTypes.stateRender;
|
|
96
|
+
renderFunction.processInit = processTagComponentInit;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(tag, 'use', {
|
|
100
|
+
set(renderFunction) {
|
|
101
|
+
;
|
|
102
|
+
renderFunction.original = {
|
|
103
|
+
setUse: setUseMemory,
|
|
104
|
+
tags,
|
|
105
|
+
};
|
|
106
|
+
renderFunction.tagJsType = ValueTypes.stateRender;
|
|
107
|
+
renderFunction.processInit = processTagComponentInit;
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=tag.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.function.js","sourceRoot":"","sources":["../../ts/tagJsTypes/tag.function.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAItB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,uCAAuC,CAAA;AACpG,OAAO,EAAsC,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,IAAI,QAAQ,GAAG,CAAC,CAAA;AAShB,mEAAmE;AACnE,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,4BAAa,CAAA;IAEb,4CAA4C;IAC5C,kCAAmB,CAAA;IAEnB,4BAAa,CAAA;IACb,sCAAuB,CAAA;AACzB,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CACjB,YAAe,EACf,YAAyB,WAAW,CAAC,OAAO;IAE5C,kCAAkC;IAClC,MAAM,UAAU,GAAG,SAAS,UAAU,CACpC,GAAG,KAAsC;QAEzC,MAAM,SAAS,GAAoB,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAEvE,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AC9D;QAAC,cAA0B,CAAC,WAAW,GAAG,uBAAuB,CAAA;IACpE,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagJsType.type.js","sourceRoot":"","sources":["../../ts/tagJsTypes/tagJsType.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { checkArrayValueChange, destroyArrayContextItem } from '../tag/checkDestroyPrevious.function.js';
|
|
2
|
+
import { processTagArray } from '../tag/update/processTagArray.js';
|
|
3
|
+
export function getArrayTagVar(value) {
|
|
4
|
+
return {
|
|
5
|
+
tagJsType: 'array',
|
|
6
|
+
value,
|
|
7
|
+
processInit: processArrayInit,
|
|
8
|
+
checkValueChange: checkArrayValueChange,
|
|
9
|
+
delete: destroyArrayContextItem,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function processArrayInit(value, // TemplateValue | StringTag | SubscribeValue | SignalObject,
|
|
13
|
+
contextItem, ownerSupport, counts, // {added:0, removed:0}
|
|
14
|
+
appendTo) {
|
|
15
|
+
const subValue = value;
|
|
16
|
+
processTagArray(contextItem, subValue, ownerSupport, counts, appendTo);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=getArrayTagJsVar.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArrayTagJsVar.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/getArrayTagJsVar.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAA;AAExG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAMlE,MAAM,UAAU,cAAc,CAC5B,KAAU;IAEV,OAAO;QACL,SAAS,EAAE,OAAO;QAClB,KAAK;QACL,WAAW,EAAE,gBAAgB;QAC7B,gBAAgB,EAAE,qBAAqB;QACvC,MAAM,EAAE,uBAAuB;KAChC,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,KAAe,EAAE,6DAA6D;AAC9E,WAAwB,EACxB,YAAwB,EACxB,MAAiB,EAAE,uBAAuB;AAC1C,QAAkB;IAElB,MAAM,QAAQ,GAAG,KAAY,CAAA;IAE7B,eAAe,CACb,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,QAAQ,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { deleteSubContext, guaranteeInsertBefore, onFirstSubContext } from "../index.js";
|
|
2
|
+
import { forceUpdateExistingValue } from "../tag/update/index.js";
|
|
3
|
+
function handleInnerHTML(value, newSupport, contextItem) {
|
|
4
|
+
const owner = value.owner;
|
|
5
|
+
const realValue = owner._innerHTML;
|
|
6
|
+
realValue.processInit = realValue.oldProcessInit;
|
|
7
|
+
const context = contextItem.subContext?.contextItem;
|
|
8
|
+
forceUpdateExistingValue(context, realValue, newSupport);
|
|
9
|
+
}
|
|
10
|
+
function processInnerHTML(value, contextItem, ownerSupport, counts, // {added:0, removed:0}
|
|
11
|
+
appendTo, insertBefore) {
|
|
12
|
+
contextItem.subContext = {};
|
|
13
|
+
contextItem.handler = handleInnerHTML;
|
|
14
|
+
checkInnerHTML(value, ownerSupport, contextItem, counts, insertBefore, appendTo);
|
|
15
|
+
}
|
|
16
|
+
function checkInnerHTML(value, ownerSupport, contextItem, counts, // {added:0, removed:0}
|
|
17
|
+
insertBeforeOriginal, appendTo) {
|
|
18
|
+
const { appendMarker, insertBefore } = guaranteeInsertBefore(appendTo, insertBeforeOriginal);
|
|
19
|
+
const subContext = contextItem.subContext;
|
|
20
|
+
subContext.appendMarker = appendMarker;
|
|
21
|
+
const owner = value.owner;
|
|
22
|
+
const realValue = owner._innerHTML;
|
|
23
|
+
realValue.processInit = realValue.oldProcessInit;
|
|
24
|
+
/** Render the content that will CONTAIN the innerHTML */
|
|
25
|
+
onFirstSubContext(realValue, subContext, ownerSupport, counts, insertBefore);
|
|
26
|
+
}
|
|
27
|
+
export function getInnerHTML() {
|
|
28
|
+
return {
|
|
29
|
+
tagJsType: 'innerHTML',
|
|
30
|
+
processInit: processInnerHTML,
|
|
31
|
+
delete: deleteSubContext,
|
|
32
|
+
checkValueChange: () => console.log('weird innerHTML check'),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=getInnerHTML.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInnerHTML.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/getInnerHTML.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,gBAAgB,EAAE,qBAAqB,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAA;AAG7J,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAQjE,SAAS,eAAe,CACtB,KAAoB,EACpB,UAAsB,EACtB,WAAwB;IAExB,MAAM,KAAK,GAAI,KAAa,CAAC,KAAK,CAAA;IAClC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAA;IAClC,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,cAAc,CAAA;IAEhD,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,WAAkC,CAAA;IAE1E,wBAAwB,CACtB,OAAO,EACP,SAAS,EACT,UAAU,CACX,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,KAAqB,EACrB,WAAwB,EACxB,YAAwB,EACxB,MAAiB,EAAE,uBAAuB;AAC1C,QAAkB,EAClB,YAAmB;IAEnB,WAAW,CAAC,UAAU,GAAG,EAAgB,CAAA;IAEzC,WAAW,CAAC,OAAO,GAAG,eAAe,CAAA;IAErC,cAAc,CACZ,KAAK,EACL,YAAY,EACZ,WAAW,EACX,MAAM,EACN,YAAoB,EACpB,QAAQ,CACT,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CACrB,KAAc,EACd,YAAwB,EACxB,WAAwB,EACxB,MAAiB,EAAE,uBAAuB;AAC1C,oBAA0B,EAC1B,QAAkB;IAElB,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAA;IAE5F,MAAM,UAAU,GAAG,WAAW,CAAC,UAAwB,CAAA;IACvD,UAAU,CAAC,YAAY,GAAG,YAAY,CAAA;IAEtC,MAAM,KAAK,GAAI,KAAa,CAAC,KAAK,CAAA;IAClC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAA;IAClC,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,cAAc,CAAA;IAGhD,yDAAyD;IACzD,iBAAiB,CACf,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,YAAY,CACb,CAAA;AACH,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,gBAAgB;QAC7B,MAAM,EAAE,gBAAgB;QACxB,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAQ;KACpE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnySupport, ContextItem, TagCounts } from "../index.js";
|
|
2
|
+
export declare function getSimpleTagVar(value: any): {
|
|
3
|
+
tagJsType: string;
|
|
4
|
+
value: any;
|
|
5
|
+
processInit: typeof processSimpleValueInit;
|
|
6
|
+
checkValueChange: typeof checkSimpleValueChange;
|
|
7
|
+
delete: typeof deleteSimpleValue;
|
|
8
|
+
};
|
|
9
|
+
declare function processSimpleValueInit(value: any, // TemplateValue | StringTag | SubscribeValue | SignalObject,
|
|
10
|
+
contextItem: ContextItem, ownerSupport: AnySupport, counts: TagCounts, // {added:0, removed:0}
|
|
11
|
+
appendTo?: Element, insertBefore?: Text): void;
|
|
12
|
+
export declare function deleteSimpleValue(contextItem: ContextItem): void;
|
|
13
|
+
export declare function checkSimpleValueChange(newValue: unknown, contextItem: ContextItem): -1 | 6;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BasicTypes } from "../index.js";
|
|
2
|
+
import { castTextValue } from '../castTextValue.function.js';
|
|
3
|
+
import { paintBeforeText, paintCommands, paintRemover } from "../render/paint.function.js";
|
|
4
|
+
import { processUpdateRegularValue } from "../tag/update/processRegularValue.function.js";
|
|
5
|
+
export function getSimpleTagVar(value) {
|
|
6
|
+
return {
|
|
7
|
+
tagJsType: 'simple',
|
|
8
|
+
value,
|
|
9
|
+
processInit: processSimpleValueInit,
|
|
10
|
+
checkValueChange: checkSimpleValueChange,
|
|
11
|
+
delete: deleteSimpleValue,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function processSimpleValueInit(value, // TemplateValue | StringTag | SubscribeValue | SignalObject,
|
|
15
|
+
contextItem, ownerSupport, counts, // {added:0, removed:0}
|
|
16
|
+
appendTo, insertBefore) {
|
|
17
|
+
// value = value.value
|
|
18
|
+
const castedValue = castTextValue(value);
|
|
19
|
+
insertBefore = contextItem.placeholder;
|
|
20
|
+
// always insertBefore for content
|
|
21
|
+
const paint = contextItem.paint = {
|
|
22
|
+
processor: paintBeforeText,
|
|
23
|
+
args: [insertBefore, castedValue, (x) => {
|
|
24
|
+
contextItem.simpleValueElm = x;
|
|
25
|
+
delete contextItem.paint;
|
|
26
|
+
}],
|
|
27
|
+
};
|
|
28
|
+
paintCommands.push(paint);
|
|
29
|
+
}
|
|
30
|
+
export function deleteSimpleValue(contextItem) {
|
|
31
|
+
const elm = contextItem.simpleValueElm;
|
|
32
|
+
delete contextItem.simpleValueElm;
|
|
33
|
+
delete contextItem.tagJsVar;
|
|
34
|
+
paintCommands.push({
|
|
35
|
+
processor: paintRemover,
|
|
36
|
+
args: [elm],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function checkSimpleValueChange(newValue, contextItem) {
|
|
40
|
+
const isBadValue = newValue === null || newValue === undefined;
|
|
41
|
+
if (isBadValue || !(typeof (newValue) === BasicTypes.object)) {
|
|
42
|
+
// This will cause all other values to render
|
|
43
|
+
processUpdateRegularValue(newValue, contextItem);
|
|
44
|
+
return -1; // no need to destroy, just update display
|
|
45
|
+
}
|
|
46
|
+
deleteSimpleValue(contextItem);
|
|
47
|
+
return 6; // 'changed-simple-value'
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=getSimpleTagVar.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSimpleTagVar.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/getSimpleTagVar.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAA0B,MAAM,aAAa,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1F,OAAO,EAAE,yBAAyB,EAAgB,MAAM,+CAA+C,CAAA;AAEvG,MAAM,UAAU,eAAe,CAC7B,KAAU;IAEV,OAAO;QACL,SAAS,EAAE,QAAQ;QACnB,KAAK;QACL,WAAW,EAAE,sBAAsB;QACnC,gBAAgB,EAAE,sBAAsB;QACxC,MAAM,EAAE,iBAAiB;KAC1B,CAAA;AACH,CAAC;AAED,SAAS,sBAAsB,CAC7B,KAAU,EAAE,6DAA6D;AACzE,WAAwB,EACxB,YAAwB,EACxB,MAAiB,EAAE,uBAAuB;AAC1C,QAAkB,EAClB,YAAmB;IAEnB,sBAAsB;IACtB,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;IAExC,YAAY,GAAG,WAAW,CAAC,WAAmB,CAAA;IAE9C,kCAAkC;IAClC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,GAAG;QAChC,SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,CAAO,EAAE,EAAE;gBAC5C,WAAW,CAAC,cAAc,GAAG,CAAC,CAAA;gBAC9B,OAAO,WAAW,CAAC,KAAK,CAAA;YAC1B,CAAC,CAAC;KACH,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,WAAwB;IAExB,MAAM,GAAG,GAAG,WAAW,CAAC,cAAyB,CAAA;IAEjD,OAAO,WAAW,CAAC,cAAc,CAAA;IACjC,OAAO,WAAW,CAAC,QAAQ,CAAA;IAE3B,aAAa,CAAC,IAAI,CAAC;QACjB,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,CAAC,GAAG,CAAC;KACZ,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAiB,EACjB,WAAwB;IAExB,MAAM,UAAU,GAAG,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAA;IAC9D,IAAG,UAAU,IAAI,CAAC,CAAC,OAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,6CAA6C;QAC7C,yBAAyB,CACvB,QAAwB,EACxB,WAAW,CACZ,CAAA;QAED,OAAO,CAAC,CAAC,CAAA,CAAE,0CAA0C;IACvD,CAAC;IAED,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAE9B,OAAO,CAAC,CAAA,CAAC,yBAAyB;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/tagJsVars/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ProcessInit } from "../tag/ProcessInit.type.js";
|
|
2
|
+
import { ValueTypes } from "../tag/index.js";
|
|
3
|
+
import { StatesSetter } from "../state/states.utils.js";
|
|
4
|
+
import { TagJsVar } from "./tagJsVar.type.js";
|
|
5
|
+
export type LikeSubscription = {
|
|
6
|
+
unsubscribe: () => any;
|
|
7
|
+
};
|
|
8
|
+
export type LikeObservable<T> = {
|
|
9
|
+
subscribe: (callback: (arg: T) => any) => (LikeSubscription);
|
|
10
|
+
};
|
|
11
|
+
export type SubscribeCallback<T> = (data: T) => any;
|
|
12
|
+
/** Have an html tagged value as value of subscribe emissions. Automatically unsubscribes for you */
|
|
13
|
+
export declare function subscribe<T>(Observable: LikeObservable<T>, callback?: SubscribeCallback<T>): SubscribeValue;
|
|
14
|
+
export type SubscribeValue = TagJsVar & {
|
|
15
|
+
tagJsType: typeof ValueTypes.subscribe;
|
|
16
|
+
processInit: ProcessInit;
|
|
17
|
+
states: StatesSetter[];
|
|
18
|
+
Observable: LikeObservable<any>;
|
|
19
|
+
withDefault?: any;
|
|
20
|
+
callback?: SubscribeCallback<any>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getSupportWithState } from "../interpolations/attributes/getSupportWithState.function.js";
|
|
2
|
+
import { getSupportInCycle } from "../tag/getSupportInCycle.function.js";
|
|
3
|
+
import { ValueTypes } from "../tag/index.js";
|
|
4
|
+
import { processSubscribe } from "../tag/update/processSubscribe.function.js";
|
|
5
|
+
import { deleteAndUnsubscribe } from "../tag/update/setupSubscribe.function.js";
|
|
6
|
+
/** Have an html tagged value as value of subscribe emissions. Automatically unsubscribes for you */
|
|
7
|
+
export function subscribe(Observable, callback) {
|
|
8
|
+
return {
|
|
9
|
+
tagJsType: ValueTypes.subscribe,
|
|
10
|
+
processInit: processSubscribe,
|
|
11
|
+
delete: deleteAndUnsubscribe,
|
|
12
|
+
checkValueChange: function subscribeDoNothing() {
|
|
13
|
+
console.log('weird to be here');
|
|
14
|
+
return -1;
|
|
15
|
+
},
|
|
16
|
+
Observable,
|
|
17
|
+
callback,
|
|
18
|
+
states: getSupportWithState(getSupportInCycle()).states,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=subscribe.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/subscribe.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AAGlG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAA;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AAa/E,oGAAoG;AACpG,MAAM,UAAU,SAAS,CACvB,UAA6B,EAC7B,QAA+B;IAE/B,OAAO;QACL,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,WAAW,EAAE,gBAAgB;QAC7B,MAAM,EAAE,oBAAoB;QAE5B,gBAAgB,EAAE,SAAS,kBAAkB;YAC3C,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;YAC/B,OAAO,CAAC,CAAC,CAAA;QACX,CAAC;QAED,UAAU;QACV,QAAQ;QACR,MAAM,EAAE,mBAAmB,CAAE,iBAAiB,EAAgB,CAAC,CAAC,MAAM;KACvE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { KeyFunction } from '../tag/getDomTag.function.js';
|
|
2
|
+
import { Original } from '../tag/tag.utils.js';
|
|
3
|
+
import { RouteProps, RouteTag, StateToTag, ToTag } from '../tag/tag.types.js';
|
|
4
|
+
import { UnknownFunction } from '../tag/update/oneRenderToSupport.function.js';
|
|
5
|
+
import { AnyTag } from '../tag/AnyTag.type.js';
|
|
6
|
+
/** TODO: This might be a duplicate typing of Wrapper */
|
|
7
|
+
export type TaggedFunction<T extends ToTag> = ((...x: Parameters<T>) => ReturnType<T> & {
|
|
8
|
+
key: KeyFunction;
|
|
9
|
+
original?: Original;
|
|
10
|
+
compareTo?: string;
|
|
11
|
+
}) & {
|
|
12
|
+
original: UnknownFunction;
|
|
13
|
+
};
|
|
14
|
+
/** How to handle checking for prop changes aka argument changes */
|
|
15
|
+
export declare enum PropWatches {
|
|
16
|
+
DEEP = "deep",
|
|
17
|
+
/** checks all values up to 2 levels deep */
|
|
18
|
+
SHALLOW = "shallow",
|
|
19
|
+
NONE = "none",
|
|
20
|
+
IMMUTABLE = "immutable"
|
|
21
|
+
}
|
|
22
|
+
/** Wraps a function tag in a state manager and calls wrapped function on event cycles
|
|
23
|
+
* For single rendering, no event cycles, use: tag.renderOnce = (props) => html``
|
|
24
|
+
*/
|
|
25
|
+
export declare function tag<T extends ToTag>(tagComponent: T, propWatch?: PropWatches): TaggedFunction<T>;
|
|
26
|
+
export declare namespace tag {
|
|
27
|
+
/** Used to declare a function has state in the form of a function, that when called, returns content for rendering
|
|
28
|
+
* Example () => tag.use = (counter = 0)
|
|
29
|
+
*/
|
|
30
|
+
let use: typeof tagUseFn;
|
|
31
|
+
/** Used to create a tag component that renders once and has no addition rendering cycles */
|
|
32
|
+
let renderOnce: typeof renderOnceFn;
|
|
33
|
+
let route: typeof routeFn;
|
|
34
|
+
let app: (_routeTag: RouteTag) => StateToTag;
|
|
35
|
+
let deepPropWatch: typeof tag;
|
|
36
|
+
let immutableProps: <T extends ToTag>(tagComponent: T) => TaggedFunction<T>;
|
|
37
|
+
let watchProps: <T extends ToTag>(tagComponent: T) => TaggedFunction<T>;
|
|
38
|
+
}
|
|
39
|
+
type ReturnTag = AnyTag | StateToTag | null | undefined;
|
|
40
|
+
/** Use to structure and define a browser tag route handler
|
|
41
|
+
* Example: export default tag.route = (routeProps: RouteProps) => (state) => html``
|
|
42
|
+
*/
|
|
43
|
+
declare function routeFn(_routeProps: RouteProps): StateToTag;
|
|
44
|
+
declare function renderOnceFn(): ReturnTag;
|
|
45
|
+
/** Used to create variable scoping when calling a function that lives within a prop container function */
|
|
46
|
+
declare function tagUseFn(): ReturnTag;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// taggedjs-no-compile
|
|
2
|
+
import { setUseMemory } from '../state/index.js';
|
|
3
|
+
import { getTemplaterResult } from '../tag/getTemplaterResult.function.js';
|
|
4
|
+
import { tags } from '../tag/tag.utils.js';
|
|
5
|
+
import { getTagWrap } from '../tag/getTagWrap.function.js';
|
|
6
|
+
import { ValueTypes } from '../tag/ValueTypes.enum.js';
|
|
7
|
+
import { processRenderOnceInit } from '../render/update/processRenderOnceInit.function.js';
|
|
8
|
+
import { processTagComponentInit } from '../tag/update/processTagComponentInit.function.js';
|
|
9
|
+
import { checkTagValueChange, destroySupportByContextItem } from '../tag/checkTagValueChange.function.js';
|
|
10
|
+
let tagCount = 0;
|
|
11
|
+
/** How to handle checking for prop changes aka argument changes */
|
|
12
|
+
export var PropWatches;
|
|
13
|
+
(function (PropWatches) {
|
|
14
|
+
PropWatches["DEEP"] = "deep";
|
|
15
|
+
/** checks all values up to 2 levels deep */
|
|
16
|
+
PropWatches["SHALLOW"] = "shallow";
|
|
17
|
+
PropWatches["NONE"] = "none";
|
|
18
|
+
PropWatches["IMMUTABLE"] = "immutable";
|
|
19
|
+
})(PropWatches || (PropWatches = {}));
|
|
20
|
+
/** Wraps a function tag in a state manager and calls wrapped function on event cycles
|
|
21
|
+
* For single rendering, no event cycles, use: tag.renderOnce = (props) => html``
|
|
22
|
+
*/
|
|
23
|
+
export function tag(tagComponent, propWatch = PropWatches.SHALLOW) {
|
|
24
|
+
/** function developer triggers */
|
|
25
|
+
const parentWrap = function tagWrapper(...props) {
|
|
26
|
+
const templater = getTemplaterResult(propWatch, props);
|
|
27
|
+
templater.tagJsType = ValueTypes.tagComponent;
|
|
28
|
+
templater.processInit = processTagComponentInit;
|
|
29
|
+
// attach memory back to original function that contains developer display logic
|
|
30
|
+
const innerTagWrap = getTagWrap(templater, parentWrap);
|
|
31
|
+
innerTagWrap.original = tagComponent;
|
|
32
|
+
templater.wrapper = innerTagWrap;
|
|
33
|
+
return templater;
|
|
34
|
+
}; // we override the function provided and pretend original is what's returned
|
|
35
|
+
const tag = tagComponent;
|
|
36
|
+
parentWrap.original = tagComponent;
|
|
37
|
+
// group tags together and have hmr pickup
|
|
38
|
+
tag.tags = tags;
|
|
39
|
+
tag.setUse = setUseMemory;
|
|
40
|
+
tag.ValueTypes = ValueTypes;
|
|
41
|
+
tag.tagIndex = tagCount++; // needed for things like HMR
|
|
42
|
+
tags.push(parentWrap);
|
|
43
|
+
return parentWrap;
|
|
44
|
+
}
|
|
45
|
+
/** Use to structure and define a browser tag route handler
|
|
46
|
+
* Example: export default tag.route = (routeProps: RouteProps) => (state) => html``
|
|
47
|
+
*/
|
|
48
|
+
function routeFn(_routeProps) {
|
|
49
|
+
throw new Error('Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `');
|
|
50
|
+
}
|
|
51
|
+
function renderOnceFn() {
|
|
52
|
+
throw new Error('Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `');
|
|
53
|
+
}
|
|
54
|
+
/** Used to create variable scoping when calling a function that lives within a prop container function */
|
|
55
|
+
function tagUseFn() {
|
|
56
|
+
throw new Error('Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `');
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
tag.renderOnce = renderOnceFn;
|
|
60
|
+
tag.use = tagUseFn;
|
|
61
|
+
tag.deepPropWatch = tag;
|
|
62
|
+
tag.route = routeFn;
|
|
63
|
+
tag.app = function (_routeTag) {
|
|
64
|
+
throw new Error('Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `');
|
|
65
|
+
};
|
|
66
|
+
tag.immutableProps = function immutableProps(tagComponent) {
|
|
67
|
+
return tag(tagComponent, PropWatches.IMMUTABLE);
|
|
68
|
+
};
|
|
69
|
+
tag.watchProps = function watchProps(tagComponent) {
|
|
70
|
+
return tag(tagComponent, PropWatches.SHALLOW);
|
|
71
|
+
};
|
|
72
|
+
/* BELOW: Cast functions into setters with no getters */
|
|
73
|
+
Object.defineProperty(tag, 'renderOnce', {
|
|
74
|
+
set(oneRenderFunction) {
|
|
75
|
+
oneRenderFunction.tagJsType = ValueTypes.renderOnce;
|
|
76
|
+
oneRenderFunction.processInit = processRenderOnceInit;
|
|
77
|
+
oneRenderFunction.delete = destroySupportByContextItem;
|
|
78
|
+
oneRenderFunction.checkValueChange = function renderOnceNeverChanges() {
|
|
79
|
+
return -1;
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(tag, 'use', {
|
|
84
|
+
set(renderFunction) {
|
|
85
|
+
renderFunction.original = {
|
|
86
|
+
setUse: setUseMemory,
|
|
87
|
+
tags,
|
|
88
|
+
};
|
|
89
|
+
renderFunction.tagJsType = ValueTypes.stateRender;
|
|
90
|
+
renderFunction.processInit = processTagComponentInit;
|
|
91
|
+
renderFunction.checkValueChange = checkTagValueChange;
|
|
92
|
+
renderFunction.delete = destroySupportByContextItem;
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=tag.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/tag.function.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAItB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,uCAAuC,CAAA;AACpG,OAAO,EAAsC,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,OAAO,EAAE,qBAAqB,E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YAClE,OAAO,CAAC,CAAC,CAAA;QACX,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE;IAChC,GAAG,CAAC,cAAuB;QACzB,cAAc,CAAC,QAAQ,GAAG;YACxB,MAAM,EAAE,YAAY;YACpB,IAAI;SACkB,CAAA;QACxB,cAAc,CAAC,SAAS,GAAG,UAAU,CAAC,WAAW,CAAA;QACjD,cAAc,CAAC,WAAW,GAAG,uBAAuB,CAAA;QACpD,cAAc,CAAC,gBAAgB,GAAG,mBAAmB,CAAA;QACrD,cAAc,CAAC,MAAM,GAAG,2BAA2B,CAAA;IACrD,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckSupportValueChange, CheckValueChange } from "../tag/Context.types.js";
|
|
2
|
+
import { ContextItem } from "../tag/ContextItem.type.js";
|
|
3
|
+
import { AnySupport } from "../tag/index.js";
|
|
4
|
+
import { ProcessInit } from "../tag/ProcessInit.type.js";
|
|
5
|
+
export type TagJsVar = {
|
|
6
|
+
tagJsType: string;
|
|
7
|
+
processInit: ProcessInit;
|
|
8
|
+
delete: ProcessDelete;
|
|
9
|
+
checkValueChange: CheckValueChange | CheckSupportValueChange;
|
|
10
|
+
value?: any;
|
|
11
|
+
};
|
|
12
|
+
export type ProcessDelete = (contextItem: ContextItem, ownerSupport: AnySupport) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagJsVar.type.js","sourceRoot":"","sources":["../../ts/tagJsVars/tagJsVar.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isArray } from '../isInstance.js';
|
|
2
|
+
import { getSimpleTagVar } from './getSimpleTagVar.function.js';
|
|
3
|
+
import { getArrayTagVar } from './getArrayTagJsVar.function.js';
|
|
4
|
+
export function valueToTagJsVar(value) {
|
|
5
|
+
const tagJsType = value?.tagJsType;
|
|
6
|
+
if (tagJsType) {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
return getBasicTagVar(value);
|
|
10
|
+
}
|
|
11
|
+
function getBasicTagVar(value) {
|
|
12
|
+
if (isArray(value)) {
|
|
13
|
+
return getArrayTagVar(value);
|
|
14
|
+
}
|
|
15
|
+
return getSimpleTagVar(value);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=valueToTagJsVar.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueToTagJsVar.function.js","sourceRoot":"","sources":["../../ts/tagJsVars/valueToTagJsVar.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAK1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAE/D,MAAM,UAAU,eAAe,CAC7B,KAAqC;IAErC,MAAM,SAAS,GAAI,KAAyB,EAAE,SAAsB,CAAA;IAEpE,IAAG,SAAS,EAAE,CAAC;QACb,OAAO,KAAiB,CAAA;IAC1B,CAAC;IAED,OAAO,cAAc,CAAE,KAAK,CAAE,CAAA;AAChC,CAAC;AAED,SAAS,cAAc,CACrB,KAAU;IAEV,IAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,cAAc,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAED,OAAO,eAAe,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC"}
|