diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml index ac0fe232..bbfcc73f 100644 --- a/.github/workflows/cla.yaml +++ b/.github/workflows/cla.yaml @@ -8,6 +8,6 @@ jobs: name: Verify contributor steps: - - uses: tidev/tidev-cla-action@v1 + - uses: tidev/tidev-cla-action@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/titanium-docgen/generators/jsduck_generator.js b/packages/titanium-docgen/generators/jsduck_generator.js index 744cdb80..6559f8d4 100644 --- a/packages/titanium-docgen/generators/jsduck_generator.js +++ b/packages/titanium-docgen/generators/jsduck_generator.js @@ -328,17 +328,17 @@ function exportEditUrl(api) { const file = api.__file; const blackList = [ 'appcelerator.https', 'ti.geofence' ]; // Don't include Edit button for these modules let rv = ''; - let basePath = 'https://github.com/appcelerator/titanium_mobile/edit/master/'; + let basePath = 'https://github.com/tidev/titanium-sdk/edit/master/'; // Determine edit URL by file's folder location - if (file.indexOf('titanium_mobile/apidoc') !== -1) { + if (file.indexOf('titanium-sdk/apidoc') !== -1) { const startIndex = file.indexOf('apidoc/'); const path = file.substr(startIndex); rv = basePath + path; - } else if (file.indexOf('titanium_modules') !== -1 || file.indexOf('appc_modules') !== -1) { + } else { // URL template with placeholders for module name and path. - const urlTemplate = 'https://github.com/appcelerator-modules/%MODULE_NAME%/edit/master/%MODULE_PATH%'; - const re = /titanium_modules|appc_modules\/(.+)\/apidoc/; + const urlTemplate = 'https://github.com/tidev/%MODULE_NAME%/edit/master/%MODULE_PATH%'; + const re = /tidev\/(.+)\/apidoc/; const match = file.match(re); let modulename; if (match) { @@ -358,15 +358,6 @@ function exportEditUrl(api) { rv = urlTemplate.replace(/%\w+%/g, function (all) { return urlReplacements[all] || all; }); - } else if (file.indexOf('titanium_mobile_tizen/modules/tizen/apidoc') !== -1) { - const index = file.indexOf('modules/tizen/apidoc/'); - basePath = 'https://github.com/appcelerator/titanium_mobile_tizen/edit/master/'; - if (index !== -1) { - rv = basePath + file.substr(index); - } else { - common.log(common.LOG_WARN, 'Error creating edit URL for:', file, '. Couldn\'t find apidoc/ folder.'); - return rv; - } } return rv; diff --git a/packages/titanium-docgen/generators/typescript_generator.js b/packages/titanium-docgen/generators/typescript_generator.js index bdd85e80..1d4234b8 100644 --- a/packages/titanium-docgen/generators/typescript_generator.js +++ b/packages/titanium-docgen/generators/typescript_generator.js @@ -21,7 +21,13 @@ const skipApis = [ // List of modules that need to be generated as an interface instead of a namespace. const forcedInterfaces = [ 'Titanium.Android.R', - 'Titanium.App.iOS.UserDefaults' + 'Titanium.App.iOS.UserDefaults', + 'Titanium.Media.Item', + 'Titanium.Calendar.Attendee', + 'Titanium.Calendar.Reminder', + 'Titanium.Calendar.RecurrenceRule', + 'Titanium.Platform.DisplayCaps', + 'Titanium.XML.DocumentType' ]; const eventsMethods = [ @@ -169,7 +175,9 @@ class DocsParser { // skip bundled documentation for modules and Node.js shims return; } - const namespaceParts = typeInfo.name.split('.'); + // Handle generic types by extracting the base type name before the first '<' + const typeName = typeInfo.name.split('<')[0]; + const namespaceParts = typeName.split('.'); namespaceParts.pop(); if (skipApis.includes(typeInfo.name)) { return; @@ -357,7 +365,6 @@ class GlobalTemplateWriter { this.output += '// Project: https://github.com/appcelerator/titanium_mobile\n'; this.output += '// Definitions by: Axway Appcelerator \n'; this.output += '// Jan Vennemann \n'; - this.output += '// Sergey Volkov \n'; this.output += '// Mathias Lorenzen \n'; this.output += '// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\n'; this.output += '// TypeScript Version: 3.0\n'; @@ -617,7 +624,17 @@ class GlobalTemplateWriter { if (Array.isArray(docType)) { const normalizedTypes = docType.map(typeName => this.normalizeType(typeName)); - return normalizedTypes.includes('any') ? 'any' : normalizedTypes.join(' | '); + if (normalizedTypes.includes('any')) { + return 'any'; + } + // Parenthesize function types in unions to avoid TypeScript syntax errors + const parenthesizedTypes = normalizedTypes.map(type => { + if (type.includes(') => ')) { + return `(${type})`; + } + return type; + }); + return parenthesizedTypes.join(' | '); } const lessThanIndex = docType.indexOf('<'); @@ -644,6 +661,9 @@ class GlobalTemplateWriter { } } else if (baseType === 'Dictionary') { return `Dictionary<${subType}>`; + } else if (baseType === 'Promise') { + // Use standard Promise generic syntax + return `Promise<${subTypes.join(', ')}>`; } } diff --git a/packages/titanium-docgen/package.json b/packages/titanium-docgen/package.json index 321be2c9..3235f97f 100644 --- a/packages/titanium-docgen/package.json +++ b/packages/titanium-docgen/package.json @@ -1,6 +1,6 @@ { "name": "titanium-docgen", - "version": "4.10.3", + "version": "4.10.4", "description": "Generates Titanium API documentation in different formats", "main": "index.js", "scripts": { diff --git a/packages/titanium-docgen/validate.js b/packages/titanium-docgen/validate.js index 3c4c17ba..f879773f 100644 --- a/packages/titanium-docgen/validate.js +++ b/packages/titanium-docgen/validate.js @@ -434,8 +434,12 @@ function validateDataType(type, fullTypeContext) { // Should it have been written as a complex type? if (common.COMPLEX_TYPES.has(type)) { const argCount = common.COMPLEX_TYPES.get(type); // may be 0 if Function/Callback - // Enforce as ERROR if Promise/Set/Map doesn't have exact generic type count - const severity = [ 'Map', 'Set', 'Promise' ].includes(type) ? ERROR : WARNING; + // Skip validation for Promise to allow Promise without generics (Promise not supported by build system) + if (type === 'Promise') { + return errors; + } + // Enforce as ERROR if Set/Map doesn't have exact generic type count + const severity = [ 'Map', 'Set' ].includes(type) ? ERROR : WARNING; errors.push(new Problem(`${type} ${severity === ERROR ? 'must' : 'should'} have ${argCount || 'any number of'} generic type(s) specified, but had 0: ${fullTypeContext || type}`, severity)); } else if (type === 'Object') { // Warn about generic Object types (Dictionary is handled above as a complex type) diff --git a/packages/vuepress/vuepress-plugin-apidocs/components/ConstantList.vue b/packages/vuepress/vuepress-plugin-apidocs/components/ConstantList.vue index 7d38dcab..446864e9 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/components/ConstantList.vue +++ b/packages/vuepress/vuepress-plugin-apidocs/components/ConstantList.vue @@ -5,8 +5,8 @@
-
-

+
+

# {{constant.name}}

diff --git a/packages/vuepress/vuepress-plugin-apidocs/components/EventList.vue b/packages/vuepress/vuepress-plugin-apidocs/components/EventList.vue index e5aee6f0..ea316654 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/components/EventList.vue +++ b/packages/vuepress/vuepress-plugin-apidocs/components/EventList.vue @@ -5,8 +5,8 @@

-
-

+
+

# {{event.name}}

diff --git a/packages/vuepress/vuepress-plugin-apidocs/components/MethodList.vue b/packages/vuepress/vuepress-plugin-apidocs/components/MethodList.vue index ab181acc..825cd90a 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/components/MethodList.vue +++ b/packages/vuepress/vuepress-plugin-apidocs/components/MethodList.vue @@ -5,8 +5,8 @@

-
-

+
+

# {{method.name}}

diff --git a/packages/vuepress/vuepress-plugin-apidocs/components/PropertyList.vue b/packages/vuepress/vuepress-plugin-apidocs/components/PropertyList.vue index 30e050d8..910b6574 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/components/PropertyList.vue +++ b/packages/vuepress/vuepress-plugin-apidocs/components/PropertyList.vue @@ -5,8 +5,8 @@

-
-

+
+

# {{property.name}}

diff --git a/packages/vuepress/vuepress-plugin-apidocs/lib/metadata/processor.js b/packages/vuepress/vuepress-plugin-apidocs/lib/metadata/processor.js index 0da21a16..af69f61b 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/lib/metadata/processor.js +++ b/packages/vuepress/vuepress-plugin-apidocs/lib/metadata/processor.js @@ -58,9 +58,9 @@ class MetadataProcessor { filterInheritedMembers (metadata) { const filterInherited = member => { - if (member.inherits && member.inherits !== metadata.name) { - return false - } + // if (member.inherits && member.inherits !== metadata.name) { + // return false + // } return true } @@ -108,7 +108,7 @@ class MetadataProcessor { headers.push({ level: 3, title: memberMetadata.name, - slug: memberMetadata.name.toLowerCase() + slug: memberType + "_" + memberMetadata.name.toLowerCase() }) }) if (headers.length) { @@ -117,9 +117,7 @@ class MetadataProcessor { title: memberType.charAt(0).toUpperCase() + memberType.slice(1), slug: memberType }) - if (memberType !== 'constants') { - this.additionalHeaders = this.additionalHeaders.concat(headers) - } + this.additionalHeaders = this.additionalHeaders.concat(headers) } } diff --git a/packages/vuepress/vuepress-plugin-apidocs/package.json b/packages/vuepress/vuepress-plugin-apidocs/package.json index 6db25dab..aaf8b227 100644 --- a/packages/vuepress/vuepress-plugin-apidocs/package.json +++ b/packages/vuepress/vuepress-plugin-apidocs/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-plugin-apidocs", - "version": "4.11.0", + "version": "4.11.2", "description": "Plugin for VuePress to render API reference documentation", "main": "index.js", "scripts": { diff --git a/packages/vuepress/vuepress-theme-titanium/index.js b/packages/vuepress/vuepress-theme-titanium/index.js index 4000e6b4..7f5e0652 100644 --- a/packages/vuepress/vuepress-theme-titanium/index.js +++ b/packages/vuepress/vuepress-theme-titanium/index.js @@ -18,7 +18,7 @@ module.exports = (options, ctx) => ({ } }, plugins: [ - ['@vuepress/search', { searchMaxSuggestions: 10 }], + ['@vuepress/search', { searchMaxSuggestions: 30 }], '@vuepress/nprogress', ['container', { type: 'tip' }], ['container', { type: 'warning' }], diff --git a/packages/vuepress/vuepress-theme-titanium/package.json b/packages/vuepress/vuepress-theme-titanium/package.json index f4427881..f0e94ab4 100644 --- a/packages/vuepress/vuepress-theme-titanium/package.json +++ b/packages/vuepress/vuepress-theme-titanium/package.json @@ -1,12 +1,12 @@ { "name": "vuepress-theme-titanium", - "version": "4.11.0", + "version": "4.11.2", "description": "VuePress theme for Titanium projects", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "Axway Appcelerator", + "author": "TiDev, Inc. ", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/vuepress/vuepress-theme-titanium/plugins/smoothScroll/enhanceApp.js b/packages/vuepress/vuepress-theme-titanium/plugins/smoothScroll/enhanceApp.js index daa502d7..117be37d 100644 --- a/packages/vuepress/vuepress-theme-titanium/plugins/smoothScroll/enhanceApp.js +++ b/packages/vuepress/vuepress-theme-titanium/plugins/smoothScroll/enhanceApp.js @@ -35,9 +35,11 @@ module.exports = ({ Vue, options, router }) => { }) } window.onload = () => { - const element = document.getElementById(location.hash.slice(1)) - if (element) { - element.scrollIntoView() + if (location.hash.slice(1) != "") { + const element = document.getElementById(location.hash.slice(1)) + if (element) { + element.scrollIntoView() + } } } } else { @@ -49,16 +51,20 @@ module.exports = ({ Vue, options, router }) => { if (location.hash) { setTimeout(function() { - const element = document.getElementById(location.hash.slice(1)) - if (element) { - element.scrollIntoView() + if (location.hash.slice(1) != "") { + const element = document.getElementById(location.hash.slice(1)) + if (element) { + element.scrollIntoView() + } } }, 250); } window.onload = () => { - const element = document.getElementById(location.hash.slice(1)) - if (element) { - element.scrollIntoView() + if (location.hash.slice(1) != "") { + const element = document.getElementById(location.hash.slice(1)) + if (element) { + element.scrollIntoView() + } } } } diff --git a/packages/vuepress/vuepress-theme-titanium/styles/theme.styl b/packages/vuepress/vuepress-theme-titanium/styles/theme.styl index 3a0ed4cb..2c86c8d1 100644 --- a/packages/vuepress/vuepress-theme-titanium/styles/theme.styl +++ b/packages/vuepress/vuepress-theme-titanium/styles/theme.styl @@ -48,7 +48,10 @@ body background-color $white box-sizing border-box border-bottom 1px solid $borderColor - + .suggestions + max-height 400px + overflow-y auto + .sidebar-mask position fixed z-index 9