@pictogrammers/components 0.3.1
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/@types/css.d.ts +4 -0
- package/@types/html.d.ts +4 -0
- package/README.md +49 -0
- package/dist/main.js +3819 -0
- package/dist/pgAnnoy.js +116 -0
- package/dist/pgAvatar.js +136 -0
- package/dist/pgButton.js +116 -0
- package/dist/pgButtonGroup.js +116 -0
- package/dist/pgButtonLink.js +116 -0
- package/dist/pgButtonToggle.js +146 -0
- package/dist/pgCard.js +116 -0
- package/dist/pgCardUser.js +196 -0
- package/dist/pgColor.js +136 -0
- package/dist/pgDatabase.js +236 -0
- package/dist/pgDropdown.js +686 -0
- package/dist/pgGrid.js +126 -0
- package/dist/pgHeader.js +116 -0
- package/dist/pgIcon.js +116 -0
- package/dist/pgInputCheck.js +116 -0
- package/dist/pgInputCheckList.js +126 -0
- package/dist/pgInputFileLocal.js +116 -0
- package/dist/pgInputHexRgb.js +126 -0
- package/dist/pgInputRange.js +116 -0
- package/dist/pgInputSelect.js +116 -0
- package/dist/pgInputText.js +116 -0
- package/dist/pgInputTextIcon.js +176 -0
- package/dist/pgInputUserSelect.js +116 -0
- package/dist/pgListTag.js +136 -0
- package/dist/pgMarkdown.js +346 -0
- package/dist/pgMenuIcon.js +206 -0
- package/dist/pgModalAlert.js +126 -0
- package/dist/pgModification.js +396 -0
- package/dist/pgNav.js +116 -0
- package/dist/pgOverlay.js +96 -0
- package/dist/pgPicker.js +116 -0
- package/dist/pgPreview.js +116 -0
- package/dist/pgScroll.js +266 -0
- package/dist/pgSearch.js +146 -0
- package/dist/pgTab.js +116 -0
- package/dist/pgTabs.js +136 -0
- package/dist/pgToast.js +136 -0
- package/dist/pgToasts.js +136 -0
- package/dist/pgTooltip.js +126 -0
- package/index.html +302 -0
- package/package.json +25 -0
- package/pg/annoy/README.md +18 -0
- package/pg/annoy/__examples__/basic/basic.html +8 -0
- package/pg/annoy/__examples__/basic/basic.ts +11 -0
- package/pg/annoy/annoy.css +238 -0
- package/pg/annoy/annoy.html +59 -0
- package/pg/annoy/annoy.ts +48 -0
- package/pg/annoy/index.ts +3 -0
- package/pg/avatar/README.md +23 -0
- package/pg/avatar/__examples__/basic/basic.html +6 -0
- package/pg/avatar/__examples__/basic/basic.ts +41 -0
- package/pg/avatar/__examples__/basic/constants.ts +1 -0
- package/pg/avatar/avatar.css +45 -0
- package/pg/avatar/avatar.html +8 -0
- package/pg/avatar/avatar.spec.ts +51 -0
- package/pg/avatar/avatar.ts +37 -0
- package/pg/avatar/index.ts +3 -0
- package/pg/button/README.md +51 -0
- package/pg/button/__examples__/basic/basic.html +11 -0
- package/pg/button/__examples__/basic/basic.ts +11 -0
- package/pg/button/__examples__/states/states.html +8 -0
- package/pg/button/__examples__/states/states.ts +20 -0
- package/pg/button/button.css +91 -0
- package/pg/button/button.html +3 -0
- package/pg/button/button.ts +45 -0
- package/pg/button/index.ts +3 -0
- package/pg/buttonGroup/README.md +28 -0
- package/pg/buttonGroup/__examples__/basic/basic.html +12 -0
- package/pg/buttonGroup/__examples__/basic/basic.ts +11 -0
- package/pg/buttonGroup/buttonGroup.css +4 -0
- package/pg/buttonGroup/buttonGroup.html +1 -0
- package/pg/buttonGroup/buttonGroup.spec.ts +30 -0
- package/pg/buttonGroup/buttonGroup.ts +50 -0
- package/pg/buttonGroup/index.ts +3 -0
- package/pg/buttonLink/README.md +51 -0
- package/pg/buttonLink/__examples__/basic/basic.html +17 -0
- package/pg/buttonLink/__examples__/basic/basic.ts +11 -0
- package/pg/buttonLink/buttonLink.css +91 -0
- package/pg/buttonLink/buttonLink.html +3 -0
- package/pg/buttonLink/buttonLink.ts +46 -0
- package/pg/buttonLink/index.ts +3 -0
- package/pg/buttonToggle/README.md +54 -0
- package/pg/buttonToggle/__examples__/basic/basic.html +10 -0
- package/pg/buttonToggle/__examples__/basic/basic.ts +23 -0
- package/pg/buttonToggle/buttonToggle.css +8 -0
- package/pg/buttonToggle/buttonToggle.html +4 -0
- package/pg/buttonToggle/buttonToggle.ts +44 -0
- package/pg/buttonToggle/index.ts +3 -0
- package/pg/card/README.md +21 -0
- package/pg/card/__examples__/basic/basic.html +5 -0
- package/pg/card/__examples__/basic/basic.ts +11 -0
- package/pg/card/card.css +11 -0
- package/pg/card/card.html +3 -0
- package/pg/card/card.spec.ts +30 -0
- package/pg/card/card.ts +13 -0
- package/pg/card/index.ts +3 -0
- package/pg/cardUser/README.md +22 -0
- package/pg/cardUser/__examples__/basic/basic.html +3 -0
- package/pg/cardUser/__examples__/basic/basic.ts +30 -0
- package/pg/cardUser/__examples__/basic/constants.ts +1 -0
- package/pg/cardUser/cardUser.css +67 -0
- package/pg/cardUser/cardUser.html +23 -0
- package/pg/cardUser/cardUser.spec.ts +46 -0
- package/pg/cardUser/cardUser.ts +53 -0
- package/pg/cardUser/index.ts +3 -0
- package/pg/color/README.md +13 -0
- package/pg/color/__examples__/basic/basic.html +4 -0
- package/pg/color/__examples__/basic/basic.ts +20 -0
- package/pg/color/color.css +21 -0
- package/pg/color/color.html +1 -0
- package/pg/color/color.ts +97 -0
- package/pg/color/constants.ts +357 -0
- package/pg/color/index.ts +3 -0
- package/pg/color/utils.ts +27 -0
- package/pg/database/README.md +28 -0
- package/pg/database/__examples__/basic/basic.html +9 -0
- package/pg/database/__examples__/basic/basic.ts +37 -0
- package/pg/database/database.css +0 -0
- package/pg/database/database.html +0 -0
- package/pg/database/database.ts +42 -0
- package/pg/database/index.ts +3 -0
- package/pg/dropdown/README.md +13 -0
- package/pg/dropdown/__examples__/basic/basic.html +14 -0
- package/pg/dropdown/__examples__/basic/basic.ts +11 -0
- package/pg/dropdown/dropdown.css +46 -0
- package/pg/dropdown/dropdown.html +5 -0
- package/pg/dropdown/dropdown.ts +60 -0
- package/pg/dropdown/index.ts +3 -0
- package/pg/grid/README.md +97 -0
- package/pg/grid/__examples__/basic/basic.html +29 -0
- package/pg/grid/__examples__/basic/basic.ts +139 -0
- package/pg/grid/grid.css +68 -0
- package/pg/grid/grid.html +6 -0
- package/pg/grid/grid.spec.ts +66 -0
- package/pg/grid/grid.ts +417 -0
- package/pg/grid/index.ts +3 -0
- package/pg/header/README.md +23 -0
- package/pg/header/__examples__/basic/basic.html +8 -0
- package/pg/header/__examples__/basic/basic.ts +11 -0
- package/pg/header/header.css +42 -0
- package/pg/header/header.html +15 -0
- package/pg/header/header.ts +28 -0
- package/pg/header/index.ts +3 -0
- package/pg/icon/README.md +26 -0
- package/pg/icon/__examples__/basic/basic.html +16 -0
- package/pg/icon/__examples__/basic/basic.ts +34 -0
- package/pg/icon/__examples__/basic/constants.ts +2 -0
- package/pg/icon/icon.css +9 -0
- package/pg/icon/icon.html +3 -0
- package/pg/icon/icon.spec.ts +46 -0
- package/pg/icon/icon.ts +23 -0
- package/pg/icon/index.ts +3 -0
- package/pg/inputCheck/README.md +32 -0
- package/pg/inputCheck/__examples__/basic/basic.html +8 -0
- package/pg/inputCheck/__examples__/basic/basic.ts +23 -0
- package/pg/inputCheck/index.ts +3 -0
- package/pg/inputCheck/inputCheck.css +45 -0
- package/pg/inputCheck/inputCheck.html +6 -0
- package/pg/inputCheck/inputCheck.ts +42 -0
- package/pg/inputCheckList/README.md +35 -0
- package/pg/inputCheckList/__examples__/basic/basic.html +4 -0
- package/pg/inputCheckList/__examples__/basic/basic.ts +31 -0
- package/pg/inputCheckList/index.ts +3 -0
- package/pg/inputCheckList/inputCheckList.css +70 -0
- package/pg/inputCheckList/inputCheckList.html +1 -0
- package/pg/inputCheckList/inputCheckList.ts +103 -0
- package/pg/inputCheckList/templates/option.html +8 -0
- package/pg/inputFileLocal/README.md +30 -0
- package/pg/inputFileLocal/__examples__/basic/basic.html +4 -0
- package/pg/inputFileLocal/__examples__/basic/basic.ts +23 -0
- package/pg/inputFileLocal/index.ts +3 -0
- package/pg/inputFileLocal/inputFileLocal.css +80 -0
- package/pg/inputFileLocal/inputFileLocal.html +5 -0
- package/pg/inputFileLocal/inputFileLocal.ts +82 -0
- package/pg/inputHexRgb/README.md +15 -0
- package/pg/inputHexRgb/__examples__/basic/basic.html +4 -0
- package/pg/inputHexRgb/__examples__/basic/basic.ts +23 -0
- package/pg/inputHexRgb/index.ts +3 -0
- package/pg/inputHexRgb/inputHexRgb.css +96 -0
- package/pg/inputHexRgb/inputHexRgb.html +9 -0
- package/pg/inputHexRgb/inputHexRgb.ts +79 -0
- package/pg/inputHexRgb/utils.ts +27 -0
- package/pg/inputRange/README.md +18 -0
- package/pg/inputRange/__examples__/basic/basic.html +9 -0
- package/pg/inputRange/__examples__/basic/basic.ts +30 -0
- package/pg/inputRange/index.ts +3 -0
- package/pg/inputRange/inputRange.css +0 -0
- package/pg/inputRange/inputRange.html +1 -0
- package/pg/inputRange/inputRange.ts +53 -0
- package/pg/inputSelect/README.md +25 -0
- package/pg/inputSelect/__examples__/basic/basic.html +6 -0
- package/pg/inputSelect/__examples__/basic/basic.ts +30 -0
- package/pg/inputSelect/index.ts +3 -0
- package/pg/inputSelect/inputSelect.css +36 -0
- package/pg/inputSelect/inputSelect.html +4 -0
- package/pg/inputSelect/inputSelect.ts +57 -0
- package/pg/inputText/README.md +27 -0
- package/pg/inputText/__examples__/basic/basic.html +9 -0
- package/pg/inputText/__examples__/basic/basic.ts +30 -0
- package/pg/inputText/index.ts +3 -0
- package/pg/inputText/inputText.css +20 -0
- package/pg/inputText/inputText.html +1 -0
- package/pg/inputText/inputText.spec.ts +59 -0
- package/pg/inputText/inputText.ts +59 -0
- package/pg/inputTextIcon/README.md +26 -0
- package/pg/inputTextIcon/index.ts +3 -0
- package/pg/inputTextIcon/inputTextIcon.css +24 -0
- package/pg/inputTextIcon/inputTextIcon.html +4 -0
- package/pg/inputTextIcon/inputTextIcon.spec.ts +44 -0
- package/pg/inputTextIcon/inputTextIcon.ts +26 -0
- package/pg/inputUserSelect/README.md +31 -0
- package/pg/inputUserSelect/__examples__/basic/basic.html +4 -0
- package/pg/inputUserSelect/__examples__/basic/basic.ts +25 -0
- package/pg/inputUserSelect/__examples__/basic/constants.ts +33 -0
- package/pg/inputUserSelect/index.ts +3 -0
- package/pg/inputUserSelect/inputUserSelect.css +174 -0
- package/pg/inputUserSelect/inputUserSelect.html +18 -0
- package/pg/inputUserSelect/inputUserSelect.ts +266 -0
- package/pg/listTag/README.md +26 -0
- package/pg/listTag/__examples__/basic/basic.html +16 -0
- package/pg/listTag/__examples__/basic/basic.ts +53 -0
- package/pg/listTag/__examples__/basic/constants.ts +22 -0
- package/pg/listTag/index.ts +3 -0
- package/pg/listTag/listTag.css +9 -0
- package/pg/listTag/listTag.html +1 -0
- package/pg/listTag/listTag.ts +48 -0
- package/pg/listTag/partials/tag.html +3 -0
- package/pg/markdown/README.md +13 -0
- package/pg/markdown/__examples__/basic/basic.html +3 -0
- package/pg/markdown/__examples__/basic/basic.ts +51 -0
- package/pg/markdown/__examples__/basic/constants.ts +129 -0
- package/pg/markdown/index.ts +5 -0
- package/pg/markdown/markdown.css +760 -0
- package/pg/markdown/markdown.html +1 -0
- package/pg/markdown/markdown.md +123 -0
- package/pg/markdown/markdown.spec.ts +87 -0
- package/pg/markdown/markdown.ts +381 -0
- package/pg/markdown/markdownReplace.ts +7 -0
- package/pg/menuIcon/README.md +13 -0
- package/pg/menuIcon/__examples__/basic/basic.html +3 -0
- package/pg/menuIcon/__examples__/basic/basic.ts +15 -0
- package/pg/menuIcon/index.ts +3 -0
- package/pg/menuIcon/menuIcon.css +168 -0
- package/pg/menuIcon/menuIcon.html +64 -0
- package/pg/menuIcon/menuIcon.ts +271 -0
- package/pg/modalAlert/README.md +17 -0
- package/pg/modalAlert/__examples__/basic/basic.html +4 -0
- package/pg/modalAlert/__examples__/basic/basic.ts +27 -0
- package/pg/modalAlert/index.ts +3 -0
- package/pg/modalAlert/modalAlert.css +43 -0
- package/pg/modalAlert/modalAlert.html +22 -0
- package/pg/modalAlert/modalAlert.ts +45 -0
- package/pg/modification/README.md +34 -0
- package/pg/modification/__examples__/basic/basic.html +8 -0
- package/pg/modification/__examples__/basic/basic.ts +63 -0
- package/pg/modification/__examples__/basic/constants.ts +416 -0
- package/pg/modification/index.ts +3 -0
- package/pg/modification/modification.css +311 -0
- package/pg/modification/modification.html +1 -0
- package/pg/modification/modification.spec.ts +33 -0
- package/pg/modification/modification.ts +201 -0
- package/pg/modification/type/date.html +1 -0
- package/pg/modification/type/iconAliasCreated.html +13 -0
- package/pg/modification/type/iconAliasDeleted.html +13 -0
- package/pg/modification/type/iconAuthorModified.html +13 -0
- package/pg/modification/type/iconCreated.html +13 -0
- package/pg/modification/type/iconDeleted.html +13 -0
- package/pg/modification/type/iconDeprecated.html +13 -0
- package/pg/modification/type/iconDescriptionModified.html +10 -0
- package/pg/modification/type/iconModified.html +14 -0
- package/pg/modification/type/iconRenamed.html +13 -0
- package/pg/modification/type/iconTagCreated.html +13 -0
- package/pg/modification/type/iconTagDeleted.html +13 -0
- package/pg/modification/type/news.html +5 -0
- package/pg/nav/README.md +16 -0
- package/pg/nav/__examples__/basic/basic.html +5 -0
- package/pg/nav/__examples__/basic/basic.ts +11 -0
- package/pg/nav/index.ts +3 -0
- package/pg/nav/nav.css +14 -0
- package/pg/nav/nav.html +16 -0
- package/pg/nav/nav.ts +21 -0
- package/pg/overlay/README.md +37 -0
- package/pg/overlay/__examples__/basic/basic.css +3 -0
- package/pg/overlay/__examples__/basic/basic.html +3 -0
- package/pg/overlay/__examples__/basic/basic.ts +13 -0
- package/pg/overlay/index.ts +3 -0
- package/pg/overlay/overlay.ts +26 -0
- package/pg/picker/README.md +13 -0
- package/pg/picker/index.ts +3 -0
- package/pg/picker/picker.css +56 -0
- package/pg/picker/picker.html +8 -0
- package/pg/picker/picker.ts +66 -0
- package/pg/preview/README.md +19 -0
- package/pg/preview/__examples__/basic/basic.html +11 -0
- package/pg/preview/__examples__/basic/basic.ts +22 -0
- package/pg/preview/index.ts +3 -0
- package/pg/preview/preview.css +34 -0
- package/pg/preview/preview.html +5 -0
- package/pg/preview/preview.ts +38 -0
- package/pg/scroll/README.md +42 -0
- package/pg/scroll/__examples__/basic/basic.css +4 -0
- package/pg/scroll/__examples__/basic/basic.html +11 -0
- package/pg/scroll/__examples__/basic/basic.ts +88 -0
- package/pg/scroll/index.ts +3 -0
- package/pg/scroll/scroll.css +7 -0
- package/pg/scroll/scroll.html +3 -0
- package/pg/scroll/scroll.ts +158 -0
- package/pg/search/README.md +59 -0
- package/pg/search/__examples__/basic/basic.html +3 -0
- package/pg/search/__examples__/basic/basic.ts +29 -0
- package/pg/search/__examples__/basic/constants.ts +3 -0
- package/pg/search/index.ts +3 -0
- package/pg/search/search.css +188 -0
- package/pg/search/search.html +18 -0
- package/pg/search/search.ts +252 -0
- package/pg/search/utils.ts +12 -0
- package/pg/shared/README.md +28 -0
- package/pg/shared/copy.ts +25 -0
- package/pg/shared/database.ts +35 -0
- package/pg/shared/databaseService.ts +230 -0
- package/pg/shared/debounce.ts +12 -0
- package/pg/shared/enums/modificationType.ts +19 -0
- package/pg/shared/filter.ts +14 -0
- package/pg/shared/http.ts +83 -0
- package/pg/shared/iconFilter.spec.ts +61 -0
- package/pg/shared/iconFilter.ts +71 -0
- package/pg/shared/list.ts +34 -0
- package/pg/shared/models/alias.ts +40 -0
- package/pg/shared/models/font.ts +31 -0
- package/pg/shared/models/fontIcon.ts +25 -0
- package/pg/shared/models/fontVersion.ts +22 -0
- package/pg/shared/models/icon.ts +97 -0
- package/pg/shared/models/modification.ts +45 -0
- package/pg/shared/models/style.ts +12 -0
- package/pg/shared/models/tag.ts +37 -0
- package/pg/shared/models/user.ts +35 -0
- package/pg/shared/models/version.ts +20 -0
- package/pg/shared/removeDiacritics.ts +94 -0
- package/pg/shared/toast.ts +47 -0
- package/pg/shared/uuid.ts +6 -0
- package/pg/tab/README.md +18 -0
- package/pg/tab/index.ts +3 -0
- package/pg/tab/tab.css +13 -0
- package/pg/tab/tab.html +3 -0
- package/pg/tab/tab.ts +51 -0
- package/pg/tabs/README.md +31 -0
- package/pg/tabs/__examples__/basic/basic.html +13 -0
- package/pg/tabs/__examples__/basic/basic.ts +11 -0
- package/pg/tabs/index.ts +3 -0
- package/pg/tabs/partials/tab.html +3 -0
- package/pg/tabs/tabs.css +69 -0
- package/pg/tabs/tabs.html +4 -0
- package/pg/tabs/tabs.ts +102 -0
- package/pg/toast/README.md +13 -0
- package/pg/toast/index.ts +3 -0
- package/pg/toast/toast.css +112 -0
- package/pg/toast/toast.html +13 -0
- package/pg/toast/toast.ts +39 -0
- package/pg/toasts/README.md +37 -0
- package/pg/toasts/__examples__/basic/basic.html +11 -0
- package/pg/toasts/__examples__/basic/basic.ts +86 -0
- package/pg/toasts/index.ts +3 -0
- package/pg/toasts/toasts.css +8 -0
- package/pg/toasts/toasts.html +1 -0
- package/pg/toasts/toasts.ts +51 -0
- package/pg/tooltip/README.md +51 -0
- package/pg/tooltip/__examples__/basic/basic.css +38 -0
- package/pg/tooltip/__examples__/basic/basic.html +21 -0
- package/pg/tooltip/__examples__/basic/basic.ts +55 -0
- package/pg/tooltip/addTooltip.ts +31 -0
- package/pg/tooltip/index.ts +20 -0
- package/pg/tooltip/position.ts +15 -0
- package/pg/tooltip/tooltip.css +36 -0
- package/pg/tooltip/tooltip.html +4 -0
- package/pg/tooltip/tooltip.ts +170 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
|
|
2
|
+
[part~=contextMenu] {
|
|
3
|
+
position: relative;
|
|
4
|
+
background: #737E9E;
|
|
5
|
+
border-radius: 0.25rem;
|
|
6
|
+
width: 12rem;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
padding: 0.25rem 0;
|
|
10
|
+
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[part~=contextMenu] > div.section {
|
|
14
|
+
color: #FFF;
|
|
15
|
+
font-size: 0.875rem;
|
|
16
|
+
padding: 0.25rem 0.5rem;
|
|
17
|
+
cursor: default;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[part~=contextMenu] > div.section:not(:first-child) {
|
|
22
|
+
border-top: 1px solid rgba(255, 255, 255, 0.3);
|
|
23
|
+
margin-top: 0.5rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part~=contextMenu] > div.group {
|
|
27
|
+
margin: 0 0.5rem;
|
|
28
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
29
|
+
border-radius: 0.25rem;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
[part~=contextMenu] > div.row > div.group {
|
|
35
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
36
|
+
border-radius: 0.25rem;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[part~=contextMenu] > div.row > div.group:first-child {
|
|
44
|
+
margin-left: 0.5rem;
|
|
45
|
+
margin-right: 0.25rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[part~=contextMenu] > div.row > div.group:last-child {
|
|
49
|
+
margin-right: 0.5rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part~=contextMenu] > div.group > button,
|
|
53
|
+
[part~=contextMenu] > div.row > div.group > button {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex: 1;
|
|
56
|
+
padding: 0.25rem;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
border: 0;
|
|
59
|
+
margin: 0;
|
|
60
|
+
background: transparent;
|
|
61
|
+
color: #FFF;
|
|
62
|
+
font-size: 1rem;
|
|
63
|
+
line-height: 1.25rem;
|
|
64
|
+
align-items: center;
|
|
65
|
+
outline: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[part~=contextMenu] > button,
|
|
69
|
+
[part~=contextMenu] > a {
|
|
70
|
+
display: flex;
|
|
71
|
+
border: 0;
|
|
72
|
+
margin: 0;
|
|
73
|
+
padding: 0.125rem 0.5rem;
|
|
74
|
+
background: transparent;
|
|
75
|
+
text-align: left;
|
|
76
|
+
color: #FFF;
|
|
77
|
+
font-size: 1rem;
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
cursor: default;
|
|
80
|
+
outline: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[part~=contextMenu] > div.group > button.active,
|
|
84
|
+
[part~=contextMenu] > div.row > div.group > button.active {
|
|
85
|
+
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3) inset;
|
|
86
|
+
background: rgba(0, 0, 0, 0.1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[part~=contextMenu] > div.group > button.active:hover,
|
|
90
|
+
[part~=contextMenu] > div.row > div.group > button.active:hover {
|
|
91
|
+
background: rgba(0, 0, 0, 0.2);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[part~=contextMenu] > div.group > button:not(:first-child),
|
|
95
|
+
[part~=contextMenu] > div.row > div.group > button:not(:first-child) {
|
|
96
|
+
border-left: 1px solid rgba(255, 255, 255, 0.1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[part~=contextMenu] > div.row > div.group > button > svg,
|
|
100
|
+
[part~=contextMenu] > div.group > button > svg,
|
|
101
|
+
[part~=contextMenu] > div.row > button > svg,
|
|
102
|
+
[part~=contextMenu] > button > svg {
|
|
103
|
+
width: 1.5rem;
|
|
104
|
+
height: 1.5rem;
|
|
105
|
+
align-self: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
[part~=contextMenu] > div.row > div.group > button:hover,
|
|
109
|
+
[part~=contextMenu] > div.group > button:hover,
|
|
110
|
+
[part~=contextMenu] > button:hover,
|
|
111
|
+
[part~=contextMenu] > a:hover {
|
|
112
|
+
background: rgba(255, 255, 255, 0.2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[part~=contextMenu] > div.row > div.group > button:active,
|
|
116
|
+
[part~=contextMenu] > div.group > button:active {
|
|
117
|
+
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3) inset;
|
|
118
|
+
background: rgba(0, 0, 0, 0.2);
|
|
119
|
+
}
|
|
120
|
+
[part~=contextMenu] > button:active,
|
|
121
|
+
[part~=contextMenu] > a:active {
|
|
122
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) inset;
|
|
123
|
+
background: rgba(0, 0, 0, 0.2);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.row {
|
|
127
|
+
display: flex;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.divider {
|
|
131
|
+
border-top: 1px solid rgba(255, 255, 255, 0.3);
|
|
132
|
+
margin-top: 0.5rem;
|
|
133
|
+
height: 0.4375rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.black {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
border-radius: 50%;
|
|
139
|
+
width: 1rem;
|
|
140
|
+
height: 1rem;
|
|
141
|
+
background: #000;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.white {
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
border-radius: 50%;
|
|
147
|
+
width: 1rem;
|
|
148
|
+
height: 1rem;
|
|
149
|
+
background: #FFF;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.download svg {
|
|
153
|
+
margin-bottom: -0.125rem;
|
|
154
|
+
margin-left: 0.25rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
[part~=color] {
|
|
158
|
+
visibility: hidden;
|
|
159
|
+
position: absolute;
|
|
160
|
+
padding: 0.25rem;
|
|
161
|
+
background: #737E9E;
|
|
162
|
+
border-radius: 0.25rem;
|
|
163
|
+
box-shadow: 0 1px 16px rgba(0, 0, 0, 0.6);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
[part~=colorHexRgb] {
|
|
167
|
+
margin-bottom: 0.25rem;
|
|
168
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<div part="contextMenu">
|
|
2
|
+
<a part="newTab" href="">Open icon in New Tab</a>
|
|
3
|
+
<button part="copyIconName">Copy Icon Name</button>
|
|
4
|
+
<div class="section">Download PNG</div>
|
|
5
|
+
<div class="group">
|
|
6
|
+
<button part="png24">24</button>
|
|
7
|
+
<button part="png36">36</button>
|
|
8
|
+
<button part="png48">48</button>
|
|
9
|
+
<button part="png96">96</button>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="row" style="margin-top: 0.25rem;">
|
|
12
|
+
<div class="group">
|
|
13
|
+
<button part="pngBlack"><span class="black"></span></button>
|
|
14
|
+
<button part="pngWhite"><span class="white"></span></button>
|
|
15
|
+
<button part="pngColor">
|
|
16
|
+
<svg viewBox="0 0 24 24">
|
|
17
|
+
<path fill="#fff" d="M19.35,11.72L17.22,13.85L15.81,12.43L8.1,20.14L3.5,22L2,20.5L3.86,15.9L11.57,8.19L10.15,6.78L12.28,4.65L19.35,11.72M16.76,3C17.93,1.83 19.83,1.83 21,3C22.17,4.17 22.17,6.07 21,7.24L19.08,9.16L14.84,4.92L16.76,3M5.56,17.03L4.5,19.5L6.97,18.44L14.4,11L13,9.6L5.56,17.03Z"/>
|
|
18
|
+
<path fill="currentColor" d="M12.97 8L15.8 10.85L7.67 19L3.71 20.68L3.15 20.11L4.84 16.15L12.97 8Z"/>
|
|
19
|
+
</svg>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="group">
|
|
23
|
+
<button part="pngDownload" class="download">
|
|
24
|
+
PNG
|
|
25
|
+
<svg viewBox="0 0 24 24">
|
|
26
|
+
<path fill="currentColor" d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"/>
|
|
27
|
+
</svg>
|
|
28
|
+
</button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="section">SVG</div>
|
|
32
|
+
<div class="row" style="margin-bottom: 0.25rem;">
|
|
33
|
+
<div class="group">
|
|
34
|
+
<button part="svgBlack" class="active"><span class="black"></span></button>
|
|
35
|
+
<button part="svgWhite"><span class="white"></span></button>
|
|
36
|
+
<button part="svgColor">
|
|
37
|
+
<svg viewBox="0 0 24 24">
|
|
38
|
+
<path fill="#fff" d="M19.35,11.72L17.22,13.85L15.81,12.43L8.1,20.14L3.5,22L2,20.5L3.86,15.9L11.57,8.19L10.15,6.78L12.28,4.65L19.35,11.72M16.76,3C17.93,1.83 19.83,1.83 21,3C22.17,4.17 22.17,6.07 21,7.24L19.08,9.16L14.84,4.92L16.76,3M5.56,17.03L4.5,19.5L6.97,18.44L14.4,11L13,9.6L5.56,17.03Z"/>
|
|
39
|
+
<path fill="currentColor" d="M12.97 8L15.8 10.85L7.67 19L3.71 20.68L3.15 20.11L4.84 16.15L12.97 8Z"/>
|
|
40
|
+
</svg>
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="group">
|
|
44
|
+
<button part="svgDownload" class="download">
|
|
45
|
+
SVG
|
|
46
|
+
<svg viewBox="0 0 24 24">
|
|
47
|
+
<path fill="currentColor" d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"/>
|
|
48
|
+
</svg>
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<button part="copySvgInline">Copy HTML SVG Inline</button>
|
|
53
|
+
<button part="copySvgFile">Copy SVG File Contents</button>
|
|
54
|
+
<button part="copySvgPath">Copy SVG Path Data</button>
|
|
55
|
+
<div class="section">Desktop Font</div>
|
|
56
|
+
<button part="copyUnicode">Copy Unicode Character</button>
|
|
57
|
+
<button part="copyCodepoint">Copy Codepoint</button>
|
|
58
|
+
<div class="divider"></div>
|
|
59
|
+
<button part="copyPreview">Copy GitHub Preview</button>
|
|
60
|
+
<div part="color">
|
|
61
|
+
<pg-input-hex-rgb part="colorHexRgb"></pg-input-hex-rgb>
|
|
62
|
+
<pg-color part="colorPicker"></pg-color>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Component, Prop, Part, Local } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './menuIcon.html';
|
|
4
|
+
import style from './menuIcon.css'
|
|
5
|
+
import { copyText, getCopySvgInline } from '../shared/copy';
|
|
6
|
+
import { addInfoToast } from '../shared/toast';
|
|
7
|
+
import { Icon } from '../shared/models/icon';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'pg-menu-icon',
|
|
11
|
+
style,
|
|
12
|
+
template
|
|
13
|
+
})
|
|
14
|
+
export default class PgMenuIcon extends HTMLElement {
|
|
15
|
+
@Part() $contextMenu: HTMLDivElement;
|
|
16
|
+
@Part() $newTab: HTMLAnchorElement;
|
|
17
|
+
@Part() $copyIconName: HTMLButtonElement;
|
|
18
|
+
@Part() $pngBlack: HTMLButtonElement;
|
|
19
|
+
@Part() $pngWhite: HTMLButtonElement;
|
|
20
|
+
@Part() $pngColor: HTMLButtonElement;
|
|
21
|
+
@Part() $png24: HTMLButtonElement;
|
|
22
|
+
@Part() $png36: HTMLButtonElement;
|
|
23
|
+
@Part() $png48: HTMLButtonElement;
|
|
24
|
+
@Part() $png96: HTMLButtonElement;
|
|
25
|
+
@Part() $pngDownload: HTMLButtonElement;
|
|
26
|
+
@Part() $svgBlack: HTMLButtonElement;
|
|
27
|
+
@Part() $svgWhite: HTMLButtonElement;
|
|
28
|
+
@Part() $svgColor: HTMLButtonElement;
|
|
29
|
+
@Part() $svgDownload: HTMLButtonElement;
|
|
30
|
+
@Part() $copySvgInline: HTMLButtonElement;
|
|
31
|
+
@Part() $copySvgFile: HTMLButtonElement;
|
|
32
|
+
@Part() $copySvgPath: HTMLButtonElement;
|
|
33
|
+
@Part() $copyUnicode: HTMLButtonElement;
|
|
34
|
+
@Part() $copyCodepoint: HTMLButtonElement;
|
|
35
|
+
@Part() $copyPreview: HTMLButtonElement;
|
|
36
|
+
|
|
37
|
+
@Part() $color: any;
|
|
38
|
+
@Part() $colorPicker: any;
|
|
39
|
+
@Part() $colorHexRgb: any;
|
|
40
|
+
|
|
41
|
+
@Local('#000000') cachePngColor: string;
|
|
42
|
+
@Local('24') cachePngSize: string;
|
|
43
|
+
@Local('#000000') cacheSvgColor: string;
|
|
44
|
+
|
|
45
|
+
color = 'svg';
|
|
46
|
+
@Prop() currentIndex: 0;
|
|
47
|
+
@Prop() icon: Icon = new Icon();
|
|
48
|
+
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
// Wire Up Context Menu
|
|
51
|
+
this.$copyIconName.addEventListener('click', this.handleCopyIconName.bind(this));
|
|
52
|
+
this.$svgBlack.addEventListener('click', () => {
|
|
53
|
+
this.cacheSvgColor = '#000000';
|
|
54
|
+
this.render();
|
|
55
|
+
});
|
|
56
|
+
this.$svgWhite.addEventListener('click', () => {
|
|
57
|
+
this.cacheSvgColor = '#FFFFFF';
|
|
58
|
+
this.render();
|
|
59
|
+
});
|
|
60
|
+
let preventSvgColor = false;
|
|
61
|
+
this.$svgColor.addEventListener('click', () => {
|
|
62
|
+
if (preventSvgColor) { preventSvgColor = false; return; }
|
|
63
|
+
this.color = 'svg';
|
|
64
|
+
this.$colorPicker.value = this.cacheSvgColor;
|
|
65
|
+
this.$colorHexRgb.value = this.cacheSvgColor;
|
|
66
|
+
const self = this;
|
|
67
|
+
//createPopper(this.$svgColor, this.$color, {
|
|
68
|
+
// placement: 'bottom-start'
|
|
69
|
+
//});
|
|
70
|
+
this.$color.style.visibility = 'visible';
|
|
71
|
+
let outside = true;
|
|
72
|
+
function handleMouseDown(e) {
|
|
73
|
+
if (outside) {
|
|
74
|
+
self.$color.style.visibility = 'hidden';
|
|
75
|
+
document.removeEventListener('mousedown', handleMouseDown);
|
|
76
|
+
preventSvgColor = true;
|
|
77
|
+
self.render();
|
|
78
|
+
setTimeout(() => preventSvgColor = false, 500);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this.$color.addEventListener('mouseenter', () => outside = false);
|
|
82
|
+
this.$color.addEventListener('mouseleave', () => outside = true);
|
|
83
|
+
document.addEventListener('mousedown', handleMouseDown);
|
|
84
|
+
});
|
|
85
|
+
this.$pngBlack.addEventListener('click', () => {
|
|
86
|
+
this.cachePngColor = '#000000';
|
|
87
|
+
this.render();
|
|
88
|
+
});
|
|
89
|
+
this.$pngWhite.addEventListener('click', () => {
|
|
90
|
+
this.cachePngColor = '#FFFFFF';
|
|
91
|
+
this.render();
|
|
92
|
+
});
|
|
93
|
+
let preventPngColor = false;
|
|
94
|
+
this.$pngColor.addEventListener('click', () => {
|
|
95
|
+
if (preventPngColor) { preventPngColor = false; return; }
|
|
96
|
+
this.color = 'png';
|
|
97
|
+
this.$colorPicker.value = this.cachePngColor;
|
|
98
|
+
this.$colorHexRgb.value = this.cachePngColor;
|
|
99
|
+
const self = this;
|
|
100
|
+
//createPopper(this.$pngColor, this.$color, {
|
|
101
|
+
// placement: 'bottom-start'
|
|
102
|
+
//});
|
|
103
|
+
this.$color.style.visibility = 'visible';
|
|
104
|
+
let outside = true;
|
|
105
|
+
function handleMouseDown(e) {
|
|
106
|
+
if (outside) {
|
|
107
|
+
self.$color.style.visibility = 'hidden';
|
|
108
|
+
document.removeEventListener('mousedown', handleMouseDown);
|
|
109
|
+
preventPngColor = true;
|
|
110
|
+
self.render();
|
|
111
|
+
setTimeout(() => preventPngColor = false, 500);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
this.$color.addEventListener('mouseenter', () => outside = false);
|
|
115
|
+
this.$color.addEventListener('mouseleave', () => outside = true);
|
|
116
|
+
document.addEventListener('mousedown', handleMouseDown);
|
|
117
|
+
});
|
|
118
|
+
this.$png24.addEventListener('click', () => {
|
|
119
|
+
this.cachePngSize = '24';
|
|
120
|
+
this.render();
|
|
121
|
+
});
|
|
122
|
+
this.$png36.addEventListener('click', () => {
|
|
123
|
+
this.cachePngSize = '36';
|
|
124
|
+
this.render();
|
|
125
|
+
});
|
|
126
|
+
this.$png48.addEventListener('click', () => {
|
|
127
|
+
this.cachePngSize = '48';
|
|
128
|
+
this.render();
|
|
129
|
+
});
|
|
130
|
+
this.$png96.addEventListener('click', () => {
|
|
131
|
+
this.cachePngSize = '96';
|
|
132
|
+
this.render();
|
|
133
|
+
});
|
|
134
|
+
this.$svgDownload.addEventListener('click', () => {
|
|
135
|
+
alert(`SVG ${this.cacheSvgColor}`);
|
|
136
|
+
});
|
|
137
|
+
this.$pngDownload.addEventListener('click', () => {
|
|
138
|
+
alert(`SVG ${this.cachePngSize} ${this.cachePngColor}`);
|
|
139
|
+
});
|
|
140
|
+
this.$copySvgInline.addEventListener('click', () => {
|
|
141
|
+
const icon = this.icon;
|
|
142
|
+
copyText(getCopySvgInline(icon));
|
|
143
|
+
this.hideContextMenu();
|
|
144
|
+
addInfoToast(`Copied inline SVG "${icon.name}" to clipboard.`);
|
|
145
|
+
});
|
|
146
|
+
this.$copySvgFile.addEventListener('click', () => {
|
|
147
|
+
|
|
148
|
+
});
|
|
149
|
+
this.$copySvgPath.addEventListener('click', () => {
|
|
150
|
+
|
|
151
|
+
});
|
|
152
|
+
this.$copyUnicode.addEventListener('click', () => {
|
|
153
|
+
|
|
154
|
+
});
|
|
155
|
+
this.$copyCodepoint.addEventListener('click', () => {
|
|
156
|
+
|
|
157
|
+
});
|
|
158
|
+
this.$copyPreview.addEventListener('click', () => {
|
|
159
|
+
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
handleCopyIconName() {
|
|
164
|
+
const icon = this.icon;
|
|
165
|
+
if (icon && icon.name) {
|
|
166
|
+
copyText(icon.name);
|
|
167
|
+
addInfoToast(`Copied "${icon.name}" to clipboard.`);
|
|
168
|
+
}
|
|
169
|
+
this.hideContextMenu();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
hideContextMenu() {
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
showContextMenu(index: number, x: number, y: number) {
|
|
177
|
+
this.dispatchEvent(new CustomEvent('closemenu'));
|
|
178
|
+
/*const gridRect = this.$grid.getBoundingClientRect();
|
|
179
|
+
const cmRect = this.$contextMenu.getBoundingClientRect();
|
|
180
|
+
if (y + gridRect.top + cmRect.height + 4 > window.innerHeight
|
|
181
|
+
&& x + gridRect.left + cmRect.width + 24 > window.innerWidth) {
|
|
182
|
+
y = y - cmRect.height;
|
|
183
|
+
x -= x + gridRect.left + cmRect.width + 24 - window.innerWidth;
|
|
184
|
+
} else if (y + gridRect.top + cmRect.height + 4 > window.innerHeight) {
|
|
185
|
+
y -= y + gridRect.top + cmRect.height + 4 - window.innerHeight;
|
|
186
|
+
} else if (x + gridRect.left + cmRect.width + 24 > window.innerWidth) {
|
|
187
|
+
x -= x + gridRect.left + cmRect.width + 24 - window.innerWidth;
|
|
188
|
+
}
|
|
189
|
+
this.currentIndex = index;
|
|
190
|
+
var icon = this.icons[index];
|
|
191
|
+
this.$newTab.href = `icons/${icon.name}`;
|
|
192
|
+
this.$contextMenu.style.left = `${x}px`;
|
|
193
|
+
this.$contextMenu.style.top = `${y}px`;
|
|
194
|
+
this.$contextMenu.style.visibility = 'visible';
|
|
195
|
+
this.hideTooltip();
|
|
196
|
+
this.canOpenTooltip = false;
|
|
197
|
+
const self = this;
|
|
198
|
+
this.$contextMenu.addEventListener('mouseenter', () => {
|
|
199
|
+
this.preventClose = true;
|
|
200
|
+
});
|
|
201
|
+
this.$contextMenu.addEventListener('mouseleave', () => {
|
|
202
|
+
this.preventClose = false;
|
|
203
|
+
});
|
|
204
|
+
function handleMouseDown(e) {
|
|
205
|
+
if (!self.preventClose) {
|
|
206
|
+
self.hideContextMenu();
|
|
207
|
+
document.removeEventListener('mousedown', handleMouseDown);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
this.preventClose = false;
|
|
211
|
+
document.addEventListener('mousedown', handleMouseDown);
|
|
212
|
+
this.$color.style.visibility = 'hidden';*/
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
render() {
|
|
216
|
+
// Context Menu
|
|
217
|
+
this.$svgBlack.classList.toggle('active', this.cacheSvgColor === '#000000');
|
|
218
|
+
this.$svgWhite.classList.toggle('active', this.cacheSvgColor === '#FFFFFF');
|
|
219
|
+
this.$svgColor.classList.toggle('active', this.cacheSvgColor !== '#000000' && this.cacheSvgColor !== '#FFFFFF');
|
|
220
|
+
this.$pngBlack.classList.toggle('active', this.cachePngColor === '#000000');
|
|
221
|
+
this.$pngWhite.classList.toggle('active', this.cachePngColor === '#FFFFFF');
|
|
222
|
+
this.$pngColor.classList.toggle('active', this.cachePngColor !== '#000000' && this.cachePngColor !== '#FFFFFF');
|
|
223
|
+
this.$png24.classList.toggle('active', this.cachePngSize === '24');
|
|
224
|
+
this.$png36.classList.toggle('active', this.cachePngSize === '36');
|
|
225
|
+
this.$png48.classList.toggle('active', this.cachePngSize === '48');
|
|
226
|
+
this.$png96.classList.toggle('active', this.cachePngSize === '96');
|
|
227
|
+
this.$colorPicker.addEventListener('select', this.handleColorSelect.bind(this));
|
|
228
|
+
this.$colorHexRgb.addEventListener('change', this.handleHexRgbChange.bind(this));
|
|
229
|
+
this.syncEyedropper();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
handleColorSelect(e) {
|
|
233
|
+
switch(this.color) {
|
|
234
|
+
case 'svg':
|
|
235
|
+
this.cacheSvgColor = e.detail.hex;
|
|
236
|
+
break;
|
|
237
|
+
case 'png':
|
|
238
|
+
this.cachePngColor = e.detail.hex;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
this.$colorHexRgb.value = e.detail.hex;
|
|
242
|
+
this.syncEyedropper();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
handleHexRgbChange(e) {
|
|
246
|
+
switch(this.color) {
|
|
247
|
+
case 'svg':
|
|
248
|
+
this.cacheSvgColor = e.detail.hex;
|
|
249
|
+
break;
|
|
250
|
+
case 'png':
|
|
251
|
+
this.cachePngColor = e.detail.hex;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
this.$colorPicker.value = e.detail.hex;
|
|
255
|
+
this.syncEyedropper();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
syncEyedropper() {
|
|
259
|
+
if (this.cachePngColor !== '#000000' && this.cachePngColor !== '#FFFFFF') {
|
|
260
|
+
this.$pngColor.style.color = this.cachePngColor;
|
|
261
|
+
} else {
|
|
262
|
+
this.$pngColor.style.color = 'transparent';
|
|
263
|
+
}
|
|
264
|
+
if (this.cacheSvgColor !== '#000000' && this.cacheSvgColor !== '#FFFFFF') {
|
|
265
|
+
this.$svgColor.style.color = this.cacheSvgColor;
|
|
266
|
+
} else {
|
|
267
|
+
this.$svgColor.style.color = 'transparent';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# `PgModalAlert`
|
|
2
|
+
|
|
3
|
+
The `PgModalAlert` creates a alert box above everything.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import PgModalAlert from '@pictogrammers/components/pgModalAlert';
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
const result = await PgModalAlert.open({
|
|
11
|
+
header: 'Delete Item',
|
|
12
|
+
message: 'Are you sure you want to delete the item?'
|
|
13
|
+
});
|
|
14
|
+
if (result) {
|
|
15
|
+
console.log('Item has been deleted.');
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, Part, Prop } from '@pictogrammers/element';
|
|
2
|
+
import PgModalAlert from '../../modalAlert';
|
|
3
|
+
|
|
4
|
+
import template from './basic.html';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'x-pg-modal-alert-basic',
|
|
8
|
+
template
|
|
9
|
+
})
|
|
10
|
+
export default class XPgModalAlertBasic extends HTMLElement {
|
|
11
|
+
|
|
12
|
+
@Part() $button: HTMLButtonElement;
|
|
13
|
+
@Part() $result: HTMLSpanElement;
|
|
14
|
+
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.$button.addEventListener('click', this.handleClick.bind(this));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async handleClick() {
|
|
20
|
+
const result = await PgModalAlert.open({
|
|
21
|
+
header: 'Delete Item',
|
|
22
|
+
message: 'Are you sure you want to delete the item?'
|
|
23
|
+
});
|
|
24
|
+
this.$result.innerText = `${result}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.backdrop {
|
|
2
|
+
display: flex;
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
background: rgba(0, 0, 0, 0.6);
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
.dialog {
|
|
13
|
+
background: #fff;
|
|
14
|
+
border-radius: 0.5rem;
|
|
15
|
+
box-shadow: 0 1px 1rem rgba(0, 0, 0, 0.5);
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
min-width: 15rem;
|
|
18
|
+
}
|
|
19
|
+
header {
|
|
20
|
+
border-bottom: 1px solid #ccc;
|
|
21
|
+
background: #f1f1f1;
|
|
22
|
+
padding: 0.75rem 1rem;
|
|
23
|
+
}
|
|
24
|
+
header h2 {
|
|
25
|
+
font-size: 1.25rem;
|
|
26
|
+
margin: 0;
|
|
27
|
+
font-weight: normal;
|
|
28
|
+
}
|
|
29
|
+
main {
|
|
30
|
+
padding: 0.5rem 1rem;
|
|
31
|
+
}
|
|
32
|
+
footer {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
padding: 0.75rem 1rem;
|
|
36
|
+
border-top: 1px solid #ccc;
|
|
37
|
+
background: #f1f1f1;
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part="no"] {
|
|
42
|
+
margin-right: 0.5rem;
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="backdrop">
|
|
2
|
+
<div class="dialog"
|
|
3
|
+
role="dialog"
|
|
4
|
+
id="dialog1"
|
|
5
|
+
aria-labelledby="dialog1_label"
|
|
6
|
+
aria-modal="true">
|
|
7
|
+
<header part="header">
|
|
8
|
+
<h2 id="dialog1_label"
|
|
9
|
+
class="dialog_label"
|
|
10
|
+
part="headerText">
|
|
11
|
+
Add Delivery Address
|
|
12
|
+
</h2>
|
|
13
|
+
</header>
|
|
14
|
+
<main>
|
|
15
|
+
<p part="message"></p>
|
|
16
|
+
</main>
|
|
17
|
+
<footer>
|
|
18
|
+
<pg-button part="no">No</pg-button>
|
|
19
|
+
<pg-button part="yes">Yes</pg-button>
|
|
20
|
+
</footer>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
+
|
|
3
|
+
import template from './modalAlert.html';
|
|
4
|
+
import style from './modalAlert.css';
|
|
5
|
+
|
|
6
|
+
import PgOverlay from '../overlay/overlay';
|
|
7
|
+
import PgButton from '../button/button';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'pg-modal-alert',
|
|
11
|
+
template,
|
|
12
|
+
style
|
|
13
|
+
})
|
|
14
|
+
export default class PgModalAlert extends PgOverlay {
|
|
15
|
+
@Prop() header: string = 'Are you sure?';
|
|
16
|
+
@Prop() message: string = 'Are you sure?';
|
|
17
|
+
|
|
18
|
+
@Part() $header: HTMLDivElement;
|
|
19
|
+
@Part() $headerText: HTMLHeadingElement;
|
|
20
|
+
@Part() $message: HTMLDivElement;
|
|
21
|
+
@Part() $yes: PgButton;
|
|
22
|
+
@Part() $no: PgButton;
|
|
23
|
+
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
this.$yes.addEventListener('click', this.handleYes.bind(this));
|
|
26
|
+
this.$no.addEventListener('click', this.handleNo.bind(this));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
handleYes() {
|
|
30
|
+
this.close(true);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
handleNo() {
|
|
34
|
+
this.close(false);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render(changes) {
|
|
38
|
+
if (changes.header) {
|
|
39
|
+
this.$headerText.innerText = this.header;
|
|
40
|
+
}
|
|
41
|
+
if (changes.message) {
|
|
42
|
+
this.$message.innerText = this.message;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|