@saasquatch/mint-components 2.4.1-5 → 2.4.1-7
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/cjs/sqm-widget-verification-controller.cjs.entry.js +20 -7
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js +22 -9
- package/dist/esm/sqm-widget-verification-controller.entry.js +20 -7
- package/dist/esm-es5/sqm-widget-verification-controller.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-783135d3.system.entry.js +1 -0
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/p-d180893e.entry.js +1 -0
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification-controller.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/package.json +1 -1
- package/dist/mint-components/p-27daf264.entry.js +0 -1
- package/dist/mint-components/p-e6de31a7.system.entry.js +0 -1
|
@@ -39,26 +39,39 @@ const WidgetVerificationController = class {
|
|
|
39
39
|
index.registerInstance(this, hostRef);
|
|
40
40
|
/**
|
|
41
41
|
* @undocumented
|
|
42
|
-
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth":
|
|
42
|
+
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth": false }, "disabled": "true" }
|
|
43
43
|
* @componentState { "title": "Tax and cash", "default": true, "slot": "verified", "props": { "isAuth": true }, "disabled": "true" }
|
|
44
44
|
*/
|
|
45
|
-
this.stateController = "{}
|
|
45
|
+
this.stateController = '{"sqm-widget-verification-controller":{"isAuth":true}}';
|
|
46
46
|
domContextHooks_module.h$1(this);
|
|
47
47
|
}
|
|
48
48
|
disconnectedCallback() { }
|
|
49
49
|
render() {
|
|
50
|
-
var _a;
|
|
51
50
|
const [context, setContext] = index_module.In({
|
|
52
51
|
namespace: keys.VERIFICATION_PARENT_NAMESPACE,
|
|
53
52
|
initialValue: false,
|
|
54
53
|
});
|
|
55
54
|
const props = JSON.parse(this.stateController);
|
|
56
|
-
|
|
55
|
+
// raisins sends state props flat; the @Prop default nests them under the tag
|
|
56
|
+
const stateOverride = (props === null || props === void 0 ? void 0 : props["sqm-widget-verification-controller"]) || props || {};
|
|
57
|
+
const demoIsAuth = index_module.isDemo() && (stateOverride === null || stateOverride === void 0 ? void 0 : stateOverride.isAuth);
|
|
58
|
+
// When raisins cascades a nested substate, it appears here keyed by child tag.
|
|
59
|
+
// We use these to auto-switch slots so previewing a substate works from either group.
|
|
60
|
+
const cascadedChildTags = Object.keys(props || {}).filter((k) => k !== "sqm-widget-verification-controller");
|
|
57
61
|
const [container, setContainer] = domContextHooks_module.useState(undefined);
|
|
58
62
|
const [slot, setSlot] = domContextHooks_module.useState(undefined);
|
|
59
63
|
const updateTemplates = index_module.useCallback(() => {
|
|
60
|
-
const isAuth = demoIsAuth || context;
|
|
61
64
|
const templates = slot.querySelectorAll(`template`);
|
|
65
|
+
// Infer the target slot from a cascaded substate whose tag lives in one of the templates
|
|
66
|
+
let inferredIsAuth;
|
|
67
|
+
for (const tag of cascadedChildTags) {
|
|
68
|
+
const owning = Array.from(templates).find((t) => t.content.querySelector(tag));
|
|
69
|
+
if (owning) {
|
|
70
|
+
inferredIsAuth = owning.slot === "verified";
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const isAuth = inferredIsAuth !== null && inferredIsAuth !== void 0 ? inferredIsAuth : (demoIsAuth || context);
|
|
62
75
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
63
76
|
if (template) {
|
|
64
77
|
// use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
|
|
@@ -105,7 +118,7 @@ const WidgetVerificationController = class {
|
|
|
105
118
|
target.style.height = "25px";
|
|
106
119
|
});
|
|
107
120
|
}
|
|
108
|
-
}, [container, slot, context, demoIsAuth]);
|
|
121
|
+
}, [container, slot, context, demoIsAuth, this.stateController]);
|
|
109
122
|
domContextHooks_module.useEffect(() => {
|
|
110
123
|
if (!container || !slot) {
|
|
111
124
|
debug("DOM not ready:");
|
|
@@ -114,7 +127,7 @@ const WidgetVerificationController = class {
|
|
|
114
127
|
// Run on first render
|
|
115
128
|
updateTemplates();
|
|
116
129
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
117
|
-
}, [slot, container, context, demoIsAuth]);
|
|
130
|
+
}, [slot, container, context, demoIsAuth, this.stateController]);
|
|
118
131
|
return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
|
|
119
132
|
}
|
|
120
133
|
};
|
package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js
CHANGED
|
@@ -42,26 +42,39 @@ export class WidgetVerificationController {
|
|
|
42
42
|
constructor() {
|
|
43
43
|
/**
|
|
44
44
|
* @undocumented
|
|
45
|
-
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth":
|
|
45
|
+
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth": false }, "disabled": "true" }
|
|
46
46
|
* @componentState { "title": "Tax and cash", "default": true, "slot": "verified", "props": { "isAuth": true }, "disabled": "true" }
|
|
47
47
|
*/
|
|
48
|
-
this.stateController = "{}
|
|
48
|
+
this.stateController = '{"sqm-widget-verification-controller":{"isAuth":true}}';
|
|
49
49
|
withHooks(this);
|
|
50
50
|
}
|
|
51
51
|
disconnectedCallback() { }
|
|
52
52
|
render() {
|
|
53
|
-
var _a;
|
|
54
53
|
const [context, setContext] = useParentState({
|
|
55
54
|
namespace: VERIFICATION_PARENT_NAMESPACE,
|
|
56
55
|
initialValue: false,
|
|
57
56
|
});
|
|
58
57
|
const props = JSON.parse(this.stateController);
|
|
59
|
-
|
|
58
|
+
// raisins sends state props flat; the @Prop default nests them under the tag
|
|
59
|
+
const stateOverride = (props === null || props === void 0 ? void 0 : props["sqm-widget-verification-controller"]) || props || {};
|
|
60
|
+
const demoIsAuth = isDemo() && (stateOverride === null || stateOverride === void 0 ? void 0 : stateOverride.isAuth);
|
|
61
|
+
// When raisins cascades a nested substate, it appears here keyed by child tag.
|
|
62
|
+
// We use these to auto-switch slots so previewing a substate works from either group.
|
|
63
|
+
const cascadedChildTags = Object.keys(props || {}).filter((k) => k !== "sqm-widget-verification-controller");
|
|
60
64
|
const [container, setContainer] = useState(undefined);
|
|
61
65
|
const [slot, setSlot] = useState(undefined);
|
|
62
66
|
const updateTemplates = useCallback(() => {
|
|
63
|
-
const isAuth = demoIsAuth || context;
|
|
64
67
|
const templates = slot.querySelectorAll(`template`);
|
|
68
|
+
// Infer the target slot from a cascaded substate whose tag lives in one of the templates
|
|
69
|
+
let inferredIsAuth;
|
|
70
|
+
for (const tag of cascadedChildTags) {
|
|
71
|
+
const owning = Array.from(templates).find((t) => t.content.querySelector(tag));
|
|
72
|
+
if (owning) {
|
|
73
|
+
inferredIsAuth = owning.slot === "verified";
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const isAuth = inferredIsAuth !== null && inferredIsAuth !== void 0 ? inferredIsAuth : (demoIsAuth || context);
|
|
65
78
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
66
79
|
if (template) {
|
|
67
80
|
// use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
|
|
@@ -108,7 +121,7 @@ export class WidgetVerificationController {
|
|
|
108
121
|
target.style.height = "25px";
|
|
109
122
|
});
|
|
110
123
|
}
|
|
111
|
-
}, [container, slot, context, demoIsAuth]);
|
|
124
|
+
}, [container, slot, context, demoIsAuth, this.stateController]);
|
|
112
125
|
useEffect(() => {
|
|
113
126
|
if (!container || !slot) {
|
|
114
127
|
debug("DOM not ready:");
|
|
@@ -117,7 +130,7 @@ export class WidgetVerificationController {
|
|
|
117
130
|
// Run on first render
|
|
118
131
|
updateTemplates();
|
|
119
132
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
120
|
-
}, [slot, container, context, demoIsAuth]);
|
|
133
|
+
}, [slot, container, context, demoIsAuth, this.stateController]);
|
|
121
134
|
return (h(Host, null,
|
|
122
135
|
h("div", { ref: setSlot, style: { display: "contents" } },
|
|
123
136
|
h("slot", { name: "not-verified" }),
|
|
@@ -142,7 +155,7 @@ export class WidgetVerificationController {
|
|
|
142
155
|
"text": undefined,
|
|
143
156
|
"name": "undocumented"
|
|
144
157
|
}, {
|
|
145
|
-
"text": "{ \"title\": \"Verify email\", \"slot\": \"not-verified\", \"props\": { \"isAuth\":
|
|
158
|
+
"text": "{ \"title\": \"Verify email\", \"slot\": \"not-verified\", \"props\": { \"isAuth\": false }, \"disabled\": \"true\" }",
|
|
146
159
|
"name": "componentState"
|
|
147
160
|
}, {
|
|
148
161
|
"text": "{ \"title\": \"Tax and cash\", \"default\": true, \"slot\": \"verified\", \"props\": { \"isAuth\": true }, \"disabled\": \"true\" }",
|
|
@@ -152,7 +165,7 @@ export class WidgetVerificationController {
|
|
|
152
165
|
},
|
|
153
166
|
"attribute": "state-controller",
|
|
154
167
|
"reflect": false,
|
|
155
|
-
"defaultValue": "\"{
|
|
168
|
+
"defaultValue": "'{\"sqm-widget-verification-controller\":{\"isAuth\":true}}'"
|
|
156
169
|
}
|
|
157
170
|
}; }
|
|
158
171
|
}
|
|
@@ -35,26 +35,39 @@ const WidgetVerificationController = class {
|
|
|
35
35
|
registerInstance(this, hostRef);
|
|
36
36
|
/**
|
|
37
37
|
* @undocumented
|
|
38
|
-
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth":
|
|
38
|
+
* @componentState { "title": "Verify email", "slot": "not-verified", "props": { "isAuth": false }, "disabled": "true" }
|
|
39
39
|
* @componentState { "title": "Tax and cash", "default": true, "slot": "verified", "props": { "isAuth": true }, "disabled": "true" }
|
|
40
40
|
*/
|
|
41
|
-
this.stateController = "{}
|
|
41
|
+
this.stateController = '{"sqm-widget-verification-controller":{"isAuth":true}}';
|
|
42
42
|
h(this);
|
|
43
43
|
}
|
|
44
44
|
disconnectedCallback() { }
|
|
45
45
|
render() {
|
|
46
|
-
var _a;
|
|
47
46
|
const [context, setContext] = In({
|
|
48
47
|
namespace: VERIFICATION_PARENT_NAMESPACE,
|
|
49
48
|
initialValue: false,
|
|
50
49
|
});
|
|
51
50
|
const props = JSON.parse(this.stateController);
|
|
52
|
-
|
|
51
|
+
// raisins sends state props flat; the @Prop default nests them under the tag
|
|
52
|
+
const stateOverride = (props === null || props === void 0 ? void 0 : props["sqm-widget-verification-controller"]) || props || {};
|
|
53
|
+
const demoIsAuth = isDemo() && (stateOverride === null || stateOverride === void 0 ? void 0 : stateOverride.isAuth);
|
|
54
|
+
// When raisins cascades a nested substate, it appears here keyed by child tag.
|
|
55
|
+
// We use these to auto-switch slots so previewing a substate works from either group.
|
|
56
|
+
const cascadedChildTags = Object.keys(props || {}).filter((k) => k !== "sqm-widget-verification-controller");
|
|
53
57
|
const [container, setContainer] = useState(undefined);
|
|
54
58
|
const [slot, setSlot] = useState(undefined);
|
|
55
59
|
const updateTemplates = useCallback(() => {
|
|
56
|
-
const isAuth = demoIsAuth || context;
|
|
57
60
|
const templates = slot.querySelectorAll(`template`);
|
|
61
|
+
// Infer the target slot from a cascaded substate whose tag lives in one of the templates
|
|
62
|
+
let inferredIsAuth;
|
|
63
|
+
for (const tag of cascadedChildTags) {
|
|
64
|
+
const owning = Array.from(templates).find((t) => t.content.querySelector(tag));
|
|
65
|
+
if (owning) {
|
|
66
|
+
inferredIsAuth = owning.slot === "verified";
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const isAuth = inferredIsAuth !== null && inferredIsAuth !== void 0 ? inferredIsAuth : (demoIsAuth || context);
|
|
58
71
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
59
72
|
if (template) {
|
|
60
73
|
// use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
|
|
@@ -101,7 +114,7 @@ const WidgetVerificationController = class {
|
|
|
101
114
|
target.style.height = "25px";
|
|
102
115
|
});
|
|
103
116
|
}
|
|
104
|
-
}, [container, slot, context, demoIsAuth]);
|
|
117
|
+
}, [container, slot, context, demoIsAuth, this.stateController]);
|
|
105
118
|
useEffect(() => {
|
|
106
119
|
if (!container || !slot) {
|
|
107
120
|
debug("DOM not ready:");
|
|
@@ -110,7 +123,7 @@ const WidgetVerificationController = class {
|
|
|
110
123
|
// Run on first render
|
|
111
124
|
updateTemplates();
|
|
112
125
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
113
|
-
}, [slot, container, context, demoIsAuth]);
|
|
126
|
+
}, [slot, container, context, demoIsAuth, this.stateController]);
|
|
114
127
|
return (h$1(Host, null, h$1("div", { ref: setSlot, style: { display: "contents" } }, h$1("slot", { name: "not-verified" }), h$1("slot", { name: "verified" })), h$1("div", { ref: setContainer }, h$1("slot", { name: "shown" }))));
|
|
115
128
|
}
|
|
116
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h as h$1,c as Host}from"./index-38ad4957.js";import{b as browser,n as h,k as useState,f as useEffect}from"./dom-context-hooks.module-50442785.js";import{I as In,b as useCallback,i as isDemo}from"./index.module-02cb914c.js";import{V as VERIFICATION_PARENT_NAMESPACE}from"./keys-1054056a.js";var debug=browser("sq:widget-verification");function useTemplateChildren(e){var t=e.parent,r=e.callback;var n=new MutationObserver(o);var i=new MutationObserver(r);n.observe(t,{childList:true,subtree:false});o({addedNodes:t.querySelectorAll("template")});function o(e){var t;(t=e.addedNodes)===null||t===void 0?void 0:t.forEach((function(e){i.observe(e.content,{childList:true,attributes:true,subtree:true})}))}return function(){n.disconnect();i.disconnect()}}var WidgetVerificationController=function(){function e(e){registerInstance(this,e);this.stateController="{}
|
|
1
|
+
import{r as registerInstance,h as h$1,c as Host}from"./index-38ad4957.js";import{b as browser,n as h,k as useState,f as useEffect}from"./dom-context-hooks.module-50442785.js";import{I as In,b as useCallback,i as isDemo}from"./index.module-02cb914c.js";import{V as VERIFICATION_PARENT_NAMESPACE}from"./keys-1054056a.js";var debug=browser("sq:widget-verification");function useTemplateChildren(e){var t=e.parent,r=e.callback;var n=new MutationObserver(o);var i=new MutationObserver(r);n.observe(t,{childList:true,subtree:false});o({addedNodes:t.querySelectorAll("template")});function o(e){var t;(t=e.addedNodes)===null||t===void 0?void 0:t.forEach((function(e){i.observe(e.content,{childList:true,attributes:true,subtree:true})}))}return function(){n.disconnect();i.disconnect()}}var WidgetVerificationController=function(){function e(e){registerInstance(this,e);this.stateController='{"sqm-widget-verification-controller":{"isAuth":true}}';h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=In({namespace:VERIFICATION_PARENT_NAMESPACE,initialValue:false}),t=e[0],r=e[1];var n=JSON.parse(this.stateController);var i=(n===null||n===void 0?void 0:n["sqm-widget-verification-controller"])||n||{};var o=isDemo()&&(i===null||i===void 0?void 0:i.isAuth);var a=Object.keys(n||{}).filter((function(e){return e!=="sqm-widget-verification-controller"}));var s=useState(undefined),l=s[0],f=s[1];var u=useState(undefined),c=u[0],d=u[1];var v=useCallback((function(){var e=c.querySelectorAll("template");var r;var n=function(t){var n=Array.from(e).find((function(e){return e.content.querySelector(t)}));if(n){r=n.slot==="verified";return"break"}};for(var i=0,s=a;i<s.length;i++){var f=s[i];var u=n(f);if(u==="break")break}var d=r!==null&&r!==void 0?r:o||t;var v=Array.from(e).find((function(e){return e.slot===(d?"verified":"not-verified")}));if(v){var h=v.innerHTML||v.firstElementChild.outerHTML;if(h===l.innerHTML){debug("don't rerender")}else if(v){l.innerHTML=h}}var m=Array.from(c.children).filter((function(e){return e.tagName==="RAISINS-PLOP-TARGET"}));if(m.length){var p=m.filter((function(e){return e.slot==="verified"}));var b=m.filter((function(e){return e.slot==="not-verified"}));b.forEach((function(e,t){if(d){e.style.display="none";return}if(t===b.length-1){e.style.bottom="0px";e.style.left="0px";e.style.right="0px";e.style.position="absolute"}e.style.height="25px"}));p.forEach((function(e,t){if(!d){e.style.display="none";return}if(t===p.length-1){e.style.bottom="0px";e.style.left="0px";e.style.right="0px";e.style.position="absolute"}e.style.height="25px"}))}}),[l,c,t,o,this.stateController]);useEffect((function(){if(!l||!c){debug("DOM not ready:");return}v();return useTemplateChildren({parent:c,callback:v})}),[c,l,t,o,this.stateController]);return h$1(Host,null,h$1("div",{ref:d,style:{display:"contents"}},h$1("slot",{name:"not-verified"}),h$1("slot",{name:"verified"})),h$1("div",{ref:f},h$1("slot",{name:"shown"})))};return e}();export{WidgetVerificationController as sqm_widget_verification_controller};
|