taggedjs 2.4.17 → 2.4.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 +1314 -1241
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +1 -1
- package/js/Tag.class.d.ts +5 -40
- package/js/Tag.class.js +2 -347
- package/js/Tag.class.js.map +1 -1
- package/js/TagSupport.class.d.ts +40 -6
- package/js/TagSupport.class.js +268 -30
- package/js/TagSupport.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +13 -13
- package/js/TemplaterResult.class.js +34 -45
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/afterInterpolateElement.function.d.ts +4 -0
- package/js/afterInterpolateElement.function.js +14 -0
- package/js/afterInterpolateElement.function.js.map +1 -0
- package/js/alterProps.function.d.ts +2 -4
- package/js/alterProps.function.js +7 -15
- package/js/alterProps.function.js.map +1 -1
- package/js/bindSubjectCallback.function.js +0 -3
- package/js/bindSubjectCallback.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +5 -5
- package/js/checkDestroyPrevious.function.js +20 -17
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/cloneValueArray.function.d.ts +2 -0
- package/js/cloneValueArray.function.js +19 -0
- package/js/cloneValueArray.function.js.map +1 -0
- package/js/deepFunctions.js +36 -29
- package/js/deepFunctions.js.map +1 -1
- package/js/destroy.support.d.ts +6 -0
- package/js/destroy.support.js +10 -0
- package/js/destroy.support.js.map +1 -0
- package/js/destroyTag.function.d.ts +2 -3
- package/js/destroyTag.function.js +7 -11
- package/js/destroyTag.function.js.map +1 -1
- package/js/hasTagSupportChanged.function.js +0 -12
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/index.d.ts +2 -1
- package/js/index.js +2 -1
- package/js/index.js.map +1 -1
- package/js/interpolateTemplate.js +0 -3
- package/js/interpolateTemplate.js.map +1 -1
- package/js/interpolations/bindSubjectCallback.function.d.ts +7 -0
- package/js/interpolations/bindSubjectCallback.function.js +40 -0
- package/js/interpolations/bindSubjectCallback.function.js.map +1 -0
- package/js/interpolations/elementInitCheck.d.ts +2 -0
- package/js/interpolations/elementInitCheck.js +18 -0
- package/js/interpolations/elementInitCheck.js.map +1 -0
- package/js/interpolations/inputAttribute.d.ts +1 -0
- package/js/interpolations/inputAttribute.js +19 -0
- package/js/interpolations/inputAttribute.js.map +1 -0
- package/js/interpolations/interpolateAttributes.d.ts +4 -0
- package/js/interpolations/interpolateAttributes.js +20 -0
- package/js/interpolations/interpolateAttributes.js.map +1 -0
- package/js/interpolations/interpolateContentTemplates.d.ts +9 -0
- package/js/interpolations/interpolateContentTemplates.js +42 -0
- package/js/interpolations/interpolateContentTemplates.js.map +1 -0
- package/js/interpolations/interpolateElement.d.ts +14 -0
- package/js/interpolations/interpolateElement.js +36 -0
- package/js/interpolations/interpolateElement.js.map +1 -0
- package/js/interpolations/interpolateTemplate.d.ts +32 -0
- package/js/interpolations/interpolateTemplate.js +80 -0
- package/js/interpolations/interpolateTemplate.js.map +1 -0
- package/js/interpolations/interpolations.d.ts +7 -0
- package/js/interpolations/interpolations.js +18 -0
- package/js/interpolations/interpolations.js.map +1 -0
- package/js/interpolations/processAttribute.function.d.ts +5 -0
- package/js/interpolations/processAttribute.function.js +122 -0
- package/js/interpolations/processAttribute.function.js.map +1 -0
- package/js/interpolations/scanTextAreaValue.function.d.ts +3 -0
- package/js/interpolations/scanTextAreaValue.function.js +16 -0
- package/js/interpolations/scanTextAreaValue.function.js.map +1 -0
- package/js/interpolations.js +1 -2
- package/js/interpolations.js.map +1 -1
- package/js/isInstance.d.ts +4 -1
- package/js/isInstance.js +12 -4
- package/js/isInstance.js.map +1 -1
- package/js/isLikeTags.function.d.ts +3 -1
- package/js/isLikeTags.function.js +15 -6
- package/js/isLikeTags.function.js.map +1 -1
- package/js/processNewValue.function.d.ts +3 -2
- package/js/processNewValue.function.js +27 -11
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +1 -1
- package/js/processSubjectComponent.function.d.ts +5 -5
- package/js/processSubjectComponent.function.js +26 -34
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +11 -7
- package/js/processSubjectValue.function.js +20 -7
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTag.function.d.ts +8 -4
- package/js/processTag.function.js +23 -39
- package/js/processTag.function.js.map +1 -1
- package/js/processTagArray.d.ts +6 -4
- package/js/processTagArray.js +41 -39
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +4 -4
- package/js/processTagResult.function.js +14 -30
- package/js/processTagResult.function.js.map +1 -1
- package/js/renderExistingTag.function.d.ts +6 -6
- package/js/renderExistingTag.function.js +26 -22
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/renderTagSupport.function.d.ts +2 -3
- package/js/renderTagSupport.function.js +17 -20
- package/js/renderTagSupport.function.js.map +1 -1
- package/js/setTagPlaceholder.function.d.ts +2 -0
- package/js/setTagPlaceholder.function.js +8 -0
- package/js/setTagPlaceholder.function.js.map +1 -0
- package/js/state/callbackMaker.function.d.ts +2 -2
- package/js/state/callbackMaker.function.js +4 -5
- package/js/state/callbackMaker.function.js.map +1 -1
- package/js/state/onDestroy.js +2 -2
- package/js/state/onDestroy.js.map +1 -1
- package/js/state/onInit.js +4 -5
- package/js/state/onInit.js.map +1 -1
- package/js/state/provider.utils.d.ts +2 -2
- package/js/state/provider.utils.js +11 -16
- package/js/state/provider.utils.js.map +1 -1
- package/js/state/providers.d.ts +8 -3
- package/js/state/providers.js +15 -18
- package/js/state/providers.js.map +1 -1
- package/js/state/setUse.function.d.ts +12 -10
- package/js/state/setUse.function.js.map +1 -1
- package/js/state/state.utils.d.ts +1 -3
- package/js/state/state.utils.js +19 -13
- package/js/state/state.utils.js.map +1 -1
- package/js/state/watch.function.d.ts +6 -1
- package/js/state/watch.function.js +8 -3
- package/js/state/watch.function.js.map +1 -1
- package/js/subject/Subject.class.d.ts +10 -6
- package/js/subject/Subject.class.js +26 -10
- package/js/subject/Subject.class.js.map +1 -1
- package/js/subject/Subject.utils.d.ts +7 -5
- package/js/subject/Subject.utils.js.map +1 -1
- package/js/subject/ValueSubject.d.ts +2 -2
- package/js/subject/ValueSubject.js +1 -1
- package/js/subject/ValueSubject.js.map +1 -1
- package/js/subject/combineLatest.function.js.map +1 -1
- package/js/subject.types.d.ts +18 -0
- package/js/subject.types.js +2 -0
- package/js/subject.types.js.map +1 -0
- package/js/tag.d.ts +1 -1
- package/js/tag.js +25 -31
- package/js/tag.js.map +1 -1
- package/js/tagElement.d.ts +3 -7
- package/js/tagElement.js +24 -24
- package/js/tagElement.js.map +1 -1
- package/js/tagRunner.d.ts +7 -6
- package/js/tagRunner.js +16 -8
- package/js/tagRunner.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +1 -1
- package/js/updateBeforeTemplate.function.js.map +1 -1
- package/js/updateContextItem.function.d.ts +3 -0
- package/js/updateContextItem.function.js +43 -0
- package/js/updateContextItem.function.js.map +1 -0
- package/js/updateExistingTagComponent.function.d.ts +4 -4
- package/js/updateExistingTagComponent.function.js +49 -87
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +2 -7
- package/js/updateExistingValue.function.js +94 -50
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -1
- /package/js/{errors.d.ts → Errors.d.ts} +0 -0
- /package/js/{errors.js → Errors.js} +0 -0
- /package/js/{errors.js.map → Errors.js.map} +0 -0
|
@@ -2,30 +2,34 @@ import { providersChangeCheck } from './state/provider.utils';
|
|
|
2
2
|
import { renderWithSupport } from './TemplaterResult.class';
|
|
3
3
|
import { isLikeTags } from './isLikeTags.function';
|
|
4
4
|
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
5
|
-
export function renderExistingTag(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export function renderExistingTag(oldestSupport, // oldest with elements on html
|
|
6
|
+
newSupport, // new to be rendered
|
|
7
|
+
ownerSupport, // ownerSupport
|
|
8
|
+
subject) {
|
|
9
|
+
const lastSupport = subject.tagSupport;
|
|
10
|
+
const global = lastSupport.global;
|
|
11
|
+
// share point between renders
|
|
12
|
+
newSupport.global = global;
|
|
13
|
+
const preRenderCount = global.renderCount;
|
|
14
|
+
providersChangeCheck(oldestSupport);
|
|
14
15
|
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
15
|
-
const
|
|
16
|
-
if (preRenderCount !==
|
|
17
|
-
|
|
18
|
-
return
|
|
16
|
+
const prevSupport = global.newest;
|
|
17
|
+
if (preRenderCount !== global.renderCount) {
|
|
18
|
+
oldestSupport.updateBy(prevSupport);
|
|
19
|
+
return prevSupport; // already rendered during triggered events
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
const toRedrawTag =
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
// ??? changed during mirroring - lastSupport keeps having less info than newest
|
|
22
|
+
// const toRedrawTag = lastSupport || prevSupport || tagSupport.global.oldest
|
|
23
|
+
const toRedrawTag = prevSupport || lastSupport || global.oldest;
|
|
24
|
+
const reSupport = renderWithSupport(newSupport, toRedrawTag, subject,
|
|
25
|
+
// oldestSupport,
|
|
26
|
+
ownerSupport);
|
|
27
|
+
const oldest = global.oldest || oldestSupport;
|
|
28
|
+
reSupport.global.oldest = oldest;
|
|
29
|
+
if (isLikeTags(prevSupport, reSupport)) {
|
|
30
|
+
subject.tagSupport = reSupport;
|
|
31
|
+
oldest.updateBy(reSupport);
|
|
28
32
|
}
|
|
29
|
-
return
|
|
33
|
+
return reSupport;
|
|
30
34
|
}
|
|
31
35
|
//# sourceMappingURL=renderExistingTag.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderExistingTag.function.js","sourceRoot":"","sources":["../ts/renderExistingTag.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderExistingTag.function.js","sourceRoot":"","sources":["../ts/renderExistingTag.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAC/B,aAAyB,EAAE,+BAA+B;AAC1D,UAAsB,EAAE,qBAAqB;AAC7C,YAA4B,EAAE,eAAe;AAC7C,OAAmB;IAEnB,MAAM,WAAW,GAAG,OAAO,CAAC,UAAwB,CAAA;IACpD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;IAEjC,8BAA8B;IAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAA;IAE1B,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAA;IACzC,oBAAoB,CAAC,aAAa,CAAC,CAAA;IAEnC,oGAAoG;IACpG,MAAM,WAAW,GAAG,MAAM,CAAC,MAAoB,CAAA;IAC/C,IAAG,cAAc,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC;QACzC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QACnC,OAAO,WAAW,CAAA,CAAC,2CAA2C;IAChE,CAAC;IAED,gFAAgF;IAChF,6EAA6E;IAC7E,MAAM,WAAW,GAAG,WAAW,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,CAAA;IAE/D,MAAM,SAAS,GAAG,iBAAiB,CACjC,UAAU,EACV,WAAW,EACX,OAAO;IACP,iBAAiB;IACjB,YAA0B,CAC3B,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,aAAa,CAAA;IAC7C,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;IAEhC,IAAG,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,UAAU,GAAG,SAAS,CAAA;QAC9B,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC5B,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseTagSupport } from './TagSupport.class';
|
|
1
|
+
import { TagSupport } from './TagSupport.class';
|
|
3
2
|
/** Main function used by all other callers to render/update display of a tag component */
|
|
4
|
-
export declare function renderTagSupport(tagSupport:
|
|
3
|
+
export declare function renderTagSupport(tagSupport: TagSupport, renderUp: boolean): TagSupport;
|
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import { deepEqual } from './deepFunctions';
|
|
2
|
-
import { isTagInstance } from './isInstance';
|
|
3
2
|
import { renderExistingTag } from './renderExistingTag.function';
|
|
4
3
|
/** Main function used by all other callers to render/update display of a tag component */
|
|
5
4
|
export function renderTagSupport(tagSupport, renderUp) {
|
|
6
|
-
const global = tagSupport.
|
|
7
|
-
|
|
5
|
+
const global = tagSupport.global;
|
|
6
|
+
const templater = tagSupport.templater;
|
|
7
|
+
// is it just a vanilla tag, not component?
|
|
8
|
+
if (!templater.wrapper) { // || isTagTemplater(templater)
|
|
8
9
|
const newTag = global.newest;
|
|
9
|
-
const ownerTag = newTag.
|
|
10
|
+
const ownerTag = newTag.ownerTagSupport;
|
|
10
11
|
++global.renderCount;
|
|
11
|
-
return renderTagSupport(ownerTag
|
|
12
|
+
return renderTagSupport(ownerTag, true);
|
|
12
13
|
}
|
|
13
|
-
// const oldTagSetup = this
|
|
14
14
|
const subject = tagSupport.subject;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
18
|
-
let ownerTag;
|
|
15
|
+
const newest = global.newest;
|
|
16
|
+
let ownerSupport;
|
|
19
17
|
let selfPropChange = false;
|
|
20
18
|
const shouldRenderUp = renderUp && newest;
|
|
21
19
|
if (shouldRenderUp) {
|
|
22
|
-
|
|
23
|
-
if (
|
|
20
|
+
ownerSupport = newest.ownerTagSupport;
|
|
21
|
+
if (ownerSupport) {
|
|
24
22
|
const nowProps = templater.props;
|
|
25
|
-
const latestProps = newest.
|
|
23
|
+
const latestProps = newest.propsConfig.latestCloned;
|
|
26
24
|
selfPropChange = !deepEqual(nowProps, latestProps);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
const useTagSupport = global.newest
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const renderOwner = ownerTag && selfPropChange;
|
|
27
|
+
// const useTagSupport = global.newest as TagSupport // oldTagSetup
|
|
28
|
+
const oldest = tagSupport.global.oldest;
|
|
29
|
+
const tag = renderExistingTag(oldest, tagSupport, ownerSupport, // useTagSupport,
|
|
30
|
+
subject);
|
|
31
|
+
const renderOwner = ownerSupport && selfPropChange;
|
|
35
32
|
if (renderOwner) {
|
|
36
|
-
const ownerTagSupport =
|
|
33
|
+
const ownerTagSupport = ownerSupport;
|
|
37
34
|
renderTagSupport(ownerTagSupport, true);
|
|
38
35
|
return tag;
|
|
39
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTagSupport.function.js","sourceRoot":"","sources":["../ts/renderTagSupport.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderTagSupport.function.js","sourceRoot":"","sources":["../ts/renderTagSupport.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,0FAA0F;AAC1F,MAAM,UAAU,gBAAgB,CAC9B,UAAsB,EACtB,QAAiB;IAEjB,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;IAChC,MAAM,SAAS,GAAG,UAAU,CAA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
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function setTagPlaceholder(global) {
|
|
2
|
+
const insertBefore = global.insertBefore;
|
|
3
|
+
const placeholder = global.placeholder = document.createTextNode('');
|
|
4
|
+
const parentNode = insertBefore.parentNode;
|
|
5
|
+
parentNode.insertBefore(placeholder, insertBefore);
|
|
6
|
+
parentNode.removeChild(insertBefore);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=setTagPlaceholder.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTagPlaceholder.function.js","sourceRoot":"","sources":["../ts/setTagPlaceholder.function.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,iBAAiB,CAC/B,MAAiB;IAEjB,MAAM,YAAY,GAAG,MAAM,CAAC,YAA4B,CAAA;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;IACpE,MAAM,UAAU,GAAG,YAAY,CAAC,UAAwB,CAAA;IACxD,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;IAClD,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;AACtC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type Callback<A> = <T>(
|
|
2
|
-
export declare const callbackMaker: () => <A>(callback: Callback<A>) => (
|
|
1
|
+
type Callback<A, B, C, D, E, F> = <T>(a: A, b: B, c: C, d: D, e: E, f: F) => (T | void);
|
|
2
|
+
export declare const callbackMaker: () => <A, B, C, D, E, F>(callback: Callback<A, B, C, D, E, F>) => (a?: A | undefined, b?: B | undefined, c?: C | undefined, d?: D | undefined, e?: E | undefined, f?: F | undefined) => void;
|
|
3
3
|
export {};
|
|
@@ -2,7 +2,7 @@ import { setUse } from "./setUse.function";
|
|
|
2
2
|
import { getStateValue } from "./state.utils";
|
|
3
3
|
import { renderTagSupport } from "../renderTagSupport.function";
|
|
4
4
|
import { SyncCallbackError } from "../errors";
|
|
5
|
-
let innerCallback = (callback) => (
|
|
5
|
+
let innerCallback = (callback) => (a, b, c, d, e, f) => {
|
|
6
6
|
throw new SyncCallbackError('Callback function was called immediately in sync and must instead be call async');
|
|
7
7
|
};
|
|
8
8
|
export const callbackMaker = () => innerCallback;
|
|
@@ -33,18 +33,17 @@ function initMemory(tagSupport) {
|
|
|
33
33
|
}
|
|
34
34
|
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
35
35
|
const state = tagSupport.memory.state;
|
|
36
|
-
const newest = state.newest;
|
|
37
36
|
// ensure that the oldest has the latest values first
|
|
38
|
-
updateState(
|
|
37
|
+
updateState(state, oldState);
|
|
39
38
|
// run the callback
|
|
40
39
|
const promise = callback(...args);
|
|
41
40
|
// send the oldest state changes into the newest
|
|
42
|
-
updateState(oldState,
|
|
41
|
+
updateState(oldState, state);
|
|
43
42
|
renderTagSupport(tagSupport, false);
|
|
44
43
|
if (promise instanceof Promise) {
|
|
45
44
|
promise.finally(() => {
|
|
46
45
|
// send the oldest state changes into the newest
|
|
47
|
-
updateState(oldState,
|
|
46
|
+
updateState(oldState, state);
|
|
48
47
|
renderTagSupport(tagSupport, false);
|
|
49
48
|
});
|
|
50
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbackMaker.function.js","sourceRoot":"","sources":["../../ts/state/callbackMaker.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAA2B,aAAa,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"callbackMaker.function.js","sourceRoot":"","sources":["../../ts/state/callbackMaker.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;A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,UAA0B;IAC7C,MAAM,QAAQ,GAAqB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAA;IAClE,aAAa,GAAG,CACd,QAAgD,EAChD,EAAE;QACF,MAAM,OAAO,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;QAC/F,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CACzB,UAA0B,EAC1B,QAA+C,EAC/C,QAA0B,EAC1B,GAAG,IAAW;IAEd,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAc,CAAA;IAE9C,qDAAqD;IACrD,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAE5B,mBAAmB;IACnB,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,IAAiC,CAAC,CAAA;IAE9D,gDAAgD;IAChD,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAE5B,gBAAgB,CACd,UAAwB,EACxB,KAAK,CACN,CAAA;IAED,IAAG,OAAO,YAAY,OAAO,EAAE,CAAC;QAC9B,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YACnB,gDAAgD;YAChD,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;YAE5B,gBAAgB,CACd,UAAwB,EACxB,KAAK,CACN,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
package/js/state/onDestroy.js
CHANGED
|
@@ -2,13 +2,13 @@ import { setUse } from "./setUse.function";
|
|
|
2
2
|
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
3
3
|
let destroyCurrentTagSupport;
|
|
4
4
|
export function onDestroy(callback) {
|
|
5
|
-
destroyCurrentTagSupport.
|
|
5
|
+
destroyCurrentTagSupport.global.destroyCallback = callback;
|
|
6
6
|
}
|
|
7
7
|
setUse({
|
|
8
8
|
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
9
9
|
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
10
10
|
beforeDestroy: (tagSupport, tag) => {
|
|
11
|
-
const callback = tagSupport.
|
|
11
|
+
const callback = tagSupport.global.destroyCallback;
|
|
12
12
|
if (callback) {
|
|
13
13
|
callback();
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onDestroy.js","sourceRoot":"","sources":["../../ts/state/onDestroy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI1C,4FAA4F;AAC5F,IAAI,wBAAwC,CAAA;AAE5C,MAAM,UAAU,SAAS,CACvB,QAA2B;IAE3B,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"onDestroy.js","sourceRoot":"","sources":["../../ts/state/onDestroy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI1C,4FAA4F;AAC5F,IAAI,wBAAwC,CAAA;AAE5C,MAAM,UAAU,SAAS,CACvB,QAA2B;IAE3B,wBAAwB,CAAC,MAAM,CAAC,eAAe,GAAG,QAAQ,CAAA;AAC5D,CAAC;AAED,MAAM,CAAC;IACL,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,wBAAwB,GAAG,UAAU;IACjE,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,wBAAwB,GAAG,UAAU;IACjE,aAAa,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,EAAE;QACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAA;QAElD,IAAG,QAAQ,EAAE,CAAC;YACZ,QAAQ,EAAE,CAAA;QACZ,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
package/js/state/onInit.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { setUse } from "./setUse.function";
|
|
2
2
|
function setCurrentTagSupport(support) {
|
|
3
|
-
setUse.memory.
|
|
3
|
+
setUse.memory.initCurrentSupport = support;
|
|
4
4
|
}
|
|
5
5
|
export function onInit(callback) {
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
8
|
-
;
|
|
9
|
-
templater.global.init = callback;
|
|
6
|
+
const tagSupport = setUse.memory.initCurrentSupport;
|
|
7
|
+
if (!tagSupport.global.init) {
|
|
8
|
+
tagSupport.global.init = callback;
|
|
10
9
|
callback(); // fire init
|
|
11
10
|
}
|
|
12
11
|
}
|
package/js/state/onInit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onInit.js","sourceRoot":"","sources":["../../ts/state/onInit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"onInit.js","sourceRoot":"","sources":["../../ts/state/onInit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI1C,SAAS,oBAAoB,CAAC,OAAoC;IAChE,MAAM,CAAC,MAAM,CAAC,kBAAkB,GAAG,OAAqB,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,QAAwB;IAExB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAA;IACnD,IAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC3B,UAAU,CAAC,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACjC,QAAQ,EAAE,CAAA,CAAC,YAAY;IACzB,CAAC;AACH,CAAC;AAED,MAAM,CAAC;IACL,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC;IAC5D,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC;CAC7D,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function providersChangeCheck(
|
|
1
|
+
import { TagSupport } from '../TagSupport.class';
|
|
2
|
+
export declare function providersChangeCheck(tagSupport: TagSupport): void;
|
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
import { deepClone, deepEqual } from '../deepFunctions';
|
|
2
2
|
import { renderTagSupport } from '../renderTagSupport.function';
|
|
3
|
-
export function providersChangeCheck(
|
|
4
|
-
const global =
|
|
3
|
+
export function providersChangeCheck(tagSupport) {
|
|
4
|
+
const global = tagSupport.global;
|
|
5
5
|
const providersWithChanges = global.providers.filter(provider => !deepEqual(provider.instance, provider.clone));
|
|
6
6
|
// reset clones
|
|
7
7
|
providersWithChanges.forEach(provider => {
|
|
8
|
-
const appElement =
|
|
8
|
+
const appElement = tagSupport.getAppElement();
|
|
9
9
|
handleProviderChanges(appElement, provider);
|
|
10
10
|
provider.clone = deepClone(provider.instance);
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function handleProviderChanges(appElement, provider) {
|
|
14
14
|
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
15
|
-
tagsWithProvider.forEach(({
|
|
16
|
-
if (
|
|
15
|
+
tagsWithProvider.forEach(({ tagSupport, renderCount, provider }) => {
|
|
16
|
+
if (tagSupport.global.deleted) {
|
|
17
17
|
return; // i was deleted after another tag processed
|
|
18
18
|
}
|
|
19
|
-
const notRendered = renderCount ===
|
|
19
|
+
const notRendered = renderCount === tagSupport.global.renderCount;
|
|
20
20
|
if (notRendered) {
|
|
21
21
|
provider.clone = deepClone(provider.instance);
|
|
22
|
-
renderTagSupport(
|
|
22
|
+
renderTagSupport(tagSupport, false);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function getTagsWithProvider(
|
|
27
|
-
const global =
|
|
26
|
+
function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
27
|
+
const global = tagSupport.global;
|
|
28
28
|
const compare = global.providers;
|
|
29
29
|
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
30
30
|
if (hasProvider) {
|
|
31
31
|
memory.push({
|
|
32
|
-
|
|
32
|
+
tagSupport,
|
|
33
33
|
renderCount: global.renderCount,
|
|
34
34
|
provider: hasProvider,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
memory.forEach(({ tag }) => {
|
|
39
|
-
if (tag.tagSupport.templater.global.deleted) {
|
|
40
|
-
throw new Error('do not get here - 0');
|
|
41
|
-
}
|
|
42
|
-
});
|
|
37
|
+
tagSupport.childTags.forEach(child => getTagsWithProvider(child, provider, memory));
|
|
43
38
|
return memory;
|
|
44
39
|
}
|
|
45
40
|
//# sourceMappingURL=provider.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.utils.js","sourceRoot":"","sources":["../../ts/state/provider.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.utils.js","sourceRoot":"","sources":["../../ts/state/provider.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG/D,MAAM,UAAU,oBAAoB,CAClC,UAAsB;IAEtB,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;IAChC,MAAM,oBAAoB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAC9D,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAC9C,CAAA;IAED,eAAe;IACf,oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACtC,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;QAE7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,KAAK,CAAC,EAAE,CAAC,mBAAmB,CACvD,KAAK,EACL,QAAQ,EACR,MAAM,CACP,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/js/state/providers.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { TagSupport } from '../TagSupport.class';
|
|
1
2
|
export type Provider = {
|
|
2
3
|
constructMethod: any;
|
|
3
4
|
instance: any;
|
|
4
5
|
clone: any;
|
|
5
6
|
};
|
|
6
7
|
type ProviderConstructor<T> = (new (...args: any[]) => T) | (() => T);
|
|
7
|
-
type
|
|
8
|
-
|
|
8
|
+
export type ProviderConfig = {
|
|
9
|
+
providers: Provider[];
|
|
10
|
+
ownerSupport?: TagSupport;
|
|
11
|
+
};
|
|
12
|
+
type functionProvider<T> = () => T;
|
|
13
|
+
type classProvider<T> = new (...args: any[]) => T;
|
|
9
14
|
export declare const providers: {
|
|
10
|
-
create: <T>(constructMethod: classProvider | functionProvider) => T;
|
|
15
|
+
create: <T>(constructMethod: classProvider<T> | functionProvider<T>) => T;
|
|
11
16
|
/**
|
|
12
17
|
* @template T
|
|
13
18
|
* @param {(new (...args: any[]) => T) | () => T} constructor
|
package/js/state/providers.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { deepClone } from '../deepFunctions';
|
|
2
2
|
import { setUse } from './setUse.function';
|
|
3
|
-
// TODO: rename
|
|
4
3
|
setUse.memory.providerConfig = {
|
|
5
4
|
providers: [],
|
|
6
|
-
|
|
7
|
-
ownerTag: undefined,
|
|
5
|
+
ownerSupport: undefined,
|
|
8
6
|
};
|
|
9
7
|
function get(constructMethod) {
|
|
10
8
|
const config = setUse.memory.providerConfig;
|
|
@@ -19,7 +17,7 @@ export const providers = {
|
|
|
19
17
|
return existing.instance;
|
|
20
18
|
}
|
|
21
19
|
// Providers with provider requirements just need to use providers.create() and providers.inject()
|
|
22
|
-
const instance = constructMethod
|
|
20
|
+
const instance = 'prototype' in constructMethod ? new constructMethod() : constructMethod();
|
|
23
21
|
const config = setUse.memory.providerConfig;
|
|
24
22
|
config.providers.push({
|
|
25
23
|
constructMethod,
|
|
@@ -40,10 +38,10 @@ export const providers = {
|
|
|
40
38
|
}
|
|
41
39
|
const config = setUse.memory.providerConfig;
|
|
42
40
|
let owner = {
|
|
43
|
-
|
|
41
|
+
ownerTagSupport: config.ownerSupport
|
|
44
42
|
};
|
|
45
|
-
while (owner.
|
|
46
|
-
const ownerProviders = owner.
|
|
43
|
+
while (owner.ownerTagSupport) {
|
|
44
|
+
const ownerProviders = owner.ownerTagSupport.global.providers;
|
|
47
45
|
const provider = ownerProviders.find(provider => {
|
|
48
46
|
if (provider.constructMethod === constructor) {
|
|
49
47
|
return true;
|
|
@@ -54,7 +52,7 @@ export const providers = {
|
|
|
54
52
|
config.providers.push(provider);
|
|
55
53
|
return provider.instance;
|
|
56
54
|
}
|
|
57
|
-
owner = owner.
|
|
55
|
+
owner = owner.ownerTagSupport; // cause reloop
|
|
58
56
|
}
|
|
59
57
|
const msg = `Could not inject provider: ${constructor.name} ${constructor}`;
|
|
60
58
|
console.warn(`${msg}. Available providers`, config.providers);
|
|
@@ -62,25 +60,24 @@ export const providers = {
|
|
|
62
60
|
}
|
|
63
61
|
};
|
|
64
62
|
setUse({
|
|
65
|
-
beforeRender: (tagSupport,
|
|
66
|
-
run(tagSupport,
|
|
63
|
+
beforeRender: (tagSupport, ownerSupport) => {
|
|
64
|
+
run(tagSupport, ownerSupport);
|
|
67
65
|
},
|
|
68
|
-
beforeRedraw: (tagSupport,
|
|
69
|
-
run(tagSupport,
|
|
66
|
+
beforeRedraw: (tagSupport, newTagSupport) => {
|
|
67
|
+
run(tagSupport, newTagSupport.ownerTagSupport);
|
|
70
68
|
},
|
|
71
69
|
afterRender: (tagSupport) => {
|
|
72
70
|
const config = setUse.memory.providerConfig;
|
|
73
|
-
tagSupport.
|
|
71
|
+
tagSupport.global.providers = [...config.providers];
|
|
74
72
|
config.providers.length = 0;
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
|
-
function run(tagSupport,
|
|
75
|
+
function run(tagSupport, ownerSupport) {
|
|
78
76
|
const config = setUse.memory.providerConfig;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (tagSupport.templater.global.providers.length) {
|
|
77
|
+
config.ownerSupport = ownerSupport;
|
|
78
|
+
if (tagSupport.global.providers.length) {
|
|
82
79
|
config.providers.length = 0;
|
|
83
|
-
config.providers.push(...tagSupport.
|
|
80
|
+
config.providers.push(...tagSupport.global.providers);
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
//# sourceMappingURL=providers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../ts/state/providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../ts/state/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAe1C,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG;IAC7B,SAAS,EAAE,EAAgB;IAC3B,YAAY,EAAE,SAAS;CACxB,CAAA;AAED,SAAS,GAAG,CAAC,eAAyB;IACpC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAA;IAC3C,MAAM,SAAS,GAAe,MAAM,CAAC,SAAS,CAAA;IAC9C,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,eAAe,KAAK,eAAe,CAAC,CAAA;AACjF,CAAC;AAKD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,CACN,eAAuD,EACpD,EAAE;QACL,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,CAAC,CAAA;QACrC,IAAG,QAAQ,EAAE,CAAC;YACZ,QAAQ,CAAC,KAAK,GAA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I,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseTagSupport, TagSupport } from '../TagSupport.class';
|
|
2
|
+
import { ProviderConfig } from './providers';
|
|
3
3
|
import { Config } from './state.utils';
|
|
4
4
|
interface TagUse {
|
|
5
|
-
beforeRender: (tagSupport: BaseTagSupport, ownerTag
|
|
6
|
-
beforeRedraw: (tagSupport: BaseTagSupport, tag:
|
|
7
|
-
afterRender: (tagSupport: BaseTagSupport, tag:
|
|
8
|
-
beforeDestroy: (tagSupport: BaseTagSupport, tag:
|
|
5
|
+
beforeRender: (tagSupport: BaseTagSupport, ownerTag?: TagSupport) => void;
|
|
6
|
+
beforeRedraw: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
7
|
+
afterRender: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
8
|
+
beforeDestroy: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
9
9
|
}
|
|
10
10
|
export type UseOptions = {
|
|
11
|
-
beforeRender?: (tagSupport: BaseTagSupport, ownerTag
|
|
12
|
-
beforeRedraw?: (tagSupport: BaseTagSupport, tag:
|
|
13
|
-
afterRender?: (tagSupport: BaseTagSupport, tag:
|
|
14
|
-
beforeDestroy?: (tagSupport: BaseTagSupport, tag:
|
|
11
|
+
beforeRender?: (tagSupport: BaseTagSupport, ownerTag?: TagSupport) => void;
|
|
12
|
+
beforeRedraw?: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
13
|
+
afterRender?: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
14
|
+
beforeDestroy?: (tagSupport: BaseTagSupport, tag: TagSupport) => void;
|
|
15
15
|
};
|
|
16
16
|
export declare function setUse(use: UseOptions): void;
|
|
17
17
|
export declare namespace setUse {
|
|
18
18
|
var tagUse: TagUse[];
|
|
19
19
|
var memory: Record<string, any> & {
|
|
20
20
|
stateConfig: Config;
|
|
21
|
+
providerConfig: ProviderConfig;
|
|
22
|
+
initCurrentSupport: TagSupport;
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setUse.function.js","sourceRoot":"","sources":["../../ts/state/setUse.function.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAa,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"setUse.function.js","sourceRoot":"","sources":["../../ts/state/setUse.function.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAa,EAAE,CAAA;AAyB3B,MAAM,UAAU,MAAM,CAAC,GAAe;IACpC,wBAAwB;IACxB,MAAM,KAAK,GAAW;QACpB,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;QACnD,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;QACnD,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;QACjD,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;KACtD,CAAA;IAED,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,MAAM,GAAG,EAId,CAAA"}
|
|
@@ -13,9 +13,7 @@ export type Config = {
|
|
|
13
13
|
array: StateConfigArray;
|
|
14
14
|
rearray?: StateConfigArray;
|
|
15
15
|
};
|
|
16
|
-
export type State =
|
|
17
|
-
newest: StateConfigArray;
|
|
18
|
-
};
|
|
16
|
+
export type State = StateConfigArray;
|
|
19
17
|
export type GetSet<T> = (y: T) => [T, T];
|
|
20
18
|
export declare function getStateValue<T>(state: StateConfigItem<T>): T | undefined;
|
|
21
19
|
export declare class StateEchoBack {
|
package/js/state/state.utils.js
CHANGED
|
@@ -5,20 +5,23 @@ setUse.memory.stateConfig = {
|
|
|
5
5
|
array: [], // state memory on the first render
|
|
6
6
|
// rearray: [] as StateConfigArray, // state memory to be used before the next render
|
|
7
7
|
};
|
|
8
|
+
const beforeRender = (tagSupport) => initState(tagSupport);
|
|
8
9
|
setUse({
|
|
9
|
-
beforeRender
|
|
10
|
-
beforeRedraw:
|
|
10
|
+
beforeRender,
|
|
11
|
+
beforeRedraw: beforeRender,
|
|
11
12
|
afterRender: (tagSupport) => {
|
|
12
|
-
const
|
|
13
|
+
const memory = tagSupport.memory;
|
|
14
|
+
const state = memory.state;
|
|
13
15
|
const config = setUse.memory.stateConfig;
|
|
14
16
|
const rearray = config.rearray;
|
|
15
17
|
if (rearray.length) {
|
|
16
18
|
if (rearray.length !== config.array.length) {
|
|
17
19
|
const message = `States lengths has changed ${rearray.length} !== ${config.array.length}. Typically occurs when a function is intended to be wrapped with a tag() call`;
|
|
20
|
+
const wrapper = tagSupport.templater?.wrapper;
|
|
18
21
|
const details = {
|
|
19
22
|
oldStates: config.array,
|
|
20
23
|
newStates: config.rearray,
|
|
21
|
-
|
|
24
|
+
tagFunction: wrapper.original,
|
|
22
25
|
};
|
|
23
26
|
const error = new StateMismatchError(message, details);
|
|
24
27
|
console.warn(message, details);
|
|
@@ -26,8 +29,8 @@ setUse({
|
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
delete config.rearray; // clean up any previous runs
|
|
29
|
-
state
|
|
30
|
-
state.
|
|
32
|
+
memory.state = config.array; // [...config.array]
|
|
33
|
+
memory.state.forEach(item => item.lastValue = getStateValue(item)); // set last values
|
|
31
34
|
config.array = [];
|
|
32
35
|
}
|
|
33
36
|
});
|
|
@@ -55,30 +58,33 @@ state) {
|
|
|
55
58
|
export class StateEchoBack {
|
|
56
59
|
}
|
|
57
60
|
function initState(tagSupport) {
|
|
58
|
-
const
|
|
61
|
+
const memory = tagSupport.memory;
|
|
62
|
+
const state = memory.state;
|
|
59
63
|
const config = setUse.memory.stateConfig;
|
|
60
64
|
// TODO: This guard may no longer be needed
|
|
61
65
|
if (config.rearray) {
|
|
66
|
+
const wrapper = tagSupport.templater?.wrapper;
|
|
67
|
+
const wasWrapper = config.tagSupport?.templater.wrapper;
|
|
62
68
|
const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';
|
|
63
69
|
console.error(message, {
|
|
64
70
|
config,
|
|
65
|
-
|
|
66
|
-
wasInMiddleOf:
|
|
71
|
+
tagFunction: wrapper.original,
|
|
72
|
+
wasInMiddleOf: wasWrapper.original,
|
|
67
73
|
state,
|
|
68
74
|
expectedClearArray: config.rearray,
|
|
69
75
|
});
|
|
70
76
|
throw new StateMismatchError(message, {
|
|
71
77
|
config,
|
|
72
|
-
|
|
78
|
+
tagFunction: wrapper.original,
|
|
73
79
|
state,
|
|
74
80
|
expectedClearArray: config.rearray,
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
83
|
// TODO: this maybe redundant and not needed
|
|
78
84
|
config.rearray = []; // .length = 0
|
|
79
|
-
if (state?.
|
|
80
|
-
state.
|
|
81
|
-
config.rearray.push(...state
|
|
85
|
+
if (state?.length) {
|
|
86
|
+
state.forEach(state => getStateValue(state));
|
|
87
|
+
config.rearray.push(...state);
|
|
82
88
|
}
|
|
83
89
|
config.tagSupport = tagSupport;
|
|
84
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.utils.js","sourceRoot":"","sources":["../../ts/state/state.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"state.utils.js","sourceRoot":"","sources":["../../ts/state/state.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAA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