android-extensions
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -40,3 +40,3 @@ /* android.widget.bottomnavigation | ||
node.cascade((item) => this.addDescendant(item)); | ||
this.setStyleTheme(resourceId); | ||
this.setStyleTheme(resourceId, node.localSettings.preferMaterialDesign); | ||
return { | ||
@@ -71,6 +71,8 @@ output: { | ||
} | ||
setStyleTheme(resourceId) { | ||
setStyleTheme(resourceId, materialDesign) { | ||
const options = createThemeAttribute(this.options.resource); | ||
assignEmptyValue(options, 'name', this.application.userSettings.manifestThemeName); | ||
assignEmptyValue(options, 'parent', 'Theme.AppCompat.Light.DarkActionBar'); | ||
if (materialDesign === false || materialDesign === 'MaterialComponents') { | ||
assignEmptyValue(options, 'parent', 'Theme.AppCompat.Light.DarkActionBar'); | ||
} | ||
Resource.addTheme(resourceId, options, { filename: this.controller.localSettings.filename.theme }); | ||
@@ -77,0 +79,0 @@ } |
@@ -1,1 +0,1 @@ | ||
this.android=this.android||{},this.android.widget=this.android.widget||{},this.android.widget.bottomnavigation=function(){"use strict";const e=android.base.Resource,{NODE_RESOURCE:t}=squared.base.lib.constant,{CONTAINER_NODE:i,SUPPORT_TAGNAME:n,SUPPORT_TAGNAME_X:a}=android.lib.constant,{capitalize:o,iterateArray:s}=squared.lib.util,{createThemeAttribute:d,createViewOptions:r,removeFileExtension:c}=android.lib.util,{assignEmptyValue:u}=squared.base.lib.util;class l extends squared.base.ExtensionUI{constructor(e,t,i){super(e,t,i),this.options={element:{},resource:{}},this.require("android.widget.menu")}processNode(t,i){const o=r(this.options,t.elementId);u(o,"android","background","?android:attr/windowBackground"),s(t.children,(e=>{e.hide(),e.cascade((e=>e.hide()))}),5);const d=t.localSettings.resourceId,c=t.api<29?n.BOTTOM_NAVIGATION:a.BOTTOM_NAVIGATION;return t.setControlType(c,14),t.exclude({resource:28}),t.render(i),t.apply(e.formatOptions(d,o)),t.setLayoutWidth("match_parent"),t.setLayoutHeight("wrap_content"),t.cascade((e=>this.addDescendant(e))),this.setStyleTheme(d),{output:{type:1,node:t,controlName:c},complete:!0,include:!0}}postOptimize(e){var t;const i=e.renderParent;i.documentRoot&&(i.inlineWidth&&i.setLayoutWidth("match_parent"),i.inlineHeight&&i.setLayoutHeight("match_parent"));const n=null===(t=l.findNestedElement(e,"android.widget.menu"))||void 0===t?void 0:t.dataset["filename"+o(this.application.systemName)];if(n){const t=r(this.options,e.elementId),i=t.app||(t.app={});u(i,"menu",`@menu/${c(n)}`),e.app("menu",i.menu)}}setStyleTheme(t){const i=d(this.options.resource);u(i,"name",this.application.userSettings.manifestThemeName),u(i,"parent","Theme.AppCompat.Light.DarkActionBar"),e.addTheme(t,i,{filename:this.controller.localSettings.filename.theme})}}const m=new l("android.widget.bottomnavigation",2);return squared&&squared.add(m),m}(); | ||
this.android=this.android||{},this.android.widget=this.android.widget||{},this.android.widget.bottomnavigation=function(){"use strict";const e=android.base.Resource,{NODE_RESOURCE:t}=squared.base.lib.constant,{CONTAINER_NODE:i,SUPPORT_TAGNAME:n,SUPPORT_TAGNAME_X:a}=android.lib.constant,{capitalize:o,iterateArray:s}=squared.lib.util,{createThemeAttribute:r,createViewOptions:d,removeFileExtension:c}=android.lib.util,{assignEmptyValue:l}=squared.base.lib.util;class u extends squared.base.ExtensionUI{constructor(e,t,i){super(e,t,i),this.options={element:{},resource:{}},this.require("android.widget.menu")}processNode(t,i){const o=d(this.options,t.elementId);l(o,"android","background","?android:attr/windowBackground"),s(t.children,(e=>{e.hide(),e.cascade((e=>e.hide()))}),5);const r=t.localSettings.resourceId,c=t.api<29?n.BOTTOM_NAVIGATION:a.BOTTOM_NAVIGATION;return t.setControlType(c,14),t.exclude({resource:28}),t.render(i),t.apply(e.formatOptions(r,o)),t.setLayoutWidth("match_parent"),t.setLayoutHeight("wrap_content"),t.cascade((e=>this.addDescendant(e))),this.setStyleTheme(r,t.localSettings.preferMaterialDesign),{output:{type:1,node:t,controlName:c},complete:!0,include:!0}}postOptimize(e){var t;const i=e.renderParent;i.documentRoot&&(i.inlineWidth&&i.setLayoutWidth("match_parent"),i.inlineHeight&&i.setLayoutHeight("match_parent"));const n=null===(t=u.findNestedElement(e,"android.widget.menu"))||void 0===t?void 0:t.dataset["filename"+o(this.application.systemName)];if(n){const t=d(this.options,e.elementId),i=t.app||(t.app={});l(i,"menu",`@menu/${c(n)}`),e.app("menu",i.menu)}}setStyleTheme(t,i){const n=r(this.options.resource);l(n,"name",this.application.userSettings.manifestThemeName),!1!==i&&"MaterialComponents"!==i||l(n,"parent","Theme.AppCompat.Light.DarkActionBar"),e.addTheme(t,n,{filename:this.controller.localSettings.filename.theme})}}const m=new u("android.widget.bottomnavigation",2);return squared&&squared.add(m),m}(); |
@@ -286,3 +286,6 @@ /* android.widget.toolbar | ||
assignEmptyValue(options, 'name', this.application.userSettings.manifestThemeName); | ||
assignEmptyValue(options, 'parent', 'Theme.AppCompat.Light.DarkActionBar'); | ||
const materialDesign = node.localSettings.preferMaterialDesign; | ||
if (materialDesign === false || materialDesign === 'MaterialComponents') { | ||
assignEmptyValue(options, 'parent', 'Theme.AppCompat.Light.DarkActionBar'); | ||
} | ||
assignEmptyValue(optionsActionBar.items, 'windowActionBar', 'false'); | ||
@@ -289,0 +292,0 @@ assignEmptyValue(optionsActionBar.items, 'windowNoTitle', 'true'); |
@@ -1,1 +0,1 @@ | ||
this.android=this.android||{},this.android.widget=this.android.widget||{},this.android.widget.toolbar=function(){"use strict";const e=android.base.Resource,{NODE_PROCEDURE:t,NODE_RESOURCE:a}=squared.base.lib.constant,{CONTAINER_TAGNAME:o,CONTAINER_NODE:r,SUPPORT_TAGNAME:n,SUPPORT_TAGNAME_X:i}=android.lib.constant,{formatPX:d}=squared.lib.css,{getElementAsNode:s}=squared.lib.session,{capitalize:l,isPlainObject:c,iterateArray:p}=squared.lib.util,{createThemeAttribute:u,createViewAttribute:m,getDocumentId:h,removeFileExtension:g}=android.lib.util,{assignEmptyValue:y}=squared.base.lib.util,b="ic_menu_";class f extends squared.base.ExtensionUI{constructor(e,t,a){super(e,t,a),this.options={element:{},resource:{}},this.require("android.widget.menu")}beforeInsertNode(e,t){if(this.included(e)){const a=this.application;p(e.children,(e=>{if("NAV"===e.tagName){const t=a.getDatasetName("use",e);if(!f.includes(t,"android.external"))return a.setDatasetName("use",e,(t?t+", ":"")+"android.external"),!0}}));const o=e.dataset.androidTarget;if(o){const r=document.getElementById(o);r&&!f.includes(a.getDatasetName("use",r),"android.widget.coordinator")&&a.addRootElement(t,e)}}return!1}processNode(t,a){const r=this.application,l=this.resource,u=t.localSettings.resourceId,g=t.element,T=c(this.options.element[t.elementId])?{...this.options.element[t.elementId]}:{},A=m(T.self),I=m(T.appBar),O=m(T.collapsingToolbar),N=f.findNestedElement(t,"android.widget.menu"),w=t.has("backgroundImage"),_=[],E=[];let v=A.app||(A.app={});p(g.children,(e=>{const a=e.dataset;if("IMG"===e.tagName){if(a.navigationIcon){const t=l.addImageSrc(u,e,{prefix:b});t&&y(v,"navigationIcon",`@drawable/${t}`)}if(a.collapseIcon){const t=l.addImageSrc(u,e,{prefix:b});t&&y(v,"collapseIcon",`@drawable/${t}`)}}const o=s(e,t.sessionId);if(o&&!a.androidTarget)switch(a.androidTargetModule){case"appBar":_.push(o);break;case"collapsingToolbar":E.push(o)}}));const P="collapsingToolbar"in T||E.length>0,S="appBar"in T||_.length>0||P;let B,C,k,L,R,x,D="",q="";if(t.api<29?(L=n.TOOLBAR,R=n.APPBAR,x=n.COLLAPSING_TOOLBAR):(L=i.TOOLBAR,R=i.APPBAR,x=i.COLLAPSING_TOOLBAR),P?y(v,"layout_collapseMode","pin"):(y(v,"popupTheme","@style/ThemeOverlay.AppCompat.Light"),w||y(v,"layout_scrollFlags","scroll|enterAlways")),S){if(N){const e=v.popupTheme;e&&(q=e.replace("@style/","")),v.popupTheme=`@style/${r.userSettings.manifestThemeName}.PopupOverlay`}}else t.exclude({procedure:2}),y(A,"android","fitsSystemWindows","true");if(y(A,"android","layout_height",S||!t.hasUnit("height")?"?android:attr/actionBarSize":""),t.setControlType(L,14),t.exclude({resource:4}),S){let e=I.android;y(I,"android","id",`@+id/${t.controlId}_appbar`),y(I,"android","layout_height",t.hasHeight?d(t.actualHeight):"wrap_content"),y(I,"android","fitsSystemWindows","true"),N?(e.theme&&(D=e.theme),e.theme=`@style/${r.userSettings.manifestThemeName}.AppBarOverlay`,t.data("android.widget.toolbar","themeData",{appBarOverlay:D,popupOverlay:q})):y(I,"android","theme","@style/ThemeOverlay.AppCompat.Dark.ActionBar"),B=this.createPlaceholder(t,_,t.target),B.parent=a,e.id&&(B.controlId=h(e.id),delete e.id),B.setControlType(R,14),P&&(v=O.app||(O.app={}),y(O,"android","id",`@+id/${t.controlId}_collapsingtoolbar`),y(O,"android","fitsSystemWindows","true"),w||y(v,"contentScrim","?attr/colorPrimary"),y(v,"layout_scrollFlags","scroll|exitUntilCollapsed"),y(v,"toolbarId",t.documentId),(C=this.createPlaceholder(t,E))&&(C.parent=B,e=O.android,e.id&&(B.controlId=h(e.id),delete e.id),C.setControlType(x,14)))}if(B){if(B.setLayoutWidth("match_parent"),B.setLayoutHeight("wrap_content"),B.apply(e.formatOptions(u,I)),B.render(a),k={type:1,node:B,controlName:R},C){let a;if(t.parent=C,C.apply(e.formatOptions(u,O)),C.render(B),C.setLayoutWidth("match_parent"),C.setLayoutHeight("match_parent"),r.addLayoutTemplate(C.renderParent,C,{type:1,node:C,controlName:x}),w&&(a=l.addImageSrc(u,t.backgroundImage))){const r=this.controller,n=m(T.backgroundImage);let i;switch(t.css("backgroundSize")){case"cover":case"100% auto":case"auto 100%":i="centerCrop";break;case"contain":case"100%":case"100% 100%":i="fitXY";break;case"auto":i="matrix";break;default:i="center"}v=n.app||(n.app={}),y(n,"android","id",`@+id/${t.controlId}_image`),y(n,"android","src",`@drawable/${a}`),y(n,"android","scaleType",i),y(n,"android","fitsSystemWindows","true"),y(v,"layout_collapseMode","parallax"),r.addBeforeOutsideTemplate(t,r.renderNodeStatic(t.sessionId,{controlName:o.IMAGE,width:"match_parent",height:"match_parent"},e.formatOptions(u,n))),t.setCacheValue("backgroundImage","")}}else t.parent=B,w&&t.data("android.widget.toolbar","background",B);t.data("android.widget.toolbar","outerParent",B.android("id")||B.documentId),t.render(t.parent)}else t.render(a);t.setLayoutWidth("match_parent"),t.apply(e.formatOptions(u,A));const $={type:1,node:t,controlName:L};return B?{output:$,outerParent:t.parent,renderAs:B,outputAs:k,include:!0}:{output:$,include:!0}}processChild(e){if(e.imageElement&&(e.dataset.navigationIcon||e.dataset.collapseIcon))return e.hide(),{next:!0}}postOptimize(t){var a,o;const r=null===(a=f.findNestedElement(t,"android.widget.menu"))||void 0===a?void 0:a.dataset["filename"+l(this.application.systemName)];if(r){const e=m(null===(o=this.options.element[t.elementId])||void 0===o?void 0:o.self),a=e.app||(e.app={});y(a,"menu",`@menu/${g(r)}`),t.app("menu",a.menu)}const n=t.data("android.widget.toolbar","themeData");if(n){const a=this.controller.localSettings.filename.theme,o=t.localSettings.resourceId,r=u(this.options.resource),i=r.output,d=u({name:".NoActionBar",output:i}),s=u({name:".AppBarOverlay",output:i}),l=u({name:".PopupOverlay",output:i});y(r,"name",this.application.userSettings.manifestThemeName),y(r,"parent","Theme.AppCompat.Light.DarkActionBar"),y(d.items,"windowActionBar","false"),y(d.items,"windowNoTitle","true"),y(s,"parent",n.appBarOverlay||"ThemeOverlay.AppCompat.Dark.ActionBar"),y(l,"parent",n.popupOverlay||"ThemeOverlay.AppCompat.Light");const c={filename:a};e.addTheme(o,r,c),e.addTheme(o,d,c),e.addTheme(o,s,c),e.addTheme(o,l,c)}const i=t.data("android.widget.toolbar","background"),d=t.android("background");i&&d&&(i.android("background",d),t.delete("android","background"))}createPlaceholder(e,t,a){const o=this.application.createNode(e.sessionId,{parent:e,children:t,flags:4|(t.length>0?2:0)});return o.inherit(e,"base"),a&&(o.dataset.androidTarget=a.id,o.innerWrapped=e),o.exclude({resource:31}),o.positioned=!0,o.renderExclude=!1,o}}const T=new f("android.widget.toolbar",2);return squared&&squared.add(T),T}(); | ||
this.android=this.android||{},this.android.widget=this.android.widget||{},this.android.widget.toolbar=function(){"use strict";const e=android.base.Resource,{NODE_PROCEDURE:t,NODE_RESOURCE:a}=squared.base.lib.constant,{CONTAINER_TAGNAME:o,CONTAINER_NODE:r,SUPPORT_TAGNAME:n,SUPPORT_TAGNAME_X:i}=android.lib.constant,{formatPX:d}=squared.lib.css,{getElementAsNode:s}=squared.lib.session,{capitalize:l,isPlainObject:c,iterateArray:p}=squared.lib.util,{createThemeAttribute:u,createViewAttribute:m,getDocumentId:h,removeFileExtension:g}=android.lib.util,{assignEmptyValue:y}=squared.base.lib.util,b="ic_menu_";class f extends squared.base.ExtensionUI{constructor(e,t,a){super(e,t,a),this.options={element:{},resource:{}},this.require("android.widget.menu")}beforeInsertNode(e,t){if(this.included(e)){const a=this.application;p(e.children,(e=>{if("NAV"===e.tagName){const t=a.getDatasetName("use",e);if(!f.includes(t,"android.external"))return a.setDatasetName("use",e,(t?t+", ":"")+"android.external"),!0}}));const o=e.dataset.androidTarget;if(o){const r=document.getElementById(o);r&&!f.includes(a.getDatasetName("use",r),"android.widget.coordinator")&&a.addRootElement(t,e)}}return!1}processNode(t,a){const r=this.application,l=this.resource,u=t.localSettings.resourceId,g=t.element,T=c(this.options.element[t.elementId])?{...this.options.element[t.elementId]}:{},A=m(T.self),I=m(T.appBar),O=m(T.collapsingToolbar),N=f.findNestedElement(t,"android.widget.menu"),w=t.has("backgroundImage"),_=[],E=[];let S=A.app||(A.app={});p(g.children,(e=>{const a=e.dataset;if("IMG"===e.tagName){if(a.navigationIcon){const t=l.addImageSrc(u,e,{prefix:b});t&&y(S,"navigationIcon",`@drawable/${t}`)}if(a.collapseIcon){const t=l.addImageSrc(u,e,{prefix:b});t&&y(S,"collapseIcon",`@drawable/${t}`)}}const o=s(e,t.sessionId);if(o&&!a.androidTarget)switch(a.androidTargetModule){case"appBar":_.push(o);break;case"collapsingToolbar":E.push(o)}}));const v="collapsingToolbar"in T||E.length>0,P="appBar"in T||_.length>0||v;let B,C,k,L,R,x,D="",M="";if(t.api<29?(L=n.TOOLBAR,R=n.APPBAR,x=n.COLLAPSING_TOOLBAR):(L=i.TOOLBAR,R=i.APPBAR,x=i.COLLAPSING_TOOLBAR),v?y(S,"layout_collapseMode","pin"):(y(S,"popupTheme","@style/ThemeOverlay.AppCompat.Light"),w||y(S,"layout_scrollFlags","scroll|enterAlways")),P){if(N){const e=S.popupTheme;e&&(M=e.replace("@style/","")),S.popupTheme=`@style/${r.userSettings.manifestThemeName}.PopupOverlay`}}else t.exclude({procedure:2}),y(A,"android","fitsSystemWindows","true");if(y(A,"android","layout_height",P||!t.hasUnit("height")?"?android:attr/actionBarSize":""),t.setControlType(L,14),t.exclude({resource:4}),P){let e=I.android;y(I,"android","id",`@+id/${t.controlId}_appbar`),y(I,"android","layout_height",t.hasHeight?d(t.actualHeight):"wrap_content"),y(I,"android","fitsSystemWindows","true"),N?(e.theme&&(D=e.theme),e.theme=`@style/${r.userSettings.manifestThemeName}.AppBarOverlay`,t.data("android.widget.toolbar","themeData",{appBarOverlay:D,popupOverlay:M})):y(I,"android","theme","@style/ThemeOverlay.AppCompat.Dark.ActionBar"),B=this.createPlaceholder(t,_,t.target),B.parent=a,e.id&&(B.controlId=h(e.id),delete e.id),B.setControlType(R,14),v&&(S=O.app||(O.app={}),y(O,"android","id",`@+id/${t.controlId}_collapsingtoolbar`),y(O,"android","fitsSystemWindows","true"),w||y(S,"contentScrim","?attr/colorPrimary"),y(S,"layout_scrollFlags","scroll|exitUntilCollapsed"),y(S,"toolbarId",t.documentId),(C=this.createPlaceholder(t,E))&&(C.parent=B,e=O.android,e.id&&(B.controlId=h(e.id),delete e.id),C.setControlType(x,14)))}if(B){if(B.setLayoutWidth("match_parent"),B.setLayoutHeight("wrap_content"),B.apply(e.formatOptions(u,I)),B.render(a),k={type:1,node:B,controlName:R},C){let a;if(t.parent=C,C.apply(e.formatOptions(u,O)),C.render(B),C.setLayoutWidth("match_parent"),C.setLayoutHeight("match_parent"),r.addLayoutTemplate(C.renderParent,C,{type:1,node:C,controlName:x}),w&&(a=l.addImageSrc(u,t.backgroundImage))){const r=this.controller,n=m(T.backgroundImage);let i;switch(t.css("backgroundSize")){case"cover":case"100% auto":case"auto 100%":i="centerCrop";break;case"contain":case"100%":case"100% 100%":i="fitXY";break;case"auto":i="matrix";break;default:i="center"}S=n.app||(n.app={}),y(n,"android","id",`@+id/${t.controlId}_image`),y(n,"android","src",`@drawable/${a}`),y(n,"android","scaleType",i),y(n,"android","fitsSystemWindows","true"),y(S,"layout_collapseMode","parallax"),r.addBeforeOutsideTemplate(t,r.renderNodeStatic(t.sessionId,{controlName:o.IMAGE,width:"match_parent",height:"match_parent"},e.formatOptions(u,n))),t.setCacheValue("backgroundImage","")}}else t.parent=B,w&&t.data("android.widget.toolbar","background",B);t.data("android.widget.toolbar","outerParent",B.android("id")||B.documentId),t.render(t.parent)}else t.render(a);t.setLayoutWidth("match_parent"),t.apply(e.formatOptions(u,A));const q={type:1,node:t,controlName:L};return B?{output:q,outerParent:t.parent,renderAs:B,outputAs:k,include:!0}:{output:q,include:!0}}processChild(e){if(e.imageElement&&(e.dataset.navigationIcon||e.dataset.collapseIcon))return e.hide(),{next:!0}}postOptimize(t){var a,o;const r=null===(a=f.findNestedElement(t,"android.widget.menu"))||void 0===a?void 0:a.dataset["filename"+l(this.application.systemName)];if(r){const e=m(null===(o=this.options.element[t.elementId])||void 0===o?void 0:o.self),a=e.app||(e.app={});y(a,"menu",`@menu/${g(r)}`),t.app("menu",a.menu)}const n=t.data("android.widget.toolbar","themeData");if(n){const a=this.controller.localSettings.filename.theme,o=t.localSettings.resourceId,r=u(this.options.resource),i=r.output,d=u({name:".NoActionBar",output:i}),s=u({name:".AppBarOverlay",output:i}),l=u({name:".PopupOverlay",output:i});y(r,"name",this.application.userSettings.manifestThemeName);const c=t.localSettings.preferMaterialDesign;!1!==c&&"MaterialComponents"!==c||y(r,"parent","Theme.AppCompat.Light.DarkActionBar"),y(d.items,"windowActionBar","false"),y(d.items,"windowNoTitle","true"),y(s,"parent",n.appBarOverlay||"ThemeOverlay.AppCompat.Dark.ActionBar"),y(l,"parent",n.popupOverlay||"ThemeOverlay.AppCompat.Light");const p={filename:a};e.addTheme(o,r,p),e.addTheme(o,d,p),e.addTheme(o,s,p),e.addTheme(o,l,p)}const i=t.data("android.widget.toolbar","background"),d=t.android("background");i&&d&&(i.android("background",d),t.delete("android","background"))}createPlaceholder(e,t,a){const o=this.application.createNode(e.sessionId,{parent:e,children:t,flags:4|(t.length>0?2:0)});return o.inherit(e,"base"),a&&(o.dataset.androidTarget=a.id,o.innerWrapped=e),o.exclude({resource:31}),o.positioned=!0,o.renderExclude=!1,o}}const T=new f("android.widget.toolbar",2);return squared&&squared.add(T),T}(); |
{ | ||
"name": "android-extensions", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Extensions for the Android framework.", | ||
@@ -23,10 +23,10 @@ "scripts": { | ||
"@rollup/plugin-terser": "^0.4.3", | ||
"@typescript-eslint/eslint-plugin": "^5.59.11", | ||
"@typescript-eslint/parser": "^5.59.11", | ||
"eslint": "^8.42.0", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"eslint": "^8.45.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^3.25.1", | ||
"terser": "^5.18.0", | ||
"typescript": "5.1.3" | ||
"rollup": "^3.26.3", | ||
"terser": "^5.19.2", | ||
"typescript": "5.1.6" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96580
1551