From a82843f1ff183081ed6df44bece03ca62efc3e6a Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Mon, 13 May 2024 22:48:50 +0100 Subject: [PATCH] Refactor on theming doc section --- api-generator/build-apidoc.js | 78 ++++++++- components/doc/DocApiTable.vue | 2 +- components/doc/DocSections.vue | 2 +- .../doc/helpers/{PTHelper.js => index.js} | 41 ++++- .../lib/inputtext/style/InputTextStyle.d.ts | 3 + components/lib/themes/aura/index.d.ts | 89 ++++++++++ .../lib/themes/aura/inputtext/index.d.ts | 164 ++++++++++++++++++ .../lib/themes/lara/inputtext/index.d.ts | 56 ++++++ .../lib/themes/nora/inputtext/index.d.ts | 44 +++++ doc/accordion/pt/index.vue | 12 +- doc/autocomplete/pt/index.vue | 4 +- doc/avatar/pt/index.vue | 6 +- doc/badge/pt/index.vue | 4 +- doc/blockui/pt/index.vue | 4 +- doc/breadcrumb/pt/index.vue | 4 +- doc/button/pt/index.vue | 4 +- doc/card/pt/index.vue | 4 +- doc/carousel/pt/index.vue | 4 +- doc/cascadeselect/pt/index.vue | 4 +- doc/chart/pt/index.vue | 4 +- doc/checkbox/pt/index.vue | 4 +- doc/chip/pt/index.vue | 4 +- doc/colorpicker/pt/index.vue | 4 +- doc/common/apidoc/index.json | 158 ++++++++++++++++- doc/confirmdialog/pt/index.vue | 4 +- doc/confirmpopup/pt/index.vue | 4 +- doc/contextmenu/pt/index.vue | 4 +- doc/datatable/pt/index.vue | 10 +- doc/dataview/pt/index.vue | 4 +- doc/datepicker/pt/index.vue | 4 +- doc/deferredcontent/pt/index.vue | 4 +- doc/dialog/pt/index.vue | 4 +- doc/divider/pt/index.vue | 4 +- doc/dock/pt/index.vue | 4 +- doc/drawer/pt/index.vue | 4 +- doc/dynamicdialog/pt/index.vue | 4 +- doc/editor/pt/index.vue | 4 +- doc/fieldset/pt/index.vue | 4 +- doc/fileupload/pt/index.vue | 4 +- doc/floatlabel/pt/index.vue | 4 +- doc/galleria/pt/index.vue | 4 +- doc/iconfield/pt/index.vue | 6 +- doc/iconfield/theming/pt/index.vue | 4 +- doc/image/pt/index.vue | 4 +- doc/inlinemessage/pt/index.vue | 4 +- doc/inplace/pt/index.vue | 4 +- doc/inputchips/pt/index.vue | 4 +- doc/inputgroup/pt/index.vue | 6 +- doc/inputmask/pt/index.vue | 4 +- doc/inputnumber/pt/index.vue | 4 +- doc/inputotp/pt/index.vue | 4 +- doc/inputtext/pt/index.vue | 4 +- doc/inputtext/theming/index.vue | 22 ++- doc/knob/pt/index.vue | 4 +- doc/listbox/pt/index.vue | 4 +- doc/megamenu/pt/index.vue | 4 +- doc/menu/pt/index.vue | 4 +- doc/menubar/pt/index.vue | 4 +- doc/message/pt/index.vue | 4 +- doc/metergroup/pt/index.vue | 4 +- doc/multiselect/pt/index.vue | 4 +- doc/orderlist/pt/index.vue | 4 +- doc/organizationchart/pt/index.vue | 4 +- doc/paginator/pt/index.vue | 4 +- doc/panel/pt/index.vue | 4 +- doc/panelmenu/pt/index.vue | 4 +- doc/password/pt/index.vue | 4 +- doc/picklist/pt/index.vue | 4 +- doc/popover/pt/index.vue | 4 +- doc/progressbar/pt/index.vue | 4 +- doc/progressspinner/pt/index.vue | 4 +- doc/radiobutton/pt/index.vue | 4 +- doc/rating/pt/index.vue | 4 +- doc/ripple/pt/index.vue | 4 +- doc/scrollpanel/pt/index.vue | 4 +- doc/scrolltop/pt/index.vue | 4 +- doc/select/pt/index.vue | 4 +- doc/selectbutton/pt/index.vue | 4 +- doc/skeleton/pt/index.vue | 4 +- doc/slider/pt/index.vue | 4 +- doc/speeddial/pt/index.vue | 4 +- doc/splitbutton/pt/index.vue | 4 +- doc/splitter/pt/index.vue | 6 +- doc/stepper/pt/index.vue | 6 +- doc/steps/pt/index.vue | 4 +- doc/tabmenu/pt/index.vue | 4 +- doc/tabs/pt/index.vue | 12 +- doc/tag/pt/index.vue | 4 +- doc/terminal/pt/index.vue | 4 +- doc/textarea/pt/index.vue | 4 +- doc/tieredmenu/pt/index.vue | 4 +- doc/timeline/pt/index.vue | 4 +- doc/toast/pt/index.vue | 4 +- doc/togglebutton/pt/index.vue | 4 +- doc/toggleswitch/pt/index.vue | 4 +- doc/toolbar/pt/index.vue | 4 +- doc/tooltip/pt/index.vue | 4 +- doc/tree/pt/index.vue | 4 +- doc/treeselect/pt/index.vue | 4 +- doc/treetable/pt/index.vue | 6 +- doc/virtualscroller/pt/index.vue | 4 +- layouts/AppConfigurator.vue | 14 +- plugins/app-state.js | 2 +- 103 files changed, 856 insertions(+), 213 deletions(-) rename components/doc/helpers/{PTHelper.js => index.js} (59%) diff --git a/api-generator/build-apidoc.js b/api-generator/build-apidoc.js index b11bd771a..2280246cd 100644 --- a/api-generator/build-apidoc.js +++ b/api-generator/build-apidoc.js @@ -12,7 +12,8 @@ const staticMessages = { functions: 'Defines the custom functions used by the module.', events: "Defines the custom events used by the component's emit.", interfaces: 'Defines the custom interfaces used by the module.', - types: 'Defines the custom types used by the module.' + types: 'Defines the custom types used by the module.', + tokens: 'Define design tokens used by the component.' }; const app = new TypeDoc.Application(); @@ -555,6 +556,81 @@ if (project) { }; }); + const module_namespaces_group = module.groups?.find((g) => g.title === 'Namespaces'); + + module_namespaces_group && + module_namespaces_group.children.forEach((pevent) => { + const module_interfaces_group = pevent?.groups?.find((g) => g.title === 'Interfaces'); + + module_interfaces_group && + module_interfaces_group.children.forEach((event) => { + const event_props_description = event.comment && event.comment.summary.map((s) => s.text || '').join(' '); + let component_prop = ''; + + if (event.comment && event.comment.getTag('@see')) { + const tag = event.comment.getTag('@see'); + const content = tag.content[0]; + + if (content.text.includes("['")) { + component_prop = `${content.target.name}${content.text}`; + } else { + component_prop = `${content.text === content.target?.name ? content.target.parent.name : content.target?.name}.${content.text}`; + } + } + + !doc[name]['tokens'] && + (doc[name]['tokens'] = { + description: staticMessages['tokens'], + values: {} + }); + + const props = []; + + const setProps = (_declaration, _name) => { + if (_declaration?.groups) { + const event_props_group = _declaration.groups.find((g) => g.title === 'Properties'); + + event_props_group && + event_props_group.children.forEach((prop) => { + if (prop.type?.declaration) { + setProps(prop.type?.declaration, prop.name); + } else if (prop.comment?.getTag('@designToken')) { + props.push({ + name: _name ? `${_name}.${prop.name}` : prop.name, + token: prop.comment.getTag('@designToken').content[0]?.text || '', + optional: prop.flags.isOptional, + readonly: prop.flags.isReadonly, + type: prop.type.toString(), + default: prop.comment && prop.comment.getTag('@defaultValue') ? prop.comment.getTag('@defaultValue').content[0]?.text || '' : '', // TODO: Check + description: + prop.comment && + prop.comment.summary + .map((s) => { + if (s.text.indexOf('[here]') > -1) { + return `${s.text.slice(0, s.text.indexOf('[here]'))} here ${s.text.slice( + s.text.indexOf(')') + 1 + )}`; + } + + return s.text || ''; + }) + .join(' '), + deprecated: prop.comment && prop.comment.getTag('@deprecated') ? parseText(prop.comment.getTag('@deprecated').content[0]?.text) : undefined + }); + } + }); + } + }; + + setProps(event); + + doc[name]['tokens'].values[event.name] = { + description: event_props_description, + props + }; + }); + }); + // app.generateJson(module, `./api-generator/module-typedoc.json`); }); diff --git a/components/doc/DocApiTable.vue b/components/doc/DocApiTable.vue index da7e65cde..03d757e2c 100644 --- a/components/doc/DocApiTable.vue +++ b/components/doc/DocApiTable.vue @@ -1,6 +1,6 @@