CN-121979565-A - Theme configuration method, device and equipment
Abstract
The embodiment of the specification discloses a theme configuration method, a theme configuration device and theme configuration equipment. The scheme includes defining rendering rule configuration based on a theme configuration layer to obtain a rendering rule list, collecting design data corresponding to the current theme configuration, performing rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set, and generating a corresponding semantic structure entity for executing theme rendering according to the semantic structure result set.
Inventors
- JIANG JILIN
Assignees
- 支付宝(杭州)数字服务技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260128
Claims (20)
- 1. A theme configuration method, comprising: defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; collecting design data corresponding to the current theme configuration; Performing rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And generating a corresponding semantic structure entity according to the semantic structure result set, wherein the semantic structure entity is used for executing theme rendering.
- 2. The method of claim 1, defining a rendering rule configuration based on a theme configuration layer to obtain a rendering rule list, specifically comprising: Defining attribute rendering rule configuration corresponding to a single component and global rendering rule configuration corresponding to a plurality of components based on a theme configuration layer; and aggregating the global rendering rule configuration and the attribute rendering rule configuration to obtain a rendering rule list.
- 3. The method of claim 2, wherein the global rendering rule configuration and the attribute rendering rule configuration are aggregated to obtain a rendering rule list, and specifically comprises: Performing standardized processing on the global rendering rule configuration and the attribute rendering rule configuration, and performing grouping processing according to configuration types to obtain a plurality of configuration groups; for each configuration packet, performing conflict processing according to the corresponding configuration priority; And performing format conversion processing and sequencing processing according to the rest rendering rule configuration in each configuration group to obtain a rendering rule list.
- 4. The method of claim 1, wherein the step of collecting design data corresponding to the current theme configuration specifically comprises: each corresponding component is configured aiming at the current theme, and the received external attribute and the internal state of the corresponding component are determined; and aggregating the external attribute and the internal state to obtain the design data corresponding to the current theme configuration.
- 5. The method of claim 4, wherein aggregating the external attribute and the internal state to obtain the design data corresponding to the current theme configuration specifically includes: carrying out standardization processing on the external attribute and the internal state; determining a first dependency relationship between the external attribute and the internal state based on the business rule corresponding to the current theme configuration; According to the first dependency relationship, data cleaning is carried out on the external attribute and the internal state through data type verification and business rule verification; And performing format conversion processing and sequencing processing on the external attribute and the internal state to obtain corresponding design data.
- 6. The method of claim 1, performing a rendering logic calculation on the design data based on rendering rules contained in the rendering rule list, and generating a corresponding set of semantic structure results, specifically comprising: Traversing the rendering rules contained in the rendering rule list, and aiming at a single rendering rule, performing rendering logic calculation according to the corresponding design data of the single rendering rule to obtain a corresponding style rule segment; Combining style rule fragments corresponding to each rendering rule to obtain a style rule set; Based on a predefined semantical structure, a corresponding semantical structure result set is generated according to the style rule set.
- 7. The method of claim 6, wherein the combining the style rule fragments corresponding to each rendering rule to obtain the style rule set specifically comprises: grouping according to the scope identifications included in the style rule fragments corresponding to the rendering rules to obtain a plurality of rule fragment groupings; Combining style rule fragments contained in a single rule fragment group and performing conflict processing; determining a hierarchical relation corresponding to each rule fragment group through a scope identifier corresponding to each rule fragment group, and carrying out inheritance processing on style attributes corresponding to the style rule fragments according to the hierarchical relation; And combining the style rule fragments according to the hierarchical relationship to obtain a style rule set.
- 8. The method of claim 6, the method further comprising: Extracting a second dependency relationship among the rendering rules aiming at the rendering rules, and generating a dependency relationship matrix; Obtaining nodes according to the rendering rules, generating directed edges according to the dependency relation matrix, and constructing a directed computation graph; and determining the design data to update, determining a specified style rule segment to be updated according to the directed calculation graph, and executing an updating action.
- 9. The method of claim 8, obtaining nodes according to the rendering rule, generating directed edges according to the dependency matrix, and constructing a directed computation graph, comprising: generating nodes according to the rendering rules, classifying the nodes and defining corresponding node attributes; Generating directed edges among all nodes according to the dependency relation matrix, and constructing an initial calculation graph; performing circular dependency detection on the initial calculation graph, and executing a corresponding circular dependency processing strategy according to a detection result to obtain an intermediate calculation graph; Aiming at the intermediate calculation graph, distributing priorities according to the node attributes, and defining corresponding execution conditions for each node based on the priorities to obtain a directed calculation graph; and identifying the mutually independent subareas aiming at the directed calculation graph, and carrying out parallel reconstruction on the directed calculation graph according to the subarea calculation graph corresponding to each subarea.
- 10. The method according to claim 8, wherein determining a specified style rule segment to be updated according to the directed computation graph, and performing an update action, comprises: if the updating degree of the design data is higher than the preset degree, determining a characteristic distance value between the updated current design data and a plurality of preset standard design data through characteristic extraction and cluster analysis; Selecting the standard design data with the lowest characteristic distance value as the standard design data of the current design data; And determining a style rule segment to be updated of the current design data relative to the reference design data according to the directed calculation graph, and executing an updating action based on a semantic structure result set of the reference design data.
- 11. A theme configuration apparatus comprising: the rule configuration definition module is used for defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; the design data acquisition module acquires design data corresponding to the current theme configuration; the rendering calculation module performs rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And the theme rendering module generates a corresponding semantic structure entity according to the semantic structure result set and is used for executing theme rendering.
- 12. The apparatus of claim 11, the rule configuration definition module to define, based on a theme configuration layer, an attribute rendering rule configuration corresponding to a single component, and a global rendering rule configuration corresponding to a plurality of components; and aggregating the global rendering rule configuration and the attribute rendering rule configuration to obtain a rendering rule list.
- 13. The apparatus of claim 12, wherein the rule configuration definition module performs standardization processing on the global rendering rule configuration and the attribute rendering rule configuration, and performs grouping processing according to a configuration type to obtain a plurality of configuration groups; for each configuration packet, performing conflict processing according to the corresponding configuration priority; And performing format conversion processing and sequencing processing according to the rest rendering rule configuration in each configuration group to obtain a rendering rule list.
- 14. The apparatus of claim 11, wherein the design data collection module is configured to determine, for each component corresponding to the current theme, its received external properties, and its own internal state; and aggregating the external attribute and the internal state to obtain the design data corresponding to the current theme configuration.
- 15. The apparatus of claim 14, the design data collection module to normalize the external attribute, the internal state; determining a first dependency relationship between the external attribute and the internal state based on the business rule corresponding to the current theme configuration; According to the first dependency relationship, data cleaning is carried out on the external attribute and the internal state through data type verification and business rule verification; And performing format conversion processing and sequencing processing on the external attribute and the internal state to obtain corresponding design data.
- 16. The apparatus of claim 11, the rendering calculation module traversing rendering rules contained in the rendering rule list, performing rendering logic calculation for a single rendering rule according to its corresponding design data, resulting in a corresponding style rule segment; Combining style rule fragments corresponding to each rendering rule to obtain a style rule set; Based on a predefined semantical structure, a corresponding semantical structure result set is generated according to the style rule set.
- 17. The apparatus of claim 16, wherein the rendering calculation module performs grouping processing according to scope identifiers included in style rule fragments corresponding to rendering rules to obtain a plurality of rule fragment groupings; Combining style rule fragments contained in a single rule fragment group and performing conflict processing; determining a hierarchical relation corresponding to each rule fragment group through a scope identifier corresponding to each rule fragment group, and carrying out inheritance processing on style attributes corresponding to the style rule fragments according to the hierarchical relation; And combining the style rule fragments according to the hierarchical relationship to obtain a style rule set.
- 18. The apparatus of claim 16, the apparatus method further comprising a design data update module; The design data updating module extracts a second dependency relationship among the rendering rules aiming at the rendering rules and generates a dependency relationship matrix; Obtaining nodes according to the rendering rules, generating directed edges according to the dependency relation matrix, and constructing a directed computation graph; and determining the design data to update, determining a specified style rule segment to be updated according to the directed calculation graph, and executing an updating action.
- 19. The apparatus of claim 18, the design data update module to generate nodes according to the rendering rules, to classify the nodes and to define their corresponding node attributes; Generating directed edges among all nodes according to the dependency relation matrix, and constructing an initial calculation graph; performing circular dependency detection on the initial calculation graph, and executing a corresponding circular dependency processing strategy according to a detection result to obtain an intermediate calculation graph; Aiming at the intermediate calculation graph, distributing priorities according to the node attributes, and defining corresponding execution conditions for each node based on the priorities to obtain a directed calculation graph; and identifying the mutually independent subareas aiming at the directed calculation graph, and carrying out parallel reconstruction on the directed calculation graph according to the subarea calculation graph corresponding to each subarea.
- 20. The apparatus of claim 18, wherein the design data updating module determines a feature distance value between the updated current design data and a plurality of preset standard design data through feature extraction and cluster analysis if the update degree of the design data is higher than a preset degree; Selecting the standard design data with the lowest characteristic distance value as the standard design data of the current design data; And determining a style rule segment to be updated of the current design data relative to the reference design data according to the directed calculation graph, and executing an updating action based on a semantic structure result set of the reference design data.
Description
Theme configuration method, device and equipment Technical Field The present disclosure relates to the field of internet technologies, and in particular, to a method, an apparatus, and a device for configuring a theme. Background In modern front-end development, theme configuration is an important link to achieve interface consistency and customizable in order to accommodate diverse business scenarios and brand requirements. In conventional schemes, a set of predefined Design tokens (Design tokens) is provided that allow a developer to quickly configure the overall visual style of an application by adjusting basic variables such as color, font, spacing, etc. In the practical application of the scheme, a developer sets basic parameters of the theme by modifying the value of the design token according to the requirement of the service party, so as to match the requirement of the service party. For business design specifications that contain more details or specific style requirements, if predefined design tokens are difficult to provide corresponding variable support, a developer typically needs to go directly into the implementation code of a particular component to meet these customization requirements by manually adding or overriding style rules. Based on this, in a multi-person collaborative development project, different developers may be responsible for different functional modules or pages. Custom style code is typically written independently in the respective responsible component parts when each encounters similar component style gaps. Based on this, a more versatile and stable solution is needed for theme configuration. Disclosure of Invention One or more embodiments of the present specification provide a theme configuration method, apparatus, device, and storage medium to solve the technical problem that a more general and stable scheme is required for theme configuration. To solve the above technical problems, one or more embodiments of the present specification are implemented as follows: one or more embodiments of the present specification provide a theme configuration method, including: defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; collecting design data corresponding to the current theme configuration; Performing rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And generating a corresponding semantic structure entity according to the semantic structure result set, wherein the semantic structure entity is used for executing theme rendering. One or more embodiments of the present specification provide a theme configuration apparatus including: the rule configuration definition module is used for defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; the design data acquisition module acquires design data corresponding to the current theme configuration; the rendering calculation module performs rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And the theme rendering module generates a corresponding semantic structure entity according to the semantic structure result set and is used for executing theme rendering. One or more embodiments of the present specification provide a theme configuration apparatus including: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor, the instructions are executable by the at least one processor to enable the at least one processor to: defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; collecting design data corresponding to the current theme configuration; Performing rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And generating a corresponding semantic structure entity according to the semantic structure result set, wherein the semantic structure entity is used for executing theme rendering. One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer-executable instructions configured to: defining rendering rule configuration based on the theme configuration layer to obtain a rendering rule list; collecting design data corresponding to the current theme configuration; Performing rendering logic calculation on the design data based on rendering rules contained in the rendering rule list to generate a corresponding semantic structure result set; And generating a corresponding semantic structure entity according to the semantic structure result set, wherein the sem