From c00737155ec51110dede651c1352abbb9250fdbe Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 01:58:35 -0300 Subject: [PATCH 001/348] chore(web-types): generate web-types.json for WebStorm etc --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 107d3d821da..3a7c8232fd4 100644 --- a/package.json +++ b/package.json @@ -123,6 +123,7 @@ "nuxt": "^2.9.2", "postcss-cli": "^6.1.3", "prettier": "1.14.3", + "require-context": "^1.0.4", "rollup": "^1.21.4", "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.1.0", From 97c11f37d4e70cae38627e56c1d40ab4d06f30be Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 02:10:54 -0300 Subject: [PATCH 002/348] Create create-web-types.js --- scripts/create-web-types.js | 244 ++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 scripts/create-web-types.js diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js new file mode 100644 index 00000000000..0d796b79935 --- /dev/null +++ b/scripts/create-web-types.js @@ -0,0 +1,244 @@ +const path = require('path') +const fs = require('fs') +const pkg = require('../package.json') +const requireContext = require('require-context') + +const baseDir = path.resolve(__dirname, '..') +const baseDocs = pkg.homepage.replace(/\/$/, '') +const libraryName = pkg.name +const libraryVersion = pkg.version + +// Base web-types object +const webTypes = { + $schema: '', + framework: 'vue', + name: libraryName, + version: libraryVersion, + contributions: { + html: { + 'types-syntax': 'typescript', + // Components get placed here + tags: [], + // Directives get placed in here + attributes: [] + } + } +} + +// Import metatdata from a directory glob package.json files +export const importAll = r => { + const obj = {} + r.keys() + .map(r) + .map(m => m.meta || m) + .map(m => ({ + slug: m.slug || (m.title || '').replace(' ', '-').toLowerCase(), + ...m + })) + .sort((a, b) => { + if (a.slug < b.slug) return -1 + else if (a.slug > b.slug) return 1 + return 0 + }) + .forEach(m => { + if (m.components) { + // Normalize `meta.components` to array of objects form + m.components = m.components.map(c => (typeof c === 'string' ? { component: c } : c)) + } + obj[m.slug] = m + }) + + return obj +} + +const kebabRE = /\B([A-Z])/g +const kebabCase = str => { + return str.replace(kebabRE, '-$1').toLowerCase() +} + +const computePropType = ({ type }) => { + if (!type) { + return 'any' + } + type = type || Object + if (Array.isArray(type)) { + // Array of types + return type.map(type => computePropType({ type: type })).join('|') + } + if (typeof type === 'string') { + // Mainly for events and slots + if (type === 'Array') { + type = Array + } else { + // Handle cases for BvEvent, BvModalEvent and other native + // event types (i.e. HTMLElement, MouseEvent, etc) + return /^[A-Z].*[A-Z].+/.test(type) ? type : type.toLowerCase() + } + } + if (type.name === 'Array') { + // For simplicity return arrays of any type entries + return 'any[]' + } + return type.name.toLowerCase() +} + +const computePropDefault = ({ default: def, type }) => { + // Default could be a function that retruns a non-primative type + def = typeof def === 'function' ? def.call({}) : def + if (type === Boolean || (Array.isArray(type) && type[0] === Boolean)) { + def = Boolean(def) + } else if (def === undefined) { + def = null + } + return JSON.stringify(def) +} + +// Create tag entries for each component in a group group +const processComponentGroup = groupSlug => { + // Array of components in the group + const groupMeta = componentGroups[groupSlug] || {} + const componentsMeta = groupMeta.components || [] + const docUrl = `${baseDocs}/docs/components/${groupSlug}/` + + const groupRef = require(path.resolve(baseDir, 'esm/components/' + groupSlug)) + + // Process each component + componentsMeta.forEach(meta => { + const componentName = meta.component + const componentRef = groupRef[componentName] || {} + // Pull information from the component definition/class + const $options = componentRef.options || componentRef + const $props = $options.props || {} + const $model = $options.model || null + // Pull additional info from meta + const $events = meta.events || [] + const $slots = meta.slots || [] + const $aliases = meta.aliases || [] + + const tagName = kebabCase(componentName) + + // Build the tag reference + const tag = { + name: componentName, + source: { + module: libraryName, + symbol: componentName + }, + 'docs-url': docUrl, + description: `'${componentName}' - BootstrapVue component <${tagName}>`, + attributes: [] + } + + // Add v-model information + if ($model && $model.prop && $model.event) { + tag['vue-model'] = { + prop: $model.prop, + event: $model.event + } + } + + // Add props + if (Object.keys($props).length) { + tag.attributes = Object.keys($props).map(propName => { + const $prop = $props[propName] + const prop = { + name: propName, + value: { + type: computePropType($prop), + default: computePropDefault($prop) + }, + // description: '', + 'doc-url': docUrl + } + // Add required prop is required + if ($prop.required) { + prop.value.required = true + } + return prop + }) + } + + // Add events + if ($events.length) { + tag.events = $events.map(eventObj => { + return { + name: eventObj.event, + description: eventObj.description, + 'doc-url': docUrl, + arguments: (eventObj.args || []).map(arg => { + arg = typeof arg === 'object' ? arg : { arg: arg } + const event = { + name: arg.arg, + type: 'any', + description: arg.description || '', + 'doc-url': docUrl + } + if (arg.type) { + event.type = computePropType(arg) + } + return event + }) + } + }) + } + + // Add slots + if ($slots.length) { + tag['vue-scoped-slots'] = $slots.map(slotObj => { + const properties = [] + const slot = { + name: slotObj.name, + description: slotObj.description || '', + 'doc-url': docUrl + } + if (slotObj.scope) { + // Slot props not documented in meta yet + slot.properties = slotObj.scope.forEach(propDef => { + const property = { + name: propDef.name, + type: 'any', + description: propDef.description, + 'doc-url': docUrl + } + if (propDef.type) { + property.type = computePropType(propDef) + } + return property + }) + } + return slot + }) + } + + // Add the component tag + webTypes.contributions.html.tags.push(tag) + + // Add in any component alias tags + if ($aliases.length) { + // Add the aliases + $aliases.forEach(alias => { + const aliasTag = { ...tag, name: alias, source: { ...tag.source, symbol: alias } } + aliasTag.description = `'${alias}' <${kebabCase(alias)}> (Alias for ${tag.description})` + webTypes.contributions.html.tags.push(aliasTag) + }) + } + }) +} + +// Grab the component meta data +const componentsContext = requireContext(path.resolve(baseDir, 'src/components'), true, /package.json/) +const componentGroups = importAll(componentsContext) + +// Grab teh directive meta data +// const directivesContext = requireContext(path.resolve(baseDir, 'src/directives'), true, /package.json/) +// const directiveGroups = importAll(directivesContext) + + +// Process all components +Object.keys(componentGroups).forEach(processComponentGroup) + +// Convert to JSON string +const json = JSON.stringify(webTypes, null, 2) + +// To be replaced with a write to a file +console.log('JSON:', json) From 4676007967885e48410eef5d4a45e3236e001dc0 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 02:19:01 -0300 Subject: [PATCH 003/348] Update yarn.lock --- yarn.lock | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/yarn.lock b/yarn.lock index 0a28ee601ef..a72e2270a25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8264,6 +8264,13 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" +node-dir@^0.1.17: + version "0.1.17" + resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" + integrity sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU= + dependencies: + minimatch "^3.0.2" + node-fetch@^2.2.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" @@ -10470,6 +10477,13 @@ request@^2.87.0, request@^2.88.0: tunnel-agent "^0.6.0" uuid "^3.3.2" +require-context@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/require-context/-/require-context-1.1.0.tgz#f77e60dddb0a296946e6915bf580c73dbe75ab4d" + integrity sha512-nfYSy3Q9W3W1fCo0nief19bDq216IGY9+wOUsmCWAJ5jssyak0r110rvqIj4KJYoUYDxLDaeA66ONOYy4PJEUw== + dependencies: + node-dir "^0.1.17" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" From 7caf85356ba6fe5a6ee7a7adf80b7af065f58ff9 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 02:30:53 -0300 Subject: [PATCH 004/348] Update build.sh --- scripts/build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/build.sh b/scripts/build.sh index 7154494e268..d8dc021cf5d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -84,4 +84,9 @@ cd .. echo 'Done.' echo '' +echo 'Building web-types...' +node -r esm scripts/create-web-types.js || exit 1 +echo 'Done.' +echo '' + echo 'Done building assets.' From d325f9e17e5b2947fa95460386b47bc5bddc7f3c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:07:23 -0300 Subject: [PATCH 005/348] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a7c8232fd4..d36c7462712 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "nuxt": "^2.9.2", "postcss-cli": "^6.1.3", "prettier": "1.14.3", - "require-context": "^1.0.4", + "require-context": "^1.1.0", "rollup": "^1.21.4", "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.1.0", From 617e937cd9c99f59da0192ff223e5d1dc9aa2c20 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:13:11 -0300 Subject: [PATCH 006/348] Update create-web-types.js --- scripts/create-web-types.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 0d796b79935..1ecfbac0eb0 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -1,5 +1,5 @@ const path = require('path') -const fs = require('fs') +// const fs = require('fs') const pkg = require('../package.json') const requireContext = require('require-context') @@ -185,7 +185,6 @@ const processComponentGroup = groupSlug => { // Add slots if ($slots.length) { tag['vue-scoped-slots'] = $slots.map(slotObj => { - const properties = [] const slot = { name: slotObj.name, description: slotObj.description || '', @@ -226,14 +225,17 @@ const processComponentGroup = groupSlug => { } // Grab the component meta data -const componentsContext = requireContext(path.resolve(baseDir, 'src/components'), true, /package.json/) +const componentsContext = requireContext( + path.resolve(baseDir, 'src/components'), + true, + /package.json/ +) const componentGroups = importAll(componentsContext) -// Grab teh directive meta data +// Grab the directive meta data // const directivesContext = requireContext(path.resolve(baseDir, 'src/directives'), true, /package.json/) // const directiveGroups = importAll(directivesContext) - // Process all components Object.keys(componentGroups).forEach(processComponentGroup) From d3b769a07830cd0f68e5fec32ed6783798e4a13e Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:32:19 -0300 Subject: [PATCH 007/348] Update safe-types.js --- src/utils/safe-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/safe-types.js b/src/utils/safe-types.js index 185b2feb1c6..9179d00c66b 100644 --- a/src/utils/safe-types.js +++ b/src/utils/safe-types.js @@ -6,4 +6,4 @@ import { hasWindowSupport } from './env' const w = hasWindowSupport ? window : {} -export const HTMLElement = w.HTMLElement || Object +export const HTMLElement = w.HTMLElement || class HTMLElement extends (Object) {} From 2a790e3ec5b0b6c29df24ed28c5719aff16cb0c5 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:33:25 -0300 Subject: [PATCH 008/348] Update safe-types.js --- src/utils/safe-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/safe-types.js b/src/utils/safe-types.js index 9179d00c66b..11943fddfc8 100644 --- a/src/utils/safe-types.js +++ b/src/utils/safe-types.js @@ -6,4 +6,4 @@ import { hasWindowSupport } from './env' const w = hasWindowSupport ? window : {} -export const HTMLElement = w.HTMLElement || class HTMLElement extends (Object) {} +export const HTMLElement = hasWindowSupport ? w.HTMLElement : class HTMLElement extends (Object) {} From a7174faa81317a9b968c74c53b28ee3e0615da0e Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:41:30 -0300 Subject: [PATCH 009/348] Update package.json --- src/components/modal/package.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/modal/package.json b/src/components/modal/package.json index f19600d1898..d8c410984b1 100644 --- a/src/components/modal/package.json +++ b/src/components/modal/package.json @@ -20,6 +20,7 @@ "args": [ { "arg": "isVisible", + "type": "Boolean", "description": "true if modal is visible, false otherwise" } ] @@ -30,6 +31,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel show" } ] @@ -40,6 +42,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object" } ] @@ -50,6 +53,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -60,6 +64,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object" } ] @@ -70,6 +75,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -80,6 +86,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -90,6 +97,7 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -100,10 +108,12 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvEvt.preventDefault() to cancel show" }, { "arg": "modalId", + "type": "String", "description": "modal ID" } ] @@ -114,10 +124,12 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object" }, { "arg": "modalId", + "type": "String", "description": "modal ID" } ] @@ -128,10 +140,12 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object. Call bvEvt.preventDefault() to cancel hide" }, { "arg": "modalId", + "Type": "String", "description": "modal ID" } ] @@ -142,10 +156,12 @@ "args": [ { "arg": "bvModalEvt", + "Type": "BvModalEvent", "description": "BvModalEvent object" }, { "arg": "modalId", + "Type": "String", "description": "modal ID" } ] @@ -158,10 +174,12 @@ "args": [ { "arg": "modalId", + "Type": "String", "description": "modal ID to show" }, { "arg": "elIDtoFocusOnClose", + "Type": ["String", "HTMLElement"] "description": "(optional), specify the element reference, or CSS selector, to return focus to once the modal is closed" } ] @@ -172,6 +190,7 @@ "args": [ { "arg": "modalId", + "Type": "String", "description": "ID of modal to hide" } ] @@ -182,10 +201,12 @@ "args": [ { "arg": "modalId", + "Type": "String", "description": "ID of modal to toggle visibility" }, { "arg": "elIDtoFocusOnClose", + "Type": ["String", "HTMLElement"], "description": "(optional), specify the element reference, or CSS selector, to return focus to once the modal is closed" } ] From f4287fe44c0a59821ca7fc927cf173c90632f2dd Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:43:58 -0300 Subject: [PATCH 010/348] Update safe-types.js --- src/utils/safe-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/safe-types.js b/src/utils/safe-types.js index 11943fddfc8..3c1e42cccca 100644 --- a/src/utils/safe-types.js +++ b/src/utils/safe-types.js @@ -6,4 +6,4 @@ import { hasWindowSupport } from './env' const w = hasWindowSupport ? window : {} -export const HTMLElement = hasWindowSupport ? w.HTMLElement : class HTMLElement extends (Object) {} +export const HTMLElement = hasWindowSupport ? w.HTMLElement : class HTMLElement extends Object {} From f79d573f8699998bfc72005db388f0a5dee35100 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:49:08 -0300 Subject: [PATCH 011/348] Update package.json --- src/components/modal/package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/modal/package.json b/src/components/modal/package.json index d8c410984b1..1a30f63133a 100644 --- a/src/components/modal/package.json +++ b/src/components/modal/package.json @@ -31,7 +31,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel show" } ] @@ -42,7 +42,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object" } ] @@ -53,7 +53,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -64,7 +64,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object" } ] @@ -75,7 +75,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -86,7 +86,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -97,7 +97,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvModalEvt.preventDefault() to cancel hide" } ] @@ -108,7 +108,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvEvt.preventDefault() to cancel show" }, { @@ -124,7 +124,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object" }, { @@ -140,7 +140,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object. Call bvEvt.preventDefault() to cancel hide" }, { @@ -156,7 +156,7 @@ "args": [ { "arg": "bvModalEvt", - "Type": "BvModalEvent", + "type": "BvModalEvent", "description": "BvModalEvent object" }, { @@ -174,7 +174,7 @@ "args": [ { "arg": "modalId", - "Type": "String", + "type": "String", "description": "modal ID to show" }, { @@ -190,7 +190,7 @@ "args": [ { "arg": "modalId", - "Type": "String", + "type": "String", "description": "ID of modal to hide" } ] @@ -201,12 +201,12 @@ "args": [ { "arg": "modalId", - "Type": "String", + "type": "String", "description": "ID of modal to toggle visibility" }, { "arg": "elIDtoFocusOnClose", - "Type": ["String", "HTMLElement"], + "type": ["String", "HTMLElement"], "description": "(optional), specify the element reference, or CSS selector, to return focus to once the modal is closed" } ] From af00bf2b7ff6e32d627c6ec6cfd9cb0efa1acdfc Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:53:17 -0300 Subject: [PATCH 012/348] Update create-web-types.js --- scripts/create-web-types.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 1ecfbac0eb0..7d7e621edbb 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -1,10 +1,11 @@ const path = require('path') // const fs = require('fs') -const pkg = require('../package.json') const requireContext = require('require-context') const baseDir = path.resolve(__dirname, '..') const baseDocs = pkg.homepage.replace(/\/$/, '') + +const pkg = require(path.resolve(__dirname, 'package.json')) const libraryName = pkg.name const libraryVersion = pkg.version From 800489bfb2416b2f17036495667975c26f3013e1 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 03:59:03 -0300 Subject: [PATCH 013/348] Update package.json --- src/components/modal/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/modal/package.json b/src/components/modal/package.json index 1a30f63133a..a854e16e4eb 100644 --- a/src/components/modal/package.json +++ b/src/components/modal/package.json @@ -145,7 +145,7 @@ }, { "arg": "modalId", - "Type": "String", + "type": "String", "description": "modal ID" } ] @@ -161,7 +161,7 @@ }, { "arg": "modalId", - "Type": "String", + "type": "String", "description": "modal ID" } ] @@ -179,7 +179,7 @@ }, { "arg": "elIDtoFocusOnClose", - "Type": ["String", "HTMLElement"] + "type": ["String", "HTMLElement"], "description": "(optional), specify the element reference, or CSS selector, to return focus to once the modal is closed" } ] From 3a848f417333bf6e4ec3b329c9c58abb0bda06b8 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 04:03:08 -0300 Subject: [PATCH 014/348] Update create-web-types.js --- scripts/create-web-types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 7d7e621edbb..052e5f28663 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -2,13 +2,13 @@ const path = require('path') // const fs = require('fs') const requireContext = require('require-context') -const baseDir = path.resolve(__dirname, '..') -const baseDocs = pkg.homepage.replace(/\/$/, '') - const pkg = require(path.resolve(__dirname, 'package.json')) const libraryName = pkg.name const libraryVersion = pkg.version +const baseDir = path.resolve(__dirname, '..') +const baseDocs = pkg.homepage.replace(/\/$/, '') + // Base web-types object const webTypes = { $schema: '', From 30d2f14a611d379975a68b1a8d579bad732d6c93 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 04:07:56 -0300 Subject: [PATCH 015/348] Update create-web-types.js --- scripts/create-web-types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 052e5f28663..bc4abbbbba0 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -2,11 +2,11 @@ const path = require('path') // const fs = require('fs') const requireContext = require('require-context') -const pkg = require(path.resolve(__dirname, 'package.json')) +const baseDir = path.resolve(__dirname, '..') +const pkg = require(path.resolve(baseDir, 'package.json')) + const libraryName = pkg.name const libraryVersion = pkg.version - -const baseDir = path.resolve(__dirname, '..') const baseDocs = pkg.homepage.replace(/\/$/, '') // Base web-types object From ed2343bca66386be9ce1affcb43772bb14262cae Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 19:00:45 -0300 Subject: [PATCH 016/348] Update create-web-types.js --- scripts/create-web-types.js | 71 ++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index bc4abbbbba0..4a57aa53264 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -27,7 +27,7 @@ const webTypes = { } // Import metatdata from a directory glob package.json files -export const importAll = r => { +const importAll = r => { const obj = {} r.keys() .map(r) @@ -52,11 +52,13 @@ export const importAll = r => { return obj } +// Util to kebab-case a PascalCase or camelCase string const kebabRE = /\B([A-Z])/g const kebabCase = str => { return str.replace(kebabRE, '-$1').toLowerCase() } +// Compute hte web-type "type" from the a prop type const computePropType = ({ type }) => { if (!type) { return 'any' @@ -83,6 +85,7 @@ const computePropType = ({ type }) => { return type.name.toLowerCase() } +// Compute the default value (in web-type form) for a given prop definition const computePropDefault = ({ default: def, type }) => { // Default could be a function that retruns a non-primative type def = typeof def === 'function' ? def.call({}) : def @@ -94,13 +97,14 @@ const computePropDefault = ({ default: def, type }) => { return JSON.stringify(def) } -// Create tag entries for each component in a group group +// Create tag entries for each component in a component group const processComponentGroup = groupSlug => { // Array of components in the group const groupMeta = componentGroups[groupSlug] || {} const componentsMeta = groupMeta.components || [] const docUrl = `${baseDocs}/docs/components/${groupSlug}/` + // We import the component from the transpiled `esm/` dir const groupRef = require(path.resolve(baseDir, 'esm/components/' + groupSlug)) // Process each component @@ -225,7 +229,57 @@ const processComponentGroup = groupSlug => { }) } -// Grab the component meta data +// Create attribute entries for each directive +const processDirectiveGroup = groupSlug => { + // Directives only have a single entry in their Meta for `directive` + const directiveMeta = directiveGroups[groupSlug] || {} + const docUrl = `${baseDocs}/docs/directives/${groupSlug}/` + + // Process the directive meta + const name = directiveMeta.directive + const arg = directiveMeta.arg + const modifiers = directiveMeta.modifiers + const expression = directiveMeta.expression + + // Base attribute definition + const attribute = { + name: kebabCase(name), + source: { + module: libraryName, + symbol: name + }, + required: false, + description: `${name} - BootstrapVue directive '${kebabCase(name)}'`, + 'doc-url': docUrl + } + // Add in argument details + if (arg) { + // TODO as this is missing from the schema def + // https://github.com/JetBrains/web-types/issues/7 + } + // Add in any modifier details + if (modifiers) { + attribute['vue-modifiers'] = modifiers.map(mod => { + const modifier = { + name: mod.modifer, + description: mod.description || '', + 'doc-url': docUrl + } + return modifer + }) + } + // Add in value (expression) type + if (expression) { + attribute.value = { + kind: 'expression', + type: computePropType(expression) + } + } + // Add the directive to the html attributes array + webTypes.contributions.html.attributes.push(attribute) +} + +// Grab the component meta data (from the source dir component's package.json) const componentsContext = requireContext( path.resolve(baseDir, 'src/components'), true, @@ -234,12 +288,19 @@ const componentsContext = requireContext( const componentGroups = importAll(componentsContext) // Grab the directive meta data -// const directivesContext = requireContext(path.resolve(baseDir, 'src/directives'), true, /package.json/) -// const directiveGroups = importAll(directivesContext) +const directivesContext = requireContext( + path.resolve(baseDir, 'src/directives'), + true, + /package.json/ +) +const directiveGroups = importAll(directivesContext) // Process all components Object.keys(componentGroups).forEach(processComponentGroup) +// Process all directives +Object.keys(directiveGroups).forEach(processDirectiveGroup) + // Convert to JSON string const json = JSON.stringify(webTypes, null, 2) From 2e98eaf296ae156c85e3f17ba900612dade2722b Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 19:04:09 -0300 Subject: [PATCH 017/348] Update create-web-types.js --- scripts/create-web-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 4a57aa53264..42236e3a0c2 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -265,7 +265,7 @@ const processDirectiveGroup = groupSlug => { description: mod.description || '', 'doc-url': docUrl } - return modifer + return modifier }) } // Add in value (expression) type From 49bbc676d1671f4a06f61e5373a4729af98c15b2 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 19:53:54 -0300 Subject: [PATCH 018/348] Update create-web-types.js --- scripts/create-web-types.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 42236e3a0c2..0ed6d2f41b2 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -199,11 +199,12 @@ const processComponentGroup = groupSlug => { // Slot props not documented in meta yet slot.properties = slotObj.scope.forEach(propDef => { const property = { - name: propDef.name, - type: 'any', - description: propDef.description, + name: propDef.prop, 'doc-url': docUrl } + if (propDef.description) { + property.description = propDef.description + } if (propDef.type) { property.type = computePropType(propDef) } From 7df95f20bf7a91a8204f3291fdd76e82ab2a4c89 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 19:54:52 -0300 Subject: [PATCH 019/348] Update package.json --- src/components/modal/package.json | 116 ++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 4 deletions(-) diff --git a/src/components/modal/package.json b/src/components/modal/package.json index a854e16e4eb..cd0210d26ce 100644 --- a/src/components/modal/package.json +++ b/src/components/modal/package.json @@ -215,15 +215,96 @@ "slots": [ { "name": "modal-header", - "description": "Entire modal header container contents. Also removes the top right X close button. Optionally scoped." + "description": "Entire modal header container contents. Also removes the top right X close button. Optionally scoped.", + "scope": [ + { + "prop": "visible", + "type": "Boolean", + "description": "The visibility state of the modal. true if the modal is visible and false if not visible" + }, + { + "prop": "ok", + "type": "Function", + "description": "Closes the modal and fires the 'ok' and 'hide' events, with bvModalEvent.trigger = 'ok'" + }, + { + "prop": "cancel", + "type": "Function", + "description": "Closes the modal and fires the 'cancel' and 'hide' events, with bvModalEvent.trigger = 'cancel'" + }, + { + "prop": "close", + "type": "Function", + "description": "Closes the modal and fires the close and hide events, with bvModalEvent.trigger = 'headerclose'" + }, + { + "prop": "hide", + "type": "Function", + "description": "Accepts one argument 'trigger'. Closes the modal and fires the 'hide' event, with the bvModalEvent.trigger = trigger (trigger is optional)" + } + ] }, { "name": "modal-title", - "description": "Modal title. If modal-header slot is used, this slot will not be shown. Optionally scoped." + "description": "Modal title. If modal-header slot is used, this slot will not be shown. Optionally scoped.", + "scope": [ + { + "prop": "visible", + "type": "Boolean", + "description": "The visibility state of the modal. true if the modal is visible and false if not visible" + }, + { + "prop": "ok", + "type": "Function", + "description": "Closes the modal and fires the 'ok' and 'hide' events, with bvModalEvent.trigger = 'ok'" + }, + { + "prop": "cancel", + "type": "Function", + "description": "Closes the modal and fires the 'cancel' and 'hide' events, with bvModalEvent.trigger = 'cancel'" + }, + { + "prop": "close", + "type": "Function", + "description": "Closes the modal and fires the close and hide events, with bvModalEvent.trigger = 'headerclose'" + }, + { + "prop": "hide", + "type": "Function", + "description": "Accepts one argument 'trigger'. Closes the modal and fires the 'hide' event, with the bvModalEvent.trigger = trigger (trigger is optional)" + } + ] }, { "name": "modal-footer", - "description": "Modal footer content. Also removes default OK and CANCEL buttons. Optionally scoped." + "description": "Modal footer content. Also removes default OK and CANCEL buttons. Optionally scoped.", + "scope": [ + { + "prop": "visible", + "type": "Boolean", + "description": "The visibility state of the modal. true if the modal is visible and false if not visible" + }, + { + "prop": "ok", + "type": "Function", + "description": "Closes the modal and fires the 'ok' and 'hide' events, with bvModalEvent.trigger = 'ok'" + }, + { + "prop": "cancel", + "type": "Function", + "description": "Closes the modal and fires the 'cancel' and 'hide' events, with bvModalEvent.trigger = 'cancel'" + }, + { + "prop": "close", + "type": "Function", + "description": "Closes the modal and fires the close and hide events, with bvModalEvent.trigger = 'headerclose'" + }, + { + "prop": "hide", + "type": "Function", + "description": "Accepts one argument 'trigger'. Closes the modal and fires the 'hide' event, with the bvModalEvent.trigger = trigger (trigger is optional)" + } + ] }, { "name": "modal-header-close", @@ -243,7 +324,34 @@ }, { "name": "default", - "description": "Content of modal body. Optionally scoped." + "description": "Content of modal body. Optionally scoped.", + "scope": [ + { + "prop": "visible", + "type": "Boolean", + "description": "The visibility state of the modal. true if the modal is visible and false if not visible" + }, + { + "prop": "ok", + "type": "Function", + "description": "Closes the modal and fires the 'ok' and 'hide' events, with bvModalEvent.trigger = 'ok'" + }, + { + "prop": "cancel", + "type": "Function", + "description": "Closes the modal and fires the 'cancel' and 'hide' events, with bvModalEvent.trigger = 'cancel'" + }, + { + "prop": "close", + "type": "Function", + "description": "Closes the modal and fires the close and hide events, with bvModalEvent.trigger = 'headerclose'" + }, + { + "prop": "hide", + "type": "Function", + "description": "Accepts one argument 'trigger'. Closes the modal and fires the 'hide' event, with the bvModalEvent.trigger = trigger (trigger is optional)" + } + ] } ] } From 78e78bae5a27a6627bf1a3883baff326a67bb918 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 20:02:55 -0300 Subject: [PATCH 020/348] Update create-web-types.js --- scripts/create-web-types.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 0ed6d2f41b2..b6fc3e16aab 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -166,24 +166,30 @@ const processComponentGroup = groupSlug => { // Add events if ($events.length) { tag.events = $events.map(eventObj => { - return { + const event = { name: eventObj.event, - description: eventObj.description, - 'doc-url': docUrl, - arguments: (eventObj.args || []).map(arg => { + 'doc-url': docUrl + } + if (eventObj.description) { + event.description = eventObj.description + } + if (eventObj.args) { + event.arguments = eventObj.args.map(arg => { arg = typeof arg === 'object' ? arg : { arg: arg } - const event = { + const argument = { name: arg.arg, - type: 'any', - description: arg.description || '', 'doc-url': docUrl } + if (arg.description) { + argument.description = arg.description + } if (arg.type) { - event.type = computePropType(arg) + argument.type = computePropType(arg) } - return event + return argument }) } + return event }) } @@ -192,9 +198,11 @@ const processComponentGroup = groupSlug => { tag['vue-scoped-slots'] = $slots.map(slotObj => { const slot = { name: slotObj.name, - description: slotObj.description || '', 'doc-url': docUrl } + if (slotObj.description) { + slot.description = slotObj.description + } if (slotObj.scope) { // Slot props not documented in meta yet slot.properties = slotObj.scope.forEach(propDef => { From ad0f144d92b51bf6aff058c0b00168d8baaf1fab Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 20:14:57 -0300 Subject: [PATCH 021/348] Update create-web-types.js --- scripts/create-web-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index b6fc3e16aab..67fa306fe71 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -58,7 +58,7 @@ const kebabCase = str => { return str.replace(kebabRE, '-$1').toLowerCase() } -// Compute hte web-type "type" from the a prop type +// Compute the web-type "type" from the a prop type const computePropType = ({ type }) => { if (!type) { return 'any' From ba3ac5610786e3430fc1acc25737df78e37d4cdc Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 20:24:08 -0300 Subject: [PATCH 022/348] Update create-web-types.js --- scripts/create-web-types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 67fa306fe71..fe55e565f3e 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -173,7 +173,7 @@ const processComponentGroup = groupSlug => { if (eventObj.description) { event.description = eventObj.description } - if (eventObj.args) { + if (Array.isArray(eventObj.args)) { event.arguments = eventObj.args.map(arg => { arg = typeof arg === 'object' ? arg : { arg: arg } const argument = { @@ -203,9 +203,9 @@ const processComponentGroup = groupSlug => { if (slotObj.description) { slot.description = slotObj.description } - if (slotObj.scope) { + if (Array.isArray(slotObj.scope)) { // Slot props not documented in meta yet - slot.properties = slotObj.scope.forEach(propDef => { + slot.properties = slotObj.scope.map(propDef => { const property = { name: propDef.prop, 'doc-url': docUrl From d96248445b58fd8ab37faa4a79eb964023843171 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 20:28:26 -0300 Subject: [PATCH 023/348] Update create-web-types.js --- scripts/create-web-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index fe55e565f3e..49ae599b6a8 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -75,7 +75,7 @@ const computePropType = ({ type }) => { } else { // Handle cases for BvEvent, BvModalEvent and other native // event types (i.e. HTMLElement, MouseEvent, etc) - return /^[A-Z].*[A-Z].+/.test(type) ? type : type.toLowerCase() + return /^[A-Z].*[A-Z].+/.test(type) || type === 'Event' ? type : type.toLowerCase() } } if (type.name === 'Array') { From 04a9b8213a32be1088c884d5f8ace41f770957d0 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 21:24:14 -0300 Subject: [PATCH 024/348] Update modal.js --- src/components/modal/modal.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js index af8e94060a0..58474b66e96 100644 --- a/src/components/modal/modal.js +++ b/src/components/modal/modal.js @@ -16,6 +16,7 @@ import { import { isBrowser } from '../../utils/env' import { stripTags } from '../../utils/html' import { isString, isUndefinedOrNull } from '../../utils/inspect' +import { HTMLElement } from '../../utils/safe-types' import { BTransporterSingle } from '../../utils/transporter' import idMixin from '../../mixins/id' import listenOnRootMixin from '../../mixins/listen-on-root' @@ -224,7 +225,8 @@ export const props = { default: false }, returnFocus: { - // type: Object, + // HTML Element or CSS selector string + type: [HTMLElement, String], default: null }, headerCloseLabel: { From 3b9c92ec0b0b172fb47c753002a989cd263fe35b Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 21:27:01 -0300 Subject: [PATCH 025/348] Update package.json --- src/components/tooltip/package.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/tooltip/package.json b/src/components/tooltip/package.json index b911f1c9a67..1cb32c6baac 100644 --- a/src/components/tooltip/package.json +++ b/src/components/tooltip/package.json @@ -17,6 +17,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object" } ] @@ -27,6 +28,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -37,6 +39,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object" } ] @@ -47,6 +50,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -65,6 +69,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object" } ] @@ -75,6 +80,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -85,6 +91,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object" } ] @@ -95,6 +102,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -105,6 +113,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -115,6 +124,7 @@ "args": [ { "arg": "bvEvent", + "type": "BvEvent", "description": "bvEvent object." } ] @@ -127,6 +137,7 @@ "args": [ { "arg": "id", + "type": "String", "description": "(optional), tooltip id to hide" } ] @@ -137,6 +148,7 @@ "args": [ { "arg": "id", + "type": "String", "description": "(optional), tooltip id to show" } ] @@ -147,6 +159,7 @@ "args": [ { "arg": "id", + "type": "String", "description": "(optional), tooltip id to disable" } ] @@ -157,6 +170,7 @@ "args": [ { "arg": "id", + "type": "String", "description": "(optional), tooltip id to enable" } ] @@ -165,7 +179,7 @@ "slots": [ { "name": "default", - "description": "Slot for tooltip content (HTML supported)" + "description": "Slot for tooltip content (HTML/Components supported)" } ] } From 5cc3ffc54baadd21daf9219207344e97e05f3fbe Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 21:31:00 -0300 Subject: [PATCH 026/348] Update package.json --- src/components/tooltip/package.json | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/tooltip/package.json b/src/components/tooltip/package.json index 1cb32c6baac..9b818fae49c 100644 --- a/src/components/tooltip/package.json +++ b/src/components/tooltip/package.json @@ -18,7 +18,7 @@ { "arg": "bvEvent", "type": "BvEvent", - "description": "bvEvent object" + "description": "bvEvent object. Cancelable." } ] }, @@ -40,7 +40,7 @@ { "arg": "bvEvent", "type": "BvEvent", - "description": "bvEvent object" + "description": "bvEvent object. Cancelable." } ] }, @@ -57,11 +57,25 @@ }, { "event": "enabled", - "description": "Emitted when tooltip becomes enabled" + "description": "Emitted when tooltip becomes enabled", + "args": [ + { + "arg": "bvEvent", + "type": "BvEvent", + "description": "bvEvent object" + } + ] }, { "event": "disabled", - "description": "Emitted when tooltip becomes disabled" + "description": "Emitted when tooltip becomes disabled", + "args": [ + { + "arg": "bvEvent", + "type": "BvEvent", + "description": "bvEvent object" + } + ] }, { "event": "bv::tooltip::show", @@ -70,7 +84,7 @@ { "arg": "bvEvent", "type": "BvEvent", - "description": "bvEvent object" + "description": "bvEvent object. Cancelable." } ] }, @@ -92,7 +106,7 @@ { "arg": "bvEvent", "type": "BvEvent", - "description": "bvEvent object" + "description": "bvEvent object. Cancelable." } ] }, From 1dfff5e562c569430e75c1779d12e755ac0aff5f Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 21:56:22 -0300 Subject: [PATCH 027/348] Update create-web-types.js --- scripts/create-web-types.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 49ae599b6a8..23ec111cd2b 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -66,30 +66,32 @@ const computePropType = ({ type }) => { type = type || Object if (Array.isArray(type)) { // Array of types - return type.map(type => computePropType({ type: type })).join('|') + return type.map(t => computePropType({ type: t })).join('|') } if (typeof type === 'string') { // Mainly for events and slots if (type === 'Array') { - type = Array + return 'any[]' } else { // Handle cases for BvEvent, BvModalEvent and other native - // event types (i.e. HTMLElement, MouseEvent, etc) - return /^[A-Z].*[A-Z].+/.test(type) || type === 'Event' ? type : type.toLowerCase() + // event types (i.e. HTMLElement, MouseEvent, Event, etc) as strings + // We use strings (or array of strings) in the component group package.json meta + return /^[A-Z].+[A-Z].+[a-z]$/.test(type) || type === 'Event' ? type : type.toLowerCase() } } if (type.name === 'Array') { // For simplicity return arrays of any type entries return 'any[]' } + // Prop types are typically class references (String, Function, etc) return type.name.toLowerCase() } -// Compute the default value (in web-type form) for a given prop definition +// Compute the default value (in web-type form) for a given prop definition (component props only) const computePropDefault = ({ default: def, type }) => { // Default could be a function that retruns a non-primative type def = typeof def === 'function' ? def.call({}) : def - if (type === Boolean || (Array.isArray(type) && type[0] === Boolean)) { + if (type === Boolean || (Array.isArray(type) && type[0] === Boolean && !def)) { def = Boolean(def) } else if (def === undefined) { def = null From e3386243e33994dbede1b22437ee7a898c5c6bb8 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 22:07:23 -0300 Subject: [PATCH 028/348] Update create-web-types.js --- scripts/create-web-types.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/create-web-types.js b/scripts/create-web-types.js index 23ec111cd2b..65e644747ab 100644 --- a/scripts/create-web-types.js +++ b/scripts/create-web-types.js @@ -68,23 +68,20 @@ const computePropType = ({ type }) => { // Array of types return type.map(t => computePropType({ type: t })).join('|') } - if (typeof type === 'string') { - // Mainly for events and slots - if (type === 'Array') { - return 'any[]' - } else { - // Handle cases for BvEvent, BvModalEvent and other native - // event types (i.e. HTMLElement, MouseEvent, Event, etc) as strings - // We use strings (or array of strings) in the component group package.json meta - return /^[A-Z].+[A-Z].+[a-z]$/.test(type) || type === 'Event' ? type : type.toLowerCase() - } + if (typeof type === 'undefined') { + return 'any' + } + if (typeof type !== 'string') { + type = type.name } - if (type.name === 'Array') { + if (type === 'Array') { // For simplicity return arrays of any type entries return 'any[]' } - // Prop types are typically class references (String, Function, etc) - return type.name.toLowerCase() + // For browser types, we leave them capitalized, otherwise we return a lowercase typescipt name + return ['Boolean', 'String', 'Number', 'Function', 'Object'].indexOf(type) > -1 + ? type.toLowerCase() + : type } // Compute the default value (in web-type form) for a given prop definition (component props only) From 9f95f7d684a8fb4e26f1c5b7cd0d9aaf7f168155 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 22:09:59 -0300 Subject: [PATCH 029/348] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d36c7462712..ac8609e8544 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "style": "dist/bootstrap-vue.css", "license": "MIT", "types": "src/index.d.ts", + "web-types": "dist/web-types.json", "repository": "bootstrap-vue/bootstrap-vue", "homepage": "https://bootstrap-vue.js.org", "contributors": [ From 13c2040278bd1b9bd50207ecd04f38b7c5b1a4c4 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 22:36:13 -0300 Subject: [PATCH 030/348] Update package.json --- src/components/toast/package.json | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/toast/package.json b/src/components/toast/package.json index 294f7e17825..030672a3296 100644 --- a/src/components/toast/package.json +++ b/src/components/toast/package.json @@ -18,6 +18,7 @@ "args": [ { "arg": "visible", + "type": "Boolean", "description": "true if toast is visible, false otherwise." } ] @@ -28,6 +29,7 @@ "args": [ { "arg": "bvEvt", + "type": "BvEvent", "description": "BvEvent object." } ] @@ -38,6 +40,7 @@ "args": [ { "arg": "bvEvt", + "type": "BvEvent", "description": "BvEvent object." } ] @@ -48,6 +51,7 @@ "args": [ { "arg": "bvEvt", + "type": "BvEvent", "description": "BvEvent object." } ] @@ -58,6 +62,7 @@ "args": [ { "arg": "bvEvt", + "type": "BvEvent", "description": "BvEvent object." } ] @@ -66,11 +71,25 @@ "slots": [ { "name": "toast-title", - "description": "Toast title. Optionally scoped." + "description": "Toast title. Optionally scoped.", + "scope": [ + { + "prop": "hide", + "type": "Function", + "description": "Hides the toast when called. Useful if you are providing your own close button." + } + ] }, { "name": "default", - "description": "Toast body content. Optionally scoped." + "description": "Toast body content. Optionally scoped.", + "scope": [ + { + "prop": "hide", + "type": "Function", + "description": "Hides the toast when called. Useful if you are providing your own close button." + } + ] } ] }, From 5487b64cc5d3924cee2f3711b17c3bd3be012228 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 22:38:46 -0300 Subject: [PATCH 031/348] Update package.json --- src/components/tabs/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/tabs/package.json b/src/components/tabs/package.json index 2c34a1edde8..e61d96a9859 100644 --- a/src/components/tabs/package.json +++ b/src/components/tabs/package.json @@ -14,6 +14,7 @@ "args": [ { "arg": "tabIndex", + "type": "Number", "description": "Current selected tab index (0-based index)" } ] @@ -24,10 +25,12 @@ "args": [ { "arg": "currentTabs", + "type": "Array", "description": "Array of the current b-tab instances, in document order." }, { "arg": "previousTabs", + "type": "Array", "description": "Array of the previous b-tab instances, in document order." } ] @@ -57,6 +60,7 @@ "args": [ { "arg": "evt", + "type": "MouseEvent", "description": "Original event object" } ] From 3736d8d8deb0c97010037498da496fdb5b8667bd Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Tue, 17 Sep 2019 23:50:38 -0300 Subject: [PATCH 032/348] Update package.json --- src/components/table/package.json | 659 ++++++++++++++++++++++++++++-- 1 file changed, 634 insertions(+), 25 deletions(-) diff --git a/src/components/table/package.json b/src/components/table/package.json index a0bd54d9725..dd6cf9fc08e 100644 --- a/src/components/table/package.json +++ b/src/components/table/package.json @@ -18,14 +18,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -36,14 +39,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being double clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being double clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -54,14 +60,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being middle clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being middle clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -72,14 +81,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being right clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being right clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -90,14 +102,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being hovered." }, { "arg": "index", + "type": "Number", "description": "Index of the row being hovered." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -108,24 +123,28 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being unhovered." }, { "arg": "index", + "type": "Number", "description": "Index of the row being unhovered." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] }, { "event": "row-selected", - "description": "Emitted when a row or rows have been selected.", + "description": "Emitted when a row or rows have been selected or unselected.", "args": [ { "arg": "rows", + "type": "Array", "description": "Array of the row items that are selected." } ] @@ -136,18 +155,22 @@ "args": [ { "arg": "key", + "type": "String", "description": "Column key clicked (field name)." }, { "arg": "field", + "type": "Object", "description": "Field definition object." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." }, { "arg": "isFooter", + "type": "Boolean", "description": "'True' if this event originated from clicking on the footer cell" } ] @@ -158,6 +181,7 @@ "args": [ { "arg": "ctx", + "type": "Object", "description": "Table state context object. See docs." } ] @@ -168,6 +192,7 @@ "args": [ { "arg": "ctx", + "type": "Object", "description": "Table state context object. See docs." } ] @@ -178,6 +203,7 @@ "args": [ { "arg": "filteredItems", + "type": "Array", "description": "Array of items after filtering (before local pagination occurs)." } ] @@ -194,6 +220,7 @@ "args": [ { "arg": "id", + "type": "String", "description": "table id to refresh data" } ] @@ -202,27 +229,215 @@ "slots": [ { "name": "cell(key)", - "description": "Scoped slot for custom data rendering of field data. 'key' is the fields key name. See docs for scoped data" + "description": "Scoped slot for custom data rendering of field data. 'key' is the fields key name. See docs for scoped data", + "scope": [ + { + "prop": "index", + "type": "Number", + "description": "The row's index (zero-based) with respect to the displayed rows" + }, + { + "prop": "item", + "type": "Object", + "description": "The row's item data object" + }, + { + "prop": "value", + "description": "The value for this key in the record (null or undefined if a virtual column), or the output of the field's formatter function" + }, + { + "prop": "unformatted", + "description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function" + }, + { + "prop": "detailsShowing", + "type": "Boolean", + "description": "Will be true if the row's row-details scoped slot is visible" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Can be called to toggle the visibility of the rows row-details scoped slot" + }, + { + "prop": "rowSelected", + "type": "Boolean", + "description": "Will be true if the row has been selected." + } + ] }, { "name": "cell()", - "description": "Default scoped slot for custom data rendering of field data. See docs for scoped data" + "description": "Default scoped slot for custom data rendering of field data. See docs for scoped data", + "scope": [ + { + "prop": "index", + "type": "Number", + "description": "The row's index (zero-based) with respect to the displayed rows" + }, + { + "prop": "item", + "type": "Object", + "description": "The row's item data object" + }, + { + "prop": "value", + "description": "The value for this key in the record (null or undefined if a virtual column), or the output of the field's formatter function" + }, + { + "prop": "unformatted", + "description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function" + }, + { + "prop": "detailsShowing", + "type": "Boolean", + "description": "Will be true if the row's row-details scoped slot is visible" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Can be called to toggle the visibility of the rows row-details scoped slot" + }, + { + "prop": "rowSelected", + "type": "Boolean", + "description": "Will be true if the row has been selected." + } + ] }, { "name": "head(key)", - "description": "Scoped slot for custom rendering of field header. 'key' is the fields key name. See docs for scoped header" + "description": "Scoped slot for custom rendering of field header. 'key' is the fields key name. See docs for scoped header", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "isFoot", + "type": "Boolean", + "description": "Will be true if the slot is being rendered in the table footer" + } + ] }, { "name": "head()", - "description": "Default scoped slot for custom rendering of field header. See docs for scoped header" + "description": "Default scoped slot for custom rendering of field header. See docs for scoped header", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "isFoot", + "type": "Boolean", + "description": "Will be true if the slot is being rendered in the table footer" + } + ] }, { "name": "foot(key)", - "description": "Scoped slot for custom rendering of field footer. 'key' is the fields key name. See docs for scoped footer" + "description": "Scoped slot for custom rendering of field footer. 'key' is the fields key name. See docs for scoped footer", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + } + ] }, { "name": "foot()", - "description": "Default scoped slot for custom rendering of field footer. See docs for scoped footer" + "description": "Default scoped slot for custom rendering of field footer. See docs for scoped footer", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + } + ] }, { "name": "table-caption", @@ -230,7 +445,19 @@ }, { "name": "table-colgroup", - "description": "Slot to place custom colgroup and col elements (optionally scoped: columns - number of columns, fields - array of field definition objects)" + "description": "Slot to place custom colgroup and col elements. Optionally scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "Array of field definition objects" + } + ] }, { "name": "table-busy", @@ -238,31 +465,180 @@ }, { "name": "row-details", - "description": "Scoped slot for optional rendering additional record details. See docs for Row details support" + "description": "Scoped slot for optional rendering additional record details. See docs for Row details support", + "scope": [ + { + "prop": "item", + "type": "Object", + "description": "The entire row's record data object" + }, + { + "prop": "index", + "type": "Number", + "description": "The item's row index number (with respect to the displayed item rows)" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Function to toggle visibility of the row's details slot" + } + ] }, { "name": "empty", - "description": "Content to display when no items are present in the `items` array (optionally scoped: see docs for details)" + "description": "Content to display when no items are present in the `items` array. Optionally scoped", + "scope": [ + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "items", + "type": "Array", + "description": "The items array. Exposed here to check null vs []" + }, + { + "prop": "emptyText", + "type": "String", + "description": "The value of the empty-text prop" + }, + { + "prop": "emptyHtml", + "type": "String", + "description": "The value of the empty-html prop" + }, + { + "prop": "emptyFilteredText", + "type": "String", + "description": "The value of the empty-filtered-text prop" + }, + { + "prop": "emptyFilteredHtml", + "type": "String", + "description": "The value of the empty-filtered-html prop" + } + ] }, { "name": "emptyfiltered", - "description": "Content to display when no items are present in the filtered `items` array (optionally scoped: see docs for details)" + "description": "Content to display when no items are present in the filtered `items` array. Optionally scoped", + "scope": [ + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "items", + "type": "Array", + "description": "The items array. Exposed here to check null vs []" + }, + { + "prop": "emptyText", + "type": "String", + "description": "The value of the empty-text prop" + }, + { + "prop": "emptyHtml", + "type": "String", + "description": "The value of the empty-html prop" + }, + { + "prop": "emptyFilteredText", + "type": "String", + "description": "The value of the empty-filtered-text prop" + }, + { + "prop": "emptyFilteredHtml", + "type": "String", + "description": "The value of the empty-filtered-html prop" + } + ] }, { "name": "thead-top", - "description": "Slot above the column headers in the `thead` element for user-supplied B-TR's with B-TH/B-TD (optionally scoped: columns - number of TDs to provide, fields - array of field definition objects)" + "description": "Slot above the column headers in the `thead` element for user-supplied B-TR's with B-TH/B-TD. Optionally scoped.", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + } + ] }, { "name": "top-row", - "description": "Fixed top row slot for user supplied B-TD cells (Optionally scoped: columns - number of B-TDs to provide, fields - array of field definition objects)" + "description": "Fixed top row slot for user supplied B-TD cells. Optionally scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + } + ] }, { "name": "bottom-row", - "description": "Fixed bottom row slot for user supplied B-TD cells (Optionally Scoped: columns - number of B-TDs to provide, fields - array of field definition objects)" + "description": "Fixed bottom row slot for user supplied B-TD cells. Optionally Scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + } + ] }, { "name": "custom-foot", - "description": "Custom footer content slot for user supplied B-TR, B-TH, B-TD (Optionally Scoped: columns - number columns, fields - array of field definition objects, items - array of currently displayed row items)" + "description": "Custom footer content slot for user supplied B-TR, B-TH, B-TD. Optionally Scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "items", + "type": "Array", + "description": "Array of items that are currently being displayed" + } + ] } ] }, @@ -275,14 +651,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -293,14 +672,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being double clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being double clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -311,14 +693,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being middle clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being middle clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -329,14 +714,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being right clicked." }, { "arg": "index", + "type": "Number", "description": "Index of the row being right clicked." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -347,14 +735,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being hovered." }, { "arg": "index", + "type": "Number", "description": "Index of the row being hovered." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -365,14 +756,17 @@ "args": [ { "arg": "item", + "type": "Object", "description": "Item data of the row being unhovered." }, { "arg": "index", + "type": "Number", "description": "Index of the row being unhovered." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." } ] @@ -383,18 +777,22 @@ "args": [ { "arg": "key", + "type": "String", "description": "Column key clicked (field name)." }, { "arg": "field", + "type": "Object", "description": "Field definition object." }, { "arg": "event", + "type": "MouseEvent", "description": "Native event object." }, { "arg": "isFooter", + "type": "Boolean", "description": "'True' if this event originated from clicking on the footer cell" } ] @@ -403,27 +801,165 @@ "slots": [ { "name": "cell(key)", - "description": "Scoped slot for custom data rendering of field data. 'key' is the fields key name. See docs for scoped data" + "description": "Scoped slot for custom data rendering of field data. 'key' is the fields key name.", + "scope": [ + { + "prop": "index", + "type": "Number", + "description": "The row's index (zero-based) with respect to the displayed rows" + }, + { + "prop": "item", + "type": "Object", + "description": "The row's item data object" + }, + { + "prop": "value", + "description": "The value for this key in the record (null or undefined if a virtual column), or the output of the field's formatter function" + }, + { + "prop": "unformatted", + "description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function" + }, + { + "prop": "detailsShowing", + "type": "Boolean", + "description": "Will be true if the row's row-details scoped slot is visible" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Can be called to toggle the visibility of the rows row-details scoped slot" + } + ] }, { "name": "cell()", - "description": "Default scoped slot for custom data rendering of field data. See docs for scoped data" + "description": "Default scoped slot for custom data rendering of field data.", + "scope": [ + { + "prop": "index", + "type": "Number", + "description": "The row's index (zero-based) with respect to the displayed rows" + }, + { + "prop": "item", + "type": "Object", + "description": "The row's item data object" + }, + { + "prop": "value", + "description": "The value for this key in the record (null or undefined if a virtual column), or the output of the field's formatter function" + }, + { + "prop": "unformatted", + "description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function" + }, + { + "prop": "detailsShowing", + "type": "Boolean", + "description": "Will be true if the row's row-details scoped slot is visible" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Can be called to toggle the visibility of the rows row-details scoped slot" + } + ] }, { "name": "head(key)", - "description": "Scoped slot for custom rendering of field header. 'key' is the fields key name. See docs for scoped header" + "description": "Scoped slot for custom rendering of field header. 'key' is the fields key name", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "isFoot", + "type": "Boolean", + "description": "Will be true if the slot is being rendered in the table footer" + } + ] }, { "name": "head()", - "description": "Default scoped slot for custom rendering of field header. See docs for scoped header" + "description": "Default scoped slot for custom rendering of field header.", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + }, + { + "prop": "isFoot", + "type": "Boolean", + "description": "Will be true if the slot is being rendered in the table footer" + } + ] }, { "name": "foot(key)", - "description": "Scoped slot for custom rendering of field footer. 'key' is the fields key name. See docs for scoped footer" + "description": "Scoped slot for custom rendering of field footer. 'key' is the fields key name.", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + } + ] }, { "name": "foot()", - "description": "Default scoped slot for custom rendering of field footer. See docs for scoped footer" + "description": "Default scoped slot for custom rendering of field footer", + "scope": [ + { + "prop": "column", + "type": "String", + "description": "The fields's key value" + }, + { + "prop": "field", + "type": "Object", + "description": "the field's definition object (from the fields prop)" + }, + { + "prop": "label", + "type": "String", + "description": "The fields label value" + } + ] }, { "name": "table-caption", @@ -431,19 +967,92 @@ }, { "name": "table-colgroup", - "description": "Slot to place custom colgroup and col elements (optionally scoped: columns - number of columns, fields - array of field definition objects)" + "description": "Slot to place custom colgroup and col elements. Optionally scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "Array of field definition objects" + } + ] }, { "name": "row-details", - "description": "Scoped slot for optional rendering additional record details. See docs for Row details support" + "description": "Scoped slot for optional rendering additional record details. See docs for Row details support", + "scope": [ + { + "prop": "item", + "type": "Object", + "description": "The entire row's record data object" + }, + { + "prop": "index", + "type": "Number", + "description": "The item's row index number (with respect to the displayed item rows)" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "toggleDetails", + "type": "Function", + "description": "Function to toggle visibility of the row's details slot" + } + ] }, { "name": "thead-top", - "description": "Slot above the column headers in the `thead` element for user-supplied B-TR with B-TH/B-TD (optionally scoped: columns - number of TDs to provide, fields - array of field definition objects)" + "description": "Slot above the column headers in the `thead` element for user-supplied B-TR with B-TH/B-TD. Optionally scoped.", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "selectAllRows", + "type": "Function", + "description": "Select all rows (applicable if the table is in selectable mode)" + }, + { + "prop": "clearSelected", + "type": "Function", + "description": "Unselect all rows (applicable if the table is in selectable mode)" + } + ] }, { "name": "custom-foot", - "description": "Custom footer content slot for user supplied B-TR's with B-TH/B-TD (Optionally Scoped: columns - number columns, fields - array of field definition objects, items - array of currently displayed row items)" + "description": "Custom footer content slot for user supplied B-TR's with B-TH/B-TD. Optionally Scoped", + "scope": [ + { + "prop": "columns", + "type": "Number", + "description": "the number of columns in the table" + }, + { + "prop": "fields", + "type": "Array", + "description": "The normalized fields definition array (in the array of objects format)" + }, + { + "prop": "items", + "type": "Array", + "description": "Array of items that are currently being displayed" + } + ] } ] }, From d1e53982346c18c8b42e1de2a2a45445fd48d8bd Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 18 Sep 2019 00:04:59 -0300 Subject: [PATCH 033/348] Update componentdoc.vue --- docs/components/componentdoc.vue | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/components/componentdoc.vue b/docs/components/componentdoc.vue index 2d335f57c0a..8a488883518 100644 --- a/docs/components/componentdoc.vue +++ b/docs/components/componentdoc.vue @@ -108,6 +108,20 @@ + + @@ -262,7 +276,16 @@ export default { ] }, slotsFields() { - return [{ key: 'name', label: 'Slot' }, { key: 'description', label: 'Description' }] + const fields = [ + { key: 'name', label: 'Slot Name' }, + { key: 'description', label: 'Description' } + ] + if (this.slots.length > 0 && this.slots.some(s => s.scope)) { + fields.push({ + key: 'scoped', label: 'Scoped' + }) + } + return fields }, propsItems() { const props = this.componentProps From 777833f4e934b0582260d568bddf3cae742dd967 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 18 Sep 2019 00:12:44 -0300 Subject: [PATCH 034/348] Update componentdoc.vue --- docs/components/componentdoc.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/components/componentdoc.vue b/docs/components/componentdoc.vue index 8a488883518..ed1074fea6b 100644 --- a/docs/components/componentdoc.vue +++ b/docs/components/componentdoc.vue @@ -108,7 +108,7 @@ - + @@ -281,9 +281,7 @@ export default { { key: 'description', label: 'Description' } ] if (this.slots.length > 0 && this.slots.some(s => s.scope)) { - fields.push({ - key: 'scoped', label: 'Scoped' - }) + fields.push({ key: 'scope', label: 'Scoped' }) } return fields }, From c1b3b8437e22161cabddbd2aa6ba2cf7d6ee94d0 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 18 Sep 2019 00:24:41 -0300 Subject: [PATCH 035/348] Update componentdoc.vue --- docs/components/componentdoc.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/components/componentdoc.vue b/docs/components/componentdoc.vue index ed1074fea6b..1e8bdf812c5 100644 --- a/docs/components/componentdoc.vue +++ b/docs/components/componentdoc.vue @@ -109,18 +109,23 @@ {{ value }} From 52831b212dcb00c65b3ff46025f5a92e85d56f92 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 18 Sep 2019 00:34:27 -0300 Subject: [PATCH 036/348] Update componentdoc.vue --- docs/components/componentdoc.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/components/componentdoc.vue b/docs/components/componentdoc.vue index 1e8bdf812c5..d61a3514735 100644 --- a/docs/components/componentdoc.vue +++ b/docs/components/componentdoc.vue @@ -97,7 +97,7 @@ Slots