@devvit/ui-renderer 0.10.11-next-2023-12-13-72cf71865.0 → 0.10.11-next-2023-12-13-9458b6d1f.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-form-dialog.d.ts","sourceRoot":"","sources":["../../../library/src/client/formbuilder/devvit-form-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,kEAAkE,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAwB,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAoB,MAAM,gDAAgD,CAAC;AAGjG,OAAO,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKzF,OAAO,kDAAkD,CAAC;AAC1D,OAAO,gDAAgD,CAAC;AAIxD,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,0BAA0B,CAAC;IACvF,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,qBACa,gBAAiB,SAAQ,UAAU;;IAE9C,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAGvB,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,KAAK,CAAC,EAAE,aAAa,CAAC;IAKtB,WAAoB,MAAM,8BAEzB;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"devvit-form-dialog.d.ts","sourceRoot":"","sources":["../../../library/src/client/formbuilder/devvit-form-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,kEAAkE,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAwB,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAoB,MAAM,gDAAgD,CAAC;AAGjG,OAAO,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKzF,OAAO,kDAAkD,CAAC;AAC1D,OAAO,gDAAgD,CAAC;AAIxD,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,0BAA0B,CAAC;IACvF,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,qBACa,gBAAiB,SAAQ,UAAU;;IAE9C,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAGvB,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,KAAK,CAAC,EAAE,aAAa,CAAC;IAKtB,WAAoB,MAAM,8BAEzB;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IA+FpD,MAAM;CAmDhB"}
|
|
@@ -18,7 +18,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
18
18
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
19
19
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
20
20
|
};
|
|
21
|
-
var _DevvitFormDialog_onEvent, _DevvitFormDialog_idMap, _DevvitFormDialog_makeIdMap, _DevvitFormDialog_collectValues, _DevvitFormDialog_submitClicked, _DevvitFormDialog_cancelClicked,
|
|
21
|
+
var _DevvitFormDialog_onEvent, _DevvitFormDialog_idMap, _DevvitFormDialog_makeIdMap, _DevvitFormDialog_collectValues, _DevvitFormDialog_submitClicked, _DevvitFormDialog_cancelClicked, _DevvitFormDialog_onDialogClosed, _DevvitFormDialog_dispatchFormStatusToHost, _DevvitFormDialog_fixFocustrap, _DevvitFormDialog_renderTitle, _DevvitFormDialog_renderDescription, _DevvitFormDialog_renderButtons;
|
|
22
22
|
import { html, LitElement } from 'lit';
|
|
23
23
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
24
24
|
import { when } from 'lit/directives/when.js';
|
|
@@ -91,13 +91,13 @@ let DevvitFormDialog = class DevvitFormDialog extends LitElement {
|
|
|
91
91
|
results: __classPrivateFieldGet(this, _DevvitFormDialog_collectValues, "f").call(this),
|
|
92
92
|
},
|
|
93
93
|
}));
|
|
94
|
-
|
|
94
|
+
this.$dialog?.close();
|
|
95
95
|
});
|
|
96
96
|
_DevvitFormDialog_cancelClicked.set(this, () => {
|
|
97
|
-
__classPrivateFieldGet(this, _DevvitFormDialog_closeDialog, "f").call(this);
|
|
98
|
-
});
|
|
99
|
-
_DevvitFormDialog_closeDialog.set(this, () => {
|
|
100
97
|
this.$dialog?.close();
|
|
98
|
+
});
|
|
99
|
+
// don't call directly, should be used as event listener to dialog closed
|
|
100
|
+
_DevvitFormDialog_onDialogClosed.set(this, () => {
|
|
101
101
|
this.form = undefined;
|
|
102
102
|
__classPrivateFieldSet(this, _DevvitFormDialog_idMap, {}, "f");
|
|
103
103
|
__classPrivateFieldGet(this, _DevvitFormDialog_dispatchFormStatusToHost, "f").call(this, { open: false });
|
|
@@ -105,26 +105,34 @@ let DevvitFormDialog = class DevvitFormDialog extends LitElement {
|
|
|
105
105
|
_DevvitFormDialog_dispatchFormStatusToHost.set(this, ({ open }) => {
|
|
106
106
|
this.dispatchEvent(customEvent('devvit-form-dialog-event', { open }));
|
|
107
107
|
});
|
|
108
|
+
_DevvitFormDialog_fixFocustrap.set(this, (event) => {
|
|
109
|
+
// faceplate-dialog has a known issue with focus management.
|
|
110
|
+
// Inputs are not registered as "focusable" so click on input label is handled by focus trap incorrectly
|
|
111
|
+
// faceplate-ui team knows about it, but the solution is not yet ready
|
|
112
|
+
// this is a band-aid that prevents focus trap from knowing that we did the click
|
|
113
|
+
// and blocks incorrect behaviour from happening
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
});
|
|
108
116
|
_DevvitFormDialog_renderTitle.set(this, () => html `<span class="text-32 py-sm">${this.form?.title}</span>`);
|
|
109
117
|
_DevvitFormDialog_renderDescription.set(this, () => html `<span class="pb-md">${this.form?.shortDescription}</span>`);
|
|
110
118
|
_DevvitFormDialog_renderButtons.set(this, () => html `
|
|
111
119
|
<div class="flex justify-end space-x-xs">
|
|
112
120
|
${button({
|
|
113
|
-
appearance: '
|
|
121
|
+
appearance: 'secondary',
|
|
114
122
|
size: ButtonSize.Medium,
|
|
115
|
-
children: this.form?.
|
|
123
|
+
children: this.form?.cancelLabel ??
|
|
124
|
+
msg('Cancel', { desc: 'Cancel custom action and dismiss dialog' }),
|
|
116
125
|
attributes: {
|
|
117
|
-
|
|
118
|
-
onclick: __classPrivateFieldGet(this, _DevvitFormDialog_submitClicked, "f"),
|
|
126
|
+
onclick: __classPrivateFieldGet(this, _DevvitFormDialog_cancelClicked, "f"),
|
|
119
127
|
},
|
|
120
128
|
})}
|
|
121
129
|
${button({
|
|
122
|
-
appearance: '
|
|
130
|
+
appearance: 'primary',
|
|
123
131
|
size: ButtonSize.Medium,
|
|
124
|
-
children: this.form?.
|
|
125
|
-
msg('Cancel', { desc: 'Cancel custom action and dismiss dialog' }),
|
|
132
|
+
children: this.form?.acceptLabel ?? msg('OK', { desc: 'Submit input for the custom action' }),
|
|
126
133
|
attributes: {
|
|
127
|
-
|
|
134
|
+
type: 'submit',
|
|
135
|
+
onclick: __classPrivateFieldGet(this, _DevvitFormDialog_submitClicked, "f"),
|
|
128
136
|
},
|
|
129
137
|
})}
|
|
130
138
|
</div>
|
|
@@ -144,8 +152,11 @@ let DevvitFormDialog = class DevvitFormDialog extends LitElement {
|
|
|
144
152
|
}
|
|
145
153
|
render() {
|
|
146
154
|
return html `
|
|
147
|
-
<faceplate-dialog
|
|
148
|
-
|
|
155
|
+
<faceplate-dialog
|
|
156
|
+
class="z-dialog w-[32rem] overflow-auto"
|
|
157
|
+
@faceplate-close="${__classPrivateFieldGet(this, _DevvitFormDialog_onDialogClosed, "f")}"
|
|
158
|
+
>
|
|
159
|
+
<div class="flex flex-col gap-y-sm" @focusin="${__classPrivateFieldGet(this, _DevvitFormDialog_fixFocustrap, "f")}">
|
|
149
160
|
${when(this.form?.title, __classPrivateFieldGet(this, _DevvitFormDialog_renderTitle, "f"))}
|
|
150
161
|
${when(this.form?.shortDescription, __classPrivateFieldGet(this, _DevvitFormDialog_renderDescription, "f"))}
|
|
151
162
|
<faceplate-form
|
|
@@ -167,8 +178,9 @@ _DevvitFormDialog_makeIdMap = new WeakMap();
|
|
|
167
178
|
_DevvitFormDialog_collectValues = new WeakMap();
|
|
168
179
|
_DevvitFormDialog_submitClicked = new WeakMap();
|
|
169
180
|
_DevvitFormDialog_cancelClicked = new WeakMap();
|
|
170
|
-
|
|
181
|
+
_DevvitFormDialog_onDialogClosed = new WeakMap();
|
|
171
182
|
_DevvitFormDialog_dispatchFormStatusToHost = new WeakMap();
|
|
183
|
+
_DevvitFormDialog_fixFocustrap = new WeakMap();
|
|
172
184
|
_DevvitFormDialog_renderTitle = new WeakMap();
|
|
173
185
|
_DevvitFormDialog_renderDescription = new WeakMap();
|
|
174
186
|
_DevvitFormDialog_renderButtons = new WeakMap();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/ui-renderer",
|
|
3
|
-
"version": "0.10.11-next-2023-12-13-
|
|
3
|
+
"version": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
},
|
|
55
55
|
"types": "./index.d.ts",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@devvit/protos": "0.10.11-next-2023-12-13-
|
|
58
|
-
"@devvit/runtime-lite": "0.10.11-next-2023-12-13-
|
|
59
|
-
"@devvit/runtimes": "0.10.11-next-2023-12-13-
|
|
60
|
-
"@devvit/shared-types": "0.10.11-next-2023-12-13-
|
|
57
|
+
"@devvit/protos": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
58
|
+
"@devvit/runtime-lite": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
59
|
+
"@devvit/runtimes": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
60
|
+
"@devvit/shared-types": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
61
61
|
"@lottiefiles/lottie-player": "1.7.1",
|
|
62
62
|
"p-queue": "7.3.4",
|
|
63
63
|
"rxjs": "7.5.7"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@devvit/eslint-config": "0.10.10",
|
|
86
86
|
"@devvit/repo-tools": "0.10.10",
|
|
87
|
-
"@devvit/tsconfig": "0.10.11-next-2023-12-13-
|
|
87
|
+
"@devvit/tsconfig": "0.10.11-next-2023-12-13-9458b6d1f.0",
|
|
88
88
|
"@lit-labs/ssr": "^2.2.3",
|
|
89
89
|
"@lit/localize": "0.11.4",
|
|
90
90
|
"@open-wc/testing-helpers": "2.3.0",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"directory": "dist"
|
|
117
117
|
},
|
|
118
118
|
"source": "./src/index.ts",
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "9d4ed089a50057bededbf64ad8abd2972fd4643d"
|
|
120
120
|
}
|