@moraby/app-launcher 2.0.12 → 2.0.14
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 +11 -3
- package/dist/app-launcher-element.global.js +2 -2
- package/dist/app-launcher-element.mjs +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- 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;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;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}
|
package/dist/index.d.mts
CHANGED
|
@@ -99,7 +99,7 @@ interface AppSettingsProps {
|
|
|
99
99
|
onUpdate: (id: string, app: Partial<Omit<AppItem, 'id'>>) => void;
|
|
100
100
|
onDelete: (id: string) => void;
|
|
101
101
|
}
|
|
102
|
-
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps):
|
|
102
|
+
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps): react_jsx_runtime.JSX.Element | null;
|
|
103
103
|
|
|
104
104
|
interface LocalAppLauncherProps {
|
|
105
105
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ interface AppSettingsProps {
|
|
|
99
99
|
onUpdate: (id: string, app: Partial<Omit<AppItem, 'id'>>) => void;
|
|
100
100
|
onDelete: (id: string) => void;
|
|
101
101
|
}
|
|
102
|
-
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps):
|
|
102
|
+
declare function AppSettings({ isOpen, onClose, apps, defaultApps, onAdd, onUpdate, onDelete, }: AppSettingsProps): react_jsx_runtime.JSX.Element | null;
|
|
103
103
|
|
|
104
104
|
interface LocalAppLauncherProps {
|
|
105
105
|
/**
|
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 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 o=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,o.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,o.jsxs)("div",{className:"app-launcher-form__preview",children:[(0,o.jsx)("div",{className:"app-launcher-form__preview-icon",style:{backgroundColor:r+"20"},children:p==="custom"&&d?d.endsWith(".svg")?(0,o.jsx)("div",{className:"app-launcher-form__preview-svg",style:{maskImage:`url(${d})`,WebkitMaskImage:`url(${d})`,backgroundColor:r==="transparent"?"#5f6368":r}}):(0,o.jsx)("img",{src:d,alt:"Icon preview",className:"app-launcher-form__preview-img"}):(0,o.jsx)(D,{style:{color:r,fontSize:32}})}),(0,o.jsx)("span",{className:"app-launcher-form__preview-name",children:c||"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: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,o.jsx)("span",{className:"app-launcher-form__error",children:b.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: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,o.jsx)("span",{className:"app-launcher-form__error",children:b.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:_,onChange:s=>P(s.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:[le.map(s=>(0,o.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,o.jsx)("input",{type:"color",value:r,onChange:s=>a(s.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 ${p==="picker"?"app-launcher-form__mode-button--active":""}`,onClick:()=>f("picker"),children:"Icon Picker"}),(0,o.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,o.jsx)(K,{selectedIcon:y,onSelect:F}):(0,o.jsxs)("div",{className:"app-launcher-form__custom-icon",children:[(0,o.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,o.jsx)("span",{className:"app-launcher-form__error",children:b.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:u,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:x})]})]})}var t=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,t.jsx)("div",{className:"app-settings__overlay",children:(0,t.jsxs)("div",{className:"app-settings__modal",onClick:r=>r.stopPropagation(),children:[(0,t.jsxs)("div",{className:"app-settings__header",children:[(0,t.jsx)("h2",{className:"app-settings__title",children:I?"Add New App":g?"Edit App":"Settings"}),(0,t.jsx)("button",{className:"app-settings__close-button",onClick:l,"aria-label":"Close",children:(0,t.jsx)(N.FaTimes,{})})]}),(0,t.jsx)("div",{className:"app-settings__content",children:I?(0,t.jsx)(B,{onSubmit:F,onCancel:()=>v(!1),submitLabel:"Add App"}):g?(0,t.jsx)(B,{initialData:g,onSubmit:d,onCancel:()=>y(null),submitLabel:"Save Changes"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{className:"app-settings__add-button",onClick:()=>v(!0),children:[(0,t.jsx)(N.FaPlus,{className:"app-settings__add-icon"}),"Add New App"]}),(0,t.jsxs)("div",{className:"app-settings__list",children:[(0,t.jsx)("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),u.length===0?(0,t.jsx)("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):(0,t.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,t.jsxs)("div",{className:"app-settings__card",children:[(0,t.jsxs)("div",{className:"app-settings__card-info",children:[(0,t.jsx)("div",{className:"app-settings__card-icon",style:{backgroundColor:r.color+"20"},children:a?r.icon.endsWith(".svg")?(0,t.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,t.jsx)("img",{src:r.icon,alt:r.name,style:{width:20,height:20,objectFit:"contain"}}):_&&(0,t.jsx)(_,{style:{color:r.color}})}),(0,t.jsxs)("div",{className:"app-settings__card-details",children:[(0,t.jsx)("span",{className:"app-settings__card-name",children:r.name}),(0,t.jsx)("span",{className:"app-settings__card-url",children:r.url})]})]}),(0,t.jsxs)("div",{className:"app-settings__card-actions",children:[(0,t.jsx)("button",{className:"app-settings__action-button",onClick:()=>y(r),title:"Edit",children:(0,t.jsx)(N.FaEdit,{})}),(0,t.jsx)("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>C(r.id),title:"Delete",children:(0,t.jsx)(N.FaTrash,{})})]})]},r.id)})})]}),(0,t.jsxs)("button",{className:"app-settings__export-button",onClick:p,children:[(0,t.jsx)(N.FaDownload,{className:"app-settings__export-icon"}),"Export Configuration"]}),(0,t.jsx)("div",{className:"app-settings__info",children:(0,t.jsx)("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document>"u"?null:(0,t.jsx)(t.Fragment,{children:(0,V.createPortal)(f,document.body)})}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});
|
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 Ye,useEffect as M}from"react";import{IoApps as He}from"react-icons/io5";import{FaGoogle as K,FaEnvelope as V,FaYoutube as Q,FaCalendarAlt as X,FaMapMarkerAlt as Z,FaFile as ee,FaBookmark as ae,FaTable as re,FaNewspaper as te,FaImage as oe,FaRocket as T,FaHome as ne,FaUser as ie,FaCog as pe,FaChartBar as se,FaShoppingCart as le,FaDatabase as ce,FaCode as de,FaTerminal as ue,FaGlobe as me,FaLock as ge,FaKey as he,FaBell as fe,FaHeart as be,FaStar as _e,FaFolder as xe,FaClipboard as ve,FaCalculator as ye,FaMusic as ke,FaCamera as we,FaGamepad as Ae,FaPuzzlePiece as Ne,FaBriefcase as Ie,FaGraduationCap as Fe,FaPlane as Ce,FaCar as Se,FaBicycle as Le,FaUtensils as ze,FaCoffee as Re,FaGift as Ee}from"react-icons/fa";import{FaTicketSimple as Pe}from"react-icons/fa6";import{GrDeliver as Me}from"react-icons/gr";import{IoBusinessSharp as Ue,IoApps as Oe}from"react-icons/io5";import{MdOutlineSecurity as We,MdDashboard as je,MdAnalytics as De,MdEmail as Te,MdWork as Be}from"react-icons/md";import{SiGoogledrive as $e,SiGooglemeet as Ge}from"react-icons/si";import{AiOutlineSecurityScan as qe}from"react-icons/ai";var x={FaBriefcase:Ie,IoBusinessSharp:Ue,MdWork:Be,FaGraduationCap:Fe,MdOutlineSecurity:We,FaLock:ge,FaKey:he,AiOutlineSecurityScan:qe,FaEnvelope:V,MdEmail:Te,FaBell:fe,FaYoutube:Q,FaMusic:ke,FaCamera:we,FaImage:oe,FaGamepad:Ae,FaCalendarAlt:X,FaClipboard:ve,FaCalculator:ye,FaFolder:xe,FaFile:ee,FaBookmark:ae,FaTable:re,FaNewspaper:te,FaMapMarkerAlt:Z,FaGlobe:me,FaHome:ne,FaGoogle:K,SiGoogledrive:$e,SiGooglemeet:Ge,FaCode:de,FaTerminal:ue,FaDatabase:ce,FaPuzzlePiece:Ne,FaChartBar:se,MdDashboard:je,MdAnalytics:De,FaShoppingCart:le,FaGift:Ee,FaTicketSimple:Pe,FaPlane:Ce,FaCar:Se,FaBicycle:Le,GrDeliver:Me,FaUtensils:ze,FaCoffee:Re,FaRocket:T,FaUser:ie,FaCog:pe,FaHeart:be,FaStar:_e,IoApps:Oe};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=Ye(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(He,{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 Xe}from"react-dom";import{FaTimes as Ze,FaPlus as ea,FaEdit as aa,FaTrash as ra,FaDownload as ta}from"react-icons/fa";import{useState as F}from"react";import{useState as Je}from"react";import{jsx as C,jsxs as Ve}from"react/jsx-runtime";var Ke=Object.keys(x);function B({selectedIcon:p,onSelect:_}){let[h,k]=Je(""),d=Ke.filter(r=>r.toLowerCase().includes(h.toLowerCase()));return Ve("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 Qe=["#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,H=()=>{let i={};return d.trim()||(i.name="Name is required"),l.trim()?!l.startsWith("http://")&&!l.startsWith("https://")&&!l.startsWith("/")&&(i.url="URL must start with http://, https://, or /"):i.url="URL is required",t==="custom"&&s.trim()&&!s.startsWith("http://")&&!s.startsWith("https://")&&!s.startsWith("/")&&(i.customIconUrl="Icon URL must start with http://, https://, or /"),R(i),Object.keys(i).length===0};return y("form",{onSubmit:i=>{if(i.preventDefault(),!H())return;let J=t==="custom"&&s.trim()?s.trim():b;_({name:d.trim(),url:l.trim(),icon:J,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:i=>r(i.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:i=>A(i.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:i=>S(i.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:[Qe.map(i=>o("button",{type:"button",className:`app-launcher-form__color-button ${a===i?"app-launcher-form__color-button--selected":""}`,style:{backgroundColor:i},onClick:()=>e(i),title:i},i)),o("input",{type:"color",value:a,onChange:i=>e(i.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:i=>I(i.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 G,jsx as n,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=n("div",{className:"app-settings__overlay",children:w("div",{className:"app-settings__modal",onClick:a=>a.stopPropagation(),children:[w("div",{className:"app-settings__header",children:[n("h2",{className:"app-settings__title",children:A?"Add New App":c?"Edit App":"Settings"}),n("button",{className:"app-settings__close-button",onClick:_,"aria-label":"Close",children:n(Ze,{})})]}),n("div",{className:"app-settings__content",children:A?n(O,{onSubmit:N,onCancel:()=>f(!1),submitLabel:"Add App"}):c?n(O,{initialData:c,onSubmit:s,onCancel:()=>b(null),submitLabel:"Save Changes"}):w(G,{children:[w("button",{className:"app-settings__add-button",onClick:()=>f(!0),children:[n(ea,{className:"app-settings__add-icon"}),"Add New App"]}),w("div",{className:"app-settings__list",children:[n("h3",{className:"app-settings__section-title",children:"My Custom Apps"}),h.length===0?n("p",{className:"app-settings__empty-message",children:'No custom apps yet. Click "Add New App" to get started.'}):n("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:[n("div",{className:"app-settings__card-icon",style:{backgroundColor:a.color+"20"},children:e?a.icon.endsWith(".svg")?n("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}}):n("img",{src:a.icon,alt:a.name,style:{width:20,height:20,objectFit:"contain"}}):g&&n(g,{style:{color:a.color}})}),w("div",{className:"app-settings__card-details",children:[n("span",{className:"app-settings__card-name",children:a.name}),n("span",{className:"app-settings__card-url",children:a.url})]})]}),w("div",{className:"app-settings__card-actions",children:[n("button",{className:"app-settings__action-button",onClick:()=>b(a),title:"Edit",children:n(aa,{})}),n("button",{className:"app-settings__action-button app-settings__action-button--delete",onClick:()=>I(a.id),title:"Delete",children:n(ra,{})})]})]},a.id)})})]}),w("button",{className:"app-settings__export-button",onClick:t,children:[n(ta,{className:"app-settings__export-icon"}),"Export Configuration"]}),n("div",{className:"app-settings__info",children:n("p",{children:'Custom apps are saved in your browser. Use "Export Configuration" to share with other apps.'})})]})})]})});return typeof document>"u"?null:n(G,{children:Xe(u,document.body)})}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 Y}from"react/jsx-runtime";var q="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(q);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(q,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 Y(pa,{children:[D(z,{apps:I,className:_,renderFooter:()=>Y("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};
|