vintage-frames 0.14.1 → 0.15.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.
- package/custom-elements.json +94 -14
- package/dist/components/vf-button.d.ts +5 -1
- package/dist/components/vf-button.js +1 -1
- package/dist/components/vf-dialog.d.ts +7 -1
- package/dist/events.d.ts +3 -2
- package/dist/events.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/modal-dialog.d.ts +31 -4
- package/dist/modal-dialog.js +98 -82
- package/dist/position.js +25 -20
- package/dist/shell/alert.d.ts +17 -9
- package/dist/shell/alert.js +25 -28
- package/dist/shell/finder.d.ts +41 -1
- package/dist/shell/finder.js +212 -178
- package/dist/shell/index.d.ts +1 -3
- package/dist/shell/index.js +5 -6
- package/dist/shell/shell.d.ts +25 -11
- package/dist/shell/shell.js +143 -122
- package/dist/shell/windows.d.ts +21 -2
- package/dist/shell/windows.js +169 -125
- package/dist/text-control.d.ts +6 -0
- package/dist/text-control.js +2 -2
- package/docs/SPEC.md +5 -5
- package/editor/vscode.html-custom-data.json +2 -2
- package/editor/web-types.json +11 -6
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
"text": "string"
|
|
304
304
|
},
|
|
305
305
|
"default": "''",
|
|
306
|
-
"description": "Value submitted under `name` when `type=\"submit\"`.",
|
|
306
|
+
"description": "Value submitted under `name` when `type=\"submit\"`. In a\n`<form method=\"dialog\">` inside a `vf-dialog`, the dialog's answer\n(`returnValue`), with or without a `name`.",
|
|
307
307
|
"attribute": "value",
|
|
308
308
|
"reflects": true
|
|
309
309
|
},
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
"text": "string"
|
|
1141
1141
|
},
|
|
1142
1142
|
"default": "''",
|
|
1143
|
-
"description": "Value submitted under `name` when `type=\"submit\"`.",
|
|
1143
|
+
"description": "Value submitted under `name` when `type=\"submit\"`. In a\n`<form method=\"dialog\">` inside a `vf-dialog`, the dialog's answer\n(`returnValue`), with or without a `name`.",
|
|
1144
1144
|
"fieldName": "value"
|
|
1145
1145
|
},
|
|
1146
1146
|
{
|
|
@@ -3398,7 +3398,7 @@
|
|
|
3398
3398
|
"declarations": [
|
|
3399
3399
|
{
|
|
3400
3400
|
"kind": "class",
|
|
3401
|
-
"description": "`<vf-dialog>` — the System 7 modal dialog shell.\n\nTwo chromes, one modal lifecycle (native `<dialog>` for top-layer rendering\nand focus trapping, with a fully transparent backdrop — no dimming). Both\nare the same dBoxProc double frame — 1px outer rule, 2px gap, 2px inner\nband, no shadow (vfModalFrame):\n\n- **Default:** the movable modal (movableDBoxProc) — the striped title bar\n set into the top of that frame, with a centered title over a white body.\n Drag the title bar to move it. `closable` adds the standard close box\n (left of the bar) — the HIG's own figures disagree on whether a movable\n modal carries one (Figure 5-1 says yes, Figure 6-1 and the Chapter 6 text\n say no), so the component enables either reading rather than enforcing\n one.\n- **`frame=\"plain\"`:** the modal dialog box — the bare frame, no title bar —\n and immovable, like the original. With no bar, `heading` only names the\n dialog and `closable` is ignored.\n\nOpen it with `show()` (or set the `open` attribute/property); close with\n`close()`. Escape closes it and fires `vf-close` with\n`{ reason: 'escape' }`; the close box and programmatic closing fire\n`{ reason: 'close' }`. With `light-dismiss`, a click outside the frame\ncloses it too, with `{ reason: 'outside' }` — for the About box; off by\ndefault, since the classic modal ignored an outside click.\n\nKeyboard, the classic Dialog Manager's two rules (VfModalDialog):\non open, focus goes to the first text-entry control — a slotted control\nwith `autofocus` first — or, with none, to the default button\n(`vf-button variant=\"default\"`). Return or Enter activates the default\nbutton from anywhere in the dialog, a focused Cancel included; Space\npresses the focused control. A link keeps its own Enter, and in a\nmulti-line editor Return inserts the newline while the keypad's Enter\nactivates the button.\n\nSlotted children placed with `top`/`left` measure from the content region's\ncorner — the frame's inner edge, below the title bar — and flow content\nstarts at the same corner.",
|
|
3401
|
+
"description": "`<vf-dialog>` — the System 7 modal dialog shell.\n\nTwo chromes, one modal lifecycle (native `<dialog>` for top-layer rendering\nand focus trapping, with a fully transparent backdrop — no dimming). Both\nare the same dBoxProc double frame — 1px outer rule, 2px gap, 2px inner\nband, no shadow (vfModalFrame):\n\n- **Default:** the movable modal (movableDBoxProc) — the striped title bar\n set into the top of that frame, with a centered title over a white body.\n Drag the title bar to move it. `closable` adds the standard close box\n (left of the bar) — the HIG's own figures disagree on whether a movable\n modal carries one (Figure 5-1 says yes, Figure 6-1 and the Chapter 6 text\n say no), so the component enables either reading rather than enforcing\n one.\n- **`frame=\"plain\"`:** the modal dialog box — the bare frame, no title bar —\n and immovable, like the original. With no bar, `heading` only names the\n dialog and `closable` is ignored.\n\nOpen it with `show()` (or set the `open` attribute/property); close with\n`close()`. Escape closes it and fires `vf-close` with\n`{ reason: 'escape' }`; the close box and programmatic closing fire\n`{ reason: 'close' }`. With `light-dismiss`, a click outside the frame\ncloses it too, with `{ reason: 'outside' }` — for the About box; off by\ndefault, since the classic modal ignored an outside click.\n\nAnswers: a `<form method=\"dialog\">` inside it closes it with the\nsubmitting button's `value` as `returnValue`, and `close(value)` does the\nsame. `vf-close` carries it as `detail.returnValue`, null when the close\ncarried none (Escape, a click outside, the close box).\n\nKeyboard, the classic Dialog Manager's two rules (VfModalDialog):\non open, focus goes to the first text-entry control — a slotted control\nwith `autofocus` first — or, with none, to the default button\n(`vf-button variant=\"default\"`). Return or Enter activates the default\nbutton from anywhere in the dialog, a focused Cancel included; Space\npresses the focused control. A link keeps its own Enter, and in a\nmulti-line editor Return inserts the newline while the keypad's Enter\nactivates the button.\n\nSlotted children placed with `top`/`left` measure from the content region's\ncorner — the frame's inner edge, below the title bar — and flow content\nstarts at the same corner.",
|
|
3402
3402
|
"name": "VfDialog",
|
|
3403
3403
|
"cssProperties": [
|
|
3404
3404
|
{
|
|
@@ -3590,6 +3590,19 @@
|
|
|
3590
3590
|
"module": "src/modal-dialog.ts"
|
|
3591
3591
|
}
|
|
3592
3592
|
},
|
|
3593
|
+
{
|
|
3594
|
+
"kind": "field",
|
|
3595
|
+
"name": "returnValue",
|
|
3596
|
+
"type": {
|
|
3597
|
+
"text": "string"
|
|
3598
|
+
},
|
|
3599
|
+
"default": "''",
|
|
3600
|
+
"description": "The modal's answer, as on `<dialog>`: set by `close(value)` and by a\nsubmit from a `<form method=\"dialog\">` inside it (the submitting\nbutton's `value`). Cleared on each open, so a dialog asked again doesn't\nstart with its last answer.",
|
|
3601
|
+
"inheritedFrom": {
|
|
3602
|
+
"name": "VfModalDialog",
|
|
3603
|
+
"module": "src/modal-dialog.ts"
|
|
3604
|
+
}
|
|
3605
|
+
},
|
|
3593
3606
|
{
|
|
3594
3607
|
"kind": "field",
|
|
3595
3608
|
"name": "width",
|
|
@@ -3726,6 +3739,30 @@
|
|
|
3726
3739
|
"module": "src/modal-dialog.ts"
|
|
3727
3740
|
}
|
|
3728
3741
|
},
|
|
3742
|
+
{
|
|
3743
|
+
"kind": "field",
|
|
3744
|
+
"name": "#closeValue",
|
|
3745
|
+
"privacy": "private",
|
|
3746
|
+
"type": {
|
|
3747
|
+
"text": "string | null"
|
|
3748
|
+
},
|
|
3749
|
+
"default": "null",
|
|
3750
|
+
"description": "The value `close(value)` gave, pending for the next native `close` event.",
|
|
3751
|
+
"inheritedFrom": {
|
|
3752
|
+
"name": "VfModalDialog",
|
|
3753
|
+
"module": "src/modal-dialog.ts"
|
|
3754
|
+
}
|
|
3755
|
+
},
|
|
3756
|
+
{
|
|
3757
|
+
"kind": "field",
|
|
3758
|
+
"name": "#onSubmit",
|
|
3759
|
+
"privacy": "private",
|
|
3760
|
+
"description": "A submit from a form whose nearest modal is this one, by `method=\"dialog\"`\nor the submitter's `formmethod=\"dialog\"`, closes it with the submitter's\n`value` — at the end of the submit's path, and not if anything cancelled\nit, as the platform runs a form's submission.",
|
|
3761
|
+
"inheritedFrom": {
|
|
3762
|
+
"name": "VfModalDialog",
|
|
3763
|
+
"module": "src/modal-dialog.ts"
|
|
3764
|
+
}
|
|
3765
|
+
},
|
|
3729
3766
|
{
|
|
3730
3767
|
"kind": "field",
|
|
3731
3768
|
"name": "#outsidePress",
|
|
@@ -3870,7 +3907,16 @@
|
|
|
3870
3907
|
"text": "void"
|
|
3871
3908
|
}
|
|
3872
3909
|
},
|
|
3873
|
-
"
|
|
3910
|
+
"parameters": [
|
|
3911
|
+
{
|
|
3912
|
+
"name": "returnValue",
|
|
3913
|
+
"optional": true,
|
|
3914
|
+
"type": {
|
|
3915
|
+
"text": "string"
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
],
|
|
3919
|
+
"description": "Close the modal, with `returnValue` as its answer when one is given.\nFires `vf-close` with `{ reason: 'close', returnValue }`.",
|
|
3874
3920
|
"inheritedFrom": {
|
|
3875
3921
|
"name": "VfModalDialog",
|
|
3876
3922
|
"module": "src/modal-dialog.ts"
|
|
@@ -4104,7 +4150,7 @@
|
|
|
4104
4150
|
"text": "void"
|
|
4105
4151
|
}
|
|
4106
4152
|
},
|
|
4107
|
-
"description": "Native `close` — the single teardown funnel for every close path. Drops\nthe written origin so the next open re-derives it from the box it will\nactually have (a stated `top`/`left` is the author's or the user's and\nsurvives, and is re-applied by that open), syncs `open`, and fires\n`vf-close` with the reason.",
|
|
4153
|
+
"description": "Native `close` — the single teardown funnel for every close path. Drops\nthe written origin so the next open re-derives it from the box it will\nactually have (a stated `top`/`left` is the author's or the user's and\nsurvives, and is re-applied by that open), syncs `open`, and fires\n`vf-close` with the reason and the value the close carried.",
|
|
4108
4154
|
"inheritedFrom": {
|
|
4109
4155
|
"name": "VfModalDialog",
|
|
4110
4156
|
"module": "src/modal-dialog.ts"
|
|
@@ -4113,7 +4159,7 @@
|
|
|
4113
4159
|
],
|
|
4114
4160
|
"events": [
|
|
4115
4161
|
{
|
|
4116
|
-
"description": "Dialog closed. Detail `{ reason: 'escape' | 'close' | 'outside' }` — `'outside'` only under `light-dismiss`.",
|
|
4162
|
+
"description": "Dialog closed. Detail `{ reason: 'escape' | 'close' | 'outside', returnValue: string | null }` — `'outside'` only under `light-dismiss`.",
|
|
4117
4163
|
"name": "vf-close",
|
|
4118
4164
|
"inheritedFrom": {
|
|
4119
4165
|
"name": "VfModalDialog",
|
|
@@ -10318,7 +10364,7 @@
|
|
|
10318
10364
|
"text": "boolean"
|
|
10319
10365
|
}
|
|
10320
10366
|
},
|
|
10321
|
-
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
10367
|
+
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nOne departure: a submit `vf-button variant=\"default\"`, the button with\nthe ring, is the default button when the form has one, ahead of the\nfirst in tree order. A Cancel/OK row puts Cancel first, and Return\nshould press the button the ring marks — the one a modal's own Return\nrule presses (`VfModalDialog`).\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
10322
10368
|
"inheritedFrom": {
|
|
10323
10369
|
"name": "VfTextControlBase",
|
|
10324
10370
|
"module": "src/text-control.ts"
|
|
@@ -18264,7 +18310,7 @@
|
|
|
18264
18310
|
"text": "boolean"
|
|
18265
18311
|
}
|
|
18266
18312
|
},
|
|
18267
|
-
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
18313
|
+
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nOne departure: a submit `vf-button variant=\"default\"`, the button with\nthe ring, is the default button when the form has one, ahead of the\nfirst in tree order. A Cancel/OK row puts Cancel first, and Return\nshould press the button the ring marks — the one a modal's own Return\nrule presses (`VfModalDialog`).\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
18268
18314
|
"inheritedFrom": {
|
|
18269
18315
|
"name": "VfTextControlBase",
|
|
18270
18316
|
"module": "src/text-control.ts"
|
|
@@ -19416,7 +19462,7 @@
|
|
|
19416
19462
|
"text": "boolean"
|
|
19417
19463
|
}
|
|
19418
19464
|
},
|
|
19419
|
-
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
19465
|
+
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nOne departure: a submit `vf-button variant=\"default\"`, the button with\nthe ring, is the default button when the form has one, ahead of the\nfirst in tree order. A Cancel/OK row puts Cancel first, and Return\nshould press the button the ring marks — the one a modal's own Return\nrule presses (`VfModalDialog`).\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched.",
|
|
19420
19466
|
"inheritedFrom": {
|
|
19421
19467
|
"name": "VfTextControlBase",
|
|
19422
19468
|
"module": "src/text-control.ts"
|
|
@@ -22555,7 +22601,7 @@
|
|
|
22555
22601
|
"text": "boolean"
|
|
22556
22602
|
}
|
|
22557
22603
|
},
|
|
22558
|
-
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched."
|
|
22604
|
+
"description": "Emulates the form's implicit submission for a plain Enter press. HTML\ndefines it as *activating the form's default button* — the first submit\nbutton in tree order — so the submission carries that button's submitter\nidentity and name/value. A bare `requestSubmit()` carries neither\n(`event.submitter === null`), which made Enter and a click on the same\nform produce different payloads. `click()` is the activation: a native\nbutton becomes the real submitter, and a `vf-button` forwards it to its\ninner button, which runs the same transient-proxy path a pointer does. A\ndisabled default button means no submission at all, as in HTML; a form\nwith no submit button falls back to the bare call, also as in HTML.\n\nOne departure: a submit `vf-button variant=\"default\"`, the button with\nthe ring, is the default button when the form has one, ahead of the\nfirst in tree order. A Cancel/OK row puts Cancel first, and Return\nshould press the button the ring marks — the one a modal's own Return\nrule presses (`VfModalDialog`).\n\nReturns whether a form owner took the press — true even when a disabled\ndefault button meant no submission, since HTML gave the press to the form\neither way. The callers cancel the keydown on true, so a modal shell\n(`VfModalDialog`) sees the press as spoken for and does not also route it\nto the dialog's default button; with no form the press goes on to the\ndialog untouched."
|
|
22559
22605
|
},
|
|
22560
22606
|
{
|
|
22561
22607
|
"kind": "method",
|
|
@@ -23495,7 +23541,7 @@
|
|
|
23495
23541
|
},
|
|
23496
23542
|
{
|
|
23497
23543
|
"kind": "class",
|
|
23498
|
-
"description": "Base class for the modal shell `vf-dialog` — and for a consumer's own\nmodal (an alert box, say) authored against the kit.\n\nOwns the native `<dialog>` lifecycle every modal shares: `open` sync, `show()` /\n`close()`, the top/left placement (stated or centered) and the\nsingle `close` funnel that drops the written origin and fires `vf-close` with\nthe reason. Because every close path — Escape, `close()`, the opt-in\nlightDismiss click outside — routes through the native `close`\nevent, an Escape-close no longer leaves a stale origin behind, so the next\nopen re-derives it.\n\nIt also owns the two keyboard rules every classic dialog followed (see\ndefaultButton and initialFocusTarget): Return or Enter\nactivates the default button from anywhere in the dialog, and the box opens\nwith the insertion point in its first text field — or, with none, focus on\nthe default button.\n\nRemoving an open modal from the DOM is a close path too. HTML's dialog\n*removing steps* take the element out of the top layer **without** running\nthe close algorithm — no `close` event, no focus restoration — which is\nexactly what the standard framework pattern of unmounting a dialog instead\nof calling `close()` does. `disconnectedCallback` routes that path through\nthe same funnel: the removed element still fires `vf-close` (heard by\nlisteners on the element itself — it has left the tree, so nothing\nbubbles), `open` and the pinned margins reconcile so a re-append mounts it\nclosed and re-centered, and focus returns to the element that was focused\nwhen the modal opened.\n\nSubclasses supply only the frame chrome: a `render()` returning\n`<dialog",
|
|
23544
|
+
"description": "Base class for the modal shell `vf-dialog` — and for a consumer's own\nmodal (an alert box, say) authored against the kit.\n\nOwns the native `<dialog>` lifecycle every modal shares: `open` sync, `show()` /\n`close()`, the top/left placement (stated or centered) and the\nsingle `close` funnel that drops the written origin and fires `vf-close` with\nthe reason. Because every close path — Escape, `close()`, the opt-in\nlightDismiss click outside — routes through the native `close`\nevent, an Escape-close no longer leaves a stale origin behind, so the next\nopen re-derives it.\n\nIt also owns the two keyboard rules every classic dialog followed (see\ndefaultButton and initialFocusTarget): Return or Enter\nactivates the default button from anywhere in the dialog, and the box opens\nwith the insertion point in its first text field — or, with none, focus on\nthe default button.\n\nRemoving an open modal from the DOM is a close path too. HTML's dialog\n*removing steps* take the element out of the top layer **without** running\nthe close algorithm — no `close` event, no focus restoration — which is\nexactly what the standard framework pattern of unmounting a dialog instead\nof calling `close()` does. `disconnectedCallback` routes that path through\nthe same funnel: the removed element still fires `vf-close` (heard by\nlisteners on the element itself — it has left the tree, so nothing\nbubbles), `open` and the pinned margins reconcile so a re-append mounts it\nclosed and re-centered, and focus returns to the element that was focused\nwhen the modal opened.\n\nA `<form method=\"dialog\">` inside the modal closes it with the submitting\nbutton's `value` as returnValue, as a form inside a native\n`<dialog>` does. The platform's own rule looks for a `<dialog>` around the\nform, and this one is in the shadow root, so the modal listens for the\nsubmit itself.\n\nSubclasses supply only the frame chrome: a `render()` returning\n`<dialog",
|
|
23499
23545
|
"name": "VfModalDialog",
|
|
23500
23546
|
"members": [
|
|
23501
23547
|
{
|
|
@@ -23517,6 +23563,15 @@
|
|
|
23517
23563
|
"attribute": "open",
|
|
23518
23564
|
"reflects": true
|
|
23519
23565
|
},
|
|
23566
|
+
{
|
|
23567
|
+
"kind": "field",
|
|
23568
|
+
"name": "returnValue",
|
|
23569
|
+
"type": {
|
|
23570
|
+
"text": "string"
|
|
23571
|
+
},
|
|
23572
|
+
"default": "''",
|
|
23573
|
+
"description": "The modal's answer, as on `<dialog>`: set by `close(value)` and by a\nsubmit from a `<form method=\"dialog\">` inside it (the submitting\nbutton's `value`). Cleared on each open, so a dialog asked again doesn't\nstart with its last answer."
|
|
23574
|
+
},
|
|
23520
23575
|
{
|
|
23521
23576
|
"kind": "field",
|
|
23522
23577
|
"name": "width",
|
|
@@ -23613,6 +23668,22 @@
|
|
|
23613
23668
|
"default": "null",
|
|
23614
23669
|
"description": "Close reason pending for the next native `close` event."
|
|
23615
23670
|
},
|
|
23671
|
+
{
|
|
23672
|
+
"kind": "field",
|
|
23673
|
+
"name": "#closeValue",
|
|
23674
|
+
"privacy": "private",
|
|
23675
|
+
"type": {
|
|
23676
|
+
"text": "string | null"
|
|
23677
|
+
},
|
|
23678
|
+
"default": "null",
|
|
23679
|
+
"description": "The value `close(value)` gave, pending for the next native `close` event."
|
|
23680
|
+
},
|
|
23681
|
+
{
|
|
23682
|
+
"kind": "field",
|
|
23683
|
+
"name": "#onSubmit",
|
|
23684
|
+
"privacy": "private",
|
|
23685
|
+
"description": "A submit from a form whose nearest modal is this one, by `method=\"dialog\"`\nor the submitter's `formmethod=\"dialog\"`, closes it with the submitter's\n`value` — at the end of the submit's path, and not if anything cancelled\nit, as the platform runs a form's submission."
|
|
23686
|
+
},
|
|
23616
23687
|
{
|
|
23617
23688
|
"kind": "field",
|
|
23618
23689
|
"name": "#outsidePress",
|
|
@@ -23713,7 +23784,16 @@
|
|
|
23713
23784
|
"text": "void"
|
|
23714
23785
|
}
|
|
23715
23786
|
},
|
|
23716
|
-
"
|
|
23787
|
+
"parameters": [
|
|
23788
|
+
{
|
|
23789
|
+
"name": "returnValue",
|
|
23790
|
+
"optional": true,
|
|
23791
|
+
"type": {
|
|
23792
|
+
"text": "string"
|
|
23793
|
+
}
|
|
23794
|
+
}
|
|
23795
|
+
],
|
|
23796
|
+
"description": "Close the modal, with `returnValue` as its answer when one is given.\nFires `vf-close` with `{ reason: 'close', returnValue }`."
|
|
23717
23797
|
},
|
|
23718
23798
|
{
|
|
23719
23799
|
"kind": "method",
|
|
@@ -23891,12 +23971,12 @@
|
|
|
23891
23971
|
"text": "void"
|
|
23892
23972
|
}
|
|
23893
23973
|
},
|
|
23894
|
-
"description": "Native `close` — the single teardown funnel for every close path. Drops\nthe written origin so the next open re-derives it from the box it will\nactually have (a stated `top`/`left` is the author's or the user's and\nsurvives, and is re-applied by that open), syncs `open`, and fires\n`vf-close` with the reason."
|
|
23974
|
+
"description": "Native `close` — the single teardown funnel for every close path. Drops\nthe written origin so the next open re-derives it from the box it will\nactually have (a stated `top`/`left` is the author's or the user's and\nsurvives, and is re-applied by that open), syncs `open`, and fires\n`vf-close` with the reason and the value the close carried."
|
|
23895
23975
|
}
|
|
23896
23976
|
],
|
|
23897
23977
|
"events": [
|
|
23898
23978
|
{
|
|
23899
|
-
"description": "The modal closed. `detail: { reason: 'escape' | 'close' | 'outside' }`.",
|
|
23979
|
+
"description": "The modal closed. `detail: { reason: 'escape' | 'close' | 'outside', returnValue: string | null }`.",
|
|
23900
23980
|
"name": "vf-close"
|
|
23901
23981
|
}
|
|
23902
23982
|
],
|
|
@@ -75,7 +75,11 @@ export declare class VfButton extends VfButton_base {
|
|
|
75
75
|
type: 'button' | 'submit' | 'reset';
|
|
76
76
|
/** Form field name; submitted as `name=value` when `type="submit"`. */
|
|
77
77
|
name: string;
|
|
78
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Value submitted under `name` when `type="submit"`. In a
|
|
80
|
+
* `<form method="dialog">` inside a `vf-dialog`, the dialog's answer
|
|
81
|
+
* (`returnValue`), with or without a `name`.
|
|
82
|
+
*/
|
|
79
83
|
value: string;
|
|
80
84
|
/**
|
|
81
85
|
* The submission overrides native `<button>` carries, honored on
|
|
@@ -253,7 +253,7 @@ var S = "vf-submitter", C = class extends i(h) {
|
|
|
253
253
|
let e = this.resolvedType;
|
|
254
254
|
if (!this.internals.form || e === "button" || this.isDisabled) return;
|
|
255
255
|
let t = document.createElement("button");
|
|
256
|
-
t.type = e, t.slot = S, t.addEventListener("click", (e) => e.stopPropagation()), e === "submit" && (this.name && (t.name = this.name, t.value = this.value
|
|
256
|
+
t.type = e, t.slot = S, t.addEventListener("click", (e) => e.stopPropagation()), e === "submit" && (this.name && (t.name = this.name), t.value = this.value, this.formAction && (t.formAction = this.formAction), this.formEnctype && (t.formEnctype = this.formEnctype), this.formMethod && (t.formMethod = this.formMethod), this.formTarget && (t.formTarget = this.formTarget), t.formNoValidate = this.formNoValidate), this.#e = !0;
|
|
257
257
|
try {
|
|
258
258
|
this.append(t), t.click();
|
|
259
259
|
} finally {
|
|
@@ -25,6 +25,11 @@ import { VfModalDialog } from '../modal-dialog.js';
|
|
|
25
25
|
* closes it too, with `{ reason: 'outside' }` — for the About box; off by
|
|
26
26
|
* default, since the classic modal ignored an outside click.
|
|
27
27
|
*
|
|
28
|
+
* Answers: a `<form method="dialog">` inside it closes it with the
|
|
29
|
+
* submitting button's `value` as `returnValue`, and `close(value)` does the
|
|
30
|
+
* same. `vf-close` carries it as `detail.returnValue`, null when the close
|
|
31
|
+
* carried none (Escape, a click outside, the close box).
|
|
32
|
+
*
|
|
28
33
|
* Keyboard, the classic Dialog Manager's two rules ({@link VfModalDialog}):
|
|
29
34
|
* on open, focus goes to the first text-entry control — a slotted control
|
|
30
35
|
* with `autofocus` first — or, with none, to the default button
|
|
@@ -49,7 +54,8 @@ import { VfModalDialog } from '../modal-dialog.js';
|
|
|
49
54
|
* content). Inert while the content fits; over-stuffed, it scrolls under a
|
|
50
55
|
* System 7 rail and becomes a keyboard stop.
|
|
51
56
|
* @fires vf-close - Dialog closed. Detail `{ reason: 'escape' | 'close' |
|
|
52
|
-
* 'outside' }` — `'outside'` only under
|
|
57
|
+
* 'outside', returnValue: string | null }` — `'outside'` only under
|
|
58
|
+
* `light-dismiss`.
|
|
53
59
|
* @cssprop --vf-dots-pattern - the windoid bar's dot-grid dither — a 2×2 tile,
|
|
54
60
|
* one black pixel at the origin (`vfDots`; override the whole pattern like
|
|
55
61
|
* `--vf-desktop-pattern`)
|
package/dist/events.d.ts
CHANGED
|
@@ -46,7 +46,8 @@ export declare function emitNative(host: EventTarget, type: 'input' | 'change'):
|
|
|
46
46
|
/**
|
|
47
47
|
* Run a control's **activation behavior** the way HTML runs a native one's: at
|
|
48
48
|
* the *end* of the click's propagation, and not at all if anything on the path
|
|
49
|
-
* called `preventDefault()`.
|
|
49
|
+
* called `preventDefault()`. A form's `submit` defers the same way: the
|
|
50
|
+
* listener waits on the event's own type.
|
|
50
51
|
*
|
|
51
52
|
* This is what makes `preventDefault()` on a native checkbox — or on any
|
|
52
53
|
* ancestor — actually stop it from checking. A handler that acts where it sits
|
|
@@ -73,7 +74,7 @@ export declare function emitNative(host: EventTarget, type: 'input' | 'change'):
|
|
|
73
74
|
* submit proxy's re-entrancy guard woven through it.
|
|
74
75
|
*
|
|
75
76
|
* @param host the element whose ownerDocument supplies the window to defer on
|
|
76
|
-
* @param event the click being deferred; its `defaultPrevented` is the verdict
|
|
77
|
+
* @param event the click (or submit) being deferred; its `defaultPrevented` is the verdict
|
|
77
78
|
* @param action run once, at the end of the path, unless cancelled
|
|
78
79
|
*/
|
|
79
80
|
export declare function deferActivation(host: Element, event: Event, action: () => void): void;
|
package/dist/events.js
CHANGED
|
@@ -16,10 +16,10 @@ function t(e, t) {
|
|
|
16
16
|
function n(e, t, n) {
|
|
17
17
|
let r = e.ownerDocument.defaultView;
|
|
18
18
|
if (!r) return;
|
|
19
|
-
let i =
|
|
20
|
-
r.removeEventListener(
|
|
19
|
+
let i = t.type, a = 0, o = () => {
|
|
20
|
+
r.removeEventListener(i, o), r.clearTimeout(a), !t.defaultPrevented && n();
|
|
21
21
|
};
|
|
22
|
-
r.addEventListener(
|
|
22
|
+
r.addEventListener(i, o), a = r.setTimeout(o, 0);
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
export { n as deferActivation, e as emit, t as emitNative };
|
package/dist/index.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ export type { PlacementBounds, PlacementClamp, PlacementOrigin, VfPositionedInte
|
|
|
174
174
|
export { VfSized } from './size.js';
|
|
175
175
|
export type { VfSizedInterface } from './size.js';
|
|
176
176
|
export { VfModalDialog, modalDialogStyles } from './modal-dialog.js';
|
|
177
|
-
export type { VfCloseReason } from './modal-dialog.js';
|
|
177
|
+
export type { VfCloseDetail, VfCloseReason } from './modal-dialog.js';
|
|
178
178
|
/** The embedded System 7 bitmap faces and the registration helper. */
|
|
179
179
|
export { registerEmbeddedFont, PIXEL_GRID_METRICS } from './styles/register-embedded-font.js';
|
|
180
180
|
export type { EmbeddedFontMetrics } from './styles/register-embedded-font.js';
|
package/dist/modal-dialog.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ import { ScaleController } from './scale.js';
|
|
|
7
7
|
* — a click outside the frame.
|
|
8
8
|
*/
|
|
9
9
|
export type VfCloseReason = 'escape' | 'close' | 'outside';
|
|
10
|
+
/** The `vf-close` event's detail. */
|
|
11
|
+
export interface VfCloseDetail {
|
|
12
|
+
reason: VfCloseReason;
|
|
13
|
+
/**
|
|
14
|
+
* The value this close carried — the submitting button's `value`, or
|
|
15
|
+
* `close(value)`'s — or null when it carried none: Escape, a click
|
|
16
|
+
* outside, `close()` alone, or removal from the DOM.
|
|
17
|
+
*/
|
|
18
|
+
returnValue: string | null;
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* The width an undeclared modal falls back to, in system px — a classic
|
|
12
22
|
* dialog's own measure, wide enough for a line of chrome text and a button row.
|
|
@@ -49,12 +59,18 @@ export declare const modalDialogStyles: import("lit").CSSResult;
|
|
|
49
59
|
* closed and re-centered, and focus returns to the element that was focused
|
|
50
60
|
* when the modal opened.
|
|
51
61
|
*
|
|
62
|
+
* A `<form method="dialog">` inside the modal closes it with the submitting
|
|
63
|
+
* button's `value` as {@link returnValue}, as a form inside a native
|
|
64
|
+
* `<dialog>` does. The platform's own rule looks for a `<dialog>` around the
|
|
65
|
+
* form, and this one is in the shadow root, so the modal listens for the
|
|
66
|
+
* submit itself.
|
|
67
|
+
*
|
|
52
68
|
* Subclasses supply only the frame chrome: a `render()` returning
|
|
53
69
|
* `<dialog @cancel=${this._onNativeCancel} @close=${this._onNativeClose}>` with
|
|
54
70
|
* their role/ARIA and body, and {@link modalDialogStyles} in `static styles`.
|
|
55
71
|
*
|
|
56
72
|
* @fires vf-close - The modal closed. `detail: { reason: 'escape' | 'close' |
|
|
57
|
-
* 'outside' }`.
|
|
73
|
+
* 'outside', returnValue: string | null }`.
|
|
58
74
|
*/
|
|
59
75
|
export declare class VfModalDialog extends LitElement {
|
|
60
76
|
#private;
|
|
@@ -62,6 +78,13 @@ export declare class VfModalDialog extends LitElement {
|
|
|
62
78
|
protected readonly scale: ScaleController;
|
|
63
79
|
/** Whether the modal is open. Kept in sync with the native `<dialog>`. */
|
|
64
80
|
open: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The modal's answer, as on `<dialog>`: set by `close(value)` and by a
|
|
83
|
+
* submit from a `<form method="dialog">` inside it (the submitting
|
|
84
|
+
* button's `value`). Cleared on each open, so a dialog asked again doesn't
|
|
85
|
+
* start with its last answer.
|
|
86
|
+
*/
|
|
87
|
+
returnValue: string;
|
|
65
88
|
/**
|
|
66
89
|
* Modal width in whole system px — the art's own unit, so the box holds its
|
|
67
90
|
* proportion to the chrome inside it at every display density.
|
|
@@ -130,6 +153,7 @@ export declare class VfModalDialog extends LitElement {
|
|
|
130
153
|
* drag from squeezing the box.
|
|
131
154
|
*/
|
|
132
155
|
protected get dialogSize(): Record<string, string | null>;
|
|
156
|
+
constructor();
|
|
133
157
|
/**
|
|
134
158
|
* The dialog's default button — the one wearing the bold ring
|
|
135
159
|
* (`vf-button[variant="default"]`) — or null with none, or none enabled.
|
|
@@ -159,8 +183,11 @@ export declare class VfModalDialog extends LitElement {
|
|
|
159
183
|
protected get initialFocusTarget(): HTMLElement | null;
|
|
160
184
|
/** Open the modal (native `showModal()`), pinned onto the device grid. */
|
|
161
185
|
show(): void;
|
|
162
|
-
/**
|
|
163
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Close the modal, with `returnValue` as its answer when one is given.
|
|
188
|
+
* Fires `vf-close` with `{ reason: 'close', returnValue }`.
|
|
189
|
+
*/
|
|
190
|
+
close(returnValue?: string): void;
|
|
164
191
|
protected updated(changed: PropertyValues<this>): void;
|
|
165
192
|
/**
|
|
166
193
|
* State the origin, in system px — clamped on screen and snapped onto the
|
|
@@ -197,7 +224,7 @@ export declare class VfModalDialog extends LitElement {
|
|
|
197
224
|
* the written origin so the next open re-derives it from the box it will
|
|
198
225
|
* actually have (a stated `top`/`left` is the author's or the user's and
|
|
199
226
|
* survives, and is re-applied by that open), syncs `open`, and fires
|
|
200
|
-
* `vf-close` with the reason.
|
|
227
|
+
* `vf-close` with the reason and the value the close carried.
|
|
201
228
|
*/
|
|
202
229
|
protected _onNativeClose(): void;
|
|
203
230
|
}
|