waibu-bootstrap 1.1.2 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@ async function appLauncherTrigger () {
23
23
  const { fastGlob } = this.plugin.lib
24
24
  const { omit } = this.plugin.lib._
25
25
  let logo = 'waibu'
26
- const files = await fastGlob(`${this.plugin.app.main.dir.pkg}/bajo/logo.*`)
26
+ const files = await fastGlob(`${this.plugin.app.main.dir.pkg}/plugin/logo.*`)
27
27
  if (files.length > 0) logo = 'main'
28
28
  this.params.tag = 'a'
29
29
  const sentence = [
@@ -1,10 +1,9 @@
1
1
  const cls = 'breadcrumb'
2
2
 
3
3
  function bcHandler (href, source, opts = {}) {
4
- const { last } = this.plugin.lib._
5
- const { titleize } = this.plugin.app.bajo
4
+ const { last, camelCase } = this.plugin.lib._
6
5
  const parts = href.split('/')
7
- const content = titleize(last(parts))
6
+ const content = this.component.req.t(camelCase(last(parts)))
8
7
  if (href === source) return { content }
9
8
  return { content, href, hrefRebuild: opts.hrefRebuild }
10
9
  }
@@ -5,7 +5,8 @@ async function cardSubtitle () {
5
5
  constructor (options) {
6
6
  super(options)
7
7
  this.selector = '.' + cls
8
- this.component.normalizeAttr(this.params, { tag: 'h6', cls: [cls, 'mb-2', 'text-body-secondary'] })
8
+ this.component.normalizeAttr(this.params, { tag: 'h6', cls: [cls, 'mb-2'] })
9
+ if (!this.params.attr.text) this.params.attr.class.push('text-body-secondary')
9
10
  }
10
11
  }
11
12
  }
@@ -12,7 +12,7 @@ async function navDivider () {
12
12
  this.params.attr.padding = 'y-2'
13
13
  const attr = {
14
14
  class: ['vr'],
15
- display: 'type:none type:flex-lg',
15
+ display: 'type:flex-lg',
16
16
  dim: 'height:100',
17
17
  margin: this.params.attr.margin ?? 'x-2'
18
18
  }
@@ -1,9 +1,14 @@
1
1
  async function navDropdownDarkmode () {
2
2
  return class NavDropdownDarkmode extends this.baseFactory {
3
3
  build = async () => {
4
- const { titleize } = this.plugin.app.bajo
4
+ const { titleize, isSet } = this.plugin.app.bajo
5
5
  const { set } = this.plugin.lib._
6
6
  const cfgWmpa = this.plugin.app.waibuMpa.config
7
+ this.params.noTag = true
8
+ if (isSet(this.plugin.app.waibuMpa.config.darkMode.set)) {
9
+ this.params.html = ''
10
+ return
11
+ }
7
12
  const name = this.component.req.darkMode ? 'dark' : 'bright'
8
13
  const content = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name } }) : this.component.req.t(titleize(name))
9
14
  const attr = {
@@ -12,11 +17,11 @@ async function navDropdownDarkmode () {
12
17
  dropdownMenudir: this.params.attr.dropdownMenudir,
13
18
  content
14
19
  }
20
+ if (this.params.attr.text) attr.text = this.params.attr.text
15
21
  const html = [
16
22
  await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') }), active: !this.component.req.darkMode }, html: this.component.req.t('brightMode') }),
17
23
  await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') }), active: this.component.req.darkMode }, html: this.component.req.t('darkMode') })
18
24
  ].join('\n')
19
- this.params.noTag = true
20
25
  this.params.html = await this.component.buildTag({ tag: 'navItem', attr, html })
21
26
  }
22
27
  }
@@ -10,6 +10,7 @@ async function navDropdownLanguage () {
10
10
  dropdownMenudir: this.params.attr.dropdownMenudir,
11
11
  content: lang.toUpperCase()
12
12
  }
13
+ if (this.params.attr.text) attr.text = this.params.attr.text
13
14
  const html = []
14
15
  for (const s of supported) {
15
16
  html.push(await this.component.buildTag({
@@ -6,6 +6,7 @@ async function navDropdownSetting () {
6
6
  const { groupAttrs } = this.plugin.app.waibuMpa
7
7
  const { generateId } = this.plugin.app.bajo
8
8
  const { routePath } = this.plugin.app.waibu
9
+ const { isSet } = this.plugin.app.bajo
9
10
  const { req } = this.component
10
11
  const cfgWmpa = this.plugin.app.waibuMpa.config
11
12
 
@@ -28,11 +29,17 @@ async function navDropdownSetting () {
28
29
  </div>
29
30
  `)
30
31
  }
32
+ let darkMode = ''
33
+ if (!isSet(cfgWmpa.darkMode.set)) {
34
+ darkMode = `
35
+ <c:dropdown-item divider />
36
+ <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') })}" ${this.component.req.darkMode ? '' : 'active'} t:content="bright" />
37
+ <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') })}" ${!this.component.req.darkMode ? '' : 'active'} t:content="dark" />
38
+ `
39
+ }
31
40
  let html = `
32
41
  ${profile}
33
- <c:dropdown-item divider />
34
- <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') })}" ${this.component.req.darkMode ? '' : 'active'} t:content="bright" />
35
- <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') })}" ${!this.component.req.darkMode ? '' : 'active'} t:content="dark" />
42
+ ${darkMode}
36
43
  `
37
44
  if (supported.length > 0) {
38
45
  html += `
@@ -25,6 +25,7 @@ async function navDropdownUser () {
25
25
  dropdownMenudir: this.params.attr.dropdownMenudir,
26
26
  content: `${icon} ${text}`
27
27
  }
28
+ if (this.params.attr.text) attr.text = this.params.attr.text
28
29
  if (this.params.attr.noMenu) {
29
30
  delete attr.dropdown
30
31
  delete attr.dropdownMenu
@@ -11,6 +11,7 @@ async function navToggleFullscreen () {
11
11
  '@click': 'toggle()',
12
12
  content
13
13
  }
14
+ if (this.params.attr.text) attr.text = this.params.attr.text
14
15
  attr['@fullscreenchange.document'] = `
15
16
  const el = $refs.fullscreen.querySelector('i')
16
17
  if (document.fullscreenElement) {
@@ -7,6 +7,7 @@ function formatSentence (item, params) {
7
7
  if (this.params.attr.divider) attr.border = `side:${item.bottom ? 'top' : 'bottom'}`
8
8
  if (this.params.attr.expanded) attr.rounded = 'width:0'
9
9
  merge(attr, omit(item, ['component', 'icon', 'ohref', 'html']))
10
+ if (this.params.attr.text && !attr.active) attr.text = this.params.attr.text
10
11
  const result = [`<c:${cmp}`]
11
12
  for (const k in attr) {
12
13
  result.push(attr[k] === true ? k : `${k}="${attr[k]}"`)
@@ -4,7 +4,7 @@ export const weights = ['bold', 'bolder', 'semibold', 'medium', 'normal', 'light
4
4
  export const fstyles = ['italic', 'normal']
5
5
  export const heights = ['1', 'sm', 'base', 'lg']
6
6
  export const cvariants = ['emphasis', 'secondary', 'tertiary']
7
- export const cbgvariants = ['subtle', 'secondary', 'tertiary']
7
+ export const cbgvariants = ['subtle']
8
8
  export const opacities = ['25', '50', '75', '100']
9
9
  export const aligns = ['top', 'bottom', 'start', 'end', 'middle']
10
10
  export const dirs = ['up', 'down', 'start', 'end']
@@ -1,13 +1,14 @@
1
- import { aligns, widths } from './_lib.js'
1
+ import { aligns, widths, breakpoints } from './_lib.js'
2
2
 
3
3
  const sides = ['x', 'y', 'all', ...aligns]
4
4
  const sizes = ['0', 'auto', ...widths]
5
5
 
6
6
  function marginPadding ({ key, params }) {
7
7
  for (const item of this.plugin.app.waibuMpa.attrToArray(params.attr[key])) {
8
- const [side, size] = item.split('-')
8
+ let [side, size, bp] = item.split('-')
9
+ if (bp && !breakpoints.includes(bp)) bp = undefined
9
10
  if (sides.includes(side) && (!size || sizes.includes(size))) {
10
- params.attr.class.push(`${key[0]}${side === 'all' ? '' : side[0]}${size ? ('-' + size) : ''}`)
11
+ params.attr.class.push(`${key[0]}${side === 'all' ? '' : side[0]}${bp ? ('-' + bp) : ''}${size ? ('-' + size) : ''}`)
11
12
  }
12
13
  }
13
14
  }