@cratis/showrunner.notes.react 0.0.0-stage → 1.0.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/Buttons/NotesButton.tsx +117 -0
- package/Buttons/index.ts +6 -0
- package/Buttons/menuItems.ts +55 -0
- package/Buttons/notesDialogHeaderActions.tsx +33 -0
- package/Context/componentContext.ts +57 -0
- package/Context/formatLocation.ts +27 -0
- package/Context/index.ts +6 -0
- package/Context/noteContext.ts +139 -0
- package/Feedback/ComponentFeedbackDialog.tsx +150 -0
- package/Feedback/ComponentModeSwitch.tsx +39 -0
- package/Feedback/ContextSummary.tsx +31 -0
- package/Feedback/FeedbackDialog.tsx +64 -0
- package/Feedback/KindAndText.tsx +38 -0
- package/Feedback/SliceChooser.tsx +90 -0
- package/Feedback/SlicesFeedbackDialog.tsx +63 -0
- package/Feedback/index.ts +13 -0
- package/Feedback/kindOptions.ts +35 -0
- package/Feedback/propertySuggestions.ts +38 -0
- package/Feedback/sliceChoice.ts +73 -0
- package/Icons.tsx +29 -0
- package/Labels/NotesLabels.ts +185 -0
- package/Labels/defaultNotesLabels.ts +93 -0
- package/Labels/format.ts +13 -0
- package/Labels/index.ts +7 -0
- package/Labels/resolveLabels.ts +36 -0
- package/MyFeedback/MyFeedbackDialog.tsx +51 -0
- package/MyFeedback/MyFeedbackList.tsx +62 -0
- package/MyFeedback/index.ts +6 -0
- package/MyFeedback/noteStates.ts +75 -0
- package/Provider/NotesContext.ts +111 -0
- package/Provider/NotesProvider.tsx +122 -0
- package/Provider/index.ts +6 -0
- package/Provider/notesVisibility.ts +13 -0
- package/README.md +49 -2
- package/dist/cjs/Buttons/NotesButton.d.ts +8 -0
- package/dist/cjs/Buttons/NotesButton.d.ts.map +1 -0
- package/dist/cjs/Buttons/NotesButton.js +126 -0
- package/dist/cjs/Buttons/NotesButton.js.map +1 -0
- package/dist/cjs/Buttons/index.d.ts +4 -0
- package/dist/cjs/Buttons/index.d.ts.map +1 -0
- package/dist/cjs/Buttons/menuItems.d.ts +10 -0
- package/dist/cjs/Buttons/menuItems.d.ts.map +1 -0
- package/dist/cjs/Buttons/menuItems.js +57 -0
- package/dist/cjs/Buttons/menuItems.js.map +1 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.d.ts +4 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.d.ts.map +1 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.js +37 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.js.map +1 -0
- package/dist/cjs/Context/componentContext.d.ts +8 -0
- package/dist/cjs/Context/componentContext.d.ts.map +1 -0
- package/dist/cjs/Context/componentContext.js +56 -0
- package/dist/cjs/Context/componentContext.js.map +1 -0
- package/dist/cjs/Context/formatLocation.d.ts +7 -0
- package/dist/cjs/Context/formatLocation.d.ts.map +1 -0
- package/dist/cjs/Context/formatLocation.js +23 -0
- package/dist/cjs/Context/formatLocation.js.map +1 -0
- package/dist/cjs/Context/index.d.ts +4 -0
- package/dist/cjs/Context/index.d.ts.map +1 -0
- package/dist/cjs/Context/noteContext.d.ts +22 -0
- package/dist/cjs/Context/noteContext.d.ts.map +1 -0
- package/dist/cjs/Context/noteContext.js +117 -0
- package/dist/cjs/Context/noteContext.js.map +1 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.d.ts +10 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.js +183 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.d.ts +7 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.d.ts.map +1 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.js +29 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.js.map +1 -0
- package/dist/cjs/Feedback/ContextSummary.d.ts +7 -0
- package/dist/cjs/Feedback/ContextSummary.d.ts.map +1 -0
- package/dist/cjs/Feedback/ContextSummary.js +31 -0
- package/dist/cjs/Feedback/ContextSummary.js.map +1 -0
- package/dist/cjs/Feedback/FeedbackDialog.d.ts +11 -0
- package/dist/cjs/Feedback/FeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/FeedbackDialog.js +55 -0
- package/dist/cjs/Feedback/FeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/KindAndText.d.ts +7 -0
- package/dist/cjs/Feedback/KindAndText.d.ts.map +1 -0
- package/dist/cjs/Feedback/KindAndText.js +33 -0
- package/dist/cjs/Feedback/KindAndText.js.map +1 -0
- package/dist/cjs/Feedback/SliceChooser.d.ts +9 -0
- package/dist/cjs/Feedback/SliceChooser.d.ts.map +1 -0
- package/dist/cjs/Feedback/SliceChooser.js +113 -0
- package/dist/cjs/Feedback/SliceChooser.js.map +1 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.d.ts +8 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.js +74 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/index.d.ts +11 -0
- package/dist/cjs/Feedback/index.d.ts.map +1 -0
- package/dist/cjs/Feedback/kindOptions.d.ts +9 -0
- package/dist/cjs/Feedback/kindOptions.d.ts.map +1 -0
- package/dist/cjs/Feedback/kindOptions.js +37 -0
- package/dist/cjs/Feedback/kindOptions.js.map +1 -0
- package/dist/cjs/Feedback/propertySuggestions.d.ts +6 -0
- package/dist/cjs/Feedback/propertySuggestions.d.ts.map +1 -0
- package/dist/cjs/Feedback/propertySuggestions.js +32 -0
- package/dist/cjs/Feedback/propertySuggestions.js.map +1 -0
- package/dist/cjs/Feedback/sliceChoice.d.ts +7 -0
- package/dist/cjs/Feedback/sliceChoice.d.ts.map +1 -0
- package/dist/cjs/Feedback/sliceChoice.js +71 -0
- package/dist/cjs/Feedback/sliceChoice.js.map +1 -0
- package/dist/cjs/Icons.d.ts +4 -0
- package/dist/cjs/Icons.d.ts.map +1 -0
- package/dist/cjs/Icons.js +53 -0
- package/dist/cjs/Icons.js.map +1 -0
- package/dist/cjs/Labels/NotesLabels.d.ts +90 -0
- package/dist/cjs/Labels/NotesLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/defaultNotesLabels.d.ts +3 -0
- package/dist/cjs/Labels/defaultNotesLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/defaultNotesLabels.js +94 -0
- package/dist/cjs/Labels/defaultNotesLabels.js.map +1 -0
- package/dist/cjs/Labels/format.d.ts +2 -0
- package/dist/cjs/Labels/format.d.ts.map +1 -0
- package/dist/cjs/Labels/format.js +15 -0
- package/dist/cjs/Labels/format.js.map +1 -0
- package/dist/cjs/Labels/index.d.ts +5 -0
- package/dist/cjs/Labels/index.d.ts.map +1 -0
- package/dist/cjs/Labels/resolveLabels.d.ts +3 -0
- package/dist/cjs/Labels/resolveLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/resolveLabels.js +35 -0
- package/dist/cjs/Labels/resolveLabels.js.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.d.ts +2 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.js +55 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.js.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.d.ts +10 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.js +62 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.js.map +1 -0
- package/dist/cjs/MyFeedback/index.d.ts +4 -0
- package/dist/cjs/MyFeedback/index.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/noteStates.d.ts +8 -0
- package/dist/cjs/MyFeedback/noteStates.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/noteStates.js +90 -0
- package/dist/cjs/MyFeedback/noteStates.js.map +1 -0
- package/dist/cjs/Provider/NotesContext.d.ts +23 -0
- package/dist/cjs/Provider/NotesContext.d.ts.map +1 -0
- package/dist/cjs/Provider/NotesContext.js +51 -0
- package/dist/cjs/Provider/NotesContext.js.map +1 -0
- package/dist/cjs/Provider/NotesProvider.d.ts +11 -0
- package/dist/cjs/Provider/NotesProvider.d.ts.map +1 -0
- package/dist/cjs/Provider/NotesProvider.js +133 -0
- package/dist/cjs/Provider/NotesProvider.js.map +1 -0
- package/dist/cjs/Provider/index.d.ts +4 -0
- package/dist/cjs/Provider/index.d.ts.map +1 -0
- package/dist/cjs/Provider/notesVisibility.d.ts +2 -0
- package/dist/cjs/Provider/notesVisibility.d.ts.map +1 -0
- package/dist/cjs/Provider/notesVisibility.js +16 -0
- package/dist/cjs/Provider/notesVisibility.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +85 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/Buttons/NotesButton.d.ts +8 -0
- package/dist/esm/Buttons/NotesButton.d.ts.map +1 -0
- package/dist/esm/Buttons/NotesButton.js +124 -0
- package/dist/esm/Buttons/NotesButton.js.map +1 -0
- package/dist/esm/Buttons/index.d.ts +4 -0
- package/dist/esm/Buttons/index.d.ts.map +1 -0
- package/dist/esm/Buttons/index.js +4 -0
- package/dist/esm/Buttons/index.js.map +1 -0
- package/dist/esm/Buttons/menuItems.d.ts +10 -0
- package/dist/esm/Buttons/menuItems.d.ts.map +1 -0
- package/dist/esm/Buttons/menuItems.js +54 -0
- package/dist/esm/Buttons/menuItems.js.map +1 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.d.ts +4 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.d.ts.map +1 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.js +34 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.js.map +1 -0
- package/dist/esm/Context/componentContext.d.ts +8 -0
- package/dist/esm/Context/componentContext.d.ts.map +1 -0
- package/dist/esm/Context/componentContext.js +51 -0
- package/dist/esm/Context/componentContext.js.map +1 -0
- package/dist/esm/Context/formatLocation.d.ts +7 -0
- package/dist/esm/Context/formatLocation.d.ts.map +1 -0
- package/dist/esm/Context/formatLocation.js +21 -0
- package/dist/esm/Context/formatLocation.js.map +1 -0
- package/dist/esm/Context/index.d.ts +4 -0
- package/dist/esm/Context/index.d.ts.map +1 -0
- package/dist/esm/Context/index.js +4 -0
- package/dist/esm/Context/index.js.map +1 -0
- package/dist/esm/Context/noteContext.d.ts +22 -0
- package/dist/esm/Context/noteContext.d.ts.map +1 -0
- package/dist/esm/Context/noteContext.js +110 -0
- package/dist/esm/Context/noteContext.js.map +1 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.d.ts +10 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.js +181 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/ComponentModeSwitch.d.ts +7 -0
- package/dist/esm/Feedback/ComponentModeSwitch.d.ts.map +1 -0
- package/dist/esm/Feedback/ComponentModeSwitch.js +27 -0
- package/dist/esm/Feedback/ComponentModeSwitch.js.map +1 -0
- package/dist/esm/Feedback/ContextSummary.d.ts +7 -0
- package/dist/esm/Feedback/ContextSummary.d.ts.map +1 -0
- package/dist/esm/Feedback/ContextSummary.js +29 -0
- package/dist/esm/Feedback/ContextSummary.js.map +1 -0
- package/dist/esm/Feedback/FeedbackDialog.d.ts +11 -0
- package/dist/esm/Feedback/FeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/FeedbackDialog.js +53 -0
- package/dist/esm/Feedback/FeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/KindAndText.d.ts +7 -0
- package/dist/esm/Feedback/KindAndText.d.ts.map +1 -0
- package/dist/esm/Feedback/KindAndText.js +31 -0
- package/dist/esm/Feedback/KindAndText.js.map +1 -0
- package/dist/esm/Feedback/SliceChooser.d.ts +9 -0
- package/dist/esm/Feedback/SliceChooser.d.ts.map +1 -0
- package/dist/esm/Feedback/SliceChooser.js +111 -0
- package/dist/esm/Feedback/SliceChooser.js.map +1 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.d.ts +8 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.js +72 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/index.d.ts +11 -0
- package/dist/esm/Feedback/index.d.ts.map +1 -0
- package/dist/esm/Feedback/index.js +11 -0
- package/dist/esm/Feedback/index.js.map +1 -0
- package/dist/esm/Feedback/kindOptions.d.ts +9 -0
- package/dist/esm/Feedback/kindOptions.d.ts.map +1 -0
- package/dist/esm/Feedback/kindOptions.js +34 -0
- package/dist/esm/Feedback/kindOptions.js.map +1 -0
- package/dist/esm/Feedback/propertySuggestions.d.ts +6 -0
- package/dist/esm/Feedback/propertySuggestions.d.ts.map +1 -0
- package/dist/esm/Feedback/propertySuggestions.js +29 -0
- package/dist/esm/Feedback/propertySuggestions.js.map +1 -0
- package/dist/esm/Feedback/sliceChoice.d.ts +7 -0
- package/dist/esm/Feedback/sliceChoice.d.ts.map +1 -0
- package/dist/esm/Feedback/sliceChoice.js +65 -0
- package/dist/esm/Feedback/sliceChoice.js.map +1 -0
- package/dist/esm/Icons.d.ts +4 -0
- package/dist/esm/Icons.d.ts.map +1 -0
- package/dist/esm/Icons.js +49 -0
- package/dist/esm/Icons.js.map +1 -0
- package/dist/esm/Labels/NotesLabels.d.ts +90 -0
- package/dist/esm/Labels/NotesLabels.d.ts.map +1 -0
- package/dist/esm/Labels/NotesLabels.js +2 -0
- package/dist/esm/Labels/NotesLabels.js.map +1 -0
- package/dist/esm/Labels/defaultNotesLabels.d.ts +3 -0
- package/dist/esm/Labels/defaultNotesLabels.d.ts.map +1 -0
- package/dist/esm/Labels/defaultNotesLabels.js +92 -0
- package/dist/esm/Labels/defaultNotesLabels.js.map +1 -0
- package/dist/esm/Labels/format.d.ts +2 -0
- package/dist/esm/Labels/format.d.ts.map +1 -0
- package/dist/esm/Labels/format.js +13 -0
- package/dist/esm/Labels/format.js.map +1 -0
- package/dist/esm/Labels/index.d.ts +5 -0
- package/dist/esm/Labels/index.d.ts.map +1 -0
- package/dist/esm/Labels/index.js +5 -0
- package/dist/esm/Labels/index.js.map +1 -0
- package/dist/esm/Labels/resolveLabels.d.ts +3 -0
- package/dist/esm/Labels/resolveLabels.d.ts.map +1 -0
- package/dist/esm/Labels/resolveLabels.js +33 -0
- package/dist/esm/Labels/resolveLabels.js.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.d.ts +2 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.js +53 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.js.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackList.d.ts +10 -0
- package/dist/esm/MyFeedback/MyFeedbackList.d.ts.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackList.js +60 -0
- package/dist/esm/MyFeedback/MyFeedbackList.js.map +1 -0
- package/dist/esm/MyFeedback/index.d.ts +4 -0
- package/dist/esm/MyFeedback/index.d.ts.map +1 -0
- package/dist/esm/MyFeedback/index.js +4 -0
- package/dist/esm/MyFeedback/index.js.map +1 -0
- package/dist/esm/MyFeedback/noteStates.d.ts +8 -0
- package/dist/esm/MyFeedback/noteStates.d.ts.map +1 -0
- package/dist/esm/MyFeedback/noteStates.js +84 -0
- package/dist/esm/MyFeedback/noteStates.js.map +1 -0
- package/dist/esm/Provider/NotesContext.d.ts +23 -0
- package/dist/esm/Provider/NotesContext.d.ts.map +1 -0
- package/dist/esm/Provider/NotesContext.js +44 -0
- package/dist/esm/Provider/NotesContext.js.map +1 -0
- package/dist/esm/Provider/NotesProvider.d.ts +11 -0
- package/dist/esm/Provider/NotesProvider.d.ts.map +1 -0
- package/dist/esm/Provider/NotesProvider.js +131 -0
- package/dist/esm/Provider/NotesProvider.js.map +1 -0
- package/dist/esm/Provider/index.d.ts +4 -0
- package/dist/esm/Provider/index.d.ts.map +1 -0
- package/dist/esm/Provider/index.js +4 -0
- package/dist/esm/Provider/index.js.map +1 -0
- package/dist/esm/Provider/notesVisibility.d.ts +2 -0
- package/dist/esm/Provider/notesVisibility.d.ts.map +1 -0
- package/dist/esm/Provider/notesVisibility.js +14 -0
- package/dist/esm/Provider/notesVisibility.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/index.ts +10 -0
- package/package.json +84 -5
- package/styles.css +192 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotesButton.d.ts","sourceRoot":"","sources":["../../../Buttons/NotesButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AASjE,MAAM,WAAW,gBAAgB;IAE7B,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAGzB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAG7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD,eAAO,MAAM,WAAW,GAAI,6BAAuC,gBAAgB,uCAuFlF,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Common = require('@cratis/components/Common');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var Icons = require('../Icons.js');
|
|
7
|
+
var NotesContext = require('../Provider/NotesContext.js');
|
|
8
|
+
var menuItems = require('./menuItems.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The feedback button, a split button. Its main action gives feedback on what the user is looking at; its drop-down offers
|
|
12
|
+
* feedback on specific slices, on this screen, on a component the user points at, and the user's own feedback. It
|
|
13
|
+
* renders nothing unless the user is signed in and Notes is switched on. Place it in any top bar.
|
|
14
|
+
*/ const NotesButton = ({ size = 'large', dialog, className })=>{
|
|
15
|
+
const notes = NotesContext.useNotesContext();
|
|
16
|
+
const { labels } = notes;
|
|
17
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
18
|
+
const root = react.useRef(null);
|
|
19
|
+
const menuId = react.useId();
|
|
20
|
+
react.useEffect(()=>{
|
|
21
|
+
if (!isOpen) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const dismiss = (event)=>{
|
|
25
|
+
if (!root.current?.contains(event.target)) {
|
|
26
|
+
setIsOpen(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
document.addEventListener('pointerdown', dismiss);
|
|
30
|
+
return ()=>document.removeEventListener('pointerdown', dismiss);
|
|
31
|
+
}, [
|
|
32
|
+
isOpen
|
|
33
|
+
]);
|
|
34
|
+
react.useEffect(()=>{
|
|
35
|
+
if (isOpen) {
|
|
36
|
+
root.current?.querySelector('[role="menuitem"]:not([disabled])')?.focus();
|
|
37
|
+
}
|
|
38
|
+
}, [
|
|
39
|
+
isOpen
|
|
40
|
+
]);
|
|
41
|
+
if (!notes.isAvailable) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const items = menuItems.menuItems(labels, notes.isPicking);
|
|
45
|
+
const choose = (action)=>{
|
|
46
|
+
setIsOpen(false);
|
|
47
|
+
switch(action){
|
|
48
|
+
case 'slices':
|
|
49
|
+
return notes.giveFeedbackOnSlices(dialog);
|
|
50
|
+
case 'screen':
|
|
51
|
+
return notes.giveFeedbackOnScreen(dialog);
|
|
52
|
+
case 'component':
|
|
53
|
+
return notes.pointAtSomething(dialog);
|
|
54
|
+
default:
|
|
55
|
+
return notes.showMyFeedback();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const onMenuKeyDown = (event)=>{
|
|
59
|
+
if (event.key === 'Escape') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
setIsOpen(false);
|
|
63
|
+
root.current?.querySelector('[data-notes-toggle]')?.focus();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const elements = Array.from(event.currentTarget.querySelectorAll('[role="menuitem"]'));
|
|
67
|
+
const next = menuItems.nextMenuIndex(event.key, elements.indexOf(document.activeElement), elements.length);
|
|
68
|
+
if (next !== undefined) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
elements[next].focus();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
74
|
+
ref: root,
|
|
75
|
+
className: [
|
|
76
|
+
'notes-button',
|
|
77
|
+
className
|
|
78
|
+
].filter(Boolean).join(' '),
|
|
79
|
+
"data-size": size,
|
|
80
|
+
children: [
|
|
81
|
+
size === 'small' ? /*#__PURE__*/ jsxRuntime.jsx(Common.IconButton, {
|
|
82
|
+
variant: "ghost",
|
|
83
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.FeedbackIcon, {}),
|
|
84
|
+
"aria-label": labels.button.giveFeedback,
|
|
85
|
+
tooltip: labels.button.giveFeedback,
|
|
86
|
+
onClick: ()=>notes.giveFeedback(dialog)
|
|
87
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Common.Button, {
|
|
88
|
+
variant: "outline",
|
|
89
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.FeedbackIcon, {}),
|
|
90
|
+
label: labels.button.giveFeedback,
|
|
91
|
+
onClick: ()=>notes.giveFeedback(dialog)
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ jsxRuntime.jsx(Common.IconButton, {
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.ChevronIcon, {}),
|
|
96
|
+
"aria-label": labels.button.moreOptions,
|
|
97
|
+
"aria-haspopup": "menu",
|
|
98
|
+
"aria-expanded": isOpen,
|
|
99
|
+
"aria-controls": isOpen ? menuId : undefined,
|
|
100
|
+
"data-notes-toggle": "",
|
|
101
|
+
onClick: ()=>setIsOpen((open)=>!open)
|
|
102
|
+
}),
|
|
103
|
+
isOpen && /*#__PURE__*/ jsxRuntime.jsx("ul", {
|
|
104
|
+
id: menuId,
|
|
105
|
+
className: "notes-button__menu",
|
|
106
|
+
role: "menu",
|
|
107
|
+
"aria-label": labels.button.moreOptions,
|
|
108
|
+
onKeyDown: onMenuKeyDown,
|
|
109
|
+
children: items.map((item)=>/*#__PURE__*/ jsxRuntime.jsx("li", {
|
|
110
|
+
role: "none",
|
|
111
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
role: "menuitem",
|
|
114
|
+
className: "notes-button__item",
|
|
115
|
+
disabled: item.disabled,
|
|
116
|
+
onClick: ()=>choose(item.action),
|
|
117
|
+
children: item.label
|
|
118
|
+
})
|
|
119
|
+
}, item.action))
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
exports.NotesButton = NotesButton;
|
|
126
|
+
//# sourceMappingURL=NotesButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotesButton.js","sources":["../../../Buttons/NotesButton.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Button, IconButton } from '@cratis/components/Common';\nimport { DialogHeaderContext } from '@cratis/components/Dialogs';\nimport { KeyboardEvent, useEffect, useId, useRef, useState } from 'react';\nimport { ChevronIcon, FeedbackIcon } from '../Icons.js';\nimport { useNotesContext } from '../Provider/NotesContext.js';\nimport { menuItems, nextMenuIndex, NotesMenuAction } from './menuItems.js';\n\n/**\n * Props for {@link NotesButton}.\n */\nexport interface NotesButtonProps {\n /** `large` shows the icon and the text; `small` shows the icon, with the text as tooltip and accessible name. Defaults to `large`. */\n size?: 'large' | 'small';\n\n /** The dialog the button is in; the feedback is about the dialog and its slice when given. */\n dialog?: DialogHeaderContext;\n\n /** Additional class name for the button. */\n className?: string;\n}\n\n/**\n * The feedback button, a split button. Its main action gives feedback on what the user is looking at; its drop-down offers\n * feedback on specific slices, on this screen, on a component the user points at, and the user's own feedback. It\n * renders nothing unless the user is signed in and Notes is switched on. Place it in any top bar.\n */\nexport const NotesButton = ({ size = 'large', dialog, className }: NotesButtonProps) => {\n const notes = useNotesContext();\n const { labels } = notes;\n const [isOpen, setIsOpen] = useState(false);\n const root = useRef<HTMLSpanElement>(null);\n const menuId = useId();\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const dismiss = (event: PointerEvent) => {\n if (!root.current?.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('pointerdown', dismiss);\n return () => document.removeEventListener('pointerdown', dismiss);\n }, [isOpen]);\n\n useEffect(() => {\n if (isOpen) {\n root.current?.querySelector<HTMLElement>('[role=\"menuitem\"]:not([disabled])')?.focus();\n }\n }, [isOpen]);\n\n if (!notes.isAvailable) {\n return null;\n }\n\n const items = menuItems(labels, notes.isPicking);\n const choose = (action: NotesMenuAction) => {\n setIsOpen(false);\n switch (action) {\n case 'slices': return notes.giveFeedbackOnSlices(dialog);\n case 'screen': return notes.giveFeedbackOnScreen(dialog);\n case 'component': return notes.pointAtSomething(dialog);\n default: return notes.showMyFeedback();\n }\n };\n\n const onMenuKeyDown = (event: KeyboardEvent<HTMLUListElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n setIsOpen(false);\n root.current?.querySelector<HTMLElement>('[data-notes-toggle]')?.focus();\n return;\n }\n\n const elements = Array.from(event.currentTarget.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'));\n const next = nextMenuIndex(event.key, elements.indexOf(document.activeElement as HTMLElement), elements.length);\n if (next !== undefined) {\n event.preventDefault();\n elements[next].focus();\n }\n };\n\n return (\n <span ref={root} className={['notes-button', className].filter(Boolean).join(' ')} data-size={size}>\n {size === 'small'\n ? <IconButton variant='ghost' icon={<FeedbackIcon />} aria-label={labels.button.giveFeedback} tooltip={labels.button.giveFeedback} onClick={() => notes.giveFeedback(dialog)} />\n : <Button variant='outline' icon={<FeedbackIcon />} label={labels.button.giveFeedback} onClick={() => notes.giveFeedback(dialog)} />}\n <IconButton\n variant='ghost'\n icon={<ChevronIcon />}\n aria-label={labels.button.moreOptions}\n aria-haspopup='menu'\n aria-expanded={isOpen}\n aria-controls={isOpen ? menuId : undefined}\n data-notes-toggle=''\n onClick={() => setIsOpen(open => !open)} />\n {isOpen && (\n <ul id={menuId} className='notes-button__menu' role='menu' aria-label={labels.button.moreOptions} onKeyDown={onMenuKeyDown}>\n {items.map(item => (\n <li key={item.action} role='none'>\n <button type='button' role='menuitem' className='notes-button__item' disabled={item.disabled} onClick={() => choose(item.action)}>\n {item.label}\n </button>\n </li>\n ))}\n </ul>\n )}\n </span>\n );\n};\n"],"names":["NotesButton","size","dialog","className","notes","useNotesContext","labels","isOpen","setIsOpen","useState","root","useRef","menuId","useId","useEffect","dismiss","event","current","contains","target","document","addEventListener","removeEventListener","querySelector","focus","isAvailable","items","menuItems","isPicking","choose","action","giveFeedbackOnSlices","giveFeedbackOnScreen","pointAtSomething","showMyFeedback","onMenuKeyDown","key","preventDefault","stopPropagation","elements","Array","from","currentTarget","querySelectorAll","next","nextMenuIndex","indexOf","activeElement","length","undefined","_jsxs","span","ref","filter","Boolean","join","data-size","_jsx","IconButton","variant","icon","FeedbackIcon","aria-label","button","giveFeedback","tooltip","onClick","Button","label","ChevronIcon","moreOptions","aria-haspopup","aria-expanded","aria-controls","data-notes-toggle","open","ul","id","role","onKeyDown","map","item","li","type","disabled"],"mappings":";;;;;;;;;AA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AAQ,CAACA,IAAAA;;AACrCpE,YAAAA,MAAAA,kBACGkD,cAAA,CAACmB,IAAAA,EAAAA;gBAAGC,EAAAA,EAAIjE,MAAAA;gBAAQT,SAAAA,EAAU,oBAAA;gBAAqB2E,IAAAA,EAAK,MAAA;gBAAOhB,YAAAA,EAAYxD,MAAAA,CAAOyD,MAAM,CAACO,WAAW;gBAAES,SAAAA,EAAW5C,aAAAA;AACxGT,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMsD,GAAG,CAACC,CAAAA,IAAAA,iBACPxB,cAAA,CAACyB,IAAAA,EAAAA;wBAAqBJ,IAAAA,EAAK,MAAA;AACvB,wBAAA,QAAA,gBAAArB,cAAA,CAACM,QAAAA,EAAAA;4BAAOoB,IAAAA,EAAK,QAAA;4BAASL,IAAAA,EAAK,UAAA;4BAAW3E,SAAAA,EAAU,oBAAA;AAAqBiF,4BAAAA,QAAAA,EAAUH,KAAKG,QAAQ;4BAAElB,OAAAA,EAAS,IAAMrC,MAAAA,CAAOoD,IAAAA,CAAKnD,MAAM,CAAA;AAC1HmD,4BAAAA,QAAAA,EAAAA,IAAAA,CAAKb;;AAFLa,qBAAAA,EAAAA,IAAAA,CAAKnD,MAAM,CAAA;;;;AAU5C;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Buttons/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NotesLabels } from '../Labels/index.js';
|
|
2
|
+
export type NotesMenuAction = 'slices' | 'screen' | 'component' | 'myFeedback';
|
|
3
|
+
export interface NotesMenuItem {
|
|
4
|
+
readonly action: NotesMenuAction;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function menuItems(labels: NotesLabels, isPicking: boolean): NotesMenuItem[];
|
|
9
|
+
export declare function nextMenuIndex(key: string, current: number, count: number): number | undefined;
|
|
10
|
+
//# sourceMappingURL=menuItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuItems.d.ts","sourceRoot":"","sources":["../../../Buttons/menuItems.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKjD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAK/E,MAAM,WAAW,aAAa;IAE1B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAGjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC9B;AAQD,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,aAAa,EAAE,CAOlF;AASD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ7F"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Gets the items of the drop-down: specific slices, this screen, pointing at a component, and the user's own feedback.
|
|
7
|
+
* @param labels The labels to show.
|
|
8
|
+
* @param isPicking Whether the user is pointing at a component already.
|
|
9
|
+
* @returns The {@link NotesMenuItem}s in the order they are shown.
|
|
10
|
+
*/ function menuItems(labels, isPicking) {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
action: 'slices',
|
|
14
|
+
label: labels.button.aboutSlices,
|
|
15
|
+
disabled: false
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
action: 'screen',
|
|
19
|
+
label: labels.button.aboutScreen,
|
|
20
|
+
disabled: false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
action: 'component',
|
|
24
|
+
label: labels.button.pointAtSomething,
|
|
25
|
+
disabled: isPicking
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
action: 'myFeedback',
|
|
29
|
+
label: labels.button.myFeedback,
|
|
30
|
+
disabled: false
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets which item a key moves to in an open drop-down.
|
|
36
|
+
* @param key The key.
|
|
37
|
+
* @param current The index of the item that has focus; -1 when none has.
|
|
38
|
+
* @param count How many items there are.
|
|
39
|
+
* @returns The index to move focus to; undefined when the key does not move focus.
|
|
40
|
+
*/ function nextMenuIndex(key, current, count) {
|
|
41
|
+
switch(key){
|
|
42
|
+
case 'ArrowDown':
|
|
43
|
+
return (current + 1) % count;
|
|
44
|
+
case 'ArrowUp':
|
|
45
|
+
return current <= 0 ? count - 1 : current - 1;
|
|
46
|
+
case 'Home':
|
|
47
|
+
return 0;
|
|
48
|
+
case 'End':
|
|
49
|
+
return count - 1;
|
|
50
|
+
default:
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.menuItems = menuItems;
|
|
56
|
+
exports.nextMenuIndex = nextMenuIndex;
|
|
57
|
+
//# sourceMappingURL=menuItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuItems.js","sources":["../../../Buttons/menuItems.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { NotesLabels } from '../Labels/index.js';\n\n/**\n * What a drop-down item of the feedback button does.\n */\nexport type NotesMenuAction = 'slices' | 'screen' | 'component' | 'myFeedback';\n\n/**\n * One item of the drop-down of the feedback button.\n */\nexport interface NotesMenuItem {\n /** What the item does. */\n readonly action: NotesMenuAction;\n\n /** The text. */\n readonly label: string;\n\n /** Whether the item is switched off, such as pointing at something while the user is already pointing. */\n readonly disabled: boolean;\n}\n\n/**\n * Gets the items of the drop-down: specific slices, this screen, pointing at a component, and the user's own feedback.\n * @param labels The labels to show.\n * @param isPicking Whether the user is pointing at a component already.\n * @returns The {@link NotesMenuItem}s in the order they are shown.\n */\nexport function menuItems(labels: NotesLabels, isPicking: boolean): NotesMenuItem[] {\n return [\n { action: 'slices', label: labels.button.aboutSlices, disabled: false },\n { action: 'screen', label: labels.button.aboutScreen, disabled: false },\n { action: 'component', label: labels.button.pointAtSomething, disabled: isPicking },\n { action: 'myFeedback', label: labels.button.myFeedback, disabled: false }\n ];\n}\n\n/**\n * Gets which item a key moves to in an open drop-down.\n * @param key The key.\n * @param current The index of the item that has focus; -1 when none has.\n * @param count How many items there are.\n * @returns The index to move focus to; undefined when the key does not move focus.\n */\nexport function nextMenuIndex(key: string, current: number, count: number): number | undefined {\n switch (key) {\n case 'ArrowDown': return (current + 1) % count;\n case 'ArrowUp': return current <= 0 ? count - 1 : current - 1;\n case 'Home': return 0;\n case 'End': return count - 1;\n default: return undefined;\n }\n}\n"],"names":["menuItems","labels","isPicking","action","label","button","aboutSlices","disabled","aboutScreen","pointAtSomething","myFeedback","nextMenuIndex","key","current","count","undefined"],"mappings":";;AAAA;AACA;AAuBA;;;;;AAKC,IACM,SAASA,SAAAA,CAAUC,MAAmB,EAAEC,SAAkB,EAAA;IAC7D,OAAO;AACH,QAAA;YAAEC,MAAAA,EAAQ,QAAA;YAAUC,KAAAA,EAAOH,MAAAA,CAAOI,MAAM,CAACC,WAAW;YAAEC,QAAAA,EAAU;AAAM,SAAA;AACtE,QAAA;YAAEJ,MAAAA,EAAQ,QAAA;YAAUC,KAAAA,EAAOH,MAAAA,CAAOI,MAAM,CAACG,WAAW;YAAED,QAAAA,EAAU;AAAM,SAAA;AACtE,QAAA;YAAEJ,MAAAA,EAAQ,WAAA;YAAaC,KAAAA,EAAOH,MAAAA,CAAOI,MAAM,CAACI,gBAAgB;YAAEF,QAAAA,EAAUL;AAAU,SAAA;AAClF,QAAA;YAAEC,MAAAA,EAAQ,YAAA;YAAcC,KAAAA,EAAOH,MAAAA,CAAOI,MAAM,CAACK,UAAU;YAAEH,QAAAA,EAAU;AAAM;AAC5E,KAAA;AACL;AAEA;;;;;;AAMC,IACM,SAASI,aAAAA,CAAcC,GAAW,EAAEC,OAAe,EAAEC,KAAa,EAAA;IACrE,OAAQF,GAAAA;QACJ,KAAK,WAAA;AAAa,YAAA,OAAO,CAACC,OAAAA,GAAU,CAAA,IAAKC,KAAAA;QACzC,KAAK,SAAA;AAAW,YAAA,OAAOD,OAAAA,IAAW,CAAA,GAAIC,KAAAA,GAAQ,CAAA,GAAID,OAAAA,GAAU,CAAA;QAC5D,KAAK,MAAA;YAAQ,OAAO,CAAA;QACpB,KAAK,KAAA;AAAO,YAAA,OAAOC,KAAAA,GAAQ,CAAA;AAC3B,QAAA;YAAS,OAAOC,SAAAA;AACpB;AACJ;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DialogHeaderActionsRenderer, DialogHeaderContext } from '@cratis/components/Dialogs';
|
|
2
|
+
export declare function showsFeedbackButton(dialog: DialogHeaderContext, enabled: boolean): boolean;
|
|
3
|
+
export declare const notesDialogHeaderActions: DialogHeaderActionsRenderer;
|
|
4
|
+
//# sourceMappingURL=notesDialogHeaderActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notesDialogHeaderActions.d.ts","sourceRoot":"","sources":["../../../Buttons/notesDialogHeaderActions.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAW9F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAG1F;AAeD,eAAO,MAAM,wBAAwB,EAAE,2BAAmF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var NotesContext = require('../Provider/NotesContext.js');
|
|
5
|
+
var NotesButton = require('./NotesButton.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* Decides whether a dialog gets the feedback button in its header: only a dialog that has a slice location, and only when
|
|
11
|
+
* `<NotesProvider enabled>` turned it on.
|
|
12
|
+
* @param dialog The dialog.
|
|
13
|
+
* @param enabled Whether the provider turned the header button on.
|
|
14
|
+
* @returns True when the dialog shows the button.
|
|
15
|
+
*/ function showsFeedbackButton(dialog, enabled) {
|
|
16
|
+
const location = dialog.sliceLocation;
|
|
17
|
+
return enabled && location !== undefined && (!!location.module || !!location.feature || !!location.slice);
|
|
18
|
+
}
|
|
19
|
+
const NotesDialogHeaderButton = ({ dialog })=>{
|
|
20
|
+
const { showsInDialogHeaders } = NotesContext.useNotesContext();
|
|
21
|
+
return showsFeedbackButton(dialog, showsInDialogHeaders) ? /*#__PURE__*/ jsxRuntime.jsx(NotesButton.NotesButton, {
|
|
22
|
+
size: "small",
|
|
23
|
+
dialog: dialog
|
|
24
|
+
}) : null;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The renderer to pass to `CratisComponentsProvider` as `dialogHeaderActions`: it puts the feedback button in the header of
|
|
28
|
+
* every dialog that belongs to a slice. The context it captures is the dialog's location.
|
|
29
|
+
* @param dialog What the dialog tells about itself.
|
|
30
|
+
* @returns The button, or nothing for a dialog without a slice.
|
|
31
|
+
*/ const notesDialogHeaderActions = (dialog)=>/*#__PURE__*/ jsxRuntime.jsx(NotesDialogHeaderButton, {
|
|
32
|
+
dialog: dialog
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
exports.notesDialogHeaderActions = notesDialogHeaderActions;
|
|
36
|
+
exports.showsFeedbackButton = showsFeedbackButton;
|
|
37
|
+
//# sourceMappingURL=notesDialogHeaderActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notesDialogHeaderActions.js","sources":["../../../Buttons/notesDialogHeaderActions.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogHeaderActionsRenderer, DialogHeaderContext } from '@cratis/components/Dialogs';\nimport { useNotesContext } from '../Provider/NotesContext.js';\nimport { NotesButton } from './NotesButton.js';\n\n/**\n * Decides whether a dialog gets the feedback button in its header: only a dialog that has a slice location, and only when\n * `<NotesProvider enabled>` turned it on.\n * @param dialog The dialog.\n * @param enabled Whether the provider turned the header button on.\n * @returns True when the dialog shows the button.\n */\nexport function showsFeedbackButton(dialog: DialogHeaderContext, enabled: boolean): boolean {\n const location = dialog.sliceLocation;\n return enabled && location !== undefined && (!!location.module || !!location.feature || !!location.slice);\n}\n\nconst NotesDialogHeaderButton = ({ dialog }: { dialog: DialogHeaderContext }) => {\n const { showsInDialogHeaders } = useNotesContext();\n return showsFeedbackButton(dialog, showsInDialogHeaders)\n ? <NotesButton size='small' dialog={dialog} />\n : null;\n};\n\n/**\n * The renderer to pass to `CratisComponentsProvider` as `dialogHeaderActions`: it puts the feedback button in the header of\n * every dialog that belongs to a slice. The context it captures is the dialog's location.\n * @param dialog What the dialog tells about itself.\n * @returns The button, or nothing for a dialog without a slice.\n */\nexport const notesDialogHeaderActions: DialogHeaderActionsRenderer = dialog => <NotesDialogHeaderButton dialog={dialog} />;\n"],"names":["showsFeedbackButton","dialog","enabled","location","sliceLocation","undefined","module","feature","slice","NotesDialogHeaderButton","showsInDialogHeaders","useNotesContext","_jsx","NotesButton","size","notesDialogHeaderActions"],"mappings":";;;;;;AAAA;AACA;AAMA;;;;;;AAMC,IACM,SAASA,mBAAAA,CAAoBC,MAA2B,EAAEC,OAAgB,EAAA;IAC7E,MAAMC,QAAAA,GAAWF,OAAOG,aAAa;AACrC,IAAA,OAAOF,WAAWC,QAAAA,KAAaE,SAAAA,KAAc,CAAC,CAACF,SAASG,MAAM,IAAI,CAAC,CAACH,SAASI,OAAO,IAAI,CAAC,CAACJ,QAAAA,CAASK,KAAK,CAAD;AAC3G;AAEA,MAAMC,uBAAAA,GAA0B,CAAC,EAAER,MAAM,EAAmC,GAAA;IACxE,MAAM,EAAES,oBAAoB,EAAE,GAAGC,4BAAAA,EAAAA;IACjC,OAAOX,mBAAAA,CAAoBC,MAAAA,EAAQS,oBAAAA,CAAAA,iBAC7BE,cAAA,CAACC,uBAAAA,EAAAA;QAAYC,IAAAA,EAAK,OAAA;QAAQb,MAAAA,EAAQA;AAClC,KAAA,CAAA,GAAA,IAAA;AACV,CAAA;AAEA;;;;;AAKC,IACM,MAAMc,wBAAAA,GAAwDd,CAAAA,uBAAUW,cAAA,CAACH,uBAAAA,EAAAA;QAAwBR,MAAAA,EAAQA;AAAW,KAAA;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PickedComponent as PickedByUser } from '@cratis/components/ComponentPicker';
|
|
2
|
+
import { PickedComponent } from '@cratis/showrunner.notes';
|
|
3
|
+
import { LocationParts } from './formatLocation.js';
|
|
4
|
+
export declare const sliceContextKey = "slice";
|
|
5
|
+
export declare function sliceMarkedOn(element: Element): LocationParts | undefined;
|
|
6
|
+
export declare function resolveComponentContext(element: Element): Record<string, unknown> | undefined;
|
|
7
|
+
export declare function toNotePickedComponent(picked: PickedByUser, focused: LocationParts): PickedComponent;
|
|
8
|
+
//# sourceMappingURL=componentContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentContext.d.ts","sourceRoot":"","sources":["../../../Context/componentContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,eAAO,MAAM,eAAe,UAAU,CAAC;AAOvC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAWzE;AAOD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAG7F;AAQD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,eAAe,CASnG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var showrunner_notes = require('@cratis/showrunner.notes');
|
|
4
|
+
var noteContext = require('./noteContext.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* The key of what the picker's resolver adds to a picked component: the slice its element belongs to.
|
|
10
|
+
*/ const sliceContextKey = 'slice';
|
|
11
|
+
/**
|
|
12
|
+
* Reads the slice location Arc marks an element with, when `<Arc sliceMarkers>` is on.
|
|
13
|
+
* @param element The element.
|
|
14
|
+
* @returns The location of the closest slice marker; undefined when there is none.
|
|
15
|
+
*/ function sliceMarkedOn(element) {
|
|
16
|
+
const marker = element.closest('[data-cratis-module]');
|
|
17
|
+
if (!marker) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
module: marker.getAttribute('data-cratis-module') ?? '',
|
|
22
|
+
feature: marker.getAttribute('data-cratis-feature') ?? '',
|
|
23
|
+
slice: marker.getAttribute('data-cratis-slice') ?? ''
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The picker's `resolve`: tells the slice of a picked component from the closest Arc slice marker.
|
|
28
|
+
* @param element The root element of the picked component.
|
|
29
|
+
* @returns The context to add to the picked component; undefined when the element is in no marked slice.
|
|
30
|
+
*/ function resolveComponentContext(element) {
|
|
31
|
+
const slice = sliceMarkedOn(element);
|
|
32
|
+
return slice ? {
|
|
33
|
+
[sliceContextKey]: slice
|
|
34
|
+
} : undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Makes the component a note carries from what the picker found.
|
|
38
|
+
* @param picked What the picker found.
|
|
39
|
+
* @param focused The focused location, used when the component's slice is not known.
|
|
40
|
+
* @returns The {@link PickedComponent}.
|
|
41
|
+
*/ function toNotePickedComponent(picked, focused) {
|
|
42
|
+
const slice = picked.context[sliceContextKey];
|
|
43
|
+
return Object.assign(new showrunner_notes.PickedComponent(), {
|
|
44
|
+
componentName: picked.component,
|
|
45
|
+
componentId: picked.id ?? '',
|
|
46
|
+
part: picked.part ?? '',
|
|
47
|
+
ancestors: picked.ancestors.map((ancestor)=>ancestor.component),
|
|
48
|
+
location: noteContext.toSliceLocation(slice ?? focused)
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
exports.resolveComponentContext = resolveComponentContext;
|
|
53
|
+
exports.sliceContextKey = sliceContextKey;
|
|
54
|
+
exports.sliceMarkedOn = sliceMarkedOn;
|
|
55
|
+
exports.toNotePickedComponent = toNotePickedComponent;
|
|
56
|
+
//# sourceMappingURL=componentContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentContext.js","sources":["../../../Context/componentContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PickedComponent as PickedByUser } from '@cratis/components/ComponentPicker';\nimport { PickedComponent } from '@cratis/showrunner.notes';\nimport { LocationParts } from './formatLocation.js';\nimport { toSliceLocation } from './noteContext.js';\n\n/**\n * The key of what the picker's resolver adds to a picked component: the slice its element belongs to.\n */\nexport const sliceContextKey = 'slice';\n\n/**\n * Reads the slice location Arc marks an element with, when `<Arc sliceMarkers>` is on.\n * @param element The element.\n * @returns The location of the closest slice marker; undefined when there is none.\n */\nexport function sliceMarkedOn(element: Element): LocationParts | undefined {\n const marker = element.closest('[data-cratis-module]');\n if (!marker) {\n return undefined;\n }\n\n return {\n module: marker.getAttribute('data-cratis-module') ?? '',\n feature: marker.getAttribute('data-cratis-feature') ?? '',\n slice: marker.getAttribute('data-cratis-slice') ?? ''\n };\n}\n\n/**\n * The picker's `resolve`: tells the slice of a picked component from the closest Arc slice marker.\n * @param element The root element of the picked component.\n * @returns The context to add to the picked component; undefined when the element is in no marked slice.\n */\nexport function resolveComponentContext(element: Element): Record<string, unknown> | undefined {\n const slice = sliceMarkedOn(element);\n return slice ? { [sliceContextKey]: slice } : undefined;\n}\n\n/**\n * Makes the component a note carries from what the picker found.\n * @param picked What the picker found.\n * @param focused The focused location, used when the component's slice is not known.\n * @returns The {@link PickedComponent}.\n */\nexport function toNotePickedComponent(picked: PickedByUser, focused: LocationParts): PickedComponent {\n const slice = picked.context[sliceContextKey] as LocationParts | undefined;\n return Object.assign(new PickedComponent(), {\n componentName: picked.component,\n componentId: picked.id ?? '',\n part: picked.part ?? '',\n ancestors: picked.ancestors.map(ancestor => ancestor.component),\n location: toSliceLocation(slice ?? focused)\n });\n}\n"],"names":["sliceContextKey","sliceMarkedOn","element","marker","closest","undefined","module","getAttribute","feature","slice","resolveComponentContext","toNotePickedComponent","picked","focused","context","Object","assign","PickedComponent","componentName","component","componentId","id","part","ancestors","map","ancestor","location","toSliceLocation"],"mappings":";;;;;AAAA;AACA;AAOA;;IAGO,MAAMA,eAAAA,GAAkB;AAE/B;;;;IAKO,SAASC,aAAAA,CAAcC,OAAgB,EAAA;IAC1C,MAAMC,MAAAA,GAASD,OAAAA,CAAQE,OAAO,CAAC,sBAAA,CAAA;AAC/B,IAAA,IAAI,CAACD,MAAAA,EAAQ;QACT,OAAOE,SAAAA;AACX,IAAA;IAEA,OAAO;QACHC,MAAAA,EAAQH,MAAAA,CAAOI,YAAY,CAAC,oBAAA,CAAA,IAAyB,EAAA;QACrDC,OAAAA,EAASL,MAAAA,CAAOI,YAAY,CAAC,qBAAA,CAAA,IAA0B,EAAA;QACvDE,KAAAA,EAAON,MAAAA,CAAOI,YAAY,CAAC,mBAAA,CAAA,IAAwB;AACvD,KAAA;AACJ;AAEA;;;;IAKO,SAASG,uBAAAA,CAAwBR,OAAgB,EAAA;AACpD,IAAA,MAAMO,QAAQR,aAAAA,CAAcC,OAAAA,CAAAA;AAC5B,IAAA,OAAOO,KAAAA,GAAQ;AAAE,QAAA,CAACT,kBAAkBS;KAAM,GAAIJ,SAAAA;AAClD;AAEA;;;;;AAKC,IACM,SAASM,qBAAAA,CAAsBC,MAAoB,EAAEC,OAAsB,EAAA;AAC9E,IAAA,MAAMJ,KAAAA,GAAQG,MAAAA,CAAOE,OAAO,CAACd,eAAAA,CAAgB;AAC7C,IAAA,OAAOe,MAAAA,CAAOC,MAAM,CAAC,IAAIC,gCAAAA,EAAAA,EAAmB;AACxCC,QAAAA,aAAAA,EAAeN,OAAOO,SAAS;QAC/BC,WAAAA,EAAaR,MAAAA,CAAOS,EAAE,IAAI,EAAA;QAC1BC,IAAAA,EAAMV,MAAAA,CAAOU,IAAI,IAAI,EAAA;QACrBC,SAAAA,EAAWX,MAAAA,CAAOW,SAAS,CAACC,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAASN,SAAS,CAAA;AAC9DO,QAAAA,QAAAA,EAAUC,4BAAgBlB,KAAAA,IAASI,OAAAA;AACvC,KAAA,CAAA;AACJ;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface LocationParts {
|
|
2
|
+
readonly module: string;
|
|
3
|
+
readonly feature: string;
|
|
4
|
+
readonly slice: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function formatLocation(location: LocationParts | undefined, separator: string, unknown: string): string;
|
|
7
|
+
//# sourceMappingURL=formatLocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatLocation.d.ts","sourceRoot":"","sources":["../../../Context/formatLocation.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,aAAa;IAE1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AASD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAI9G"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* The parts of where in the application something is.
|
|
7
|
+
*/ /**
|
|
8
|
+
* Formats a location for people, such as `Orders › Editing › Change order`.
|
|
9
|
+
* @param location The location; parts that are empty are left out.
|
|
10
|
+
* @param separator What separates the parts.
|
|
11
|
+
* @param unknown What to show when no part is known.
|
|
12
|
+
* @returns The formatted location.
|
|
13
|
+
*/ function formatLocation(location, separator, unknown) {
|
|
14
|
+
const parts = [
|
|
15
|
+
location?.module,
|
|
16
|
+
location?.feature,
|
|
17
|
+
location?.slice
|
|
18
|
+
].filter((part)=>typeof part === 'string' && part.length > 0);
|
|
19
|
+
return parts.length > 0 ? parts.join(separator) : unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.formatLocation = formatLocation;
|
|
23
|
+
//# sourceMappingURL=formatLocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatLocation.js","sources":["../../../Context/formatLocation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The parts of where in the application something is.\n */\nexport interface LocationParts {\n /** The module. */\n readonly module: string;\n /** The feature within the module. */\n readonly feature: string;\n /** The slice within the feature. */\n readonly slice: string;\n}\n\n/**\n * Formats a location for people, such as `Orders › Editing › Change order`.\n * @param location The location; parts that are empty are left out.\n * @param separator What separates the parts.\n * @param unknown What to show when no part is known.\n * @returns The formatted location.\n */\nexport function formatLocation(location: LocationParts | undefined, separator: string, unknown: string): string {\n const parts = [location?.module, location?.feature, location?.slice]\n .filter((part): part is string => typeof part === 'string' && part.length > 0);\n return parts.length > 0 ? parts.join(separator) : unknown;\n}\n"],"names":["formatLocation","location","separator","unknown","parts","module","feature","slice","filter","part","length","join"],"mappings":";;AAAA;AACA;AAEA;;;;;;;;AAkBC,IACM,SAASA,cAAAA,CAAeC,QAAmC,EAAEC,SAAiB,EAAEC,OAAe,EAAA;AAClG,IAAA,MAAMC,KAAAA,GAAQ;QAACH,QAAAA,EAAUI,MAAAA;QAAQJ,QAAAA,EAAUK,OAAAA;QAASL,QAAAA,EAAUM;KAAM,CAC/DC,MAAM,CAAC,CAACC,IAAAA,GAAyB,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,MAAM,GAAG,CAAA,CAAA;AAChF,IAAA,OAAON,MAAMM,MAAM,GAAG,IAAIN,KAAAA,CAAMO,IAAI,CAACT,SAAAA,CAAAA,GAAaC,OAAAA;AACtD;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Context/index.ts"],"names":[],"mappings":"AAGA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ApplicationContextSnapshot } from '@cratis/arc.react';
|
|
2
|
+
import { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import { NoteContext, SliceLocation } from '@cratis/showrunner.notes';
|
|
4
|
+
import { NotesLabels } from '../Labels/index.js';
|
|
5
|
+
import { LocationParts } from './formatLocation.js';
|
|
6
|
+
export declare const modelReferencesKey = "modelReferences";
|
|
7
|
+
export interface DialogReference {
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly location: LocationParts;
|
|
10
|
+
}
|
|
11
|
+
export interface NoteContextInput {
|
|
12
|
+
readonly snapshot: ApplicationContextSnapshot;
|
|
13
|
+
readonly route: string;
|
|
14
|
+
readonly correlationId: Guid;
|
|
15
|
+
readonly dialog?: DialogReference;
|
|
16
|
+
}
|
|
17
|
+
export declare function toSliceLocation(parts?: LocationParts): SliceLocation;
|
|
18
|
+
export declare function modelReferencesOf(contributions: Readonly<Record<string, unknown>>): Record<string, string>;
|
|
19
|
+
export declare function buildNoteContext(input: NoteContextInput): NoteContext;
|
|
20
|
+
export declare function describeContext(context: NoteContext, labels: NotesLabels): string;
|
|
21
|
+
export declare function describeScreen(context: NoteContext, labels: NotesLabels): string;
|
|
22
|
+
//# sourceMappingURL=noteContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noteContext.d.ts","sourceRoot":"","sources":["../../../Context/noteContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAA0B,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAU,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAkB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKpE,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAKpD,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CACpC;AAKD,MAAM,WAAW,gBAAgB;IAE7B,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAG9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC;IAG7B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CACrC;AAOD,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,aAAa,CAMpE;AAOD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS1G;AAOD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAoBrE;AAaD,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAcjF;AAQD,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAGhF"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var showrunner_notes = require('@cratis/showrunner.notes');
|
|
4
|
+
var format = require('../Labels/format.js');
|
|
5
|
+
var formatLocation = require('./formatLocation.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* The key of the Arc application context contributions that holds the identifiers of model elements.
|
|
11
|
+
*/ const modelReferencesKey = 'modelReferences';
|
|
12
|
+
/**
|
|
13
|
+
* Makes a location of the contract from the parts of one.
|
|
14
|
+
* @param parts The parts; an absent part is empty.
|
|
15
|
+
* @returns The {@link SliceLocation}.
|
|
16
|
+
*/ function toSliceLocation(parts) {
|
|
17
|
+
return Object.assign(new showrunner_notes.SliceLocation(), {
|
|
18
|
+
module: parts?.module ?? '',
|
|
19
|
+
feature: parts?.feature ?? '',
|
|
20
|
+
slice: parts?.slice ?? ''
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reads the identifiers of model elements the host contributed to the Arc application context.
|
|
25
|
+
* @param contributions The contributions of the application context.
|
|
26
|
+
* @returns The identifiers by what they identify; empty when the host contributed none.
|
|
27
|
+
*/ function modelReferencesOf(contributions) {
|
|
28
|
+
const value = contributions[modelReferencesKey];
|
|
29
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
return Object.fromEntries(Object.entries(value).filter(([, reference])=>reference !== undefined && reference !== null).map(([key, reference])=>[
|
|
33
|
+
key,
|
|
34
|
+
String(reference)
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Builds the context every Notes command carries from what the user is looking at.
|
|
39
|
+
* @param input The {@link NoteContextInput}.
|
|
40
|
+
* @returns The {@link NoteContext}; when a dialog is the subject its location is the focused location.
|
|
41
|
+
*/ function buildNoteContext(input) {
|
|
42
|
+
const { snapshot } = input;
|
|
43
|
+
const dialog = input.dialog ?? openDialogOf(snapshot);
|
|
44
|
+
return Object.assign(new showrunner_notes.NoteContext(), {
|
|
45
|
+
location: toSliceLocation(dialog?.location ?? snapshot.location),
|
|
46
|
+
activeSlices: snapshot.activeSlices.map(toSliceLocation),
|
|
47
|
+
screen: Object.assign(new showrunner_notes.NoteScreen(), {
|
|
48
|
+
screenId: snapshot.screen.id,
|
|
49
|
+
screenName: snapshot.screen.name,
|
|
50
|
+
screenPath: snapshot.screen.path
|
|
51
|
+
}),
|
|
52
|
+
route: input.route,
|
|
53
|
+
dialog: Object.assign(new showrunner_notes.NoteDialog(), {
|
|
54
|
+
dialogTitle: dialog?.title ?? '',
|
|
55
|
+
location: toSliceLocation(dialog?.location)
|
|
56
|
+
}),
|
|
57
|
+
modelReferences: modelReferencesOf(snapshot.contributions),
|
|
58
|
+
correlationId: input.correlationId
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function openDialogOf(snapshot) {
|
|
62
|
+
const dialog = snapshot.dialogs.at(-1);
|
|
63
|
+
return dialog ? {
|
|
64
|
+
title: dialog.title ?? '',
|
|
65
|
+
location: dialog.location
|
|
66
|
+
} : undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Says in plain language what a note context is about, such as `Orders › Editing › Change order, on screen Order details`.
|
|
70
|
+
* @param context The context.
|
|
71
|
+
* @param labels The labels to show.
|
|
72
|
+
* @returns The sentence.
|
|
73
|
+
*/ function describeContext(context, labels) {
|
|
74
|
+
const location = formatLocation.formatLocation(context.location, labels.common.locationSeparator, labels.common.unknownLocation);
|
|
75
|
+
const screen = context.screen.screenName || context.screen.screenPath;
|
|
76
|
+
const dialog = context.dialog.dialogTitle;
|
|
77
|
+
if (dialog) {
|
|
78
|
+
return format.format(labels.context.inDialog, {
|
|
79
|
+
location,
|
|
80
|
+
dialog,
|
|
81
|
+
screen: screen || labels.common.unknownLocation
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (screen && !isEmpty(context.location)) {
|
|
85
|
+
return format.format(labels.context.onScreen, {
|
|
86
|
+
location,
|
|
87
|
+
screen
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return screen ? format.format(labels.context.screenOnly, {
|
|
91
|
+
screen
|
|
92
|
+
}) : format.format(labels.context.atLocation, {
|
|
93
|
+
location
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Says in plain language where a screen note is given.
|
|
98
|
+
* @param context The context.
|
|
99
|
+
* @param labels The labels to show.
|
|
100
|
+
* @returns The sentence.
|
|
101
|
+
*/ function describeScreen(context, labels) {
|
|
102
|
+
const screen = context.screen.screenName || context.screen.screenPath;
|
|
103
|
+
return format.format(labels.context.screenOnly, {
|
|
104
|
+
screen: screen || labels.common.unknownLocation
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function isEmpty(location) {
|
|
108
|
+
return !location.module && !location.feature && !location.slice;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
exports.buildNoteContext = buildNoteContext;
|
|
112
|
+
exports.describeContext = describeContext;
|
|
113
|
+
exports.describeScreen = describeScreen;
|
|
114
|
+
exports.modelReferencesKey = modelReferencesKey;
|
|
115
|
+
exports.modelReferencesOf = modelReferencesOf;
|
|
116
|
+
exports.toSliceLocation = toSliceLocation;
|
|
117
|
+
//# sourceMappingURL=noteContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noteContext.js","sources":["../../../Context/noteContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ApplicationContextSnapshot } from '@cratis/arc.react';\nimport { Guid } from '@cratis/fundamentals';\nimport { NoteContext, NoteDialog, NoteScreen, SliceLocation } from '@cratis/showrunner.notes';\nimport { format, NotesLabels } from '../Labels/index.js';\nimport { formatLocation, LocationParts } from './formatLocation.js';\n\n/**\n * The key of the Arc application context contributions that holds the identifiers of model elements.\n */\nexport const modelReferencesKey = 'modelReferences';\n\n/**\n * The dialog a note is given from.\n */\nexport interface DialogReference {\n /** The title of the dialog. */\n readonly title: string;\n\n /** Where the dialog belongs. */\n readonly location: LocationParts;\n}\n\n/**\n * What {@link buildNoteContext} reads besides the application context.\n */\nexport interface NoteContextInput {\n /** What the user is looking at, from Arc's `useApplicationContext()`. */\n readonly snapshot: ApplicationContextSnapshot;\n\n /** The route of the browser. */\n readonly route: string;\n\n /** The correlation id to send. */\n readonly correlationId: Guid;\n\n /** The dialog the note is given from; the topmost open dialog of the snapshot when not given. */\n readonly dialog?: DialogReference;\n}\n\n/**\n * Makes a location of the contract from the parts of one.\n * @param parts The parts; an absent part is empty.\n * @returns The {@link SliceLocation}.\n */\nexport function toSliceLocation(parts?: LocationParts): SliceLocation {\n return Object.assign(new SliceLocation(), {\n module: parts?.module ?? '',\n feature: parts?.feature ?? '',\n slice: parts?.slice ?? ''\n });\n}\n\n/**\n * Reads the identifiers of model elements the host contributed to the Arc application context.\n * @param contributions The contributions of the application context.\n * @returns The identifiers by what they identify; empty when the host contributed none.\n */\nexport function modelReferencesOf(contributions: Readonly<Record<string, unknown>>): Record<string, string> {\n const value = contributions[modelReferencesKey];\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return {};\n }\n\n return Object.fromEntries(Object.entries(value)\n .filter(([, reference]) => reference !== undefined && reference !== null)\n .map(([key, reference]) => [key, String(reference)]));\n}\n\n/**\n * Builds the context every Notes command carries from what the user is looking at.\n * @param input The {@link NoteContextInput}.\n * @returns The {@link NoteContext}; when a dialog is the subject its location is the focused location.\n */\nexport function buildNoteContext(input: NoteContextInput): NoteContext {\n const { snapshot } = input;\n const dialog = input.dialog ?? openDialogOf(snapshot);\n\n return Object.assign(new NoteContext(), {\n location: toSliceLocation(dialog?.location ?? snapshot.location),\n activeSlices: snapshot.activeSlices.map(toSliceLocation),\n screen: Object.assign(new NoteScreen(), {\n screenId: snapshot.screen.id,\n screenName: snapshot.screen.name,\n screenPath: snapshot.screen.path\n }),\n route: input.route,\n dialog: Object.assign(new NoteDialog(), {\n dialogTitle: dialog?.title ?? '',\n location: toSliceLocation(dialog?.location)\n }),\n modelReferences: modelReferencesOf(snapshot.contributions),\n correlationId: input.correlationId\n });\n}\n\nfunction openDialogOf(snapshot: ApplicationContextSnapshot): DialogReference | undefined {\n const dialog = snapshot.dialogs.at(-1);\n return dialog ? { title: dialog.title ?? '', location: dialog.location } : undefined;\n}\n\n/**\n * Says in plain language what a note context is about, such as `Orders › Editing › Change order, on screen Order details`.\n * @param context The context.\n * @param labels The labels to show.\n * @returns The sentence.\n */\nexport function describeContext(context: NoteContext, labels: NotesLabels): string {\n const location = formatLocation(context.location, labels.common.locationSeparator, labels.common.unknownLocation);\n const screen = context.screen.screenName || context.screen.screenPath;\n const dialog = context.dialog.dialogTitle;\n\n if (dialog) {\n return format(labels.context.inDialog, { location, dialog, screen: screen || labels.common.unknownLocation });\n }\n\n if (screen && !isEmpty(context.location)) {\n return format(labels.context.onScreen, { location, screen });\n }\n\n return screen ? format(labels.context.screenOnly, { screen }) : format(labels.context.atLocation, { location });\n}\n\n/**\n * Says in plain language where a screen note is given.\n * @param context The context.\n * @param labels The labels to show.\n * @returns The sentence.\n */\nexport function describeScreen(context: NoteContext, labels: NotesLabels): string {\n const screen = context.screen.screenName || context.screen.screenPath;\n return format(labels.context.screenOnly, { screen: screen || labels.common.unknownLocation });\n}\n\nfunction isEmpty(location: LocationParts): boolean {\n return !location.module && !location.feature && !location.slice;\n}\n"],"names":["modelReferencesKey","toSliceLocation","parts","Object","assign","SliceLocation","module","feature","slice","modelReferencesOf","contributions","value","Array","isArray","fromEntries","entries","filter","reference","undefined","map","key","String","buildNoteContext","input","snapshot","dialog","openDialogOf","NoteContext","location","activeSlices","screen","NoteScreen","screenId","id","screenName","name","screenPath","path","route","NoteDialog","dialogTitle","title","modelReferences","correlationId","dialogs","at","describeContext","context","labels","formatLocation","common","locationSeparator","unknownLocation","format","inDialog","isEmpty","onScreen","screenOnly","atLocation","describeScreen"],"mappings":";;;;;;AAAA;AACA;AAQA;;IAGO,MAAMA,kBAAAA,GAAqB;AA8BlC;;;;IAKO,SAASC,eAAAA,CAAgBC,KAAqB,EAAA;AACjD,IAAA,OAAOC,MAAAA,CAAOC,MAAM,CAAC,IAAIC,8BAAAA,EAAAA,EAAiB;AACtCC,QAAAA,MAAAA,EAAQJ,OAAOI,MAAAA,IAAU,EAAA;AACzBC,QAAAA,OAAAA,EAASL,OAAOK,OAAAA,IAAW,EAAA;AAC3BC,QAAAA,KAAAA,EAAON,OAAOM,KAAAA,IAAS;AAC3B,KAAA,CAAA;AACJ;AAEA;;;;IAKO,SAASC,iBAAAA,CAAkBC,aAAgD,EAAA;IAC9E,MAAMC,KAAAA,GAAQD,aAAa,CAACV,kBAAAA,CAAmB;IAC/C,IAAI,OAAOW,UA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IAAA;AAEA,IAAA,IAAItB,MAAAA,IAAU,CAACyB,OAAAA,CAAQR,OAAAA,CAAQnB,QAAQ,CAAA,EAAG;AACtC,QAAA,OAAOyB,aAAAA,CAAOL,MAAAA,CAAOD,OAAO,CAACS,QAAQ,EAAE;AAAE5B,YAAAA,QAAAA;AAAUE,YAAAA;AAAO,SAAA,CAAA;AAC9D,IAAA;AAEA,IAAA,OAAOA,SAASuB,aAAAA,CAAOL,MAAAA,CAAOD,OAAO,CAACU,UAAU,EAAE;AAAE3B,QAAAA;AAAO,KAAA,CAAA,GAAKuB,aAAAA,CAAOL,MAAAA,CAAOD,OAAO,CAACW,UAAU,EAAE;AAAE9B,QAAAA;AAAS,KAAA,CAAA;AACjH;AAEA;;;;;AAKC,IACM,SAAS+B,cAAAA,CAAeZ,OAAoB,EAAEC,MAAmB,EAAA;IACpE,MAAMlB,MAAAA,GAASiB,QAAQjB,MAAM,CAACI,UAAU,IAAIa,OAAAA,CAAQjB,MAAM,CAACM,UAAU;AACrE,IAAA,OAAOiB,aAAAA,CAAOL,MAAAA,CAAOD,OAAO,CAACU,UAAU,EAAE;AAAE3B,QAAAA,MAAAA,EAAQA,MAAAA,IAAUkB,MAAAA,CAAOE,MAAM,CAACE;AAAgB,KAAA,CAAA;AAC/F;AAEA,SAASG,QAAQ3B,QAAuB,EAAA;IACpC,OAAO,CAACA,QAAAA,CAAStB,MAAM,IAAI,CAACsB,SAASrB,OAAO,IAAI,CAACqB,QAAAA,CAASpB,KAAK;AACnE;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PickedComponent as PickedByUser } from '@cratis/components/ComponentPicker';
|
|
2
|
+
import { NoteContext } from '@cratis/showrunner.notes';
|
|
3
|
+
import { ComponentFeedbackMode } from './ComponentModeSwitch.js';
|
|
4
|
+
export interface ComponentFeedbackDialogProps {
|
|
5
|
+
context: NoteContext;
|
|
6
|
+
picked: PickedByUser;
|
|
7
|
+
initialMode?: ComponentFeedbackMode;
|
|
8
|
+
}
|
|
9
|
+
export declare const ComponentFeedbackDialog: ({ context, picked, initialMode }: ComponentFeedbackDialogProps) => import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=ComponentFeedbackDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentFeedbackDialog.d.ts","sourceRoot":"","sources":["../../../Feedback/ComponentFeedbackDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAsB,eAAe,IAAI,YAAY,EAAkD,MAAM,oCAAoC,CAAC;AAGzJ,OAAO,EAAuB,WAAW,EAAkC,MAAM,0BAA0B,CAAC;AAK5G,OAAO,EAAE,qBAAqB,EAAuB,MAAM,0BAA0B,CAAC;AAUtF,MAAM,WAAW,4BAA4B;IAEzC,OAAO,EAAE,WAAW,CAAC;IAGrB,MAAM,EAAE,YAAY,CAAC;IAGrB,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAOD,eAAO,MAAM,uBAAuB,GAAI,kCAA+C,4BAA4B,gCAkBlH,CAAC"}
|