@moraby/app-launcher 2.0.13 → 2.0.17
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/README.md +32 -35
- package/dist/app-launcher-element.global.js +6 -6
- package/dist/app-launcher-element.mjs +6 -6
- package/dist/index.css +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.app-launcher,.app-settings__overlay{--al-bg: #ffffff;--al-bg-hover: rgba(0, 0, 0, .04);--al-bg-focus: rgba(0, 0, 0, .08);--al-text: #3c4043;--al-text-secondary: #5f6368;--al-text-error: #d93025;--al-border: #e0e0e0;--al-shadow: 0 2px 10px rgba(0, 0, 0, .1), 0 8px 40px rgba(0, 0, 0, .2);--al-trigger-bg-hover: rgba(0, 0, 0, .08);--al-trigger-bg-focus: rgba(0, 0, 0, .12);--al-footer-bg: #fafafa;--al-scrollbar: #dadce0;--al-overlay-bg: rgba(0, 0, 0, .5);--al-primary: #4285F4;--al-primary-hover: #3367d6;--al-primary-text: #ffffff;position:relative;display:inline-flex;align-items:center}@media(prefers-color-scheme:dark){.app-launcher,.app-settings__overlay{--al-bg: #202124;--al-bg-hover: rgba(255, 255, 255, .08);--al-bg-focus: rgba(255, 255, 255, .12);--al-text: #e8eaed;--al-text-secondary: #9aa0a6;--al-text-error: #f28b82;--al-border: #3c4043;--al-shadow: 0 2px 10px rgba(0, 0, 0, .3), 0 8px 40px rgba(0, 0, 0, .5);--al-trigger-bg-hover: rgba(255, 255, 255, .1);--al-trigger-bg-focus: rgba(255, 255, 255, .15);--al-footer-bg: #292a2d;--al-scrollbar: #5f6368;--al-overlay-bg: rgba(0, 0, 0, .7);--al-primary: #8ab4f8;--al-primary-hover: #aecbfa;--al-primary-text: #202124}}html.dark .app-launcher,:root.dark .app-launcher,.dark .app-launcher,.app-launcher.app-launcher--dark,html.dark .app-settings__overlay,:root.dark .app-settings__overlay,.dark .app-settings__overlay{--al-bg: #202124;--al-bg-hover: rgba(255, 255, 255, .08);--al-bg-focus: rgba(255, 255, 255, .12);--al-text: #e8eaed;--al-text-secondary: #9aa0a6;--al-text-error: #f28b82;--al-border: #3c4043;--al-shadow: 0 2px 10px rgba(0, 0, 0, .3), 0 8px 40px rgba(0, 0, 0, .5);--al-trigger-bg-hover: rgba(255, 255, 255, .1);--al-trigger-bg-focus: rgba(255, 255, 255, .15);--al-footer-bg: #292a2d;--al-scrollbar: #5f6368;--al-overlay-bg: rgba(0, 0, 0, .7);--al-primary: #8ab4f8;--al-primary-hover: #aecbfa;--al-primary-text: #202124}.app-launcher__trigger{all:revert;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border:none;padding:0;margin:0;background:transparent;border-radius:50%;cursor:pointer;transition:background-color .2s ease}.app-launcher__trigger:hover{background-color:var(--al-trigger-bg-hover)}.app-launcher__trigger:focus{outline:none;background-color:var(--al-trigger-bg-focus)}.app-launcher__trigger-icon{box-sizing:border-box;display:block;font-size:24px;width:1em;height:1em;margin:0;padding:0;background:transparent;color:var(--al-text-secondary)}.app-launcher__dropdown{position:absolute;top:calc(100% + 8px);right:0;width:336px;max-height:70vh;overflow-y:auto;background-color:var(--al-bg);border-radius:8px;box-shadow:var(--al-shadow);z-index:9999;animation:app-launcher-slide-in .15s ease-out}@keyframes app-launcher-slide-in{0%{opacity:0;transform:translateY(-8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.app-launcher__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;padding:16px 8px}.app-launcher__item{all:revert;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px 8px;margin:0;width:100%;border:none;background:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease;min-height:90px;font-family:inherit;color:inherit}.app-launcher__item:hover{background-color:var(--al-bg-hover)}.app-launcher__item:focus{outline:none;background-color:var(--al-bg-focus)}.app-launcher__icon-wrapper{display:flex;align-items:center;justify-content:center;width:48px;height:48px;margin-bottom:8px}.app-launcher__icon{box-sizing:border-box;display:block;font-size:32px;width:1em;height:1em;margin:0;padding:0;background:transparent;transition:transform .15s ease}.app-launcher__item:hover .app-launcher__icon{transform:scale(1.1)}.app-launcher__icon--custom{width:32px;height:32px;object-fit:contain}.app-launcher__icon--svg{width:32px;height:32px;mask-size:contain;mask-repeat:no-repeat;mask-position:center;-webkit-mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-position:center}.app-launcher__name{font-family:Google Sans,Roboto,-apple-system,BlinkMacSystemFont,sans-serif;font-size:13px;font-weight:400;color:var(--al-text);text-align:center;line-height:1.3;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.app-launcher__loading,.app-launcher__error{padding:24px;text-align:center;font-size:14px;color:var(--al-text-secondary)}.app-launcher__error{color:var(--al-text-error)}.app-launcher__dropdown::-webkit-scrollbar,.app-settings__content::-webkit-scrollbar{width:8px}.app-launcher__dropdown::-webkit-scrollbar-track,.app-settings__content::-webkit-scrollbar-track{background:transparent}.app-launcher__dropdown::-webkit-scrollbar-thumb,.app-settings__content::-webkit-scrollbar-thumb{background-color:var(--al-scrollbar);border-radius:4px}.app-launcher__footer{display:flex;justify-content:center;padding:12px 16px;border-top:1px solid var(--al-border);background:var(--al-footer-bg)}@media(max-width:400px){.app-launcher__dropdown{width:280px;right:-8px}.app-launcher__icon-wrapper{width:40px;height:40px}.app-launcher__icon{font-size:28px}.app-launcher__name{font-size:12px}}.app-settings__overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--al-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:2147483647;animation:app-settings-fade-in .15s ease-out;color:var(--al-text)}.app-settings__overlay svg{width:1em;height:1em;margin:0;padding:0;display:block}@keyframes app-settings-fade-in{0%{opacity:0}to{opacity:1}}.app-settings__modal{position:relative;width:100%;max-width:480px;max-height:85vh;margin:20px;background:var(--al-bg);border-radius:16px;box-shadow:var(--al-shadow);display:flex;flex-direction:column;animation:app-settings-slide-up .2s ease-out;overflow:hidden}@keyframes app-settings-slide-up{0%{opacity:0;transform:translateY(20px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.app-settings__header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--al-border);background:var(--al-bg);min-height:36px;flex-shrink:0}.app-settings__title{font-size:18px;font-weight:600;color:var(--al-text);margin:0;font-family:Google Sans,Roboto,sans-serif}.app-settings__close-button{display:flex;align-items:center;justify-content:center;padding:0;width:36px;height:36px;font-size:20px;border:none;background:transparent;border-radius:50%;cursor:pointer;color:var(--al-text-secondary);transition:background .2s}.app-settings__close-button:hover{background:var(--al-bg-hover)}.app-settings__content{flex:1;overflow-y:auto;padding:24px}.app-settings__add-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:14px;border:2px dashed var(--al-border);border-radius:12px;background:transparent;font-size:14px;font-weight:500;color:var(--al-text-secondary);cursor:pointer;transition:all .2s;margin-bottom:24px;font-family:inherit}.app-settings__add-button:hover{border-color:var(--al-primary);color:var(--al-primary);background:var(--al-bg-hover)}.app-settings__add-icon{font-size:16px}.app-settings__list{margin-bottom:16px}.app-settings__section-title{font-size:13px;font-weight:600;color:var(--al-text-secondary);text-transform:uppercase;letter-spacing:.5px;margin-bottom:12px;font-family:inherit}.app-settings__empty-message{text-align:center;color:var(--al-text-secondary);font-size:14px;padding:24px;background:var(--al-bg-hover);border-radius:8px}.app-settings__grid{display:flex;flex-direction:column;gap:8px}.app-settings__card{display:flex;align-items:center;justify-content:space-between;padding:12px;background:var(--al-bg-hover);border-radius:12px;transition:background .2s}.app-settings__card:hover{background:var(--al-bg-focus)}.app-settings__card-info{display:flex;align-items:center;gap:12px;min-width:0;flex:1}.app-settings__card-icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;font-size:20px;flex-shrink:0}.app-settings__card-details{display:flex;flex-direction:column;min-width:0}.app-settings__card-name{font-size:14px;font-weight:500;color:var(--al-text);font-family:inherit}.app-settings__card-url{font-size:12px;color:var(--al-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:inherit}.app-settings__card-actions{display:flex;gap:4px}.app-settings__action-button{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:8px;cursor:pointer;color:var(--al-text-secondary);transition:all .15s}.app-settings__action-button:hover{background:var(--al-bg-focus);color:var(--al-text)}.app-settings__action-button--delete:hover{background:#d930251a;color:var(--al-text-error)}.app-settings__export-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px;margin-bottom:16px;border:1px solid #34A853;border-radius:8px;background:#e6f4ea;font-size:14px;font-weight:500;color:#137333;cursor:pointer;transition:all .2s;font-family:inherit}@media(prefers-color-scheme:dark){.app-settings__export-button{background:#34a85333;color:#81c995;border-color:#81c995}}.app-settings__export-button:hover{background:#ceead6;border-color:#137333}@media(prefers-color-scheme:dark){.app-settings__export-button:hover{background:#34a8534d}}.app-settings__export-icon{font-size:14px}.app-settings__info{padding:12px;background:#e8f0fe;border-radius:8px;font-size:13px;color:#1967d2}@media(prefers-color-scheme:dark){.app-settings__info{background:#8ab4f833;color:#8ab4f8}}.app-settings__info p{margin:0;font-family:inherit}.app-launcher-form{display:flex;flex-direction:column;gap:16px}.app-launcher-form__preview{display:flex;flex-direction:column;align-items:center;gap:8px;padding:20px;background:var(--al-bg-hover);border-radius:12px;margin-bottom:8px}.app-launcher-form__preview-icon{display:flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:16px}.app-launcher-form__preview-name{font-size:14px;font-weight:500;color:var(--al-text);font-family:inherit}.app-launcher-form__field{display:flex;flex-direction:column;gap:6px}.app-launcher-form__label{font-size:13px;font-weight:500;color:var(--al-text-secondary);font-family:inherit}.app-launcher-form__input{padding:10px 12px;border:1px solid var(--al-border);border-radius:8px;font-size:14px;outline:none;background:transparent;color:var(--al-text);transition:border-color .2s;font-family:inherit}.app-launcher-form__input:focus{border-color:var(--al-primary)}.app-launcher-form__input--error{border-color:var(--al-text-error)}.app-launcher-form__error{font-size:12px;color:var(--al-text-error);font-family:inherit}.app-launcher-form__color-picker{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.app-launcher-form__color-button{width:28px;height:28px;padding:0;font-size:20px;border:2px solid transparent;border-radius:50%;cursor:pointer;transition:transform .15s,border-color .15s}.app-launcher-form__color-button:hover{transform:scale(1.15)}.app-launcher-form__color-button--selected{border-color:var(--al-text)}.app-launcher-form__color-input{width:28px;height:28px;border:none;border-radius:50%;cursor:pointer;padding:0;background:none}.app-launcher-form__color-input::-webkit-color-swatch-wrapper{padding:0}.app-launcher-form__color-input::-webkit-color-swatch{border:1px dashed var(--al-text-secondary);border-radius:50%}.app-launcher-form__actions{display:flex;justify-content:flex-end;gap:12px;padding-top:8px;border-top:1px solid var(--al-border)}.app-launcher-form__button{padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;font-family:inherit}.app-launcher-form__button--cancel{border:1px solid var(--al-border);background:var(--al-bg);color:var(--al-text-secondary)}.app-launcher-form__button--cancel:hover{background:var(--al-bg-hover)}.app-launcher-form__button--submit{border:none;background:var(--al-primary);color:var(--al-primary-text)}.app-launcher-form__button--submit:hover{background:var(--al-primary-hover)}.app-launcher-form__icon-mode{display:flex;gap:8px;margin-bottom:12px}.app-launcher-form__mode-button{flex:1;padding:8px 12px;border:1px solid var(--al-border);border-radius:6px;background:var(--al-bg);font-size:13px;font-weight:500;color:var(--al-text-secondary);cursor:pointer;transition:all .2s;font-family:inherit}.app-launcher-form__mode-button:hover{background:var(--al-bg-hover)}.app-launcher-form__mode-button--active{background:#4285f41a;border-color:var(--al-primary);color:var(--al-primary)}.app-launcher-form__custom-icon{display:flex;flex-direction:column;gap:6px}.app-launcher-form__hint{font-size:12px;color:var(--al-text-secondary);margin:0;font-family:inherit}.app-launcher-form__preview-svg{width:32px;height:32px;mask-size:contain;mask-repeat:no-repeat;mask-position:center;-webkit-mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-position:center}.app-launcher-form__preview-img{width:32px;height:32px;object-fit:contain}.app-launcher-icon-picker{width:100%}.app-launcher-icon-picker__search{width:100%;padding:10px 12px;border:1px solid var(--al-border);border-radius:8px;font-size:14px;outline:none;background:transparent;color:var(--al-text);transition:border-color .2s;margin-bottom:12px;font-family:inherit}.app-launcher-icon-picker__search:focus{border-color:var(--al-primary)}.app-launcher-icon-picker__grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;max-height:200px;overflow-y:auto;padding:4px}.app-launcher-icon-picker__button{display:flex;align-items:center;justify-content:center;padding:0;font-size:20px;width:40px;height:40px;border:2px solid transparent;border-radius:8px;background:var(--al-bg-hover);cursor:pointer;transition:all .15s}.app-launcher-icon-picker__button:hover{background:var(--al-bg-focus);transform:scale(1.1)}.app-launcher-icon-picker__button--selected{border-color:var(--al-primary);background:#4285f41a}.app-launcher-icon-picker__icon{font-size:20px;color:var(--al-text-secondary)}.app-launcher-icon-picker__button--selected .app-launcher-icon-picker__icon{color:var(--al-primary)}.app-launcher-icon-picker__empty{text-align:center;color:var(--al-text-secondary);font-size:14px;padding:20px;font-family:inherit}.app-launcher-icon-picker__grid::-webkit-scrollbar{width:6px}.app-launcher-icon-picker__grid::-webkit-scrollbar-track{background:transparent}.app-launcher-icon-picker__grid::-webkit-scrollbar-thumb{background-color:var(--al-scrollbar);border-radius:3px}
|
|
1
|
+
.app-launcher,.app-settings__overlay{--al-bg: #ffffff;--al-bg-hover: rgba(0, 0, 0, .04);--al-bg-focus: rgba(0, 0, 0, .08);--al-text: #3c4043;--al-text-secondary: #5f6368;--al-text-error: #d93025;--al-border: #e0e0e0;--al-shadow: 0 2px 10px rgba(0, 0, 0, .1), 0 8px 40px rgba(0, 0, 0, .2);--al-trigger-bg-hover: rgba(0, 0, 0, .08);--al-trigger-bg-focus: rgba(0, 0, 0, .12);--al-footer-bg: #fafafa;--al-scrollbar: #dadce0;--al-overlay-bg: rgba(0, 0, 0, .5);--al-primary: #4285F4;--al-primary-hover: #3367d6;--al-primary-text: #ffffff;position:relative;display:inline-flex;align-items:center}@media(prefers-color-scheme:dark){.app-launcher,.app-settings__overlay{--al-bg: #202124;--al-bg-hover: rgba(255, 255, 255, .08);--al-bg-focus: rgba(255, 255, 255, .12);--al-text: #e8eaed;--al-text-secondary: #9aa0a6;--al-text-error: #f28b82;--al-border: #3c4043;--al-shadow: 0 2px 10px rgba(0, 0, 0, .3), 0 8px 40px rgba(0, 0, 0, .5);--al-trigger-bg-hover: rgba(255, 255, 255, .1);--al-trigger-bg-focus: rgba(255, 255, 255, .15);--al-footer-bg: #292a2d;--al-scrollbar: #5f6368;--al-overlay-bg: rgba(0, 0, 0, .7);--al-primary: #8ab4f8;--al-primary-hover: #aecbfa;--al-primary-text: #202124}}html.dark .app-launcher,:root.dark .app-launcher,.dark .app-launcher,.app-launcher.app-launcher--dark,html.dark .app-settings__overlay,:root.dark .app-settings__overlay,.dark .app-settings__overlay{--al-bg: #202124;--al-bg-hover: rgba(255, 255, 255, .08);--al-bg-focus: rgba(255, 255, 255, .12);--al-text: #e8eaed;--al-text-secondary: #9aa0a6;--al-text-error: #f28b82;--al-border: #3c4043;--al-shadow: 0 2px 10px rgba(0, 0, 0, .3), 0 8px 40px rgba(0, 0, 0, .5);--al-trigger-bg-hover: rgba(255, 255, 255, .1);--al-trigger-bg-focus: rgba(255, 255, 255, .15);--al-footer-bg: #292a2d;--al-scrollbar: #5f6368;--al-overlay-bg: rgba(0, 0, 0, .7);--al-primary: #8ab4f8;--al-primary-hover: #aecbfa;--al-primary-text: #202124}.app-launcher__trigger{all:revert;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border:none;padding:0;margin:0;background:transparent;border-radius:50%;cursor:pointer;transition:background-color .2s ease}.app-launcher__trigger:hover{background-color:var(--al-trigger-bg-hover)}.app-launcher__trigger:focus{outline:none;background-color:var(--al-trigger-bg-focus)}.app-launcher__trigger-icon{box-sizing:border-box;display:block;font-size:24px;width:1em;height:1em;margin:0;padding:0;background:transparent;color:var(--al-text-secondary)}.app-launcher__dropdown{position:absolute;top:calc(100% + 8px);right:0;width:336px;max-height:70vh;overflow-y:auto;background-color:var(--al-bg);border-radius:8px;box-shadow:var(--al-shadow);z-index:9999;animation:app-launcher-slide-in .15s ease-out}@keyframes app-launcher-slide-in{0%{opacity:0;transform:translateY(-8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.app-launcher__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;padding:16px 8px}.app-launcher__item{all:revert;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px 8px;margin:0;width:100%;border:none;background:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease;min-height:90px;font-family:inherit;color:inherit}.app-launcher__item:hover{background-color:var(--al-bg-hover)}.app-launcher__item:focus{outline:none;background-color:var(--al-bg-focus)}.app-launcher__icon-wrapper{display:flex;align-items:center;justify-content:center;width:48px;height:48px;margin-bottom:8px}.app-launcher__icon{box-sizing:border-box;display:block;font-size:32px;width:1em;height:1em;margin:0;padding:0;background:transparent;transition:transform .15s ease}.app-launcher__item:hover .app-launcher__icon{transform:scale(1.1)}.app-launcher__icon--custom{width:32px;height:32px;object-fit:contain}.app-launcher__icon--svg{width:32px;height:32px;mask-size:contain;mask-repeat:no-repeat;mask-position:center;-webkit-mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-position:center}.app-launcher__name{font-family:Google Sans,Roboto,-apple-system,BlinkMacSystemFont,sans-serif;font-size:13px;font-weight:400;color:var(--al-text);text-align:center;line-height:1.3;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.app-launcher__loading,.app-launcher__error{padding:24px;text-align:center;font-size:14px;color:var(--al-text-secondary)}.app-launcher__error{color:var(--al-text-error)}.app-launcher__dropdown::-webkit-scrollbar,.app-settings__content::-webkit-scrollbar{width:8px}.app-launcher__dropdown::-webkit-scrollbar-track,.app-settings__content::-webkit-scrollbar-track{background:transparent}.app-launcher__dropdown::-webkit-scrollbar-thumb,.app-settings__content::-webkit-scrollbar-thumb{background-color:var(--al-scrollbar);border-radius:4px}.app-launcher__footer{display:flex;justify-content:center;padding:12px 16px;border-top:1px solid var(--al-border);background:var(--al-footer-bg)}@media(max-width:400px){.app-launcher__dropdown{width:280px;right:-8px}.app-launcher__icon-wrapper{width:40px;height:40px}.app-launcher__icon{font-size:28px}.app-launcher__name{font-size:12px}}.app-settings__overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--al-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:2147483647;animation:app-settings-fade-in .15s ease-out;color:var(--al-text)}.app-settings__overlay svg{width:1em;height:1em;margin:0;padding:0;display:block}@keyframes app-settings-fade-in{0%{opacity:0}to{opacity:1}}.app-settings__modal{position:relative;width:100%;max-width:480px;max-height:85vh;margin:20px;background:var(--al-bg);border-radius:16px;box-shadow:var(--al-shadow);display:flex;flex-direction:column;animation:app-settings-slide-up .2s ease-out;overflow:hidden}@keyframes app-settings-slide-up{0%{opacity:0;transform:translateY(20px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.app-settings__header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--al-border);background:var(--al-bg);min-height:36px;flex-shrink:0}.app-settings__title{font-size:18px;font-weight:600;color:var(--al-text);margin:0;font-family:Google Sans,Roboto,sans-serif}.app-settings__close-button{display:flex;align-items:center;justify-content:center;padding:0;width:36px;height:36px;font-size:20px;border:none;background:transparent;border-radius:50%;cursor:pointer;color:var(--al-text-secondary);transition:background .2s}.app-settings__close-button:hover{background:var(--al-bg-hover)}.app-settings__content{flex:1;overflow-y:auto;padding:24px}.app-settings__add-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:14px;border:2px dashed var(--al-border);border-radius:12px;background:transparent;font-size:14px;font-weight:500;color:var(--al-text-secondary);cursor:pointer;transition:all .2s;margin-bottom:24px;font-family:inherit}.app-settings__add-button:hover{border-color:var(--al-primary);color:var(--al-primary);background:var(--al-bg-hover)}.app-settings__add-icon{font-size:16px}.app-settings__list{margin-bottom:16px}.app-settings__section-title{font-size:13px;font-weight:600;color:var(--al-text-secondary);text-transform:uppercase;letter-spacing:.5px;margin-bottom:12px;font-family:inherit}.app-settings__empty-message{text-align:center;color:var(--al-text-secondary);font-size:14px;padding:24px;background:var(--al-bg-hover);border-radius:8px}.app-settings__grid{display:flex;flex-direction:column;gap:8px}.app-settings__card{display:flex;align-items:center;justify-content:space-between;padding:12px;background:var(--al-bg-hover);border-radius:12px;transition:background .2s}.app-settings__card:hover{background:var(--al-bg-focus)}.app-settings__card-info{display:flex;align-items:center;gap:12px;min-width:0;flex:1}.app-settings__card-icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;font-size:20px;flex-shrink:0}.app-settings__card-details{display:flex;flex-direction:column;min-width:0}.app-settings__card-name{font-size:14px;font-weight:500;color:var(--al-text);font-family:inherit}.app-settings__card-url{font-size:12px;color:var(--al-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:inherit}.app-settings__card-actions{display:flex;padding:0;gap:4px}.app-settings__action-button{display:flex;padding:0;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:8px;cursor:pointer;color:var(--al-text-secondary);transition:all .15s}.app-settings__action-button:hover{background:var(--al-bg-focus);color:var(--al-text)}.app-settings__action-button--delete:hover{background:#d930251a;color:var(--al-text-error)}.app-settings__export-button{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px;margin-bottom:16px;border:1px solid #34A853;border-radius:8px;background:#e6f4ea;font-size:14px;font-weight:500;color:#137333;cursor:pointer;transition:all .2s;font-family:inherit}@media(prefers-color-scheme:dark){.app-settings__export-button{background:#34a85333;color:#81c995;border-color:#81c995}}.app-settings__export-button:hover{background:#ceead6;border-color:#137333}@media(prefers-color-scheme:dark){.app-settings__export-button:hover{background:#34a8534d}}.app-settings__export-icon{font-size:14px}.app-settings__info{padding:12px;background:#e8f0fe;border-radius:8px;font-size:13px;color:#1967d2}@media(prefers-color-scheme:dark){.app-settings__info{background:#8ab4f833;color:#8ab4f8}}.app-settings__info p{margin:0;font-family:inherit}.app-launcher-form{display:flex;flex-direction:column;gap:16px}.app-launcher-form__preview{display:flex;flex-direction:column;align-items:center;gap:8px;padding:20px;background:var(--al-bg-hover);border-radius:12px;margin-bottom:8px}.app-launcher-form__preview-icon{display:flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:16px}.app-launcher-form__preview-name{font-size:14px;font-weight:500;color:var(--al-text);font-family:inherit}.app-launcher-form__field{display:flex;flex-direction:column;gap:6px}.app-launcher-form__label{font-size:13px;font-weight:500;color:var(--al-text-secondary);font-family:inherit}.app-launcher-form__input{padding:10px 12px;border:1px solid var(--al-border);border-radius:8px;font-size:14px;outline:none;background:transparent;color:var(--al-text);transition:border-color .2s;font-family:inherit}.app-launcher-form__input:focus{border-color:var(--al-primary)}.app-launcher-form__input--error{border-color:var(--al-text-error)}.app-launcher-form__error{font-size:12px;color:var(--al-text-error);font-family:inherit}.app-launcher-form__color-picker{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.app-launcher-form__color-button{width:28px;height:28px;padding:0;font-size:20px;border:2px solid transparent;border-radius:50%;cursor:pointer;transition:transform .15s,border-color .15s}.app-launcher-form__color-button:hover{transform:scale(1.15)}.app-launcher-form__color-button--selected{border-color:var(--al-text)}.app-launcher-form__color-input{width:28px;height:28px;border:none;border-radius:50%;cursor:pointer;padding:0;background:none}.app-launcher-form__color-input::-webkit-color-swatch-wrapper{padding:0}.app-launcher-form__color-input::-webkit-color-swatch{border:1px dashed var(--al-text-secondary);border-radius:50%}.app-launcher-form__actions{display:flex;justify-content:flex-end;gap:12px;padding-top:8px;border-top:1px solid var(--al-border)}.app-launcher-form__button{padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;font-family:inherit}.app-launcher-form__button--cancel{border:1px solid var(--al-border);background:var(--al-bg);color:var(--al-text-secondary)}.app-launcher-form__button--cancel:hover{background:var(--al-bg-hover)}.app-launcher-form__button--submit{border:none;background:var(--al-primary);color:var(--al-primary-text)}.app-launcher-form__button--submit:hover{background:var(--al-primary-hover)}.app-launcher-form__icon-mode{display:flex;gap:8px;margin-bottom:12px}.app-launcher-form__mode-button{flex:1;padding:8px 12px;border:1px solid var(--al-border);border-radius:6px;background:var(--al-bg);font-size:13px;font-weight:500;color:var(--al-text-secondary);cursor:pointer;transition:all .2s;font-family:inherit}.app-launcher-form__mode-button:hover{background:var(--al-bg-hover)}.app-launcher-form__mode-button--active{background:#4285f41a;border-color:var(--al-primary);color:var(--al-primary)}.app-launcher-form__custom-icon{display:flex;flex-direction:column;gap:6px}.app-launcher-form__hint{font-size:12px;color:var(--al-text-secondary);margin:0;font-family:inherit}.app-launcher-form__preview-svg{width:32px;height:32px;mask-size:contain;mask-repeat:no-repeat;mask-position:center;-webkit-mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-position:center}.app-launcher-form__preview-img{width:32px;height:32px;object-fit:contain}.app-launcher-icon-picker{width:100%}.app-launcher-icon-picker__search{width:100%;padding:10px 12px;border:1px solid var(--al-border);border-radius:8px;font-size:14px;outline:none;background:transparent;color:var(--al-text);transition:border-color .2s;margin-bottom:12px;font-family:inherit}.app-launcher-icon-picker__search:focus{border-color:var(--al-primary)}.app-launcher-icon-picker__grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;max-height:200px;overflow-y:auto;padding:4px}.app-launcher-icon-picker__button{display:flex;align-items:center;justify-content:center;padding:0;font-size:20px;width:40px;height:40px;border:2px solid transparent;border-radius:8px;background:var(--al-bg-hover);cursor:pointer;transition:all .15s}.app-launcher-icon-picker__button:hover{background:var(--al-bg-focus);transform:scale(1.1)}.app-launcher-icon-picker__button--selected{border-color:var(--al-primary);background:#4285f41a}.app-launcher-icon-picker__icon{font-size:20px;color:var(--al-text-secondary)}.app-launcher-icon-picker__button--selected .app-launcher-icon-picker__icon{color:var(--al-primary)}.app-launcher-icon-picker__empty{text-align:center;color:var(--al-text-secondary);font-size:14px;padding:20px;font-family:inherit}.app-launcher-icon-picker__grid::-webkit-scrollbar{width:6px}.app-launcher-icon-picker__grid::-webkit-scrollbar-track{background:transparent}.app-launcher-icon-picker__grid::-webkit-scrollbar-thumb{background-color:var(--al-scrollbar);border-radius:3px}
|
package/dist/index.d.mts
CHANGED
|
@@ -54,6 +54,14 @@ interface AppLauncherProps {
|
|
|
54
54
|
* Used by admin app to add settings functionality
|
|
55
55
|
*/
|
|
56
56
|
renderFooter?: () => React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Optional key for localStorage to save and load custom apps
|
|
59
|
+
*/
|
|
60
|
+
storageKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* If true, shows the Settings button and AppSettings modal for managing custom apps
|
|
63
|
+
*/
|
|
64
|
+
allowCustomApps?: boolean;
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
67
|
* Internal app representation with resolved icon
|
|
@@ -79,7 +87,7 @@ interface ResolvedApp {
|
|
|
79
87
|
* // With direct apps array
|
|
80
88
|
* <AppLauncher apps={[{ id: '1', name: 'App', url: '/app', icon: 'FaRocket', color: '#4285F4' }]} />
|
|
81
89
|
*/
|
|
82
|
-
declare function AppLauncher({ configUrl, apps: propApps, className, onAppClick, renderFooter, }: AppLauncherProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare function AppLauncher({ configUrl, apps: propApps, className, onAppClick, renderFooter, storageKey, allowCustomApps, }: AppLauncherProps): react_jsx_runtime.JSX.Element;
|
|
83
91
|
|
|
84
92
|
/**
|
|
85
93
|
* Map of icon names to icon components
|
|
@@ -99,7 +107,7 @@ interface AppSettingsProps {
|
|
|
99
107
|
onUpdate: (id: string, app: Partial<Omit<AppItem, 'id'>>) => void;
|
|
100
108
|
onDelete: (id: string) => void;
|
|
101
109
|
}
|
|
102
|
-
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps):
|
|
110
|
+
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps): react_jsx_runtime.JSX.Element | null;
|
|
103
111
|
|
|
104
112
|
interface LocalAppLauncherProps {
|
|
105
113
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,14 @@ interface AppLauncherProps {
|
|
|
54
54
|
* Used by admin app to add settings functionality
|
|
55
55
|
*/
|
|
56
56
|
renderFooter?: () => React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Optional key for localStorage to save and load custom apps
|
|
59
|
+
*/
|
|
60
|
+
storageKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* If true, shows the Settings button and AppSettings modal for managing custom apps
|
|
63
|
+
*/
|
|
64
|
+
allowCustomApps?: boolean;
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
67
|
* Internal app representation with resolved icon
|
|
@@ -79,7 +87,7 @@ interface ResolvedApp {
|
|
|
79
87
|
* // With direct apps array
|
|
80
88
|
* <AppLauncher apps={[{ id: '1', name: 'App', url: '/app', icon: 'FaRocket', color: '#4285F4' }]} />
|
|
81
89
|
*/
|
|
82
|
-
declare function AppLauncher({ configUrl, apps: propApps, className, onAppClick, renderFooter, }: AppLauncherProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare function AppLauncher({ configUrl, apps: propApps, className, onAppClick, renderFooter, storageKey, allowCustomApps, }: AppLauncherProps): react_jsx_runtime.JSX.Element;
|
|
83
91
|
|
|
84
92
|
/**
|
|
85
93
|
* Map of icon names to icon components
|
|
@@ -99,7 +107,7 @@ interface AppSettingsProps {
|
|
|
99
107
|
onUpdate: (id: string, app: Partial<Omit<AppItem, 'id'>>) => void;
|
|
100
108
|
onDelete: (id: string) => void;
|
|
101
109
|
}
|
|
102
|
-
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps):
|
|
110
|
+
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps): react_jsx_runtime.JSX.Element | null;
|
|
103
111
|
|
|
104
112
|
interface LocalAppLauncherProps {
|
|
105
113
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var ne=(i,l)=>{for(var u in l)T(i,u,{get:l[u],enumerable:!0})},ie=(i,l,u,x)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of te(l))!oe.call(i,c)&&c!==u&&T(i,c,{get:()=>l[c],enumerable:!(x=re(l,c))||x.enumerable});return i};var pe=i=>ie(T({},"__esModule",{value:!0}),i);var ce={};ne(ce,{AppLauncher:()=>E,AppSettings:()=>W,LocalAppLauncher:()=>Z,default:()=>E,getIcon:()=>O,iconMap:()=>k});module.exports=pe(ce);var w=require("react"),H=require("react-icons/io5");var e=require("react-icons/fa"),G=require("react-icons/fa6"),q=require("react-icons/gr"),M=require("react-icons/io5"),A=require("react-icons/md"),U=require("react-icons/si"),Y=require("react-icons/ai"),k={FaBriefcase:e.FaBriefcase,IoBusinessSharp:M.IoBusinessSharp,MdWork:A.MdWork,FaGraduationCap:e.FaGraduationCap,MdOutlineSecurity:A.MdOutlineSecurity,FaLock:e.FaLock,FaKey:e.FaKey,AiOutlineSecurityScan:Y.AiOutlineSecurityScan,FaEnvelope:e.FaEnvelope,MdEmail:A.MdEmail,FaBell:e.FaBell,FaYoutube:e.FaYoutube,FaMusic:e.FaMusic,FaCamera:e.FaCamera,FaImage:e.FaImage,FaGamepad:e.FaGamepad,FaCalendarAlt:e.FaCalendarAlt,FaClipboard:e.FaClipboard,FaCalculator:e.FaCalculator,FaFolder:e.FaFolder,FaFile:e.FaFile,FaBookmark:e.FaBookmark,FaTable:e.FaTable,FaNewspaper:e.FaNewspaper,FaMapMarkerAlt:e.FaMapMarkerAlt,FaGlobe:e.FaGlobe,FaHome:e.FaHome,FaGoogle:e.FaGoogle,SiGoogledrive:U.SiGoogledrive,SiGooglemeet:U.SiGooglemeet,FaCode:e.FaCode,FaTerminal:e.FaTerminal,FaDatabase:e.FaDatabase,FaPuzzlePiece:e.FaPuzzlePiece,FaChartBar:e.FaChartBar,MdDashboard:A.MdDashboard,MdAnalytics:A.MdAnalytics,FaShoppingCart:e.FaShoppingCart,FaGift:e.FaGift,FaTicketSimple:G.FaTicketSimple,FaPlane:e.FaPlane,FaCar:e.FaCar,FaBicycle:e.FaBicycle,GrDeliver:q.GrDeliver,FaUtensils:e.FaUtensils,FaCoffee:e.FaCoffee,FaRocket:e.FaRocket,FaUser:e.FaUser,FaCog:e.FaCog,FaHeart:e.FaHeart,FaStar:e.FaStar,IoApps:M.IoApps};function O(i){return k[i]||e.FaRocket}var h=require("react/jsx-runtime");function E({configUrl:i,apps:l,className:u,onAppClick:x,renderFooter:c}){let[n,m]=(0,w.useState)(!1),[I,v]=(0,w.useState)([]),[g,y]=(0,w.useState)(!1),[F,d]=(0,w.useState)(null),C=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(l){v(l.map(f));return}i&&(y(!0),d(null),fetch(i).then(a=>{if(!a.ok)throw new Error(`Failed to fetch: ${a.status}`);return a.json()}).then(a=>{v(a.apps.map(f))}).catch(a=>{d(a.message),console.error("AppLauncher: Failed to load config",a)}).finally(()=>y(!1)))},[i,l]),(0,w.useEffect)(()=>{function a(_){C.current&&!C.current.contains(_.target)&&m(!1)}return n&&document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]),(0,w.useEffect)(()=>{function a(_){_.key==="Escape"&&m(!1)}return n&&document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[n]);function p(a){return a.startsWith("/")||a.startsWith("http")}function f(a){let _=p(a.icon);return{id:a.id,name:a.name,url:a.url,icon:_?null:O(a.icon),customIconUrl:_?a.icon:null,color:a.color,description:a.description}}function r(a){x?x({id:a.id,name:a.name,url:a.url,icon:a.customIconUrl||(a.icon?.name??"FaRocket"),color:a.color,description:a.description}):window.open(a.url,"_blank","noopener,noreferrer")}return(0,h.jsxs)("div",{className:`app-launcher ${u||""}`,ref:C,children:[(0,h.jsx)("button",{className:"app-launcher__trigger",onClick:()=>m(!n),"aria-label":"Open app launcher","aria-expanded":n,title:"Open app launcher",children:(0,h.jsx)(H.IoApps,{className:"app-launcher__trigger-icon"})}),n&&(0,h.jsxs)("div",{className:"app-launcher__dropdown",children:[g&&(0,h.jsx)("div",{className:"app-launcher__loading",children:"Loading..."}),F&&(0,h.jsx)("div",{className:"app-launcher__error",children:F}),!g&&!F&&(0,h.jsx)("div",{className:"app-launcher__grid",children:I.map(a=>(0,h.jsxs)("button",{className:"app-launcher__item",onClick:()=>r(a),title:a.description||a.name,children:[(0,h.jsx)("div",{className:"app-launcher__icon-wrapper",children:a.customIconUrl?a.customIconUrl.endsWith(".svg")?(0,h.jsx)("div",{className:"app-launcher__icon app-launcher__icon--svg",style:{maskImage:`url(${a.customIconUrl})`,WebkitMaskImage:`url(${a.customIconUrl})`,backgroundColor:a.color==="transparent"?"#5f6368":a.color},"aria-label":a.name}):(0,h.jsx)("img",{src:a.customIconUrl,alt:a.name,className:"app-launcher__icon app-launcher__icon--custom"}):a.icon?(0,h.jsx)(a.icon,{className:"app-launcher__icon",style:{color:a.color}}):null}),(0,h.jsx)("span",{className:"app-launcher__name",children:a.name})]},a.id))}),c&&(0,h.jsx)("div",{className:"app-launcher__footer",children:c()})]})]})}var $=require("react"),V=require("react-dom"),N=require("react-icons/fa");var S=require("react");var J=require("react");var z=require("react/jsx-runtime"),se=Object.keys(k);function K({selectedIcon:i,onSelect:l}){let[u,x]=(0,J.useState)(""),c=se.filter(n=>n.toLowerCase().includes(u.toLowerCase()));return(0,z.jsxs)("div",{className:"app-launcher-icon-picker",children:[(0,z.jsx)("input",{type:"text",placeholder:"Search icons...",value:u,onChange:n=>x(n.target.value),className:"app-launcher-icon-picker__search"}),(0,z.jsx)("div",{className:"app-launcher-icon-picker__grid",children:c.map(n=>{let m=k[n];return(0,z.jsx)("button",{className:`app-launcher-icon-picker__button ${i===n?"app-launcher-icon-picker__button--selected":""}`,onClick:()=>l(n),title:n,type:"button",children:(0,z.jsx)(m,{className:"app-launcher-icon-picker__icon"})},n)})}),c.length===0&&(0,z.jsx)("div",{className:"app-launcher-icon-picker__empty",children:"No icons found"})]})}var t=require("react/jsx-runtime"),le=["#4285F4","#EA4335","#FBBC04","#34A853","#FF6D01","#46BDC6","#7B1FA2","#E91E63","#607D8B","#795548"];function B({initialData:i,onSubmit:l,onCancel:u,submitLabel:x="Add App"}){let[c,n]=(0,S.useState)(i?.name||""),[m,I]=(0,S.useState)(i?.url||""),v=i?.icon||"FaRocket",g=v.startsWith("/")||v.startsWith("http"),[y,F]=(0,S.useState)(g?"FaRocket":v),[d,C]=(0,S.useState)(g?v:""),[p,f]=(0,S.useState)(g?"custom":"picker"),[r,a]=(0,S.useState)(i?.color||"#4285F4"),[_,P]=(0,S.useState)(i?.description||""),[b,j]=(0,S.useState)({}),D=k[y]||k.FaRocket,ee=()=>{let s={};return c.trim()||(s.name="Name is required"),m.trim()?!m.startsWith("http://")&&!m.startsWith("https://")&&!m.startsWith("/")&&(s.url="URL must start with http://, https://, or /"):s.url="URL is required",p==="custom"&&d.trim()&&!d.startsWith("http://")&&!d.startsWith("https://")&&!d.startsWith("/")&&(s.customIconUrl="Icon URL must start with http://, https://, or /"),j(s),Object.keys(s).length===0};return(0,t.jsxs)("form",{onSubmit:s=>{if(s.preventDefault(),!ee())return;let ae=p==="custom"&&d.trim()?d.trim():y;l({name:c.trim(),url:m.trim(),icon:ae,color:r,description:_.trim()||void 0})},className:"app-launcher-form",children:[(0,t.jsxs)("div",{className:"app-launcher-form__preview",children:[(0,t.jsx)("div",{className:"app-launcher-form__preview-icon",style:{backgroundColor:r+"20"},children:p==="custom"&&d?d.endsWith(".svg")?(0,t.jsx)("div",{className:"app-launcher-form__preview-svg",style:{maskImage:`url(${d})`,WebkitMaskImage:`url(${d})`,backgroundColor:r==="transparent"?"#5f6368":r}}):(0,t.jsx)("img",{src:d,alt:"Icon preview",className:"app-launcher-form__preview-img"}):(0,t.jsx)(D,{style:{color:r,fontSize:32}})}),(0,t.jsx)("span",{className:"app-launcher-form__preview-name",children:c||"App Name"})]}),(0,t.jsxs)("div",{className:"app-launcher-form__field",children:[(0,t.jsx)("label",{htmlFor:"app-name",className:"app-launcher-form__label",children:"Name *"}),(0,t.jsx)("input",{id:"app-name",type:"text",value:c,onChange:s=>n(s.target.value),placeholder:"My App",className:`app-launcher-form__input ${b.name?"app-launcher-form__input--error":""}`}),b.name&&(0,t.jsx)("span",{className:"app-launcher-form__error",children:b.name})]}),(0,t.jsxs)("div",{className:"app-launcher-form__field",children:[(0,t.jsx)("label",{htmlFor:"app-url",className:"app-launcher-form__label",children:"URL *"}),(0,t.jsx)("input",{id:"app-url",type:"text",value:m,onChange:s=>I(s.target.value),placeholder:"https://myapp.com or /dashboard",className:`app-launcher-form__input ${b.url?"app-launcher-form__input--error":""}`}),b.url&&(0,t.jsx)("span",{className:"app-launcher-form__error",children:b.url})]}),(0,t.jsxs)("div",{className:"app-launcher-form__field",children:[(0,t.jsx)("label",{htmlFor:"app-description",className:"app-launcher-form__label",children:"Description"}),(0,t.jsx)("input",{id:"app-description",type:"text",value:_,onChange:s=>P(s.target.value),placeholder:"Optional description (shown on hover)",className:"app-launcher-form__input"})]}),(0,t.jsxs)("div",{className:"app-launcher-form__field",children:[(0,t.jsx)("label",{className:"app-launcher-form__label",children:"Color"}),(0,t.jsxs)("div",{className:"app-launcher-form__color-picker",children:[le.map(s=>(0,t.jsx)("button",{type:"button",className:`app-launcher-form__color-button ${r===s?"app-launcher-form__color-button--selected":""}`,style:{backgroundColor:s},onClick:()=>a(s),title:s},s)),(0,t.jsx)("input",{type:"color",value:r,onChange:s=>a(s.target.value),className:"app-launcher-form__color-input",title:"Custom color"})]})]}),(0,t.jsxs)("div",{className:"app-launcher-form__field",children:[(0,t.jsx)("label",{className:"app-launcher-form__label",children:"Icon"}),(0,t.jsxs)("div",{className:"app-launcher-form__icon-mode",children:[(0,t.jsx)("button",{type:"button",className:`app-launcher-form__mode-button ${p==="picker"?"app-launcher-form__mode-button--active":""}`,onClick:()=>f("picker"),children:"Icon Picker"}),(0,t.jsx)("button",{type:"button",className:`app-launcher-form__mode-button ${p==="custom"?"app-launcher-form__mode-button--active":""}`,onClick:()=>f("custom"),children:"Custom URL"})]}),p==="picker"?(0,t.jsx)(K,{selectedIcon:y,onSelect:F}):(0,t.jsxs)("div",{className:"app-launcher-form__custom-icon",children:[(0,t.jsx)("input",{id:"app-custom-icon",type:"text",value:d,onChange:s=>C(s.target.value),placeholder:"/icons/my-icon.svg or https://cdn.example.com/icon.svg",className:`app-launcher-form__input ${b.customIconUrl?"app-launcher-form__input--error":""}`}),b.customIconUrl&&(0,t.jsx)("span",{className:"app-launcher-form__error",children:b.customIconUrl}),(0,t.jsx)("p",{className:"app-launcher-form__hint",children:"Enter a path from your public folder (e.g., /icons/logo.svg) or a full URL"})]})]}),(0,t.jsxs)("div",{className:"app-launcher-form__actions",children:[(0,t.jsx)("button",{type:"button",onClick:u,className:"app-launcher-form__button app-launcher-form__button--cancel",children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:"app-launcher-form__button app-launcher-form__button--submit",children:x})]})]})}var o=require("react/jsx-runtime");function W({isOpen:i,onClose:l,apps:u,defaultApps:x=[],onAdd:c,onUpdate:n,onDelete:m}){let[I,v]=(0,$.useState)(!1),[g,y]=(0,$.useState)(null);if(!i)return null;let F=r=>{c(r),v(!1)},d=r=>{g&&(n(g.id,r),y(null))},C=r=>{confirm("Are you sure you want to delete this app?")&&m(r)},p=()=>{let r=[...u,...x.filter(j=>!u.some(D=>D.id===j.id))],a={version:"1.0",exportedAt:new Date().toISOString(),apps:r},_=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),P=URL.createObjectURL(_),b=document.createElement("a");b.href=P,b.download="app-launcher-config.json",document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(P)},f=(0,o.jsx)("div",{className:"app-settings__overlay",children:(0,o.jsxs)("div",{className:"app-settings__modal",onClick:r=>r.stopPropagation(),children:[(0,o.jsxs)("div",{className:"app-settings__header",children:[(0,o.jsx)("h2",{className:"app-settings__title",children:I?"Add New App":g?"Edit App":"Settings"}),(0,o.jsx)("button",{className:"app-settings__close-button",onClick:l,"aria-label":"Close",children:(0,o.jsx)(N.FaTimes,{})})]}),(0,o.jsx)("div",{className:"app-settings__content",children:I?(0,o.jsx)(B,{onSubmit:F,onCancel:()=>v(!1),submitLabel:"Add App"}):g?(0,o.jsx)(B,{initialData:g,onSubmit:d,onCancel:()=>y(null),submitLabel:"Save Changes"}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{className:"app-settings__add-button",onClick:()=>v(!0),children:[(0,o.jsx)(N.FaPlus,{className:"app-settings__add-icon"}),"Add New App"]}),(0,o.jsxs)("div",{className:"app-settings__list",children:[(0,o.jsx)("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),u.length===0?(0,o.jsx)("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):(0,o.jsx)("div",{className:"app-settings__grid",children:u.map(r=>{let a=r.icon.startsWith("/")||r.icon.startsWith("http"),_=a?null:k[r.icon]||k.FaRocket;return(0,o.jsxs)("div",{className:"app-settings__card",children:[(0,o.jsxs)("div",{className:"app-settings__card-info",children:[(0,o.jsx)("div",{className:"app-settings__card-icon",style:{backgroundColor:r.color+"20"},children:a?r.icon.endsWith(".svg")?(0,o.jsx)("div",{style:{width:20,height:20,maskImage:`url(${r.icon})`,WebkitMaskImage:`url(${r.icon})`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",backgroundColor:r.color==="transparent"?"#5f6368":r.color}}):(0,o.jsx)("img",{src:r.icon,alt:r.name,style:{width:20,height:20,objectFit:"contain"}}):_&&(0,o.jsx)(_,{style:{color:r.color}})}),(0,o.jsxs)("div",{className:"app-settings__card-details",children:[(0,o.jsx)("span",{className:"app-settings__card-name",children:r.name}),(0,o.jsx)("span",{className:"app-settings__card-url",children:r.url})]})]}),(0,o.jsxs)("div",{className:"app-settings__card-actions",children:[(0,o.jsx)("button",{className:"app-settings__action-button",onClick:()=>y(r),title:"Edit",children:(0,o.jsx)(N.FaEdit,{})}),(0,o.jsx)("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>C(r.id),title:"Delete",children:(0,o.jsx)(N.FaTrash,{})})]})]},r.id)})})]}),(0,o.jsxs)("button",{className:"app-settings__export-button",onClick:p,children:[(0,o.jsx)(N.FaDownload,{className:"app-settings__export-icon"}),"Export Configuration"]}),(0,o.jsx)("div",{className:"app-settings__info",children:(0,o.jsx)("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document<"u"?(0,V.createPortal)(f,document.body):null}var R=require("react"),X=require("react-icons/fa");var L=require("react/jsx-runtime"),Q="app-launcher-user-apps";function Z({defaultApps:i=[],className:l,mergeDefaultApps:u=!0}){let[x,c]=(0,R.useState)(!1),[n,m]=(0,R.useState)([]),[I,v]=(0,R.useState)(!1);(0,R.useEffect)(()=>{if(typeof window<"u"){try{let p=localStorage.getItem(Q);p&&m(JSON.parse(p))}catch(p){console.error("Failed to load apps from localStorage",p)}v(!0)}},[]);let g=p=>{m(p),typeof window<"u"&&localStorage.setItem(Q,JSON.stringify(p))},y=p=>{let f={...p,id:`custom-${Date.now()}`};g([...n,f])},F=(p,f)=>{g(n.map(r=>r.id===p?{...r,...f}:r))},d=p=>{g(n.filter(f=>f.id!==p))},C=I?u?[...n,...i.filter(p=>!n.some(f=>f.id===p.id))]:n.length>0?n:i:[];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(E,{apps:C,className:l,renderFooter:()=>(0,L.jsxs)("button",{className:"app-launcher__footer-button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",color:"var(--al-text-secondary)",fontSize:"14px",fontWeight:500},onClick:()=>c(!0),children:[(0,L.jsx)(X.FaCog,{style:{fontSize:"16px"}}),"Settings"]})}),(0,L.jsx)(W,{isOpen:x,onClose:()=>c(!1),apps:n,defaultApps:i,onAdd:y,onUpdate:F,onDelete:d})]})}0&&(module.exports={AppLauncher,AppSettings,LocalAppLauncher,getIcon,iconMap});
|
|
1
|
+
"use strict";var G=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var ie=(p,c)=>{for(var m in c)G(p,m,{get:c[m],enumerable:!0})},pe=(p,c,m,y)=>{if(c&&typeof c=="object"||typeof c=="function")for(let l of oe(c))!ne.call(p,l)&&l!==m&&G(p,l,{get:()=>c[l],enumerable:!(y=re(c,l))||y.enumerable});return p};var se=p=>pe(G({},"__esModule",{value:!0}),p);var de={};ie(de,{AppLauncher:()=>W,AppSettings:()=>P,LocalAppLauncher:()=>ae,default:()=>W,getIcon:()=>B,iconMap:()=>w});module.exports=se(de);var v=require("react"),K=require("react-icons/io5");var e=require("react-icons/fa"),Y=require("react-icons/fa6"),H=require("react-icons/gr"),j=require("react-icons/io5"),S=require("react-icons/md"),T=require("react-icons/si"),V=require("react-icons/ai"),w={FaBriefcase:e.FaBriefcase,IoBusinessSharp:j.IoBusinessSharp,MdWork:S.MdWork,FaGraduationCap:e.FaGraduationCap,MdOutlineSecurity:S.MdOutlineSecurity,FaLock:e.FaLock,FaKey:e.FaKey,AiOutlineSecurityScan:V.AiOutlineSecurityScan,FaEnvelope:e.FaEnvelope,MdEmail:S.MdEmail,FaBell:e.FaBell,FaYoutube:e.FaYoutube,FaMusic:e.FaMusic,FaCamera:e.FaCamera,FaImage:e.FaImage,FaGamepad:e.FaGamepad,FaCalendarAlt:e.FaCalendarAlt,FaClipboard:e.FaClipboard,FaCalculator:e.FaCalculator,FaFolder:e.FaFolder,FaFile:e.FaFile,FaBookmark:e.FaBookmark,FaTable:e.FaTable,FaNewspaper:e.FaNewspaper,FaMapMarkerAlt:e.FaMapMarkerAlt,FaGlobe:e.FaGlobe,FaHome:e.FaHome,FaGoogle:e.FaGoogle,SiGoogledrive:T.SiGoogledrive,SiGooglemeet:T.SiGooglemeet,FaCode:e.FaCode,FaTerminal:e.FaTerminal,FaDatabase:e.FaDatabase,FaPuzzlePiece:e.FaPuzzlePiece,FaChartBar:e.FaChartBar,MdDashboard:S.MdDashboard,MdAnalytics:S.MdAnalytics,FaShoppingCart:e.FaShoppingCart,FaGift:e.FaGift,FaTicketSimple:Y.FaTicketSimple,FaPlane:e.FaPlane,FaCar:e.FaCar,FaBicycle:e.FaBicycle,GrDeliver:H.GrDeliver,FaUtensils:e.FaUtensils,FaCoffee:e.FaCoffee,FaRocket:e.FaRocket,FaUser:e.FaUser,FaCog:e.FaCog,FaHeart:e.FaHeart,FaStar:e.FaStar,IoApps:j.IoApps};function B(p){return w[p]||e.FaRocket}var J=require("react"),Z=require("react-dom"),F=require("react-icons/fa");var C=require("react");var Q=require("react");var E=require("react/jsx-runtime"),le=Object.keys(w);function X({selectedIcon:p,onSelect:c}){let[m,y]=(0,Q.useState)(""),l=le.filter(i=>i.toLowerCase().includes(m.toLowerCase()));return(0,E.jsxs)("div",{className:"app-launcher-icon-picker",children:[(0,E.jsx)("input",{type:"text",placeholder:"Search icons...",value:m,onChange:i=>y(i.target.value),className:"app-launcher-icon-picker__search"}),(0,E.jsx)("div",{className:"app-launcher-icon-picker__grid",children:l.map(i=>{let f=w[i];return(0,E.jsx)("button",{className:`app-launcher-icon-picker__button ${p===i?"app-launcher-icon-picker__button--selected":""}`,onClick:()=>c(i),title:i,type:"button",children:(0,E.jsx)(f,{className:"app-launcher-icon-picker__icon"})},i)})}),l.length===0&&(0,E.jsx)("div",{className:"app-launcher-icon-picker__empty",children:"No icons found"})]})}var o=require("react/jsx-runtime"),ce=["#4285F4","#EA4335","#FBBC04","#34A853","#FF6D01","#46BDC6","#7B1FA2","#E91E63","#607D8B","#795548"];function q({initialData:p,onSubmit:c,onCancel:m,submitLabel:y="Add App"}){let[l,i]=(0,C.useState)(p?.name||""),[f,h]=(0,C.useState)(p?.url||""),x=p?.icon||"FaRocket",b=x.startsWith("/")||x.startsWith("http"),[k,z]=(0,C.useState)(b?"FaRocket":x),[d,A]=(0,C.useState)(b?x:""),[s,_]=(0,C.useState)(b?"custom":"picker"),[a,N]=(0,C.useState)(p?.color||"#4285F4"),[I,R]=(0,C.useState)(p?.description||""),[u,M]=(0,C.useState)({}),O=w[k]||w.FaRocket,$=()=>{let n={};return l.trim()||(n.name="Name is required"),f.trim()?!f.startsWith("http://")&&!f.startsWith("https://")&&!f.startsWith("/")&&(n.url="URL must start with http://, https://, or /"):n.url="URL is required",s==="custom"&&d.trim()&&!d.startsWith("http://")&&!d.startsWith("https://")&&!d.startsWith("/")&&(n.customIconUrl="Icon URL must start with http://, https://, or /"),M(n),Object.keys(n).length===0};return(0,o.jsxs)("form",{onSubmit:n=>{if(n.preventDefault(),!$())return;let D=s==="custom"&&d.trim()?d.trim():k;c({name:l.trim(),url:f.trim(),icon:D,color:a,description:I.trim()||void 0})},className:"app-launcher-form",children:[(0,o.jsxs)("div",{className:"app-launcher-form__preview",children:[(0,o.jsx)("div",{className:"app-launcher-form__preview-icon",style:{backgroundColor:a+"20"},children:s==="custom"&&d?d.endsWith(".svg")?(0,o.jsx)("div",{className:"app-launcher-form__preview-svg",style:{maskImage:`url(${d})`,WebkitMaskImage:`url(${d})`,backgroundColor:a==="transparent"?"#5f6368":a}}):(0,o.jsx)("img",{src:d,alt:"Icon preview",className:"app-launcher-form__preview-img"}):(0,o.jsx)(O,{style:{color:a,fontSize:32}})}),(0,o.jsx)("span",{className:"app-launcher-form__preview-name",children:l||"App Name"})]}),(0,o.jsxs)("div",{className:"app-launcher-form__field",children:[(0,o.jsx)("label",{htmlFor:"app-name",className:"app-launcher-form__label",children:"Name *"}),(0,o.jsx)("input",{id:"app-name",type:"text",value:l,onChange:n=>i(n.target.value),placeholder:"My App",className:`app-launcher-form__input ${u.name?"app-launcher-form__input--error":""}`}),u.name&&(0,o.jsx)("span",{className:"app-launcher-form__error",children:u.name})]}),(0,o.jsxs)("div",{className:"app-launcher-form__field",children:[(0,o.jsx)("label",{htmlFor:"app-url",className:"app-launcher-form__label",children:"URL *"}),(0,o.jsx)("input",{id:"app-url",type:"text",value:f,onChange:n=>h(n.target.value),placeholder:"https://myapp.com or /dashboard",className:`app-launcher-form__input ${u.url?"app-launcher-form__input--error":""}`}),u.url&&(0,o.jsx)("span",{className:"app-launcher-form__error",children:u.url})]}),(0,o.jsxs)("div",{className:"app-launcher-form__field",children:[(0,o.jsx)("label",{htmlFor:"app-description",className:"app-launcher-form__label",children:"Description"}),(0,o.jsx)("input",{id:"app-description",type:"text",value:I,onChange:n=>R(n.target.value),placeholder:"Optional description (shown on hover)",className:"app-launcher-form__input"})]}),(0,o.jsxs)("div",{className:"app-launcher-form__field",children:[(0,o.jsx)("label",{className:"app-launcher-form__label",children:"Color"}),(0,o.jsxs)("div",{className:"app-launcher-form__color-picker",children:[ce.map(n=>(0,o.jsx)("button",{type:"button",className:`app-launcher-form__color-button ${a===n?"app-launcher-form__color-button--selected":""}`,style:{backgroundColor:n},onClick:()=>N(n),title:n},n)),(0,o.jsx)("input",{type:"color",value:a,onChange:n=>N(n.target.value),className:"app-launcher-form__color-input",title:"Custom color"})]})]}),(0,o.jsxs)("div",{className:"app-launcher-form__field",children:[(0,o.jsx)("label",{className:"app-launcher-form__label",children:"Icon"}),(0,o.jsxs)("div",{className:"app-launcher-form__icon-mode",children:[(0,o.jsx)("button",{type:"button",className:`app-launcher-form__mode-button ${s==="picker"?"app-launcher-form__mode-button--active":""}`,onClick:()=>_("picker"),children:"Icon Picker"}),(0,o.jsx)("button",{type:"button",className:`app-launcher-form__mode-button ${s==="custom"?"app-launcher-form__mode-button--active":""}`,onClick:()=>_("custom"),children:"Custom URL"})]}),s==="picker"?(0,o.jsx)(X,{selectedIcon:k,onSelect:z}):(0,o.jsxs)("div",{className:"app-launcher-form__custom-icon",children:[(0,o.jsx)("input",{id:"app-custom-icon",type:"text",value:d,onChange:n=>A(n.target.value),placeholder:"/icons/my-icon.svg or https://cdn.example.com/icon.svg",className:`app-launcher-form__input ${u.customIconUrl?"app-launcher-form__input--error":""}`}),u.customIconUrl&&(0,o.jsx)("span",{className:"app-launcher-form__error",children:u.customIconUrl}),(0,o.jsx)("p",{className:"app-launcher-form__hint",children:"Enter a path from your public folder (e.g., /icons/logo.svg) or a full URL"})]})]}),(0,o.jsxs)("div",{className:"app-launcher-form__actions",children:[(0,o.jsx)("button",{type:"button",onClick:m,className:"app-launcher-form__button app-launcher-form__button--cancel",children:"Cancel"}),(0,o.jsx)("button",{type:"submit",className:"app-launcher-form__button app-launcher-form__button--submit",children:y})]})]})}var r=require("react/jsx-runtime");function P({isOpen:p,onClose:c,apps:m,defaultApps:y=[],onAdd:l,onUpdate:i,onDelete:f}){let[h,x]=(0,J.useState)(!1),[b,k]=(0,J.useState)(null);if(!p)return null;let z=a=>{l(a),x(!1)},d=a=>{b&&(i(b.id,a),k(null))},A=a=>{confirm("Are you sure you want to delete this app?")&&f(a)},s=()=>{let a=[...m,...y.filter(M=>!m.some(O=>O.id===M.id))],N={version:"1.0",exportedAt:new Date().toISOString(),apps:a},I=new Blob([JSON.stringify(N,null,2)],{type:"application/json"}),R=URL.createObjectURL(I),u=document.createElement("a");u.href=R,u.download="app-launcher-config.json",document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(R)},_=(0,r.jsx)("div",{className:"app-settings__overlay",children:(0,r.jsxs)("div",{className:"app-settings__modal",onClick:a=>a.stopPropagation(),children:[(0,r.jsxs)("div",{className:"app-settings__header",children:[(0,r.jsx)("h2",{className:"app-settings__title",children:h?"Add New App":b?"Edit App":"Settings"}),(0,r.jsx)("button",{className:"app-settings__close-button",onClick:c,"aria-label":"Close",children:(0,r.jsx)(F.FaTimes,{})})]}),(0,r.jsx)("div",{className:"app-settings__content",children:h?(0,r.jsx)(q,{onSubmit:z,onCancel:()=>x(!1),submitLabel:"Add App"}):b?(0,r.jsx)(q,{initialData:b,onSubmit:d,onCancel:()=>k(null),submitLabel:"Save Changes"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{className:"app-settings__add-button",onClick:()=>x(!0),children:[(0,r.jsx)(F.FaPlus,{className:"app-settings__add-icon"}),"Add New App"]}),(0,r.jsxs)("div",{className:"app-settings__list",children:[(0,r.jsx)("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),m.length===0?(0,r.jsx)("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):(0,r.jsx)("div",{className:"app-settings__grid",children:m.map(a=>{let N=a.icon.startsWith("/")||a.icon.startsWith("http"),I=N?null:w[a.icon]||w.FaRocket;return(0,r.jsxs)("div",{className:"app-settings__card",children:[(0,r.jsxs)("div",{className:"app-settings__card-info",children:[(0,r.jsx)("div",{className:"app-settings__card-icon",style:{backgroundColor:a.color+"20"},children:N?a.icon.endsWith(".svg")?(0,r.jsx)("div",{style:{width:20,height:20,maskImage:`url(${a.icon})`,WebkitMaskImage:`url(${a.icon})`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",backgroundColor:a.color==="transparent"?"#5f6368":a.color}}):(0,r.jsx)("img",{src:a.icon,alt:a.name,style:{width:20,height:20,objectFit:"contain"}}):I&&(0,r.jsx)(I,{style:{color:a.color}})}),(0,r.jsxs)("div",{className:"app-settings__card-details",children:[(0,r.jsx)("span",{className:"app-settings__card-name",children:a.name}),(0,r.jsx)("span",{className:"app-settings__card-url",children:a.url})]})]}),(0,r.jsxs)("div",{className:"app-settings__card-actions",children:[(0,r.jsx)("button",{className:"app-settings__action-button",onClick:()=>k(a),title:"Edit",children:(0,r.jsx)(F.FaEdit,{})}),(0,r.jsx)("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>A(a.id),title:"Delete",children:(0,r.jsx)(F.FaTrash,{})})]})]},a.id)})})]}),(0,r.jsxs)("button",{className:"app-settings__export-button",onClick:s,children:[(0,r.jsx)(F.FaDownload,{className:"app-settings__export-icon"}),"Export Configuration"]}),(0,r.jsx)("div",{className:"app-settings__info",children:(0,r.jsx)("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document>"u"?null:(0,r.jsx)(r.Fragment,{children:(0,Z.createPortal)(_,document.body)})}var g=require("react/jsx-runtime");function W({configUrl:p,apps:c,className:m,onAppClick:y,renderFooter:l,storageKey:i,allowCustomApps:f}){let[h,x]=(0,v.useState)(!1),[b,k]=(0,v.useState)(!1),[z,d]=(0,v.useState)([]),[A,s]=(0,v.useState)([]),[_,a]=(0,v.useState)(!1),[N,I]=(0,v.useState)(null),R=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(c){d(c);return}p&&(a(!0),I(null),fetch(p).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()}).then(t=>{d(t.apps)}).catch(t=>{I(t.message),console.error("AppLauncher: Failed to load config",t)}).finally(()=>a(!1)))},[p,c]),(0,v.useEffect)(()=>{if(i&&typeof window<"u")try{let t=localStorage.getItem(i);t&&s(JSON.parse(t))}catch(t){console.error("Failed to parse user apps from storage",t)}},[i]);let u=t=>{if(s(t),i&&typeof window<"u")try{localStorage.setItem(i,JSON.stringify(t))}catch(n){console.error("Failed to save user apps",n)}};(0,v.useEffect)(()=>{function t(n){R.current&&!R.current.contains(n.target)&&x(!1)}return h&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[h]),(0,v.useEffect)(()=>{function t(n){n.key==="Escape"&&x(!1)}return h&&document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[h]);function M(t){return t.startsWith("/")||t.startsWith("http")}function O(t){let n=M(t.icon);return{id:t.id,name:t.name,url:t.url,icon:n?null:B(t.icon),customIconUrl:n?t.icon:null,color:t.color,description:t.description}}function $(t){y?y({id:t.id,name:t.name,url:t.url,icon:t.customIconUrl||(t.icon?.name??"FaRocket"),color:t.color,description:t.description}):window.open(t.url,"_blank","noopener,noreferrer")}return(0,g.jsxs)("div",{className:`app-launcher ${m||""}`,ref:R,children:[(0,g.jsx)("button",{className:"app-launcher__trigger",onClick:()=>x(!h),"aria-label":"Open app launcher","aria-expanded":h,title:"Open app launcher",children:(0,g.jsx)(K.IoApps,{className:"app-launcher__trigger-icon"})}),h&&(0,g.jsxs)("div",{className:"app-launcher__dropdown",children:[_&&(0,g.jsx)("div",{className:"app-launcher__loading",children:"Loading..."}),N&&(0,g.jsx)("div",{className:"app-launcher__error",children:N}),!_&&!N&&(0,g.jsx)("div",{className:"app-launcher__grid",children:[...z,...A].map(O).map(t=>(0,g.jsxs)("button",{className:"app-launcher__item",onClick:()=>$(t),title:t.description||t.name,children:[(0,g.jsx)("div",{className:"app-launcher__icon-wrapper",children:t.customIconUrl?t.customIconUrl.endsWith(".svg")?(0,g.jsx)("div",{className:"app-launcher__icon app-launcher__icon--svg",style:{maskImage:`url(${t.customIconUrl})`,WebkitMaskImage:`url(${t.customIconUrl})`,backgroundColor:t.color==="transparent"?"#5f6368":t.color},"aria-label":t.name}):(0,g.jsx)("img",{src:t.customIconUrl,alt:t.name,className:"app-launcher__icon app-launcher__icon--custom"}):t.icon?(0,g.jsx)(t.icon,{className:"app-launcher__icon",style:{color:t.color}}):null}),(0,g.jsx)("span",{className:"app-launcher__name",children:t.name})]},t.id))}),(l||f)&&(0,g.jsx)("div",{className:"app-launcher__footer",children:l?l():f&&(0,g.jsx)("button",{onClick:()=>k(!0),children:"Settings"})})]}),f&&(0,g.jsx)(P,{isOpen:b,onClose:()=>k(!1),apps:A,defaultApps:z,onAdd:t=>u([...A,{...t,id:Date.now().toString()}]),onUpdate:(t,n)=>u(A.map(D=>D.id===t?{...D,...n}:D)),onDelete:t=>u(A.filter(n=>n.id!==t))})]})}var U=require("react"),te=require("react-icons/fa");var L=require("react/jsx-runtime"),ee="app-launcher-user-apps";function ae({defaultApps:p=[],className:c,mergeDefaultApps:m=!0}){let[y,l]=(0,U.useState)(!1),[i,f]=(0,U.useState)([]),[h,x]=(0,U.useState)(!1);(0,U.useEffect)(()=>{if(typeof window<"u"){try{let s=localStorage.getItem(ee);s&&f(JSON.parse(s))}catch(s){console.error("Failed to load apps from localStorage",s)}x(!0)}},[]);let b=s=>{f(s),typeof window<"u"&&localStorage.setItem(ee,JSON.stringify(s))},k=s=>{let _={...s,id:`custom-${Date.now()}`};b([...i,_])},z=(s,_)=>{b(i.map(a=>a.id===s?{...a,..._}:a))},d=s=>{b(i.filter(_=>_.id!==s))},A=h?m?[...i,...p.filter(s=>!i.some(_=>_.id===s.id))]:i.length>0?i:p:[];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(W,{apps:A,className:c,renderFooter:()=>(0,L.jsxs)("button",{className:"app-launcher__footer-button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",color:"var(--al-text-secondary)",fontSize:"14px",fontWeight:500},onClick:()=>l(!0),children:[(0,L.jsx)(te.FaCog,{style:{fontSize:"16px"}}),"Settings"]})}),(0,L.jsx)(P,{isOpen:y,onClose:()=>l(!1),apps:i,defaultApps:p,onAdd:k,onUpdate:z,onDelete:d})]})}0&&(module.exports={AppLauncher,AppSettings,LocalAppLauncher,getIcon,iconMap});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as L,useRef as qe,useEffect as M}from"react";import{IoApps as Ye}from"react-icons/io5";import{FaGoogle as J,FaEnvelope as K,FaYoutube as V,FaCalendarAlt as Q,FaMapMarkerAlt as X,FaFile as Z,FaBookmark as ee,FaTable as ae,FaNewspaper as re,FaImage as te,FaRocket as T,FaHome as oe,FaUser as ne,FaCog as ie,FaChartBar as pe,FaShoppingCart as se,FaDatabase as le,FaCode as ce,FaTerminal as de,FaGlobe as ue,FaLock as me,FaKey as ge,FaBell as he,FaHeart as fe,FaStar as be,FaFolder as _e,FaClipboard as xe,FaCalculator as ve,FaMusic as ye,FaCamera as ke,FaGamepad as we,FaPuzzlePiece as Ae,FaBriefcase as Ne,FaGraduationCap as Ie,FaPlane as Fe,FaCar as Ce,FaBicycle as Se,FaUtensils as Le,FaCoffee as ze,FaGift as Re}from"react-icons/fa";import{FaTicketSimple as Ee}from"react-icons/fa6";import{GrDeliver as Pe}from"react-icons/gr";import{IoBusinessSharp as Me,IoApps as Ue}from"react-icons/io5";import{MdOutlineSecurity as Oe,MdDashboard as We,MdAnalytics as je,MdEmail as De,MdWork as Te}from"react-icons/md";import{SiGoogledrive as Be,SiGooglemeet as $e}from"react-icons/si";import{AiOutlineSecurityScan as Ge}from"react-icons/ai";var x={FaBriefcase:Ne,IoBusinessSharp:Me,MdWork:Te,FaGraduationCap:Ie,MdOutlineSecurity:Oe,FaLock:me,FaKey:ge,AiOutlineSecurityScan:Ge,FaEnvelope:K,MdEmail:De,FaBell:he,FaYoutube:V,FaMusic:ye,FaCamera:ke,FaImage:te,FaGamepad:we,FaCalendarAlt:Q,FaClipboard:xe,FaCalculator:ve,FaFolder:_e,FaFile:Z,FaBookmark:ee,FaTable:ae,FaNewspaper:re,FaMapMarkerAlt:X,FaGlobe:ue,FaHome:oe,FaGoogle:J,SiGoogledrive:Be,SiGooglemeet:$e,FaCode:ce,FaTerminal:de,FaDatabase:le,FaPuzzlePiece:Ae,FaChartBar:pe,MdDashboard:We,MdAnalytics:je,FaShoppingCart:se,FaGift:Re,FaTicketSimple:Ee,FaPlane:Fe,FaCar:Ce,FaBicycle:Se,GrDeliver:Pe,FaUtensils:Le,FaCoffee:ze,FaRocket:T,FaUser:ne,FaCog:ie,FaHeart:fe,FaStar:be,IoApps:Ue};function P(p){return x[p]||T}import{jsx as v,jsxs as U}from"react/jsx-runtime";function z({configUrl:p,apps:_,className:h,onAppClick:k,renderFooter:d}){let[r,l]=L(!1),[A,f]=L([]),[c,b]=L(!1),[N,s]=L(null),I=qe(null);M(()=>{if(_){f(_.map(u));return}p&&(b(!0),s(null),fetch(p).then(e=>{if(!e.ok)throw new Error(`Failed to fetch: ${e.status}`);return e.json()}).then(e=>{f(e.apps.map(u))}).catch(e=>{s(e.message),console.error("AppLauncher: Failed to load config",e)}).finally(()=>b(!1)))},[p,_]),M(()=>{function e(g){I.current&&!I.current.contains(g.target)&&l(!1)}return r&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),M(()=>{function e(g){g.key==="Escape"&&l(!1)}return r&&document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]);function t(e){return e.startsWith("/")||e.startsWith("http")}function u(e){let g=t(e.icon);return{id:e.id,name:e.name,url:e.url,icon:g?null:P(e.icon),customIconUrl:g?e.icon:null,color:e.color,description:e.description}}function a(e){k?k({id:e.id,name:e.name,url:e.url,icon:e.customIconUrl||(e.icon?.name??"FaRocket"),color:e.color,description:e.description}):window.open(e.url,"_blank","noopener,noreferrer")}return U("div",{className:`app-launcher ${h||""}`,ref:I,children:[v("button",{className:"app-launcher__trigger",onClick:()=>l(!r),"aria-label":"Open app launcher","aria-expanded":r,title:"Open app launcher",children:v(Ye,{className:"app-launcher__trigger-icon"})}),r&&U("div",{className:"app-launcher__dropdown",children:[c&&v("div",{className:"app-launcher__loading",children:"Loading..."}),N&&v("div",{className:"app-launcher__error",children:N}),!c&&!N&&v("div",{className:"app-launcher__grid",children:A.map(e=>U("button",{className:"app-launcher__item",onClick:()=>a(e),title:e.description||e.name,children:[v("div",{className:"app-launcher__icon-wrapper",children:e.customIconUrl?e.customIconUrl.endsWith(".svg")?v("div",{className:"app-launcher__icon app-launcher__icon--svg",style:{maskImage:`url(${e.customIconUrl})`,WebkitMaskImage:`url(${e.customIconUrl})`,backgroundColor:e.color==="transparent"?"#5f6368":e.color},"aria-label":e.name}):v("img",{src:e.customIconUrl,alt:e.name,className:"app-launcher__icon app-launcher__icon--custom"}):e.icon?v(e.icon,{className:"app-launcher__icon",style:{color:e.color}}):null}),v("span",{className:"app-launcher__name",children:e.name})]},e.id))}),d&&v("div",{className:"app-launcher__footer",children:d()})]})]})}import{useState as $}from"react";import{createPortal as Qe}from"react-dom";import{FaTimes as Xe,FaPlus as Ze,FaEdit as ea,FaTrash as aa,FaDownload as ra}from"react-icons/fa";import{useState as F}from"react";import{useState as He}from"react";import{jsx as C,jsxs as Ke}from"react/jsx-runtime";var Je=Object.keys(x);function B({selectedIcon:p,onSelect:_}){let[h,k]=He(""),d=Je.filter(r=>r.toLowerCase().includes(h.toLowerCase()));return Ke("div",{className:"app-launcher-icon-picker",children:[C("input",{type:"text",placeholder:"Search icons...",value:h,onChange:r=>k(r.target.value),className:"app-launcher-icon-picker__search"}),C("div",{className:"app-launcher-icon-picker__grid",children:d.map(r=>{let l=x[r];return C("button",{className:`app-launcher-icon-picker__button ${p===r?"app-launcher-icon-picker__button--selected":""}`,onClick:()=>_(r),title:r,type:"button",children:C(l,{className:"app-launcher-icon-picker__icon"})},r)})}),d.length===0&&C("div",{className:"app-launcher-icon-picker__empty",children:"No icons found"})]})}import{jsx as o,jsxs as y}from"react/jsx-runtime";var Ve=["#4285F4","#EA4335","#FBBC04","#34A853","#FF6D01","#46BDC6","#7B1FA2","#E91E63","#607D8B","#795548"];function O({initialData:p,onSubmit:_,onCancel:h,submitLabel:k="Add App"}){let[d,r]=F(p?.name||""),[l,A]=F(p?.url||""),f=p?.icon||"FaRocket",c=f.startsWith("/")||f.startsWith("http"),[b,N]=F(c?"FaRocket":f),[s,I]=F(c?f:""),[t,u]=F(c?"custom":"picker"),[a,e]=F(p?.color||"#4285F4"),[g,S]=F(p?.description||""),[m,R]=F({}),E=x[b]||x.FaRocket,Y=()=>{let n={};return d.trim()||(n.name="Name is required"),l.trim()?!l.startsWith("http://")&&!l.startsWith("https://")&&!l.startsWith("/")&&(n.url="URL must start with http://, https://, or /"):n.url="URL is required",t==="custom"&&s.trim()&&!s.startsWith("http://")&&!s.startsWith("https://")&&!s.startsWith("/")&&(n.customIconUrl="Icon URL must start with http://, https://, or /"),R(n),Object.keys(n).length===0};return y("form",{onSubmit:n=>{if(n.preventDefault(),!Y())return;let H=t==="custom"&&s.trim()?s.trim():b;_({name:d.trim(),url:l.trim(),icon:H,color:a,description:g.trim()||void 0})},className:"app-launcher-form",children:[y("div",{className:"app-launcher-form__preview",children:[o("div",{className:"app-launcher-form__preview-icon",style:{backgroundColor:a+"20"},children:t==="custom"&&s?s.endsWith(".svg")?o("div",{className:"app-launcher-form__preview-svg",style:{maskImage:`url(${s})`,WebkitMaskImage:`url(${s})`,backgroundColor:a==="transparent"?"#5f6368":a}}):o("img",{src:s,alt:"Icon preview",className:"app-launcher-form__preview-img"}):o(E,{style:{color:a,fontSize:32}})}),o("span",{className:"app-launcher-form__preview-name",children:d||"App Name"})]}),y("div",{className:"app-launcher-form__field",children:[o("label",{htmlFor:"app-name",className:"app-launcher-form__label",children:"Name *"}),o("input",{id:"app-name",type:"text",value:d,onChange:n=>r(n.target.value),placeholder:"My App",className:`app-launcher-form__input ${m.name?"app-launcher-form__input--error":""}`}),m.name&&o("span",{className:"app-launcher-form__error",children:m.name})]}),y("div",{className:"app-launcher-form__field",children:[o("label",{htmlFor:"app-url",className:"app-launcher-form__label",children:"URL *"}),o("input",{id:"app-url",type:"text",value:l,onChange:n=>A(n.target.value),placeholder:"https://myapp.com or /dashboard",className:`app-launcher-form__input ${m.url?"app-launcher-form__input--error":""}`}),m.url&&o("span",{className:"app-launcher-form__error",children:m.url})]}),y("div",{className:"app-launcher-form__field",children:[o("label",{htmlFor:"app-description",className:"app-launcher-form__label",children:"Description"}),o("input",{id:"app-description",type:"text",value:g,onChange:n=>S(n.target.value),placeholder:"Optional description (shown on hover)",className:"app-launcher-form__input"})]}),y("div",{className:"app-launcher-form__field",children:[o("label",{className:"app-launcher-form__label",children:"Color"}),y("div",{className:"app-launcher-form__color-picker",children:[Ve.map(n=>o("button",{type:"button",className:`app-launcher-form__color-button ${a===n?"app-launcher-form__color-button--selected":""}`,style:{backgroundColor:n},onClick:()=>e(n),title:n},n)),o("input",{type:"color",value:a,onChange:n=>e(n.target.value),className:"app-launcher-form__color-input",title:"Custom color"})]})]}),y("div",{className:"app-launcher-form__field",children:[o("label",{className:"app-launcher-form__label",children:"Icon"}),y("div",{className:"app-launcher-form__icon-mode",children:[o("button",{type:"button",className:`app-launcher-form__mode-button ${t==="picker"?"app-launcher-form__mode-button--active":""}`,onClick:()=>u("picker"),children:"Icon Picker"}),o("button",{type:"button",className:`app-launcher-form__mode-button ${t==="custom"?"app-launcher-form__mode-button--active":""}`,onClick:()=>u("custom"),children:"Custom URL"})]}),t==="picker"?o(B,{selectedIcon:b,onSelect:N}):y("div",{className:"app-launcher-form__custom-icon",children:[o("input",{id:"app-custom-icon",type:"text",value:s,onChange:n=>I(n.target.value),placeholder:"/icons/my-icon.svg or https://cdn.example.com/icon.svg",className:`app-launcher-form__input ${m.customIconUrl?"app-launcher-form__input--error":""}`}),m.customIconUrl&&o("span",{className:"app-launcher-form__error",children:m.customIconUrl}),o("p",{className:"app-launcher-form__hint",children:"Enter a path from your public folder (e.g., /icons/logo.svg) or a full URL"})]})]}),y("div",{className:"app-launcher-form__actions",children:[o("button",{type:"button",onClick:h,className:"app-launcher-form__button app-launcher-form__button--cancel",children:"Cancel"}),o("button",{type:"submit",className:"app-launcher-form__button app-launcher-form__button--submit",children:k})]})]})}import{Fragment as ta,jsx as i,jsxs as w}from"react/jsx-runtime";function W({isOpen:p,onClose:_,apps:h,defaultApps:k=[],onAdd:d,onUpdate:r,onDelete:l}){let[A,f]=$(!1),[c,b]=$(null);if(!p)return null;let N=a=>{d(a),f(!1)},s=a=>{c&&(r(c.id,a),b(null))},I=a=>{confirm("Are you sure you want to delete this app?")&&l(a)},t=()=>{let a=[...h,...k.filter(R=>!h.some(E=>E.id===R.id))],e={version:"1.0",exportedAt:new Date().toISOString(),apps:a},g=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),S=URL.createObjectURL(g),m=document.createElement("a");m.href=S,m.download="app-launcher-config.json",document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(S)},u=i("div",{className:"app-settings__overlay",children:w("div",{className:"app-settings__modal",onClick:a=>a.stopPropagation(),children:[w("div",{className:"app-settings__header",children:[i("h2",{className:"app-settings__title",children:A?"Add New App":c?"Edit App":"Settings"}),i("button",{className:"app-settings__close-button",onClick:_,"aria-label":"Close",children:i(Xe,{})})]}),i("div",{className:"app-settings__content",children:A?i(O,{onSubmit:N,onCancel:()=>f(!1),submitLabel:"Add App"}):c?i(O,{initialData:c,onSubmit:s,onCancel:()=>b(null),submitLabel:"Save Changes"}):w(ta,{children:[w("button",{className:"app-settings__add-button",onClick:()=>f(!0),children:[i(Ze,{className:"app-settings__add-icon"}),"Add New App"]}),w("div",{className:"app-settings__list",children:[i("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),h.length===0?i("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):i("div",{className:"app-settings__grid",children:h.map(a=>{let e=a.icon.startsWith("/")||a.icon.startsWith("http"),g=e?null:x[a.icon]||x.FaRocket;return w("div",{className:"app-settings__card",children:[w("div",{className:"app-settings__card-info",children:[i("div",{className:"app-settings__card-icon",style:{backgroundColor:a.color+"20"},children:e?a.icon.endsWith(".svg")?i("div",{style:{width:20,height:20,maskImage:`url(${a.icon})`,WebkitMaskImage:`url(${a.icon})`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",backgroundColor:a.color==="transparent"?"#5f6368":a.color}}):i("img",{src:a.icon,alt:a.name,style:{width:20,height:20,objectFit:"contain"}}):g&&i(g,{style:{color:a.color}})}),w("div",{className:"app-settings__card-details",children:[i("span",{className:"app-settings__card-name",children:a.name}),i("span",{className:"app-settings__card-url",children:a.url})]})]}),w("div",{className:"app-settings__card-actions",children:[i("button",{className:"app-settings__action-button",onClick:()=>b(a),title:"Edit",children:i(ea,{})}),i("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>I(a.id),title:"Delete",children:i(aa,{})})]})]},a.id)})})]}),w("button",{className:"app-settings__export-button",onClick:t,children:[i(ra,{className:"app-settings__export-icon"}),"Export Configuration"]}),i("div",{className:"app-settings__info",children:i("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document<"u"?Qe(u,document.body):null}import{useState as j,useEffect as oa}from"react";import{FaCog as na}from"react-icons/fa";import{Fragment as pa,jsx as D,jsxs as q}from"react/jsx-runtime";var G="app-launcher-user-apps";function ia({defaultApps:p=[],className:_,mergeDefaultApps:h=!0}){let[k,d]=j(!1),[r,l]=j([]),[A,f]=j(!1);oa(()=>{if(typeof window<"u"){try{let t=localStorage.getItem(G);t&&l(JSON.parse(t))}catch(t){console.error("Failed to load apps from localStorage",t)}f(!0)}},[]);let c=t=>{l(t),typeof window<"u"&&localStorage.setItem(G,JSON.stringify(t))},b=t=>{let u={...t,id:`custom-${Date.now()}`};c([...r,u])},N=(t,u)=>{c(r.map(a=>a.id===t?{...a,...u}:a))},s=t=>{c(r.filter(u=>u.id!==t))},I=A?h?[...r,...p.filter(t=>!r.some(u=>u.id===t.id))]:r.length>0?r:p:[];return q(pa,{children:[D(z,{apps:I,className:_,renderFooter:()=>q("button",{className:"app-launcher__footer-button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",color:"var(--al-text-secondary)",fontSize:"14px",fontWeight:500},onClick:()=>d(!0),children:[D(na,{style:{fontSize:"16px"}}),"Settings"]})}),D(W,{isOpen:k,onClose:()=>d(!1),apps:r,defaultApps:p,onAdd:b,onUpdate:N,onDelete:s})]})}export{z as AppLauncher,W as AppSettings,ia as LocalAppLauncher,z as default,P as getIcon,x as iconMap};
|
|
1
|
+
import{useState as L,useRef as rt,useEffect as M}from"react";import{IoApps as ot}from"react-icons/io5";import{FaGoogle as Q,FaEnvelope as X,FaYoutube as Z,FaCalendarAlt as K,FaMapMarkerAlt as ee,FaFile as te,FaBookmark as ae,FaTable as re,FaNewspaper as oe,FaImage as ne,FaRocket as G,FaHome as ie,FaUser as pe,FaCog as se,FaChartBar as le,FaShoppingCart as ce,FaDatabase as de,FaCode as ue,FaTerminal as me,FaGlobe as ge,FaLock as fe,FaKey as he,FaBell as be,FaHeart as _e,FaStar as xe,FaFolder as ve,FaClipboard as ye,FaCalculator as ke,FaMusic as we,FaCamera as Ae,FaGamepad as Ne,FaPuzzlePiece as Ie,FaBriefcase as Se,FaGraduationCap as Fe,FaPlane as Ce,FaCar as Le,FaBicycle as ze,FaUtensils as Re,FaCoffee as Ee,FaGift as Pe}from"react-icons/fa";import{FaTicketSimple as Ue}from"react-icons/fa6";import{GrDeliver as Me}from"react-icons/gr";import{IoBusinessSharp as Oe,IoApps as De}from"react-icons/io5";import{MdOutlineSecurity as We,MdDashboard as je,MdAnalytics as Te,MdEmail as Be,MdWork as $e}from"react-icons/md";import{SiGoogledrive as Ge,SiGooglemeet as qe}from"react-icons/si";import{AiOutlineSecurityScan as Je}from"react-icons/ai";var k={FaBriefcase:Se,IoBusinessSharp:Oe,MdWork:$e,FaGraduationCap:Fe,MdOutlineSecurity:We,FaLock:fe,FaKey:he,AiOutlineSecurityScan:Je,FaEnvelope:X,MdEmail:Be,FaBell:be,FaYoutube:Z,FaMusic:we,FaCamera:Ae,FaImage:ne,FaGamepad:Ne,FaCalendarAlt:K,FaClipboard:ye,FaCalculator:ke,FaFolder:ve,FaFile:te,FaBookmark:ae,FaTable:re,FaNewspaper:oe,FaMapMarkerAlt:ee,FaGlobe:ge,FaHome:ie,FaGoogle:Q,SiGoogledrive:Ge,SiGooglemeet:qe,FaCode:ue,FaTerminal:me,FaDatabase:de,FaPuzzlePiece:Ie,FaChartBar:le,MdDashboard:je,MdAnalytics:Te,FaShoppingCart:ce,FaGift:Pe,FaTicketSimple:Ue,FaPlane:Ce,FaCar:Le,FaBicycle:ze,GrDeliver:Me,FaUtensils:Re,FaCoffee:Ee,FaRocket:G,FaUser:pe,FaCog:se,FaHeart:_e,FaStar:xe,IoApps:De};function W(p){return k[p]||G}import{useState as J}from"react";import{createPortal as Xe}from"react-dom";import{FaTimes as Ze,FaPlus as Ke,FaEdit as et,FaTrash as tt,FaDownload as at}from"react-icons/fa";import{useState as C}from"react";import{useState as Ye}from"react";import{jsx as P,jsxs as Ve}from"react/jsx-runtime";var He=Object.keys(k);function q({selectedIcon:p,onSelect:x}){let[h,A]=Ye(""),d=He.filter(r=>r.toLowerCase().includes(h.toLowerCase()));return Ve("div",{className:"app-launcher-icon-picker",children:[P("input",{type:"text",placeholder:"Search icons...",value:h,onChange:r=>A(r.target.value),className:"app-launcher-icon-picker__search"}),P("div",{className:"app-launcher-icon-picker__grid",children:d.map(r=>{let c=k[r];return P("button",{className:`app-launcher-icon-picker__button ${p===r?"app-launcher-icon-picker__button--selected":""}`,onClick:()=>x(r),title:r,type:"button",children:P(c,{className:"app-launcher-icon-picker__icon"})},r)})}),d.length===0&&P("div",{className:"app-launcher-icon-picker__empty",children:"No icons found"})]})}import{jsx as n,jsxs as w}from"react/jsx-runtime";var Qe=["#4285F4","#EA4335","#FBBC04","#34A853","#FF6D01","#46BDC6","#7B1FA2","#E91E63","#607D8B","#795548"];function j({initialData:p,onSubmit:x,onCancel:h,submitLabel:A="Add App"}){let[d,r]=C(p?.name||""),[c,u]=C(p?.url||""),f=p?.icon||"FaRocket",m=f.startsWith("/")||f.startsWith("http"),[_,S]=C(m?"FaRocket":f),[s,v]=C(m?f:""),[o,g]=C(m?"custom":"picker"),[t,y]=C(p?.color||"#4285F4"),[N,F]=C(p?.description||""),[l,z]=C({}),R=k[_]||k.FaRocket,D=()=>{let a={};return d.trim()||(a.name="Name is required"),c.trim()?!c.startsWith("http://")&&!c.startsWith("https://")&&!c.startsWith("/")&&(a.url="URL must start with http://, https://, or /"):a.url="URL is required",o==="custom"&&s.trim()&&!s.startsWith("http://")&&!s.startsWith("https://")&&!s.startsWith("/")&&(a.customIconUrl="Icon URL must start with http://, https://, or /"),z(a),Object.keys(a).length===0};return w("form",{onSubmit:a=>{if(a.preventDefault(),!D())return;let E=o==="custom"&&s.trim()?s.trim():_;x({name:d.trim(),url:c.trim(),icon:E,color:t,description:N.trim()||void 0})},className:"app-launcher-form",children:[w("div",{className:"app-launcher-form__preview",children:[n("div",{className:"app-launcher-form__preview-icon",style:{backgroundColor:t+"20"},children:o==="custom"&&s?s.endsWith(".svg")?n("div",{className:"app-launcher-form__preview-svg",style:{maskImage:`url(${s})`,WebkitMaskImage:`url(${s})`,backgroundColor:t==="transparent"?"#5f6368":t}}):n("img",{src:s,alt:"Icon preview",className:"app-launcher-form__preview-img"}):n(R,{style:{color:t,fontSize:32}})}),n("span",{className:"app-launcher-form__preview-name",children:d||"App Name"})]}),w("div",{className:"app-launcher-form__field",children:[n("label",{htmlFor:"app-name",className:"app-launcher-form__label",children:"Name *"}),n("input",{id:"app-name",type:"text",value:d,onChange:a=>r(a.target.value),placeholder:"My App",className:`app-launcher-form__input ${l.name?"app-launcher-form__input--error":""}`}),l.name&&n("span",{className:"app-launcher-form__error",children:l.name})]}),w("div",{className:"app-launcher-form__field",children:[n("label",{htmlFor:"app-url",className:"app-launcher-form__label",children:"URL *"}),n("input",{id:"app-url",type:"text",value:c,onChange:a=>u(a.target.value),placeholder:"https://myapp.com or /dashboard",className:`app-launcher-form__input ${l.url?"app-launcher-form__input--error":""}`}),l.url&&n("span",{className:"app-launcher-form__error",children:l.url})]}),w("div",{className:"app-launcher-form__field",children:[n("label",{htmlFor:"app-description",className:"app-launcher-form__label",children:"Description"}),n("input",{id:"app-description",type:"text",value:N,onChange:a=>F(a.target.value),placeholder:"Optional description (shown on hover)",className:"app-launcher-form__input"})]}),w("div",{className:"app-launcher-form__field",children:[n("label",{className:"app-launcher-form__label",children:"Color"}),w("div",{className:"app-launcher-form__color-picker",children:[Qe.map(a=>n("button",{type:"button",className:`app-launcher-form__color-button ${t===a?"app-launcher-form__color-button--selected":""}`,style:{backgroundColor:a},onClick:()=>y(a),title:a},a)),n("input",{type:"color",value:t,onChange:a=>y(a.target.value),className:"app-launcher-form__color-input",title:"Custom color"})]})]}),w("div",{className:"app-launcher-form__field",children:[n("label",{className:"app-launcher-form__label",children:"Icon"}),w("div",{className:"app-launcher-form__icon-mode",children:[n("button",{type:"button",className:`app-launcher-form__mode-button ${o==="picker"?"app-launcher-form__mode-button--active":""}`,onClick:()=>g("picker"),children:"Icon Picker"}),n("button",{type:"button",className:`app-launcher-form__mode-button ${o==="custom"?"app-launcher-form__mode-button--active":""}`,onClick:()=>g("custom"),children:"Custom URL"})]}),o==="picker"?n(q,{selectedIcon:_,onSelect:S}):w("div",{className:"app-launcher-form__custom-icon",children:[n("input",{id:"app-custom-icon",type:"text",value:s,onChange:a=>v(a.target.value),placeholder:"/icons/my-icon.svg or https://cdn.example.com/icon.svg",className:`app-launcher-form__input ${l.customIconUrl?"app-launcher-form__input--error":""}`}),l.customIconUrl&&n("span",{className:"app-launcher-form__error",children:l.customIconUrl}),n("p",{className:"app-launcher-form__hint",children:"Enter a path from your public folder (e.g., /icons/logo.svg) or a full URL"})]})]}),w("div",{className:"app-launcher-form__actions",children:[n("button",{type:"button",onClick:h,className:"app-launcher-form__button app-launcher-form__button--cancel",children:"Cancel"}),n("button",{type:"submit",className:"app-launcher-form__button app-launcher-form__button--submit",children:A})]})]})}import{Fragment as Y,jsx as i,jsxs as I}from"react/jsx-runtime";function U({isOpen:p,onClose:x,apps:h,defaultApps:A=[],onAdd:d,onUpdate:r,onDelete:c}){let[u,f]=J(!1),[m,_]=J(null);if(!p)return null;let S=t=>{d(t),f(!1)},s=t=>{m&&(r(m.id,t),_(null))},v=t=>{confirm("Are you sure you want to delete this app?")&&c(t)},o=()=>{let t=[...h,...A.filter(z=>!h.some(R=>R.id===z.id))],y={version:"1.0",exportedAt:new Date().toISOString(),apps:t},N=new Blob([JSON.stringify(y,null,2)],{type:"application/json"}),F=URL.createObjectURL(N),l=document.createElement("a");l.href=F,l.download="app-launcher-config.json",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(F)},g=i("div",{className:"app-settings__overlay",children:I("div",{className:"app-settings__modal",onClick:t=>t.stopPropagation(),children:[I("div",{className:"app-settings__header",children:[i("h2",{className:"app-settings__title",children:u?"Add New App":m?"Edit App":"Settings"}),i("button",{className:"app-settings__close-button",onClick:x,"aria-label":"Close",children:i(Ze,{})})]}),i("div",{className:"app-settings__content",children:u?i(j,{onSubmit:S,onCancel:()=>f(!1),submitLabel:"Add App"}):m?i(j,{initialData:m,onSubmit:s,onCancel:()=>_(null),submitLabel:"Save Changes"}):I(Y,{children:[I("button",{className:"app-settings__add-button",onClick:()=>f(!0),children:[i(Ke,{className:"app-settings__add-icon"}),"Add New App"]}),I("div",{className:"app-settings__list",children:[i("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),h.length===0?i("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):i("div",{className:"app-settings__grid",children:h.map(t=>{let y=t.icon.startsWith("/")||t.icon.startsWith("http"),N=y?null:k[t.icon]||k.FaRocket;return I("div",{className:"app-settings__card",children:[I("div",{className:"app-settings__card-info",children:[i("div",{className:"app-settings__card-icon",style:{backgroundColor:t.color+"20"},children:y?t.icon.endsWith(".svg")?i("div",{style:{width:20,height:20,maskImage:`url(${t.icon})`,WebkitMaskImage:`url(${t.icon})`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",backgroundColor:t.color==="transparent"?"#5f6368":t.color}}):i("img",{src:t.icon,alt:t.name,style:{width:20,height:20,objectFit:"contain"}}):N&&i(N,{style:{color:t.color}})}),I("div",{className:"app-settings__card-details",children:[i("span",{className:"app-settings__card-name",children:t.name}),i("span",{className:"app-settings__card-url",children:t.url})]})]}),I("div",{className:"app-settings__card-actions",children:[i("button",{className:"app-settings__action-button",onClick:()=>_(t),title:"Edit",children:i(et,{})}),i("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>v(t.id),title:"Delete",children:i(tt,{})})]})]},t.id)})})]}),I("button",{className:"app-settings__export-button",onClick:o,children:[i(at,{className:"app-settings__export-icon"}),"Export Configuration"]}),i("div",{className:"app-settings__info",children:i("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document>"u"?null:i(Y,{children:Xe(g,document.body)})}import{jsx as b,jsxs as T}from"react/jsx-runtime";function O({configUrl:p,apps:x,className:h,onAppClick:A,renderFooter:d,storageKey:r,allowCustomApps:c}){let[u,f]=L(!1),[m,_]=L(!1),[S,s]=L([]),[v,o]=L([]),[g,t]=L(!1),[y,N]=L(null),F=rt(null);M(()=>{if(x){s(x);return}p&&(t(!0),N(null),fetch(p).then(e=>{if(!e.ok)throw new Error(`Failed to fetch: ${e.status}`);return e.json()}).then(e=>{s(e.apps)}).catch(e=>{N(e.message),console.error("AppLauncher: Failed to load config",e)}).finally(()=>t(!1)))},[p,x]),M(()=>{if(r&&typeof window<"u")try{let e=localStorage.getItem(r);e&&o(JSON.parse(e))}catch(e){console.error("Failed to parse user apps from storage",e)}},[r]);let l=e=>{if(o(e),r&&typeof window<"u")try{localStorage.setItem(r,JSON.stringify(e))}catch(a){console.error("Failed to save user apps",a)}};M(()=>{function e(a){F.current&&!F.current.contains(a.target)&&f(!1)}return u&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]),M(()=>{function e(a){a.key==="Escape"&&f(!1)}return u&&document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u]);function z(e){return e.startsWith("/")||e.startsWith("http")}function R(e){let a=z(e.icon);return{id:e.id,name:e.name,url:e.url,icon:a?null:W(e.icon),customIconUrl:a?e.icon:null,color:e.color,description:e.description}}function D(e){A?A({id:e.id,name:e.name,url:e.url,icon:e.customIconUrl||(e.icon?.name??"FaRocket"),color:e.color,description:e.description}):window.open(e.url,"_blank","noopener,noreferrer")}return T("div",{className:`app-launcher ${h||""}`,ref:F,children:[b("button",{className:"app-launcher__trigger",onClick:()=>f(!u),"aria-label":"Open app launcher","aria-expanded":u,title:"Open app launcher",children:b(ot,{className:"app-launcher__trigger-icon"})}),u&&T("div",{className:"app-launcher__dropdown",children:[g&&b("div",{className:"app-launcher__loading",children:"Loading..."}),y&&b("div",{className:"app-launcher__error",children:y}),!g&&!y&&b("div",{className:"app-launcher__grid",children:[...S,...v].map(R).map(e=>T("button",{className:"app-launcher__item",onClick:()=>D(e),title:e.description||e.name,children:[b("div",{className:"app-launcher__icon-wrapper",children:e.customIconUrl?e.customIconUrl.endsWith(".svg")?b("div",{className:"app-launcher__icon app-launcher__icon--svg",style:{maskImage:`url(${e.customIconUrl})`,WebkitMaskImage:`url(${e.customIconUrl})`,backgroundColor:e.color==="transparent"?"#5f6368":e.color},"aria-label":e.name}):b("img",{src:e.customIconUrl,alt:e.name,className:"app-launcher__icon app-launcher__icon--custom"}):e.icon?b(e.icon,{className:"app-launcher__icon",style:{color:e.color}}):null}),b("span",{className:"app-launcher__name",children:e.name})]},e.id))}),(d||c)&&b("div",{className:"app-launcher__footer",children:d?d():c&&b("button",{onClick:()=>_(!0),children:"Settings"})})]}),c&&b(U,{isOpen:m,onClose:()=>_(!1),apps:v,defaultApps:S,onAdd:e=>l([...v,{...e,id:Date.now().toString()}]),onUpdate:(e,a)=>l(v.map(E=>E.id===e?{...E,...a}:E)),onDelete:e=>l(v.filter(a=>a.id!==e))})]})}import{useState as B,useEffect as nt}from"react";import{FaCog as it}from"react-icons/fa";import{Fragment as st,jsx as $,jsxs as V}from"react/jsx-runtime";var H="app-launcher-user-apps";function pt({defaultApps:p=[],className:x,mergeDefaultApps:h=!0}){let[A,d]=B(!1),[r,c]=B([]),[u,f]=B(!1);nt(()=>{if(typeof window<"u"){try{let o=localStorage.getItem(H);o&&c(JSON.parse(o))}catch(o){console.error("Failed to load apps from localStorage",o)}f(!0)}},[]);let m=o=>{c(o),typeof window<"u"&&localStorage.setItem(H,JSON.stringify(o))},_=o=>{let g={...o,id:`custom-${Date.now()}`};m([...r,g])},S=(o,g)=>{m(r.map(t=>t.id===o?{...t,...g}:t))},s=o=>{m(r.filter(g=>g.id!==o))},v=u?h?[...r,...p.filter(o=>!r.some(g=>g.id===o.id))]:r.length>0?r:p:[];return V(st,{children:[$(O,{apps:v,className:x,renderFooter:()=>V("button",{className:"app-launcher__footer-button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",color:"var(--al-text-secondary)",fontSize:"14px",fontWeight:500},onClick:()=>d(!0),children:[$(it,{style:{fontSize:"16px"}}),"Settings"]})}),$(U,{isOpen:A,onClose:()=>d(!1),apps:r,defaultApps:p,onAdd:_,onUpdate:S,onDelete:s})]})}export{O as AppLauncher,U as AppSettings,pt as LocalAppLauncher,O as default,W as getIcon,k as iconMap};
|