@loftyshaky/shared-app 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_locales/de/messages.json +128 -0
- package/_locales/en/messages.json +131 -0
- package/_locales/ru/messages.json +128 -0
- package/announcement.d.ts +2 -0
- package/announcement.js +1 -0
- package/app.d.ts +5 -0
- package/app.js +1 -0
- package/chunk-app-198a1b93.js +1 -0
- package/chunk-main-1095d121.js +9 -0
- package/chunk-main-651fde68.js +1 -0
- package/chunk-main-b3455ac8.js +1 -0
- package/chunk-pickr.min-a2459eac.js +1 -0
- package/ext.d.ts +5 -0
- package/ext.js +1 -0
- package/fonts/noto_sans.woff2 +0 -0
- package/html/announcement.html +15 -0
- package/index.d.ts +3 -0
- package/index.js +1 -0
- package/inputs.d.ts +2 -0
- package/inputs.js +1 -0
- package/js/env.js +16 -0
- package/js/ext/manifest.js +58 -0
- package/js/locales.js +48 -0
- package/js/package/plugins/rollup-plugin-copy.js +169 -0
- package/js/package/plugins/watcher.js +56 -0
- package/js/package/terser.js +18 -0
- package/js/project_name.js +5 -0
- package/js/projects_path.js +5 -0
- package/js/task_scheduler.js +39 -0
- package/js/webpack.config.js +156 -0
- package/package.json +14 -0
- package/scss/announcement/body.scss +10 -0
- package/scss/announcement/index.scss +3 -0
- package/scss/announcement/main.scss +8 -0
- package/scss/settings/ext_version.scss +7 -0
- package/scss/settings/index.scss +6 -0
- package/scss/settings/main.scss +17 -0
- package/scss/settings/section_btns.scss +52 -0
- package/scss/settings/sections.scss +22 -0
- package/scss/settings/transitions.scss +21 -0
- package/scss/shared/all.scss +3 -0
- package/scss/shared/btns.scss +39 -0
- package/scss/shared/checkboxes.scss +38 -0
- package/scss/shared/color_pickers.scss +93 -0
- package/scss/shared/colors.scss +84 -0
- package/scss/shared/crash_handler.scss +36 -0
- package/scss/shared/css_vars.scss +4 -0
- package/scss/shared/embed/error.scss +96 -0
- package/scss/shared/embed/font_face.scss +5 -0
- package/scss/shared/embed/loading_screen.scss +36 -0
- package/scss/shared/embed/no_tr.scss +3 -0
- package/scss/shared/focus.scss +80 -0
- package/scss/shared/group.scss +18 -0
- package/scss/shared/help.scss +66 -0
- package/scss/shared/hr.scss +6 -0
- package/scss/shared/index.scss +29 -0
- package/scss/shared/input_btns.scss +11 -0
- package/scss/shared/inputs.scss +70 -0
- package/scss/shared/inset_border.scss +20 -0
- package/scss/shared/link_btns.scss +12 -0
- package/scss/shared/links.scss +11 -0
- package/scss/shared/mixins.scss +130 -0
- package/scss/shared/mods.scss +39 -0
- package/scss/shared/range.scss +43 -0
- package/scss/shared/scrollbar.scss +35 -0
- package/scss/shared/selects.scss +14 -0
- package/scss/shared/text.scss +20 -0
- package/scss/shared/textareas.scss +7 -0
- package/scss/shared/themes/colors/dark.scss +13 -0
- package/scss/shared/themes/colors/light.scss +13 -0
- package/scss/shared/themes/colors/very_dark.scss +13 -0
- package/scss/shared/themes/general/dark_theme.scss +7 -0
- package/scss/shared/themes/general/light_theme.scss +7 -0
- package/scss/shared/themes/general/template.scss +259 -0
- package/scss/shared/themes/general/template_focus.scss +52 -0
- package/scss/shared/themes/general/very_dark_theme.scss +7 -0
- package/scss/shared/transitions.scss +36 -0
- package/scss/shared/upload_box.scss +67 -0
- package/scss/shared/vars.scss +19 -0
- package/settings.d.ts +2 -0
- package/settings.js +1 -0
- package/ts/announcement/components/body.d.ts +3 -0
- package/ts/announcement/components/index.d.ts +1 -0
- package/ts/announcement/components/prop_types/body.d.ts +4 -0
- package/ts/announcement/components/prop_types/index.d.ts +1 -0
- package/ts/announcement/internal.d.ts +3 -0
- package/ts/announcement/scripts/display.d.ts +6 -0
- package/ts/announcement/scripts/header.d.ts +6 -0
- package/ts/announcement/scripts/index.d.ts +2 -0
- package/ts/error_modules/crash_handler/components/body.d.ts +52 -0
- package/ts/error_modules/crash_handler/components/index.d.ts +1 -0
- package/ts/error_modules/crash_handler/components/prop_types/body.d.ts +4 -0
- package/ts/error_modules/crash_handler/components/prop_types/index.d.ts +1 -0
- package/ts/error_modules/crash_handler/data/fatal_error.d.ts +7 -0
- package/ts/error_modules/crash_handler/data/index.d.ts +2 -0
- package/ts/error_modules/crash_handler/data/visibility.d.ts +7 -0
- package/ts/error_modules/crash_handler/scripts/index.d.ts +1 -0
- package/ts/error_modules/crash_handler/scripts/page.d.ts +6 -0
- package/ts/error_modules/css/scripts/index.d.ts +1 -0
- package/ts/error_modules/css/scripts/main.d.ts +8 -0
- package/ts/error_modules/error/components/body.d.ts +3 -0
- package/ts/error_modules/error/components/close_btn.d.ts +2 -0
- package/ts/error_modules/error/components/ext_name.d.ts +2 -0
- package/ts/error_modules/error/components/index.d.ts +4 -0
- package/ts/error_modules/error/components/msg.d.ts +2 -0
- package/ts/error_modules/error/components/prop_types/body.d.ts +5 -0
- package/ts/error_modules/error/components/prop_types/index.d.ts +1 -0
- package/ts/error_modules/error/data/index.d.ts +3 -0
- package/ts/error_modules/error/data/main.d.ts +10 -0
- package/ts/error_modules/error/data/msg.d.ts +15 -0
- package/ts/error_modules/error/data/state.d.ts +24 -0
- package/ts/error_modules/error/interfaces/error.d.ts +6 -0
- package/ts/error_modules/error/interfaces/error_obj.d.ts +6 -0
- package/ts/error_modules/error/interfaces/index.d.ts +5 -0
- package/ts/error_modules/error/interfaces/observable_keys.d.ts +1 -0
- package/ts/error_modules/error/interfaces/show_error.d.ts +6 -0
- package/ts/error_modules/error/interfaces/timeout_observable_keys.d.ts +1 -0
- package/ts/error_modules/error/scripts/globals.d.ts +9 -0
- package/ts/error_modules/error/scripts/index.d.ts +1 -0
- package/ts/error_modules/internal.d.ts +10 -0
- package/ts/inputs/color/components/body.d.ts +3 -0
- package/ts/inputs/color/components/color_picker.d.ts +3 -0
- package/ts/inputs/color/components/fill_shadow.d.ts +3 -0
- package/ts/inputs/color/components/index.d.ts +4 -0
- package/ts/inputs/color/components/prop_types/body.d.ts +4 -0
- package/ts/inputs/color/components/prop_types/color_picker.d.ts +7 -0
- package/ts/inputs/color/components/prop_types/fill_shadow.d.ts +5 -0
- package/ts/inputs/color/components/prop_types/index.d.ts +4 -0
- package/ts/inputs/color/components/prop_types/visualization.d.ts +6 -0
- package/ts/inputs/color/components/visualization.d.ts +3 -0
- package/ts/inputs/color/data/color.d.ts +54 -0
- package/ts/inputs/color/data/index.d.ts +2 -0
- package/ts/inputs/color/data/visibility.d.ts +38 -0
- package/ts/inputs/color/interfaces/color.d.ts +1 -0
- package/ts/inputs/color/interfaces/color_picker_state.d.ts +6 -0
- package/ts/inputs/color/interfaces/color_picker_state_one.d.ts +5 -0
- package/ts/inputs/color/interfaces/i.d.ts +1 -0
- package/ts/inputs/color/interfaces/index.d.ts +4 -0
- package/ts/inputs/color/obj/color.d.ts +54 -0
- package/ts/inputs/color/obj/index.d.ts +1 -0
- package/ts/inputs/color/scripts/color_picker.d.ts +20 -0
- package/ts/inputs/color/scripts/index.d.ts +2 -0
- package/ts/inputs/color/scripts/position.d.ts +7 -0
- package/ts/inputs/components/btn.d.ts +3 -0
- package/ts/inputs/components/checkbox.d.ts +3 -0
- package/ts/inputs/components/file.d.ts +3 -0
- package/ts/inputs/components/group.d.ts +3 -0
- package/ts/inputs/components/help.d.ts +3 -0
- package/ts/inputs/components/help_btn.d.ts +3 -0
- package/ts/inputs/components/hr.d.ts +3 -0
- package/ts/inputs/components/icon_btn.d.ts +3 -0
- package/ts/inputs/components/index.d.ts +21 -0
- package/ts/inputs/components/input_item.d.ts +3 -0
- package/ts/inputs/components/label.d.ts +3 -0
- package/ts/inputs/components/link.d.ts +3 -0
- package/ts/inputs/components/link_btn.d.ts +3 -0
- package/ts/inputs/components/prop_types/btn.d.ts +4 -0
- package/ts/inputs/components/prop_types/checkbox.d.ts +4 -0
- package/ts/inputs/components/prop_types/file.d.ts +4 -0
- package/ts/inputs/components/prop_types/group.d.ts +5 -0
- package/ts/inputs/components/prop_types/help.d.ts +4 -0
- package/ts/inputs/components/prop_types/help_btn.d.ts +4 -0
- package/ts/inputs/components/prop_types/hr.d.ts +4 -0
- package/ts/inputs/components/prop_types/icon_btn.d.ts +4 -0
- package/ts/inputs/components/prop_types/index.d.ts +21 -0
- package/ts/inputs/components/prop_types/input_item.d.ts +7 -0
- package/ts/inputs/components/prop_types/label.d.ts +4 -0
- package/ts/inputs/components/prop_types/link.d.ts +4 -0
- package/ts/inputs/components/prop_types/link_btn.d.ts +4 -0
- package/ts/inputs/components/prop_types/range.d.ts +4 -0
- package/ts/inputs/components/prop_types/section.d.ts +4 -0
- package/ts/inputs/components/prop_types/section_btn.d.ts +6 -0
- package/ts/inputs/components/prop_types/section_content.d.ts +4 -0
- package/ts/inputs/components/prop_types/select.d.ts +4 -0
- package/ts/inputs/components/prop_types/text.d.ts +4 -0
- package/ts/inputs/components/prop_types/text_btn.d.ts +8 -0
- package/ts/inputs/components/prop_types/textarea.d.ts +4 -0
- package/ts/inputs/components/prop_types/upload_box.d.ts +4 -0
- package/ts/inputs/components/range.d.ts +3 -0
- package/ts/inputs/components/section.d.ts +3 -0
- package/ts/inputs/components/section_btn.d.ts +3 -0
- package/ts/inputs/components/section_content.d.ts +3 -0
- package/ts/inputs/components/select.d.ts +3 -0
- package/ts/inputs/components/text.d.ts +3 -0
- package/ts/inputs/components/text_btn.d.ts +3 -0
- package/ts/inputs/components/textarea.d.ts +3 -0
- package/ts/inputs/components/upload_box.d.ts +3 -0
- package/ts/inputs/data/help.d.ts +15 -0
- package/ts/inputs/data/index.d.ts +7 -0
- package/ts/inputs/data/input_width.d.ts +22 -0
- package/ts/inputs/data/label.d.ts +9 -0
- package/ts/inputs/data/nested_input.d.ts +18 -0
- package/ts/inputs/data/text.d.ts +21 -0
- package/ts/inputs/data/upload_box.d.ts +20 -0
- package/ts/inputs/data/val.d.ts +36 -0
- package/ts/inputs/interfaces/icon_btns.d.ts +2 -0
- package/ts/inputs/interfaces/index.d.ts +8 -0
- package/ts/inputs/interfaces/input.d.ts +2 -0
- package/ts/inputs/interfaces/inputs.d.ts +2 -0
- package/ts/inputs/interfaces/links.d.ts +2 -0
- package/ts/inputs/interfaces/options.d.ts +2 -0
- package/ts/inputs/interfaces/sections.d.ts +2 -0
- package/ts/inputs/interfaces/state_cond.d.ts +4 -0
- package/ts/inputs/interfaces/text_btn.d.ts +7 -0
- package/ts/inputs/internal.d.ts +12 -0
- package/ts/inputs/obj/btn.d.ts +5 -0
- package/ts/inputs/obj/checkbox.d.ts +5 -0
- package/ts/inputs/obj/file.d.ts +8 -0
- package/ts/inputs/obj/group.d.ts +6 -0
- package/ts/inputs/obj/hr.d.ts +5 -0
- package/ts/inputs/obj/icon_btn.d.ts +6 -0
- package/ts/inputs/obj/index.d.ts +16 -0
- package/ts/inputs/obj/input_base.d.ts +37 -0
- package/ts/inputs/obj/link.d.ts +12 -0
- package/ts/inputs/obj/link_btn.d.ts +5 -0
- package/ts/inputs/obj/option.d.ts +6 -0
- package/ts/inputs/obj/range.d.ts +20 -0
- package/ts/inputs/obj/section.d.ts +17 -0
- package/ts/inputs/obj/select.d.ts +9 -0
- package/ts/inputs/obj/text.d.ts +17 -0
- package/ts/inputs/obj/textarea.d.ts +5 -0
- package/ts/inputs/obj/upload_box.d.ts +14 -0
- package/ts/inputs/scripts/index.d.ts +2 -0
- package/ts/inputs/scripts/resolve.d.ts +5 -0
- package/ts/inputs/scripts/upload_box.d.ts +8 -0
- package/ts/settings/components/body.d.ts +3 -0
- package/ts/settings/components/index.d.ts +1 -0
- package/ts/settings/components/prop_types/body.d.ts +7 -0
- package/ts/settings/components/prop_types/index.d.ts +1 -0
- package/ts/settings/data/back_up.d.ts +16 -0
- package/ts/settings/data/index.d.ts +2 -0
- package/ts/settings/data/sections.d.ts +37 -0
- package/ts/settings/init.d.ts +1 -0
- package/ts/settings/internal.d.ts +9 -0
- package/ts/settings/optional_permissions/data/index.d.ts +1 -0
- package/ts/settings/optional_permissions/data/main.d.ts +11 -0
- package/ts/settings/optional_permissions/interfaces/index.d.ts +1 -0
- package/ts/settings/optional_permissions/interfaces/optional_permission_checkbox_dict.d.ts +3 -0
- package/ts/settings/schema/data/index.d.ts +1 -0
- package/ts/settings/schema/data/main.d.ts +10 -0
- package/ts/settings/schema/obj/index.d.ts +1 -0
- package/ts/settings/schema/obj/transform_item.d.ts +7 -0
- package/ts/settings/scripts/index.d.ts +1 -0
- package/ts/settings/scripts/theme.d.ts +12 -0
- package/ts/shared/app.d.ts +10 -0
- package/ts/shared/app_ext_globals.d.ts +6 -0
- package/ts/shared/css_vars/scripts/index.d.ts +1 -0
- package/ts/shared/css_vars/scripts/main.d.ts +18 -0
- package/ts/shared/data/data/index.d.ts +1 -0
- package/ts/shared/data/data/main.d.ts +4 -0
- package/ts/shared/data/interfaces/index.d.ts +1 -0
- package/ts/shared/data/interfaces/val.d.ts +2 -0
- package/ts/shared/ext.d.ts +27 -0
- package/ts/shared/ext_version/components/body.d.ts +2 -0
- package/ts/shared/ext_version/components/index.d.ts +1 -0
- package/ts/shared/functions.d.ts +3 -0
- package/ts/shared/globals.d.ts +4 -0
- package/ts/shared/init.d.ts +1 -0
- package/ts/shared/internal.d.ts +28 -0
- package/ts/shared/loading_screen/components/body.d.ts +3 -0
- package/ts/shared/loading_screen/components/index.d.ts +1 -0
- package/ts/shared/loading_screen/components/prop_types/body.d.ts +4 -0
- package/ts/shared/loading_screen/components/prop_types/index.d.ts +1 -0
- package/ts/shared/loading_screen/data/index.d.ts +1 -0
- package/ts/shared/loading_screen/data/main.d.ts +10 -0
- package/ts/shared/no_tr/scripts/index.d.ts +1 -0
- package/ts/shared/no_tr/scripts/main.d.ts +12 -0
- package/ts/shared/svg.d.ts +7 -0
- package/ts/shared/t.d.ts +34 -0
- package/ts/shared/tab_index/interfaces/index.d.ts +1 -0
- package/ts/shared/tab_index/interfaces/set_Input_type_event.d.ts +2 -0
- package/ts/shared/tab_index/scripts/index.d.ts +1 -0
- package/ts/shared/tab_index/scripts/main.d.ts +18 -0
- package/ts/shared/theme/scripts/index.d.ts +1 -0
- package/ts/shared/theme/scripts/main.d.ts +11 -0
- package/ts/shared/title/scripts/index.d.ts +1 -0
- package/ts/shared/title/scripts/main.d.ts +6 -0
- package/ts/shared/tr/components/base_tr.d.ts +9 -0
- package/ts/shared/tr/components/index.d.ts +1 -0
- package/ts/shared/tr/components/prop_types/base_tr.d.ts +13 -0
- package/ts/shared/tr/components/prop_types/index.d.ts +1 -0
- package/ts/shared/tr/data/index.d.ts +1 -0
- package/ts/shared/tr/data/transition.d.ts +23 -0
- package/ts/shared/tr/interfaces/index.d.ts +1 -0
- package/ts/shared/tr/interfaces/transitions.d.ts +2 -0
- package/ts/shared/tr/obj/index.d.ts +1 -0
- package/ts/shared/tr/obj/transition.d.ts +8 -0
- package/ts/shared/utils/scripts/index.d.ts +1 -0
- package/ts/shared/utils/scripts/main.d.ts +11 -0
- package/ts/shared/vars.d.ts +1 -0
- package/ts/shared/viewport/scripts/index.d.ts +1 -0
- package/ts/shared/viewport/scripts/main.d.ts +8 -0
- package/ts/shared/x.d.ts +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as __awaiter}from"./chunk-main-1095d121.js";import"react";class Main$1{constructor(){this.cls="no_tr",this.enable=({el:el=document.head}={el:document.head})=>err((()=>{x.css(this.cls,el)}),"shr_1120"),this.disable=({el:el=document.head}={el:document.head})=>err_async((()=>__awaiter(this,void 0,void 0,(function*(){yield x.delay(500);const tr_link=sb(el,`.${this.cls}_link`);x.remove(tr_link)}))),"shr_1121")}static i(){return this.i0||(this.i0=new this)}}class Main{constructor(){this.set=({name:name,el:el=document.head,additional_theme_callback:additional_theme_callback})=>err_async((()=>__awaiter(this,void 0,void 0,(function*(){Main$1.i().enable({el:el});const name_final=`${name}_theme`,loading_screen_root_el=s('div[class^="root"][class*="loading_screen"]');x.css(name_final,el,"theme_link"),n(loading_screen_root_el)&&n(loading_screen_root_el.shadowRoot)&&x.css(name_final,loading_screen_root_el.shadowRoot,"theme_link"),n(additional_theme_callback)&&additional_theme_callback({name:name,el:el}),yield Main$1.i().disable({el:el})}))),"shr_1129")}static i(){return this.i0||(this.i0=new this)}}export{Main$1 as M,Main as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as __awaiter,o as observer,s as svg,B as Body$2,m as makeObservable,a as observable,b as action,r as runInAction,d as computed}from"./chunk-main-1095d121.js";import React__default,{useEffect}from"react";global.show_err_ribbon=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay,is_notification:is_notification,notification_msg_key:notification_msg_key}),global.err=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>{try{return f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}},global.err_async=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>__awaiter(void 0,void 0,void 0,(function*(){try{return yield f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}})),global.throw_err=msg=>{throw new Error(msg)},global.throw_err_obj=error_obj=>{throw error_obj},global.err_obj=msg=>new Error(msg);const Body$1=observer(class extends React__default.Component{static getDerivedStateFromError(){Visibility.i().show_reload_ui_screen()}componentDidCatch(err_obj){show_err_ribbon(err_obj,"shr_1000",{error_msg_key:"cant_render_ui"})}render(){if(Visibility.i().page_is_crashed)return React__default.createElement("div",{className:"reload_ui_btn_w"},React__default.createElement("button",{className:x.cls(["btn","reload_ui"]),type:"button",onClick:Page.i().reload},app.msg("reload_ui_btn_text")));const{children:children}=this.props;return children}}),Body=observer((props=>{const{app_id:app_id,on_render:on_render}=props;return useEffect((()=>{(class{constructor(){this.load=({app_id:app_id})=>{x.css("font_face",document.head,`font_face_link_${app_id}`);const error_root=s(`.error_${app_id}`);if(n(error_root)){const error_shadow=n(error_root.shadowRoot)?error_root.shadowRoot:void 0;if(error_shadow){const error_css=x.css("error",error_shadow);n(error_css)&&x.bind(error_css,"load",(()=>{State.i().change_state({observable_key:"is_loaded",state:!0})}))}}}}static i(){return this.i0||(this.i0=new this)}}).i().load({app_id:app_id}),on_render()}),[app_id,on_render]),React__default.createElement("div",{className:x.cls(["main","error",State.i().is_highlighted_cls,State.i().is_notification_cls]),role:"none",style:{display:State.i().is_visible_style},onMouseDown:State.i().clear_all_reset_state_timeouts},React__default.createElement(ExtName,null),React__default.createElement(Msg$1,null),React__default.createElement(CloseBtn,null))})),CloseBtn=observer((()=>React__default.createElement("button",{className:"close_btn",type:"button",onClick:()=>State.i().change_state({observable_key:"is_visible",state:!1})},React__default.createElement(svg.Close,null)))),ExtName=()=>React__default.createElement("span",{className:"ext_name"},app.msg("name")," ",React__default.createElement(Body$2,null)),Msg$1=observer((()=>React__default.createElement("div",{className:"msg"},Msg.i().main_msg,State.i().is_notification?void 0:React__default.createElement(React__default.Fragment,null,React__default.createElement("button",{type:"button",className:x.cls(["more_info_btn",Msg.i().more_info_btn_is_visible_cls]),onClick:()=>Msg.i().change_visibility_of_advanced_msg({is_visible:!0})},app.msg("error_more_info_btn_text")),React__default.createElement("div",{className:Msg.i().advanced_msg_is_visible_cls},Msg.i().advanced_msg)))));class Main$2{constructor(){this.catch_fatal_error=callback=>__awaiter(this,void 0,void 0,(function*(){if("background"===page)callback();else if(is_ext){(yield app.send_msg_resp({msg:"check_if_background_page_is_available"}))&&callback()}else callback()}))}static i(){return this.i0||(this.i0=new this)}}class Visibility{constructor(){this.page_is_crashed=!1,this.show_reload_ui_screen=()=>{this.page_is_crashed=!0},makeObservable(this,{page_is_crashed:observable,show_reload_ui_screen:action})}static i(){return this.i0||(this.i0=new this)}}class Main$1{constructor(){this.hide_delay=5e3,this.highlight_time=300,this.show_error=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=this.hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>{Main$2.i().catch_fatal_error((()=>{const error_ui_is_visible=!(x.in_service_worker||silent||error_obj&&error_obj.silent);if(error_ui_is_visible&&(is_notification?(State.i().change_state({observable_key:"is_notification",state:!0}),Msg.i().notification_msg_key=notification_msg_key):State.i().change_state({observable_key:"is_notification",state:!1}),State.i().change_state({observable_key:"is_visible",state:!0}),State.i().change_state({observable_key:"is_highlighted",state:!0}),State.i().clear_all_reset_state_timeouts(),error_obj&&error_obj.persistent||persistent||State.i().run_reset_state_timeout({observable_key:"is_visible",delay:hide_delay+this.highlight_time}),State.i().run_reset_state_timeout({observable_key:"is_highlighted",delay:this.highlight_time})),error_obj&&error_code){error_ui_is_visible&&Msg.i().change_visibility_of_advanced_msg({is_visible:!1});const error_msg_pre=app.msg(`${error_obj.error_msg||error_msg_key}_error`),error_msg_final=error_msg_pre?` ${error_msg_pre}`:"";if(runInAction((()=>err((()=>{Msg.i().basic_msg=`${app.msg("an_error_occured_msg")+error_msg_final}`,Msg.i().advanced_msg=`${app.msg("error_code_label")+(error_obj.error_code||error_code)}\n${app.msg("error_type_label")+error_obj.name}\n${app.msg("error_msg_label")+error_obj.message}`}),"shr_1195"))),error_obj.exit||exit){const updated_error_obj=error_obj,set_updated_error_obj_propery=({key:key,undefined_property:undefined_property})=>{updated_error_obj[key]=n(error_obj[key])?error_obj[key]:undefined_property};throw set_updated_error_obj_propery({key:"error_code",undefined_property:error_code}),set_updated_error_obj_propery({key:"error_msg",undefined_property:error_msg_key}),set_updated_error_obj_propery({key:"silent",undefined_property:silent}),set_updated_error_obj_propery({key:"persistent",undefined_property:persistent}),set_updated_error_obj_propery({key:"exit",undefined_property:exit}),set_updated_error_obj_propery({key:"hide_delay",undefined_property:hide_delay}),updated_error_obj}this.output_error(error_obj,error_code)}}))},this.output_error=(error_obj,error_code)=>{const line="---------------------------",separator_bottom=`\n${line}`,error_code_and_msg=`${`${line}\n`}Code: ${error_code}\nMessage: ${error_obj.message}`,console_output=error_obj.stack?`${error_code_and_msg}\nStack: ${error_obj.stack+separator_bottom}`:error_code_and_msg+separator_bottom;console.error(console_output)},makeObservable(this,{show_error:action})}static i(){return this.i0||(this.i0=new this)}}class Msg{constructor(){this.advanced_msg_is_visible=!1,this.basic_msg="",this.advanced_msg="",this.notification_msg_key="",this.change_visibility_of_advanced_msg=({is_visible:is_visible})=>{this.advanced_msg_is_visible=is_visible},makeObservable(this,{advanced_msg_is_visible:observable,basic_msg:observable,advanced_msg:observable,notification_msg_key:observable,main_msg:computed,advanced_msg_is_visible_cls:computed,more_info_btn_is_visible_cls:computed,change_visibility_of_advanced_msg:action})}static i(){return this.i0||(this.i0=new this)}get advanced_msg_is_visible_cls(){return this.advanced_msg_is_visible?"":"none"}get more_info_btn_is_visible_cls(){return this.advanced_msg_is_visible?"none":""}get main_msg(){return State.i().is_notification?app.msg(this.notification_msg_key):this.basic_msg}}class State{constructor(){this.is_loaded=!1,this.is_visible=!1,this.is_highlighted=!1,this.is_notification=!1,this.change_state=({observable_key:observable_key,state:state})=>{this[observable_key]=state},this.run_reset_state_timeout=({observable_key:observable_key,delay:delay})=>{this[`${observable_key}_timeout`]=global.setTimeout((()=>{this.change_state({observable_key:observable_key,state:!1})}),delay)},this.clear_all_reset_state_timeouts=()=>{n(this.is_visible_timeout)&&n(this.is_highlighted_timeout)&&(clearTimeout(this.is_visible_timeout),clearTimeout(this.is_highlighted_timeout))},makeObservable(this,{is_loaded:observable,is_visible:observable,is_highlighted:observable,is_notification:observable,is_visible_style:computed,is_highlighted_cls:computed,change_state:action})}static i(){return this.i0||(this.i0=new this)}get is_visible_style(){return this.is_loaded&&this.is_visible?"":"none"}get is_highlighted_cls(){return this.is_highlighted?"is_highlighted":""}get is_notification_cls(){return this.is_notification?"is_notification":""}}class Page{constructor(){this.reload=()=>{global.location.reload()}}static i(){return this.i0||(this.i0=new this)}}export{Body$1 as B,CloseBtn as C,ExtName as E,Main$1 as M,Visibility as V,Body as a,Msg$1 as b,Main$2 as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ac as getDefaultExportFromCjs}from"./chunk-main-1095d121.js";function _mergeNamespaces(n,m){return m.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(k){if("default"!==k&&!(k in n)){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:function(){return e[k]}})}}))})),Object.freeze(n)}var pickr_min$2={exports:{}};self;var pickr_min$1=_mergeNamespaces({__proto__:null,default:getDefaultExportFromCjs(pickr_min$2.exports=(()=>{var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{default:()=>L});var o={};function n(t,e,o,n,i={}){e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(o)||(o=[o]);for(const s of e)for(const e of o)s[t](e,n,{capture:!1,...i});return Array.prototype.slice.call(arguments,1)}t.r(o),t.d(o,{adjustableInputNumbers:()=>p,createElementFromString:()=>r,createFromTemplate:()=>a,eventPath:()=>l,off:()=>s,on:()=>i,resolveElement:()=>c});const i=n.bind(null,"addEventListener"),s=n.bind(null,"removeEventListener");function r(t){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function a(t){const e=(t,e)=>{const o=t.getAttribute(e);return t.removeAttribute(e),o},o=(t,n={})=>{const i=e(t,":obj"),s=e(t,":ref"),r=i?n[i]={}:n;s&&(n[s]=t);for(const n of Array.from(t.children)){const t=e(n,":arr"),i=o(n,t?{}:r);t&&(r[t]||(r[t]=[])).push(Object.keys(i).length?i:n)}return n};return o(r(t))}function l(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let o=t.target.parentElement;for(e=[t.target,o];o=o.parentElement;)e.push(o);return e.push(document,window),e}function c(t){return t instanceof Element?t:"string"==typeof t?t.split(/>>/g).reduce(((t,e,o,n)=>(t=t.querySelector(e),o<n.length-1?t.shadowRoot:t)),document):null}function p(t,e=(t=>t)){function o(o){const n=[.001,.01,.1][Number(o.shiftKey||2*o.ctrlKey)]*(o.deltaY<0?1:-1);let i=0,s=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,((t,o)=>o<=s&&o+t.length>=s?(s=o,e(Number(t),n,i)):(i++,t))),t.focus(),t.setSelectionRange(s,s),o.preventDefault(),t.dispatchEvent(new Event("input"))}i(t,"focus",(()=>i(window,"wheel",o,{passive:!1}))),i(t,"blur",(()=>s(window,"wheel",o)))}const{min:u,max:h,floor:d,round:m}=Math;function f(t,e,o){e/=100,o/=100;const n=d(t=t/360*6),i=t-n,s=o*(1-e),r=o*(1-i*e),a=o*(1-(1-i)*e),l=n%6;return[255*[o,r,s,s,a,o][l],255*[a,o,o,r,s,s][l],255*[s,s,a,o,o,r][l]]}function v(t,e,o){const n=(2-(e/=100))*(o/=100)/2;return 0!==n&&(e=1===n?0:n<.5?e*o/(2*n):e*o/(2-2*n)),[t,100*e,100*n]}function b(t,e,o){const n=u(t/=255,e/=255,o/=255),i=h(t,e,o),s=i-n;let r,a;if(0===s)r=a=0;else{a=s/i;const n=((i-t)/6+s/2)/s,l=((i-e)/6+s/2)/s,c=((i-o)/6+s/2)/s;t===i?r=c-l:e===i?r=1/3+n-c:o===i&&(r=2/3+l-n),r<0?r+=1:r>1&&(r-=1)}return[360*r,100*a,100*i]}function y(t,e,o,n){return e/=100,o/=100,[...b(255*(1-u(1,(t/=100)*(1-(n/=100))+n)),255*(1-u(1,e*(1-n)+n)),255*(1-u(1,o*(1-n)+n)))]}function g(t,e,o){e/=100;const n=2*(e*=(o/=100)<.5?o:1-o)/(o+e)*100,i=100*(o+e);return[t,isNaN(n)?0:n,i]}function _(t){return b(...t.match(/.{2}/g).map((t=>parseInt(t,16))))}function w(t){t=t.match(/^[a-zA-Z]+$/)?function(t){if("black"===t.toLowerCase())return"#000";const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,"#000"===e.fillStyle?null:e.fillStyle}(t):t;const e={cmyk:/^cmyk[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)/i,rgba:/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hsla:/^((hsla)|hsl)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hsva:/^((hsva)|hsv)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hexa:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},o=t=>t.map((t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0));let n;t:for(const i in e){if(!(n=e[i].exec(t)))continue;const s=t=>!!n[2]==("number"==typeof t);switch(i){case"cmyk":{const[,t,e,s,r]=o(n);if(t>100||e>100||s>100||r>100)break t;return{values:y(t,e,s,r),type:i}}case"rgba":{const[,,,t,e,r,a]=o(n);if(t>255||e>255||r>255||a<0||a>1||!s(a))break t;return{values:[...b(t,e,r),a],a:a,type:i}}case"hexa":{let[,t]=n;4!==t.length&&3!==t.length||(t=t.split("").map((t=>t+t)).join(""));const e=t.substring(0,6);let o=t.substring(6);return o=o?parseInt(o,16)/255:void 0,{values:[..._(e),o],a:o,type:i}}case"hsla":{const[,,,t,e,r,a]=o(n);if(t>360||e>100||r>100||a<0||a>1||!s(a))break t;return{values:[...g(t,e,r),a],a:a,type:i}}case"hsva":{const[,,,t,e,r,a]=o(n);if(t>360||e>100||r>100||a<0||a>1||!s(a))break t;return{values:[t,e,r,a],a:a,type:i}}}}return{values:null,type:null}}function A(t=0,e=0,o=0,n=1){const i=(t,e)=>(o=-1)=>e(~o?t.map((t=>Number(t.toFixed(o)))):t),s={h:t,s:e,v:o,a:n,toHSVA(){const t=[s.h,s.s,s.v,s.a];return t.toString=i(t,(t=>`hsva(${t[0]}, ${t[1]}%, ${t[2]}%, ${s.a})`)),t},toHSLA(){const t=[...v(s.h,s.s,s.v),s.a];return t.toString=i(t,(t=>`hsla(${t[0]}, ${t[1]}%, ${t[2]}%, ${s.a})`)),t},toRGBA(){const t=[...f(s.h,s.s,s.v),s.a];return t.toString=i(t,(t=>`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${s.a})`)),t},toCMYK(){const t=function(t,e,o){const n=f(t,e,o),i=n[0]/255,s=n[1]/255,r=n[2]/255,a=u(1-i,1-s,1-r);return[100*(1===a?0:(1-i-a)/(1-a)),100*(1===a?0:(1-s-a)/(1-a)),100*(1===a?0:(1-r-a)/(1-a)),100*a]}(s.h,s.s,s.v);return t.toString=i(t,(t=>`cmyk(${t[0]}%, ${t[1]}%, ${t[2]}%, ${t[3]}%)`)),t},toHEXA(){const t=function(t,e,o){return f(t,e,o).map((t=>m(t).toString(16).padStart(2,"0")))}(s.h,s.s,s.v),e=s.a>=1?"":Number((255*s.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return e&&t.push(e),t.toString=()=>`#${t.join("").toUpperCase()}`,t},clone:()=>A(s.h,s.s,s.v,s.a)};return s}const C=t=>Math.max(Math.min(t,1),0);function $(t){const e={options:Object.assign({lock:null,onchange:()=>0,onstop:()=>0},t),_keyboard(t){const{options:o}=e,{type:n,key:i}=t;if(document.activeElement===o.wrapper){const{lock:o}=e.options,s="ArrowUp"===i,r="ArrowRight"===i,a="ArrowDown"===i,l="ArrowLeft"===i;if("keydown"===n&&(s||r||a||l)){let n=0,i=0;"v"===o?n=s||r?1:-1:"h"===o?n=s||r?-1:1:(i=s?-1:a?1:0,n=l?-1:r?1:0),e.update(C(e.cache.x+.01*n),C(e.cache.y+.01*i)),t.preventDefault()}else i.startsWith("Arrow")&&(e.options.onstop(),t.preventDefault())}},_tapstart(t){i(document,["mouseup","touchend","touchcancel"],e._tapstop),i(document,["mousemove","touchmove"],e._tapmove),t.cancelable&&t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:o,cache:n}=e,{lock:i,element:s,wrapper:r}=o,a=r.getBoundingClientRect();let l=0,c=0;if(t){const e=t&&t.touches&&t.touches[0];l=t?(e||t).clientX:0,c=t?(e||t).clientY:0,l<a.left?l=a.left:l>a.left+a.width&&(l=a.left+a.width),c<a.top?c=a.top:c>a.top+a.height&&(c=a.top+a.height),l-=a.left,c-=a.top}else n&&(l=n.x*a.width,c=n.y*a.height);"h"!==i&&(s.style.left=`calc(${l/a.width*100}% - ${s.offsetWidth/2}px)`),"v"!==i&&(s.style.top=`calc(${c/a.height*100}% - ${s.offsetHeight/2}px)`),e.cache={x:l/a.width,y:c/a.height};const p=C(l/a.width),u=C(c/a.height);switch(i){case"v":return o.onchange(p);case"h":return o.onchange(u);default:return o.onchange(p,u)}},_tapstop(){e.options.onstop(),s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,o=0){const{left:n,top:i,width:s,height:r}=e.options.wrapper.getBoundingClientRect();"h"===e.options.lock&&(o=t),e._tapmove({clientX:n+s*t,clientY:i+r*o})},destroy(){const{options:t,_tapstart:o,_keyboard:n}=e;s(document,["keydown","keyup"],n),s([t.wrapper,t.element],"mousedown",o),s([t.wrapper,t.element],"touchstart",o,{passive:!1})}},{options:o,_tapstart:n,_keyboard:r}=e;return i([o.wrapper,o.element],"mousedown",n),i([o.wrapper,o.element],"touchstart",n,{passive:!1}),i(document,["keydown","keyup"],r),e}function k(t={}){t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=i(t.elements,"click",(e=>{t.elements.forEach((o=>o.classList[e.target===o?"add":"remove"](t.className))),t.onchange(e),e.stopPropagation()}));return{destroy:()=>s(...e)}}const S={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8},O=(t,e,o)=>{const{container:n,margin:i,position:s,variantFlipOrder:r,positionFlipOrder:a}={container:document.documentElement.getBoundingClientRect(),...S,...o},{left:l,top:c}=e.style;e.style.left="0",e.style.top="0";const p=t.getBoundingClientRect(),u=e.getBoundingClientRect(),h={t:p.top-u.height-i,b:p.bottom+i,r:p.right+i,l:p.left-u.width-i},d={vs:p.left,vm:p.left+p.width/2+-u.width/2,ve:p.left+p.width-u.width,hs:p.top,hm:p.bottom-p.height/2-u.height/2,he:p.bottom-u.height},[m,f="middle"]=s.split("-"),v=a[m],b=r[f],{top:y,left:g,bottom:_,right:w}=n;for(const t of v){const o="t"===t||"b"===t,n=h[t],[i,s]=o?["top","left"]:["left","top"],[r,a]=o?[u.height,u.width]:[u.width,u.height],[l,c]=o?[_,w]:[w,_],[p,m]=o?[y,g]:[g,y];if(!(n<p||n+r>l))for(const r of b){const l=d[(o?"v":"h")+r];if(!(l<m||l+a>c))return e.style[s]=l-u[s]+"px",e.style[i]=n-u[i]+"px",t+r}}return e.style.left=l,e.style.top=c,null};function E(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class L{constructor(t){E(this,"_initializingActive",!0),E(this,"_recalc",!0),E(this,"_nanopop",null),E(this,"_root",null),E(this,"_color",A()),E(this,"_lastColor",A()),E(this,"_swatchColors",[]),E(this,"_setupAnimationFrame",null),E(this,"_eventListener",{init:[],save:[],hide:[],show:[],clear:[],change:[],changestop:[],cancel:[],swatchselect:[]}),this.options=t=Object.assign({...L.DEFAULT_OPTIONS},t);const{swatches:e,components:o,theme:n,sliders:i,lockOpacity:s,padding:r}=t;["nano","monolith"].includes(n)&&!i&&(t.sliders="h"),o.interaction||(o.interaction={});const{preview:a,opacity:l,hue:c,palette:p}=o;o.opacity=!s&&l,o.palette=p||a||l||c,this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),e&&e.length&&e.forEach((t=>this.addSwatch(t)));const{button:u,app:h}=this._root;this._nanopop=((t,e,o)=>{const n="object"!=typeof t||t instanceof HTMLElement?{reference:t,popper:e,...o}:t;return{update(t=n){const{reference:e,popper:o}=Object.assign(n,t);if(!o||!e)throw new Error("Popper- or reference-element missing.");return O(e,o,n)}}})(u,h,{margin:r}),u.setAttribute("role","button"),u.setAttribute("aria-label",this._t("btn:toggle"));const d=this;this._setupAnimationFrame=requestAnimationFrame((function e(){if(!h.offsetWidth)return requestAnimationFrame(e);d.setColor(t.default),d._rePositioningPicker(),t.defaultRepresentation&&(d._representation=t.defaultRepresentation,d.setColorRepresentation(d._representation)),t.showAlways&&d.show(),d._initializingActive=!1,d._emit("init")}))}_preBuild(){const{options:t}=this;for(const e of["el","container"])t[e]=c(t[e]);this._root=(t=>{const{components:e,useAsButton:o,inline:n,appClass:i,theme:s,lockOpacity:r}=t.options,l=t=>t?"":'style="display:none" hidden',c=e=>t._t(e),p=a(`\n <div :ref="root" class="pickr">\n\n ${o?"":'<button type="button" :ref="button" class="pcr-button"></button>'}\n\n <div :ref="app" class="pcr-app ${i||""}" data-theme="${s}" ${n?'style="position: unset"':""} aria-label="${c("ui:dialog")}" role="window">\n <div class="pcr-selection" ${l(e.palette)}>\n <div :obj="preview" class="pcr-color-preview" ${l(e.preview)}>\n <button type="button" :ref="lastColor" class="pcr-last-color" aria-label="${c("btn:last-color")}"></button>\n <div :ref="currentColor" class="pcr-current-color"></div>\n </div>\n\n <div :obj="palette" class="pcr-color-palette">\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="palette" class="pcr-palette" tabindex="0" aria-label="${c("aria:palette")}" role="listbox"></div>\n </div>\n\n <div :obj="hue" class="pcr-color-chooser" ${l(e.hue)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-hue pcr-slider" tabindex="0" aria-label="${c("aria:hue")}" role="slider"></div>\n </div>\n\n <div :obj="opacity" class="pcr-color-opacity" ${l(e.opacity)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-opacity pcr-slider" tabindex="0" aria-label="${c("aria:opacity")}" role="slider"></div>\n </div>\n </div>\n\n <div class="pcr-swatches ${e.palette?"":"pcr-last"}" :ref="swatches"></div>\n\n <div :obj="interaction" class="pcr-interaction" ${l(Object.keys(e.interaction).length)}>\n <input :ref="result" class="pcr-result" type="text" spellcheck="false" ${l(e.interaction.input)} aria-label="${c("aria:input")}">\n\n <input :arr="options" class="pcr-type" data-type="HEXA" value="${r?"HEX":"HEXA"}" type="button" ${l(e.interaction.hex)}>\n <input :arr="options" class="pcr-type" data-type="RGBA" value="${r?"RGB":"RGBA"}" type="button" ${l(e.interaction.rgba)}>\n <input :arr="options" class="pcr-type" data-type="HSLA" value="${r?"HSL":"HSLA"}" type="button" ${l(e.interaction.hsla)}>\n <input :arr="options" class="pcr-type" data-type="HSVA" value="${r?"HSV":"HSVA"}" type="button" ${l(e.interaction.hsva)}>\n <input :arr="options" class="pcr-type" data-type="CMYK" value="CMYK" type="button" ${l(e.interaction.cmyk)}>\n\n <input :ref="save" class="pcr-save" value="${c("btn:save")}" type="button" ${l(e.interaction.save)} aria-label="${c("aria:btn:save")}">\n <input :ref="cancel" class="pcr-cancel" value="${c("btn:cancel")}" type="button" ${l(e.interaction.cancel)} aria-label="${c("aria:btn:cancel")}">\n <input :ref="clear" class="pcr-clear" value="${c("btn:clear")}" type="button" ${l(e.interaction.clear)} aria-label="${c("aria:btn:clear")}">\n </div>\n </div>\n </div>\n `),u=p.interaction;return u.options.find((t=>!t.hidden&&!t.classList.add("active"))),u.type=()=>u.options.find((t=>t.classList.contains("active"))),p})(this),t.useAsButton&&(this._root.button=t.el),t.container.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;if(t.container.removeChild(e.root),t.inline){const o=t.el.parentElement;t.el.nextSibling?o.insertBefore(e.app,t.el.nextSibling):o.appendChild(e.app)}else t.container.appendChild(e.app);t.useAsButton?t.inline&&t.el.remove():t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const t=this,e=this.options.components,o=(t.options.sliders||"v").repeat(2),[n,i]=o.match(/^[vh]+$/g)?o:[],s=()=>this._color||(this._color=this._lastColor.clone()),r={palette:$({element:t._root.palette.picker,wrapper:t._root.palette.palette,onstop:()=>t._emit("changestop","slider",t),onchange(o,n){if(!e.palette)return;const i=s(),{_root:r,options:a}=t,{lastColor:l,currentColor:c}=r.preview;t._recalc&&(i.s=100*o,i.v=100-100*n,i.v<0&&(i.v=0),t._updateOutput("slider"));const p=i.toRGBA().toString(0);this.element.style.background=p,this.wrapper.style.background=`\n linear-gradient(to top, rgba(0, 0, 0, ${i.a}), transparent),\n linear-gradient(to left, hsla(${i.h}, 100%, 50%, ${i.a}), rgba(255, 255, 255, ${i.a}))\n `,a.comparison?a.useAsButton||t._lastColor||l.style.setProperty("--pcr-color",p):(r.button.style.setProperty("--pcr-color",p),r.button.classList.remove("clear"));const u=i.toHEXA().toString();for(const{el:e,color:o}of t._swatchColors)e.classList[u===o.toHEXA().toString()?"add":"remove"]("pcr-active");c.style.setProperty("--pcr-color",p)}}),hue:$({lock:"v"===i?"h":"v",element:t._root.hue.picker,wrapper:t._root.hue.slider,onstop:()=>t._emit("changestop","slider",t),onchange(o){if(!e.hue||!e.palette)return;const n=s();t._recalc&&(n.h=360*o),this.element.style.backgroundColor=`hsl(${n.h}, 100%, 50%)`,r.palette.trigger()}}),opacity:$({lock:"v"===n?"h":"v",element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onstop:()=>t._emit("changestop","slider",t),onchange(o){if(!e.opacity||!e.palette)return;const n=s();t._recalc&&(n.a=Math.round(100*o)/100),this.element.style.background=`rgba(0, 0, 0, ${n.a})`,r.palette.trigger()}}),selectable:k({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._recalc&&t._updateOutput("swatch")}})};this._components=r}_bindEvents(){const{_root:t,options:e}=this,o=[i(t.interaction.clear,"click",(()=>this._clearColor())),i([t.interaction.cancel,t.preview.lastColor],"click",(()=>{this.setHSVA(...(this._lastColor||this._color).toHSVA(),!0),this._emit("cancel")})),i(t.interaction.save,"click",(()=>{!this.applyColor()&&!e.showAlways&&this.hide()})),i(t.interaction.result,["keyup","input"],(t=>{this.setColor(t.target.value,!0)&&!this._initializingActive&&(this._emit("change",this._color,"input",this),this._emit("changestop","input",this)),t.stopImmediatePropagation()})),i(t.interaction.result,["focus","blur"],(t=>{this._recalc="blur"===t.type,this._recalc&&this._updateOutput(null)})),i([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],(()=>this._recalc=!0),{passive:!0})];if(!e.showAlways){const n=e.closeWithKey;o.push(i(t.button,"click",(()=>this.isOpen()?this.hide():this.show())),i(document,"keyup",(t=>this.isOpen()&&(t.key===n||t.code===n)&&this.hide())),i(document,["touchstart","mousedown"],(e=>{this.isOpen()&&!l(e).some((e=>e===t.app||e===t.button))&&this.hide()}),{capture:!0}))}if(e.adjustableNumbers){const e={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};p(t.interaction.result,((t,o,n)=>{const i=e[this.getColorRepresentation().toLowerCase()];if(i){const e=i[n],s=t+(e>=100?1e3*o:o);return s<=0?0:Number((s<e?s:e).toPrecision(3))}return t}))}if(e.autoReposition&&!e.inline){let t=null;const n=this;o.push(i(window,["scroll","resize"],(()=>{n.isOpen()&&(e.closeOnScroll&&n.hide(),null===t?(t=setTimeout((()=>t=null),100),requestAnimationFrame((function e(){n._rePositioningPicker(),null!==t&&requestAnimationFrame(e)}))):(clearTimeout(t),t=setTimeout((()=>t=null),100)))}),{capture:!0}))}this._eventBindings=o}_rePositioningPicker(){const{options:t}=this;if(!t.inline&&!this._nanopop.update({container:document.body.getBoundingClientRect(),position:t.position})){const t=this._root.app,e=t.getBoundingClientRect();t.style.top=(global.innerHeight-e.height)/2+"px",t.style.left=(global.innerWidth-e.width)/2+"px"}}_updateOutput(t){const{_root:e,_color:o,options:n}=this;if(e.interaction.type()){const t=`to${e.interaction.type().getAttribute("data-type")}`;e.interaction.result.value="function"==typeof o[t]?o[t]().toString(n.outputPrecision):""}!this._initializingActive&&this._recalc&&this._emit("change",o,t,this)}_clearColor(t=!1){const{_root:e,options:o}=this;o.useAsButton||e.button.style.setProperty("--pcr-color","rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),o.showAlways||this.hide(),this._lastColor=null,this._initializingActive||t||(this._emit("save",null),this._emit("clear"))}_parseLocalColor(t){const{values:e,type:o,a:n}=w(t),{lockOpacity:i}=this.options,s=void 0!==n&&1!==n;return e&&3===e.length&&(e[3]=void 0),{values:!e||i&&s?null:e,type:o}}_t(t){return this.options.i18n[t]||L.I18N_DEFAULTS[t]}_emit(t,...e){this._eventListener[t].forEach((t=>t(...e,this)))}on(t,e){return this._eventListener[t].push(e),this}off(t,e){const o=this._eventListener[t]||[],n=o.indexOf(e);return~n&&o.splice(n,1),this}addSwatch(t){const{values:e}=this._parseLocalColor(t);if(e){const{_swatchColors:t,_root:o}=this,n=A(...e),s=r(`<button type="button" style="--pcr-color: ${n.toRGBA().toString(0)}" aria-label="${this._t("btn:swatch")}"/>`);return o.swatches.appendChild(s),t.push({el:s,color:n}),this._eventBindings.push(i(s,"click",(()=>{this.setHSVA(...n.toHSVA(),!0),this._emit("swatchselect",n),this._emit("change",n,"swatch",this)}))),!0}return!1}removeSwatch(t){const e=this._swatchColors[t];if(e){const{el:o}=e;return this._root.swatches.removeChild(o),this._swatchColors.splice(t,1),!0}return!1}applyColor(t=!1){const{preview:e,button:o}=this._root,n=this._color.toRGBA().toString(0);return e.lastColor.style.setProperty("--pcr-color",n),this.options.useAsButton||o.style.setProperty("--pcr-color",n),o.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color),this}destroy(){cancelAnimationFrame(this._setupAnimationFrame),this._eventBindings.forEach((t=>s(...t))),Object.keys(this._components).forEach((t=>this._components[t].destroy()))}destroyAndRemove(){this.destroy();const{root:t,app:e}=this._root;t.parentElement&&t.parentElement.removeChild(t),e.parentElement.removeChild(e),Object.keys(this).forEach((t=>this[t]=null))}hide(){return!!this.isOpen()&&(this._root.app.classList.remove("visible"),this._emit("hide"),!0)}show(){return!this.options.disabled&&!this.isOpen()&&(this._root.app.classList.add("visible"),this._rePositioningPicker(),this._emit("show",this._color),this)}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(t=360,e=0,o=0,n=1,i=!1){const s=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||o<0||o>100||n<0||n>1)return!1;this._color=A(t,e,o,n);const{hue:r,opacity:a,palette:l}=this._components;return r.update(t/360),a.update(n),l.update(e/100,1-o/100),i||this.applyColor(),s&&this._updateOutput(),this._recalc=s,!0}setColor(t,e=!1){if(null===t)return this._clearColor(e),!0;const{values:o,type:n}=this._parseLocalColor(t);if(o){const t=n.toUpperCase(),{options:i}=this._root.interaction,s=i.find((e=>e.getAttribute("data-type")===t));if(s&&!s.hidden)for(const t of i)t.classList[t===s?"add":"remove"]("active");return!!this.setHSVA(...o,e)&&this.setColorRepresentation(t)}return!1}setColorRepresentation(t){return t=t.toUpperCase(),!!this._root.interaction.options.find((e=>e.getAttribute("data-type").startsWith(t)&&!e.click()))}getColorRepresentation(){return this._representation}getColor(){return this._color}getSelectedColor(){return this._lastColor}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}return E(L,"utils",o),E(L,"version","1.8.2"),E(L,"I18N_DEFAULTS",{"ui:dialog":"color picker dialog","btn:toggle":"toggle color picker dialog","btn:swatch":"color swatch","btn:last-color":"use previous color","btn:save":"Save","btn:cancel":"Cancel","btn:clear":"Clear","aria:btn:save":"save and close","aria:btn:cancel":"cancel and close","aria:btn:clear":"clear and close","aria:input":"color input field","aria:palette":"color selection area","aria:hue":"hue selection slider","aria:opacity":"selection slider"}),E(L,"DEFAULT_OPTIONS",{appClass:null,theme:"classic",useAsButton:!1,padding:8,disabled:!1,comparison:!0,closeOnScroll:!1,outputPrecision:0,lockOpacity:!1,autoReposition:!0,container:"body",components:{interaction:{}},i18n:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"}),E(L,"create",(t=>new L(t))),e.default})())},[pickr_min$2.exports]);export{pickr_min$1 as p};
|
package/ext.d.ts
ADDED
package/ext.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{A as App}from"./chunk-app-198a1b93.js";import"path";import"./chunk-main-1095d121.js";import"react";import"react-dom";import"fs";import"constants";import"stream";import"util";import"assert";import"./chunk-main-b3455ac8.js";
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<title data-page="announcement"> </title>
|
|
7
|
+
<link rel="icon" type="image/png" href="icon16.png" />
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body class="mouse">
|
|
11
|
+
<script src="env.js"></script>
|
|
12
|
+
<script type="module" src="announcement.js"></script>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./ts/error_modules/error/scripts";
|
|
2
|
+
export { c_crash_handler, c_error, d_crash_handler } from "./ts/error_modules/internal";
|
|
3
|
+
export { X, t, vars, prevent_default, stop_propagation, init_shared, c_ext_version, c_loading_screen, c_tr, o_tr, d_loading_screen, s_css_vars, s_no_tr, s_tab_index, s_theme, s_title, s_utils, s_viewport, i_data, } from "./ts/shared/internal";
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as Body,a as Body$3,C as CloseBtn,E as ExtName,b as Msg,c as Main$8,V as Visibility}from"./chunk-main-b3455ac8.js";import{S as Sections,B as Body$1,e as Body$2,f as BaseTr,T as Transition,M as Main$2,g as Main$3,h as Main$5,i as Main$7}from"./chunk-main-1095d121.js";export{X,p as prevent_default,j as stop_propagation}from"./chunk-main-1095d121.js";import"react";import{M as Main$4,a as Main$6}from"./chunk-main-651fde68.js";import"react-dom";var index$f=Object.freeze({__proto__:null,Body:Body}),t=Object.freeze({__proto__:null});var vars=Object.freeze({__proto__:null,scrollbar_width:17});const init_shared=()=>err((()=>{err((()=>{Sections.i().init_options()}),"shr_1087")}),"shr_1112");var index$e=Object.freeze({__proto__:null,Body:Body$1}),index$d=Object.freeze({__proto__:null,Body:Body$2}),index$c=Object.freeze({__proto__:null,BaseTr:BaseTr}),index$b=Object.freeze({__proto__:null,Transition:Transition}),index$a=Object.freeze({__proto__:null,Main:Main$2}),index$9=Object.freeze({__proto__:null,Main:Main$3}),index$8=Object.freeze({__proto__:null,Main:Main$4}),index$7=Object.freeze({__proto__:null,Main:Main$5}),index$6=Object.freeze({__proto__:null,Main:Main$6});var index$5=Object.freeze({__proto__:null,Main:class{constructor(){this.set=()=>err((()=>{const title_el=s("title");if(n(title_el)){const title=app.msg(`${page}_title_text`);title_el.textContent="announcement"===page?`${we.runtime.getManifest().name} - ${title}`:title}}),"shr_1229")}static i(){return this.i0||(this.i0=new this)}}});var index$4=Object.freeze({__proto__:null,Main:class{constructor(){this.to_object=({arr:arr,section:section,subsection:subsection})=>err((()=>{const obj_final={};return arr.forEach((item=>err((()=>{obj_final[item.name]=item,section&&(obj_final[item.name].section=section),subsection&&(obj_final[item.name].subsection=subsection)}),"shr_1136"))),obj_final}),"shr_1137")}static i(){return this.i0||(this.i0=new this)}}}),index$3=Object.freeze({__proto__:null,Main:Main$7}),index$2=Object.freeze({__proto__:null}),index$1=Object.freeze({__proto__:null,Body:Body$3,CloseBtn:CloseBtn,ExtName:ExtName,Msg:Msg}),index=Object.freeze({__proto__:null,Main:Main$8,Visibility:Visibility});export{index$f as c_crash_handler,index$1 as c_error,index$e as c_ext_version,index$d as c_loading_screen,index$c as c_tr,index as d_crash_handler,index$a as d_loading_screen,index$2 as i_data,init_shared,index$b as o_tr,index$9 as s_css_vars,index$8 as s_no_tr,index$7 as s_tab_index,index$6 as s_theme,index$5 as s_title,index$4 as s_utils,index$3 as s_viewport,t,vars};
|
package/inputs.d.ts
ADDED
package/inputs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as Btn,C as Checkbox,F as File,H as HelpBtn,l as Help,n as Hr$1,I as IconBtn$1,q as InputItem,L as Label,t as LinkBtn,u as Link$1,R as Range$1,v as SectionBtn,w as SectionContent,x as Section,y as Select,G as Group$1,z as TextBtn,A as Text,D as Textarea$1,U as UploadBox$1,E as InputBase,J as computedFn,V as Val,m as makeObservable,a as observable,K as Btn$1,N as Checkbox$1,O as File$1,P as LinkBtn$1,Q as Option,W as Section$1,Y as Select$1,Z as Text$1,$ as Color$1,a0 as _,a1 as Visibility,a2 as Help$1,a3 as InputWidth,a4 as Label$1,a5 as NestedInput,a6 as Text$2,a7 as UploadBox$2,a8 as ColorPicker,a9 as Position}from"./chunk-main-1095d121.js";import"react";import"react-dom";var index$7=Object.freeze({__proto__:null,Btn:Btn,Checkbox:Checkbox,File:File,HelpBtn:HelpBtn,Help:Help,Hr:Hr$1,IconBtn:IconBtn$1,InputItem:InputItem,Label:Label,LinkBtn:LinkBtn,Link:Link$1,Range:Range$1,SectionBtn:SectionBtn,SectionContent:SectionContent,Section:Section,Select:Select,Group:Group$1,TextBtn:TextBtn,Text:Text,Textarea:Textarea$1,UploadBox:UploadBox$1});var index$6=Object.freeze({__proto__:null,InputBase:InputBase,Btn:Btn$1,Checkbox:Checkbox$1,File:File$1,Hr:class{constructor(obj){this.type="hr",Object.assign(this,obj),this.name=obj.name}},IconBtn:class extends InputBase{constructor(obj){super(obj),this.type="icon_btn",this.Svg="",Object.assign(this,obj)}},LinkBtn:LinkBtn$1,Link:class{constructor(obj){this.type="link",this.force_resolve=!1,this.text=()=>err((()=>app.msg(`${this.name}_link_text`)||app.msg(`${this.name}_${this.browser}_link_text`)),"shr_1069"),this.href_final=()=>err((()=>n(this.href)?this.href:app.msg(`${this.name}_link_href`)||app.msg(`${this.name}_${this.browser}_link_href`)),"shr_1070"),this.show_link=()=>err((()=>{const link_is_cross_browser=!n(this.browser),link_browser_is_the_same_as_env_browser=this.browser===env.browser;return link_is_cross_browser||!link_browser_is_the_same_as_env_browser||n(this.force_resolve)&&this.force_resolve}),"shr_1071"),Object.assign(this,obj),this.name=obj.name}},Option:Option,Range:class extends InputBase{constructor(obj){super(obj),this.type="range",this.min=0,this.max=100,this.step=1,this.displayed_val=computedFn((function({input:input}){return n(input.step)?Math.round(Val.i().access({input:input})/input.step):0})),this.lower_fill_percentage=computedFn((function({input:input}){return 100*input.displayed_val({input:input})/(n(input.max)&&n(input.step)?input.max/input.step:0)})),this.lower_fill_width=computedFn((function({input:input}){return`${input.lower_fill_percentage({input:input})}%`})),this.help_is_present_cls=computedFn((function({input:input}){return input.include_help?"help_is_present":""})),Object.assign(this,obj)}},Section:Section$1,Select:Select$1,Group:class extends InputBase{constructor(obj){super(obj),this.type="group",Object.assign(this,obj),this.inputs=obj.inputs}},Text:Text$1,Textarea:class extends InputBase{constructor(obj){super(obj),this.type="textarea",Object.assign(this,obj)}},UploadBox:class extends InputBase{constructor(obj){super(obj),this.type="upload_box",this.multiple=!1,this.accept=".png,.jpg,.jpeg,.gif",this.loading_msg_is_visible=!1,this.error_msg_is_visible=!1,this.is_in_hover_state=!1,this.drag_counter=0,this.loading_msg_visibility_cls=computedFn((function(){return this.loading_msg_is_visible?"":"none"})),this.error_msg_visibility_cls=computedFn((function(){return this.error_msg_is_visible?"":"none"})),this.loading_cls=computedFn((function(){return this.loading_msg_is_visible?"loading":""})),makeObservable(this,{loading_msg_is_visible:observable,error_msg_is_visible:observable,is_in_hover_state:observable}),Object.assign(this,obj)}}});const color_picker_state={is_initialized:!1,is_visible:!1,is_closed:!0};var index$5=Object.freeze({__proto__:null,Color:class extends InputBase{constructor(obj){super(obj),this.type="color",this.include_visualization=!0,this.include_palette_label=!1,this.palette_is_visible=!1,this.palette_is_closed=!0,this.palette_width="0",this.palette_height="0",this.color_picker_width="0",this.color_picker_height="0",this.include_remove_color_btn=!0,this.include_ok_btn=!1,this.state=Object.assign({main:color_picker_state},Array(Color$1.i().palette_color_amount).fill(color_picker_state).reduce(((accumulator,val,i)=>(accumulator[i]=val,accumulator)),{})),this.is_palette_color=({i:i})=>err((()=>"number"==typeof i),"shr_1030"),this.visualization_cls=({i:i})=>err((()=>"main"===i?"visualization":""),"shr_1031"),this.palette_visualization_cls=({i:i})=>err((()=>"main"===i?"":"palette_visualization"),"shr_1032"),this.inset_border_cls=({i:i})=>err((()=>"main"===i?"":"inset_border"),"shr_1033"),this.el_to_show_type=({i:i})=>err((()=>"main"===i?"color_picker_or_palette":"color_picker"),"shr_1034"),this.color_picker_is_visible=computedFn((function({i:i}){return n(this.state)&&this.state[i].is_visible})),this.palette_w_is_visible=computedFn((function(){return!this.include_visualization||this.palette_is_visible})),this.visualization_outline_opened=computedFn((function({i:i}){return"main"===i&&this.palette_is_visible||n(this.state)&&this.state[i].is_visible?"opened":""})),this.visualization_outline_selected=computedFn((function({i:i}){return this.is_palette_color({i:i})&&i===(n(this.val_accessor)?_.get(data,this.val_accessor):data.settings[this.name])?"selected":""})),this.palette_visualization_outline_selected=computedFn((function({i:i}){return i===data.settings.selected_palette_color?"selected":""})),this.color_picker_is_closed_visibility_cls=computedFn((function({i:i}){return n(this.state)&&this.state[i].is_closed?"none":""})),this.palette_is_closed_visibility_cls=computedFn((function(){return this.palette_is_closed?"none":""})),this.color_help_visibility_cls=computedFn((function(){return Visibility.i().color_help_is_visible?"":"none"})),makeObservable(this,{palette_is_visible:observable,palette_is_closed:observable,palette_width:observable,palette_height:observable,color_picker_width:observable,color_picker_height:observable,state:observable}),Object.assign(this,obj),this.select_palette_color_callback=obj.select_palette_color_callback,this.remove_color_callback=obj.remove_color_callback,this.restore_default_palette_callback=obj.restore_default_palette_callback,this.hide_color_help_callback=obj.hide_color_help_callback}}}),index$4=Object.freeze({__proto__:null,Help:Help$1,InputWidth:InputWidth,Label:Label$1,NestedInput:NestedInput,Val:Val,Text:Text$2,UploadBox:UploadBox$2}),index$3=Object.freeze({__proto__:null,Color:Color$1,Visibility:Visibility}),index$2=Object.freeze({__proto__:null,ColorPicker:ColorPicker,Position:Position}),index$1=Object.freeze({__proto__:null}),index=Object.freeze({__proto__:null});export{index$7 as c_inputs,index$3 as d_color,index$4 as d_inputs,index as i_color,index$1 as i_inputs,index$5 as o_color,index$6 as o_inputs,index$2 as s_color};
|
package/js/env.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
class Env {
|
|
5
|
+
constructor({ app_root }) {
|
|
6
|
+
this.app_root = app_root;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
generate = ({ browser, mode }) => {
|
|
10
|
+
const env = `this.env = { "browser": "${browser}", "mode": "${mode}" }`;
|
|
11
|
+
|
|
12
|
+
fs.outputFileSync(path.join(this.app_root, 'dist', 'env.js'), env, 'utf-8');
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = { Env };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
class Manifest {
|
|
5
|
+
constructor({ app_root }) {
|
|
6
|
+
this.app_root = app_root;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
generate = ({ manifest, browser, monochrome_new_tab_icon = false }) => {
|
|
10
|
+
const shared_manifest = {
|
|
11
|
+
manifest_version: 2,
|
|
12
|
+
version: process.env.npm_package_version,
|
|
13
|
+
default_locale: 'en',
|
|
14
|
+
icons: {
|
|
15
|
+
16: `icon16${monochrome_new_tab_icon ? '_monochrome' : ''}.png`,
|
|
16
|
+
},
|
|
17
|
+
action: {
|
|
18
|
+
default_icon: {
|
|
19
|
+
16: 'icon16.png',
|
|
20
|
+
32: 'icon32.png',
|
|
21
|
+
64: 'icon64.png',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (['chrome', 'opera', 'edge'].includes(browser)) {
|
|
27
|
+
shared_manifest.icons[128] = 'icon128.png';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (['chrome', 'firefox'].includes(browser)) {
|
|
31
|
+
shared_manifest.icons[48] = 'icon48.png';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (browser === 'edge') {
|
|
35
|
+
shared_manifest.icons[24] = 'icon24.png';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (browser === 'firefox') {
|
|
39
|
+
shared_manifest.icons[96] = 'icon96.png';
|
|
40
|
+
shared_manifest.applications = {
|
|
41
|
+
gecko: {
|
|
42
|
+
id: `${process.env.npm_package_name}@loftyshaky`,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fs.outputFileSync(
|
|
48
|
+
path.join(this.app_root, 'dist', 'manifest.json'),
|
|
49
|
+
JSON.stringify({
|
|
50
|
+
...shared_manifest,
|
|
51
|
+
...manifest,
|
|
52
|
+
}),
|
|
53
|
+
'utf-8',
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = { Manifest };
|
package/js/locales.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
class Locales {
|
|
5
|
+
constructor({ app_root }) {
|
|
6
|
+
this.app_root = app_root;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
merge = async () => {
|
|
10
|
+
const app_locales_path = path.join(this.app_root, 'src', '_locales');
|
|
11
|
+
const shared_locales_path = path.join(
|
|
12
|
+
this.app_root,
|
|
13
|
+
'node_modules',
|
|
14
|
+
'@loftyshaky',
|
|
15
|
+
'shared',
|
|
16
|
+
'_locales',
|
|
17
|
+
);
|
|
18
|
+
const locales = fs.readdirSync(app_locales_path);
|
|
19
|
+
|
|
20
|
+
locales.forEach((locale) => {
|
|
21
|
+
const shared_messages_path = path.join(shared_locales_path, locale, 'messages.json');
|
|
22
|
+
|
|
23
|
+
const app_messages = fs.readJSONSync(
|
|
24
|
+
path.join(app_locales_path, locale, 'messages.json'),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
let shared_messages = {};
|
|
28
|
+
|
|
29
|
+
if (fs.existsSync(shared_messages_path)) {
|
|
30
|
+
shared_messages = fs.readJSONSync(
|
|
31
|
+
path.join(shared_locales_path, locale, 'messages.json'),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const merged_messages = {
|
|
36
|
+
...shared_messages,
|
|
37
|
+
...app_messages,
|
|
38
|
+
};
|
|
39
|
+
const locale_path = path.join(this.app_root, 'dist', '_locales', locale);
|
|
40
|
+
const dest_messages = path.join(locale_path, 'messages.json');
|
|
41
|
+
|
|
42
|
+
fs.ensureDirSync(locale_path);
|
|
43
|
+
fs.writeJsonSync(dest_messages, merged_messages);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = { Locales };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const util = require('util');
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const isObject = require('is-plain-object');
|
|
5
|
+
const globby = require('globby');
|
|
6
|
+
const { bold, green, yellow } = require('colorette');
|
|
7
|
+
|
|
8
|
+
function stringify(value) {
|
|
9
|
+
return util.inspect(value, { breakLength: Infinity });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function isFile(filePath) {
|
|
13
|
+
const fileStats = await fs.stat(filePath);
|
|
14
|
+
|
|
15
|
+
return fileStats.isFile();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function renameTarget(target, rename) {
|
|
19
|
+
const parsedPath = path.parse(target);
|
|
20
|
+
|
|
21
|
+
return typeof rename === 'string'
|
|
22
|
+
? rename
|
|
23
|
+
: rename(parsedPath.name, parsedPath.ext.replace('.', ''));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function generateCopyTarget(src, dest, { flatten, rename, transform }) {
|
|
27
|
+
if (transform && !(await isFile(src))) {
|
|
28
|
+
throw new Error(`"transform" option works only on files: '${src}' must be a file`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { base, dir } = path.parse(src);
|
|
32
|
+
const destinationFolder =
|
|
33
|
+
flatten || (!flatten && !dir) ? dest : dir.replace(dir.split('/')[0], dest);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
src,
|
|
37
|
+
dest: path.join(destinationFolder, rename ? renameTarget(base, rename) : base),
|
|
38
|
+
...(transform && { contents: await transform(await fs.readFile(src)) }),
|
|
39
|
+
renamed: rename,
|
|
40
|
+
transformed: transform,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = function copy(options = {}) {
|
|
45
|
+
const {
|
|
46
|
+
copyOnce = false,
|
|
47
|
+
flatten = true,
|
|
48
|
+
hook = 'buildEnd',
|
|
49
|
+
targets = [],
|
|
50
|
+
verbose = false,
|
|
51
|
+
callback_start,
|
|
52
|
+
callback_end,
|
|
53
|
+
...restPluginOptions
|
|
54
|
+
} = options;
|
|
55
|
+
|
|
56
|
+
let copied = false;
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
name: 'copy',
|
|
60
|
+
[hook]: async () => {
|
|
61
|
+
if (callback_start != null) {
|
|
62
|
+
await callback_start();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (copyOnce && copied) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const copyTargets = [];
|
|
70
|
+
|
|
71
|
+
if (Array.isArray(targets) && targets.length) {
|
|
72
|
+
for (const target of targets) {
|
|
73
|
+
if (!isObject(target)) {
|
|
74
|
+
throw new Error(`${stringify(target)} target must be an object`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const { dest, rename, src, transform, ...restTargetOptions } = target;
|
|
78
|
+
|
|
79
|
+
if (!src || !dest) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`${stringify(target)} target must have "src" and "dest" properties`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (rename && typeof rename !== 'string' && typeof rename !== 'function') {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`${stringify(
|
|
88
|
+
target,
|
|
89
|
+
)} target's "rename" property must be a string or a function`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const matchedPaths = await globby(src, {
|
|
94
|
+
expandDirectories: false,
|
|
95
|
+
onlyFiles: false,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (matchedPaths.length) {
|
|
99
|
+
for (const matchedPath of matchedPaths) {
|
|
100
|
+
const generatedCopyTargets = Array.isArray(dest)
|
|
101
|
+
? await Promise.all(
|
|
102
|
+
dest.map((destination) =>
|
|
103
|
+
generateCopyTarget(matchedPath, destination, {
|
|
104
|
+
flatten,
|
|
105
|
+
rename,
|
|
106
|
+
transform,
|
|
107
|
+
}),
|
|
108
|
+
),
|
|
109
|
+
)
|
|
110
|
+
: [
|
|
111
|
+
await generateCopyTarget(matchedPath, dest, {
|
|
112
|
+
flatten,
|
|
113
|
+
rename,
|
|
114
|
+
transform,
|
|
115
|
+
}),
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
copyTargets.push(...generatedCopyTargets);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (copyTargets.length) {
|
|
125
|
+
setTimeout(async () => {
|
|
126
|
+
if (verbose) {
|
|
127
|
+
console.log(green('copied:'));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
for (const copyTarget of copyTargets) {
|
|
131
|
+
const { contents, dest, src, transformed } = copyTarget;
|
|
132
|
+
|
|
133
|
+
if (transformed) {
|
|
134
|
+
await fs.outputFile(dest, contents, restPluginOptions);
|
|
135
|
+
} else {
|
|
136
|
+
try {
|
|
137
|
+
await fs.copy(src, dest, restPluginOptions);
|
|
138
|
+
} catch (error_obj) {}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (verbose) {
|
|
142
|
+
let message = green(` ${bold(src)} → ${bold(dest)}`);
|
|
143
|
+
const flags = Object.entries(copyTarget)
|
|
144
|
+
.filter(
|
|
145
|
+
([key, value]) =>
|
|
146
|
+
['renamed', 'transformed'].includes(key) && value,
|
|
147
|
+
)
|
|
148
|
+
.map(([key]) => key.charAt(0).toUpperCase());
|
|
149
|
+
|
|
150
|
+
if (flags.length) {
|
|
151
|
+
message = `${message} ${yellow(`[${flags.join(', ')}]`)}`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log(message);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (callback_end != null) {
|
|
159
|
+
callback_end();
|
|
160
|
+
}
|
|
161
|
+
}, 0);
|
|
162
|
+
} else if (verbose) {
|
|
163
|
+
console.log(yellow('no items to copy'));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
copied = true;
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const appRoot = require('app-root-path');
|
|
4
|
+
const recursiveReaddir = require('recursive-readdir');
|
|
5
|
+
const _ = require('lodash');
|
|
6
|
+
|
|
7
|
+
const { TaskScheduler } = require('../../task_scheduler');
|
|
8
|
+
|
|
9
|
+
const task_scheduler = new TaskScheduler();
|
|
10
|
+
|
|
11
|
+
const app_root = appRoot.path;
|
|
12
|
+
|
|
13
|
+
let initial_run_completed = false;
|
|
14
|
+
|
|
15
|
+
const generate_watch_files = async () => {
|
|
16
|
+
let watch_files = [];
|
|
17
|
+
|
|
18
|
+
const src_dir = path.join(app_root, 'src');
|
|
19
|
+
|
|
20
|
+
const dirs = [
|
|
21
|
+
path.join(app_root, 'js'),
|
|
22
|
+
path.join(src_dir, '_locales'),
|
|
23
|
+
path.join(src_dir, 'scss'),
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
await Promise.all(
|
|
27
|
+
dirs.map(async (dir) => {
|
|
28
|
+
const files = await recursiveReaddir(dir);
|
|
29
|
+
|
|
30
|
+
watch_files = _.union(watch_files, files);
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return watch_files;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = function watcher({ mode }) {
|
|
38
|
+
return {
|
|
39
|
+
async buildStart() {
|
|
40
|
+
if (!initial_run_completed) {
|
|
41
|
+
await task_scheduler.unlock_dist({
|
|
42
|
+
package_name: 'Shared',
|
|
43
|
+
remove_dist: mode === 'production',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
initial_run_completed = true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const watch_files = await generate_watch_files();
|
|
50
|
+
|
|
51
|
+
watch_files.forEach((file) => {
|
|
52
|
+
this.addWatchFile(file);
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class Terser {
|
|
2
|
+
config = {
|
|
3
|
+
output: {
|
|
4
|
+
comments(node, comment) {
|
|
5
|
+
const text = comment.value;
|
|
6
|
+
const { type } = comment;
|
|
7
|
+
if (type === 'comment2') {
|
|
8
|
+
return /@preserve|@license|@cc_on/i.test(text);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return undefined;
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
mangle: false,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = { Terser };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const childProcess = require('child_process');
|
|
4
|
+
|
|
5
|
+
const { ProjectName } = require('./project_name');
|
|
6
|
+
|
|
7
|
+
const project_name = new ProjectName();
|
|
8
|
+
|
|
9
|
+
class TaskScheduler {
|
|
10
|
+
unlock_dist = async ({ package_name, remove_dist }) => {
|
|
11
|
+
const is_windows = process.platform === 'win32';
|
|
12
|
+
|
|
13
|
+
if (
|
|
14
|
+
(is_windows &&
|
|
15
|
+
fs.existsSync(path.join('C:', 'Program Files', 'LockHunter', 'LockHunter.exe'))) ||
|
|
16
|
+
!is_windows
|
|
17
|
+
) {
|
|
18
|
+
if (is_windows) {
|
|
19
|
+
childProcess.execSync(`SCHTASKS.EXE /RUN /TN "Unlock ${package_name} dist dir"`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (remove_dist) {
|
|
23
|
+
// eslint-disable-next-line global-require
|
|
24
|
+
const { projects_path } = require('./projects_path');
|
|
25
|
+
|
|
26
|
+
fs.removeSync(
|
|
27
|
+
path.join(
|
|
28
|
+
projects_path.q,
|
|
29
|
+
package_name,
|
|
30
|
+
project_name.transform({ project: package_name }),
|
|
31
|
+
'dist',
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { TaskScheduler };
|