heraspec 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +188 -103
  3. package/bin/heraspec.js +4805 -1122
  4. package/bin/heraspec.js.map +4 -4
  5. package/dist/core/templates/skills/CHANGELOG.md +117 -117
  6. package/dist/core/templates/skills/README-template.md +58 -58
  7. package/dist/core/templates/skills/README.md +38 -38
  8. package/dist/core/templates/skills/content-optimization-skill.md +104 -104
  9. package/dist/core/templates/skills/data/design-systems.csv +54 -0
  10. package/dist/core/templates/skills/data/pages-proposed.csv +21 -21
  11. package/dist/core/templates/skills/data/pages.csv +9 -9
  12. package/dist/core/templates/skills/data/typography.csv +57 -57
  13. package/dist/core/templates/skills/deploy-documentation-skill.md +408 -0
  14. package/dist/core/templates/skills/design-system-skill.md +176 -0
  15. package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +63 -63
  16. package/dist/core/templates/skills/documents/templates/documentation.html +49 -49
  17. package/dist/core/templates/skills/documents/templates/landing-script.js +38 -38
  18. package/dist/core/templates/skills/documents/templates/landing-style.css +158 -158
  19. package/dist/core/templates/skills/documents/templates/script.js +56 -56
  20. package/dist/core/templates/skills/documents/templates/style.css +155 -155
  21. package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -16
  22. package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -16
  23. package/dist/core/templates/skills/documents-skill.md +104 -104
  24. package/dist/core/templates/skills/e2e-test-skill.md +119 -119
  25. package/dist/core/templates/skills/git-embed-skill.md +57 -0
  26. package/dist/core/templates/skills/integration-test-skill.md +118 -118
  27. package/dist/core/templates/skills/knowledge/README.md +63 -0
  28. package/dist/core/templates/skills/knowledge/design-systems/airbnb/DESIGN.md +246 -0
  29. package/dist/core/templates/skills/knowledge/design-systems/airtable/DESIGN.md +89 -0
  30. package/dist/core/templates/skills/knowledge/design-systems/apple/DESIGN.md +313 -0
  31. package/dist/core/templates/skills/knowledge/design-systems/bmw/DESIGN.md +180 -0
  32. package/dist/core/templates/skills/knowledge/design-systems/cal/DESIGN.md +259 -0
  33. package/dist/core/templates/skills/knowledge/design-systems/claude/DESIGN.md +312 -0
  34. package/dist/core/templates/skills/knowledge/design-systems/clay/DESIGN.md +304 -0
  35. package/dist/core/templates/skills/knowledge/design-systems/clickhouse/DESIGN.md +281 -0
  36. package/dist/core/templates/skills/knowledge/design-systems/cohere/DESIGN.md +266 -0
  37. package/dist/core/templates/skills/knowledge/design-systems/coinbase/DESIGN.md +129 -0
  38. package/dist/core/templates/skills/knowledge/design-systems/composio/DESIGN.md +307 -0
  39. package/dist/core/templates/skills/knowledge/design-systems/cursor/DESIGN.md +309 -0
  40. package/dist/core/templates/skills/knowledge/design-systems/elevenlabs/DESIGN.md +265 -0
  41. package/dist/core/templates/skills/knowledge/design-systems/expo/DESIGN.md +281 -0
  42. package/dist/core/templates/skills/knowledge/design-systems/figma/DESIGN.md +220 -0
  43. package/dist/core/templates/skills/knowledge/design-systems/framer/DESIGN.md +246 -0
  44. package/dist/core/templates/skills/knowledge/design-systems/hashicorp/DESIGN.md +278 -0
  45. package/dist/core/templates/skills/knowledge/design-systems/ibm/DESIGN.md +332 -0
  46. package/dist/core/templates/skills/knowledge/design-systems/index.json +72 -0
  47. package/dist/core/templates/skills/knowledge/design-systems/intercom/DESIGN.md +146 -0
  48. package/dist/core/templates/skills/knowledge/design-systems/kraken/DESIGN.md +125 -0
  49. package/dist/core/templates/skills/knowledge/design-systems/linear.app/DESIGN.md +367 -0
  50. package/dist/core/templates/skills/knowledge/design-systems/lovable/DESIGN.md +298 -0
  51. package/dist/core/templates/skills/knowledge/design-systems/minimax/DESIGN.md +257 -0
  52. package/dist/core/templates/skills/knowledge/design-systems/mintlify/DESIGN.md +326 -0
  53. package/dist/core/templates/skills/knowledge/design-systems/miro/DESIGN.md +108 -0
  54. package/dist/core/templates/skills/knowledge/design-systems/mistral.ai/DESIGN.md +261 -0
  55. package/dist/core/templates/skills/knowledge/design-systems/mongodb/DESIGN.md +266 -0
  56. package/dist/core/templates/skills/knowledge/design-systems/notion/DESIGN.md +309 -0
  57. package/dist/core/templates/skills/knowledge/design-systems/nvidia/DESIGN.md +293 -0
  58. package/dist/core/templates/skills/knowledge/design-systems/ollama/DESIGN.md +267 -0
  59. package/dist/core/templates/skills/knowledge/design-systems/opencode.ai/DESIGN.md +281 -0
  60. package/dist/core/templates/skills/knowledge/design-systems/pinterest/DESIGN.md +230 -0
  61. package/dist/core/templates/skills/knowledge/design-systems/posthog/DESIGN.md +256 -0
  62. package/dist/core/templates/skills/knowledge/design-systems/raycast/DESIGN.md +268 -0
  63. package/dist/core/templates/skills/knowledge/design-systems/replicate/DESIGN.md +261 -0
  64. package/dist/core/templates/skills/knowledge/design-systems/resend/DESIGN.md +303 -0
  65. package/dist/core/templates/skills/knowledge/design-systems/revolut/DESIGN.md +185 -0
  66. package/dist/core/templates/skills/knowledge/design-systems/runwayml/DESIGN.md +244 -0
  67. package/dist/core/templates/skills/knowledge/design-systems/sanity/DESIGN.md +357 -0
  68. package/dist/core/templates/skills/knowledge/design-systems/sentry/DESIGN.md +262 -0
  69. package/dist/core/templates/skills/knowledge/design-systems/spacex/DESIGN.md +194 -0
  70. package/dist/core/templates/skills/knowledge/design-systems/spotify/DESIGN.md +246 -0
  71. package/dist/core/templates/skills/knowledge/design-systems/stripe/DESIGN.md +322 -0
  72. package/dist/core/templates/skills/knowledge/design-systems/supabase/DESIGN.md +255 -0
  73. package/dist/core/templates/skills/knowledge/design-systems/superhuman/DESIGN.md +252 -0
  74. package/dist/core/templates/skills/knowledge/design-systems/together.ai/DESIGN.md +263 -0
  75. package/dist/core/templates/skills/knowledge/design-systems/uber/DESIGN.md +295 -0
  76. package/dist/core/templates/skills/knowledge/design-systems/vercel/DESIGN.md +310 -0
  77. package/dist/core/templates/skills/knowledge/design-systems/voltagent/DESIGN.md +323 -0
  78. package/dist/core/templates/skills/knowledge/design-systems/warp/DESIGN.md +253 -0
  79. package/dist/core/templates/skills/knowledge/design-systems/webflow/DESIGN.md +92 -0
  80. package/dist/core/templates/skills/knowledge/design-systems/wise/DESIGN.md +173 -0
  81. package/dist/core/templates/skills/knowledge/design-systems/x.ai/DESIGN.md +257 -0
  82. package/dist/core/templates/skills/knowledge/design-systems/zapier/DESIGN.md +328 -0
  83. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/profile.json +27 -0
  84. package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/structure.md +137 -0
  85. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/profile.json +39 -0
  86. package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/structure.md +208 -0
  87. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/profile.json +51 -0
  88. package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/structure.md +369 -0
  89. package/dist/core/templates/skills/knowledge/index.json +65 -0
  90. package/dist/core/templates/skills/module-codebase-skill.md +110 -110
  91. package/dist/core/templates/skills/plugin-directory-skill.md +396 -396
  92. package/dist/core/templates/skills/project-memory-skill.md +222 -0
  93. package/dist/core/templates/skills/project-memory-skill.vi.md +223 -0
  94. package/dist/core/templates/skills/scripts/CODE_EXPLANATION.md +394 -394
  95. package/dist/core/templates/skills/scripts/SEARCH_ALGORITHMS_COMPARISON.md +421 -421
  96. package/dist/core/templates/skills/scripts/SEARCH_MODES_GUIDE.md +238 -238
  97. package/dist/core/templates/skills/scripts/__pycache__/core.cpython-311.pyc +0 -0
  98. package/dist/core/templates/skills/scripts/core.py +391 -385
  99. package/dist/core/templates/skills/scripts/search.py +1 -1
  100. package/dist/core/templates/skills/smart-explore-skill.md +141 -0
  101. package/dist/core/templates/skills/sourcecode-analyzer-skill.md +210 -0
  102. package/dist/core/templates/skills/sourcecode-analyzer-skill.vi.md +210 -0
  103. package/dist/core/templates/skills/suggestion-skill.md +118 -118
  104. package/dist/core/templates/skills/templates/accessibility-checklist.md +40 -40
  105. package/dist/core/templates/skills/templates/example-prompt-full-theme.md +333 -333
  106. package/dist/core/templates/skills/templates/page-types-guide.md +338 -338
  107. package/dist/core/templates/skills/templates/pages-proposed-summary.md +273 -273
  108. package/dist/core/templates/skills/templates/pre-delivery-checklist.md +42 -42
  109. package/dist/core/templates/skills/templates/prompt-template-full-theme.md +313 -313
  110. package/dist/core/templates/skills/templates/responsive-design.md +40 -40
  111. package/dist/core/templates/skills/ui-ux-skill.md +595 -584
  112. package/dist/core/templates/skills/unit-test-skill.md +111 -111
  113. package/dist/core/templates/skills/ux-element/templates/Controller.php +50 -50
  114. package/dist/core/templates/skills/ux-element/templates/Shortcode.php +23 -23
  115. package/dist/core/templates/skills/ux-element/templates/Template.html +20 -20
  116. package/dist/core/templates/skills/ux-element/templates/Thumbnail.svg +8 -8
  117. package/dist/core/templates/skills/ux-element/templates/View.php +21 -21
  118. package/dist/core/templates/skills/ux-element-skill.md +83 -83
  119. package/dist/core/templates/skills/wordpress-plugin-check-skill.md +151 -76
  120. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -47
  121. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -60
  122. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -22
  123. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -15
  124. package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -169
  125. package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -41
  126. package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -21
  127. package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +100 -100
  128. package/dist/index.js +4068 -278
  129. package/package.json +75 -72
@@ -1,111 +1,111 @@
1
- # Skill: Unit Testing (Cross-Cutting)
2
-
3
- ## Purpose
4
-
5
- This skill is used to create unit tests for code components. Unit tests verify that individual functions, methods, or classes work correctly in isolation.
6
-
7
- ## When to Use
8
-
9
- - When testing individual functions or methods
10
- - When testing class methods in isolation
11
- - When testing utility functions
12
- - When testing business logic
13
- - When testing data transformations
14
- - When ensuring code correctness before integration
15
-
16
- ## Step-by-Step Process
17
-
18
- ### Step 1: Identify Test Targets
19
- - Analyze the code to identify testable units
20
- - List all public methods/functions
21
- - Identify edge cases and boundary conditions
22
- - Determine expected inputs and outputs
23
-
24
- ### Step 2: Set Up Test Framework
25
- - Choose appropriate testing framework (Jest, PHPUnit, pytest, etc.)
26
- - Configure test environment
27
- - Set up test structure matching project conventions
28
- - Ensure test framework is installed and configured
29
-
30
- ### Step 3: Write Test Cases
31
- - Create test file matching source file structure
32
- - Write tests for each function/method
33
- - Test normal cases (happy path)
34
- - Test edge cases (null, empty, boundary values)
35
- - Test error cases (invalid input, exceptions)
36
- - Use descriptive test names
37
-
38
- ### Step 4: Run and Verify
39
- - Run tests to ensure they pass
40
- - Check test coverage if available
41
- - Refactor if needed
42
- - Ensure tests are fast and isolated
43
-
44
- ### Step 5: Document Test Cases
45
- - Add comments for complex test scenarios
46
- - Document test data and expected outcomes
47
- - Update test documentation if needed
48
-
49
- ## Required Input
50
-
51
- - **Source code**: Code to be tested (functions, methods, classes)
52
- - **Test framework**: Testing framework to use (Jest, PHPUnit, pytest, etc.)
53
- - **Project structure**: Understanding of where tests should be placed
54
- - **Dependencies**: List of dependencies that need to be mocked
55
-
56
- ## Expected Output
57
-
58
- - Complete unit test files
59
- - Tests covering normal, edge, and error cases
60
- - Test assertions verifying expected behavior
61
- - Test data and fixtures if needed
62
- - Passing test suite
63
-
64
- ## Tone & Rules
65
-
66
- ### Test Naming
67
- - Use descriptive names: `test_user_registration_with_valid_email()`
68
- - Follow pattern: `test_<what>_<condition>_<expected_result>`
69
- - Use clear, readable test names
70
-
71
- ### Test Structure
72
- - Arrange: Set up test data and dependencies
73
- - Act: Execute the code being tested
74
- - Assert: Verify the results
75
- - Clean up: Reset state if needed
76
-
77
- ### Coverage Goals
78
- - Aim for high coverage of critical paths
79
- - Test all public methods
80
- - Test edge cases and error handling
81
- - Don't test implementation details
82
-
83
- ### Limitations
84
- - ❌ DO NOT test private methods directly (test through public interface)
85
- - ❌ DO NOT write tests that depend on other tests
86
- - ❌ DO NOT test external dependencies (use mocks)
87
- - ❌ DO NOT write slow tests (use mocks for I/O)
88
- - ❌ DO NOT test framework code
89
-
90
- ## Available Templates
91
-
92
- - `templates/unit-test-template.js` - JavaScript/Jest template
93
- - `templates/unit-test-template.php` - PHP/PHPUnit template
94
- - `templates/unit-test-template.py` - Python/pytest template
95
-
96
- ## Available Scripts
97
-
98
- - `scripts/generate-test-stubs.sh` - Generate test file stubs from source code
99
-
100
- ## Examples
101
-
102
- See `examples/` directory for reference:
103
- - `good-unit-test/` - Well-structured unit tests
104
- - `bad-unit-test/` - Examples to avoid
105
-
106
- ## Links to Other Skills
107
-
108
- - **integration-test**: Use after unit tests for integration testing
109
- - **e2e-test**: Use for end-to-end testing
110
- - **documents**: Use to document test strategy
111
-
1
+ # Skill: Unit Testing (Cross-Cutting)
2
+
3
+ ## Purpose
4
+
5
+ This skill is used to create unit tests for code components. Unit tests verify that individual functions, methods, or classes work correctly in isolation.
6
+
7
+ ## When to Use
8
+
9
+ - When testing individual functions or methods
10
+ - When testing class methods in isolation
11
+ - When testing utility functions
12
+ - When testing business logic
13
+ - When testing data transformations
14
+ - When ensuring code correctness before integration
15
+
16
+ ## Step-by-Step Process
17
+
18
+ ### Step 1: Identify Test Targets
19
+ - Analyze the code to identify testable units
20
+ - List all public methods/functions
21
+ - Identify edge cases and boundary conditions
22
+ - Determine expected inputs and outputs
23
+
24
+ ### Step 2: Set Up Test Framework
25
+ - Choose appropriate testing framework (Jest, PHPUnit, pytest, etc.)
26
+ - Configure test environment
27
+ - Set up test structure matching project conventions
28
+ - Ensure test framework is installed and configured
29
+
30
+ ### Step 3: Write Test Cases
31
+ - Create test file matching source file structure
32
+ - Write tests for each function/method
33
+ - Test normal cases (happy path)
34
+ - Test edge cases (null, empty, boundary values)
35
+ - Test error cases (invalid input, exceptions)
36
+ - Use descriptive test names
37
+
38
+ ### Step 4: Run and Verify
39
+ - Run tests to ensure they pass
40
+ - Check test coverage if available
41
+ - Refactor if needed
42
+ - Ensure tests are fast and isolated
43
+
44
+ ### Step 5: Document Test Cases
45
+ - Add comments for complex test scenarios
46
+ - Document test data and expected outcomes
47
+ - Update test documentation if needed
48
+
49
+ ## Required Input
50
+
51
+ - **Source code**: Code to be tested (functions, methods, classes)
52
+ - **Test framework**: Testing framework to use (Jest, PHPUnit, pytest, etc.)
53
+ - **Project structure**: Understanding of where tests should be placed
54
+ - **Dependencies**: List of dependencies that need to be mocked
55
+
56
+ ## Expected Output
57
+
58
+ - Complete unit test files
59
+ - Tests covering normal, edge, and error cases
60
+ - Test assertions verifying expected behavior
61
+ - Test data and fixtures if needed
62
+ - Passing test suite
63
+
64
+ ## Tone & Rules
65
+
66
+ ### Test Naming
67
+ - Use descriptive names: `test_user_registration_with_valid_email()`
68
+ - Follow pattern: `test_<what>_<condition>_<expected_result>`
69
+ - Use clear, readable test names
70
+
71
+ ### Test Structure
72
+ - Arrange: Set up test data and dependencies
73
+ - Act: Execute the code being tested
74
+ - Assert: Verify the results
75
+ - Clean up: Reset state if needed
76
+
77
+ ### Coverage Goals
78
+ - Aim for high coverage of critical paths
79
+ - Test all public methods
80
+ - Test edge cases and error handling
81
+ - Don't test implementation details
82
+
83
+ ### Limitations
84
+ - ❌ DO NOT test private methods directly (test through public interface)
85
+ - ❌ DO NOT write tests that depend on other tests
86
+ - ❌ DO NOT test external dependencies (use mocks)
87
+ - ❌ DO NOT write slow tests (use mocks for I/O)
88
+ - ❌ DO NOT test framework code
89
+
90
+ ## Available Templates
91
+
92
+ - `templates/unit-test-template.js` - JavaScript/Jest template
93
+ - `templates/unit-test-template.php` - PHP/PHPUnit template
94
+ - `templates/unit-test-template.py` - Python/pytest template
95
+
96
+ ## Available Scripts
97
+
98
+ - `scripts/generate-test-stubs.sh` - Generate test file stubs from source code
99
+
100
+ ## Examples
101
+
102
+ See `examples/` directory for reference:
103
+ - `good-unit-test/` - Well-structured unit tests
104
+ - `bad-unit-test/` - Examples to avoid
105
+
106
+ ## Links to Other Skills
107
+
108
+ - **integration-test**: Use after unit tests for integration testing
109
+ - **e2e-test**: Use for end-to-end testing
110
+ - **documents**: Use to document test strategy
111
+
@@ -1,50 +1,50 @@
1
- <?php
2
-
3
- namespace {{namespace_prefix}}\Controllers\Elements;
4
-
5
- use polyxgo\PolyUtilities\Core\Helper;
6
-
7
- class Element{{ElementName}}Controller
8
- {
9
- public function register_hooks()
10
- {
11
- // 1. Frontend Shortcode
12
- add_shortcode('{{shortcode_prefix}}{{element_slug}}', [$this, 'render_element']);
13
-
14
- // 2. UX Builder Integration (Flatsome only)
15
- if (Helper::is_flatsome_theme_activated()) {
16
- add_action('ux_builder_setup', [$this, 'register_ux_builder_element']);
17
- }
18
- }
19
-
20
- public function register_ux_builder_element()
21
- {
22
- if (function_exists('add_ux_builder_shortcode')) {
23
- // Include the UI registration file
24
- require_once Helper::get_poly_ux_builder_shortcode('{{element_slug}}');
25
- }
26
- }
27
-
28
- public function render_element($atts, $content = null)
29
- {
30
- $atts = shortcode_atts([
31
- '_id' => '{{element_slug}}-' . rand(),
32
- 'title' => '',
33
- 'class' => '',
34
- 'visibility' => '',
35
- // Add more attributes here
36
- ], $atts, '{{shortcode_prefix}}{{element_slug}}');
37
-
38
- ob_start();
39
- $view_path = plugin_dir_path({{plugin_dir_const}}) . '/inc/Views/elements/{{element_slug}}.php';
40
-
41
- if (file_exists($view_path)) {
42
- include $view_path;
43
- } else {
44
- // Fallback inline rendering
45
- echo '<div class="' . esc_attr($atts['class']) . '">' . esc_html($atts['title']) . '</div>';
46
- }
47
-
48
- return ob_get_clean();
49
- }
50
- }
1
+ <?php
2
+
3
+ namespace {{namespace_prefix}}\Controllers\Elements;
4
+
5
+ use polyxgo\PolyUtilities\Core\Helper;
6
+
7
+ class Element{{ElementName}}Controller
8
+ {
9
+ public function register_hooks()
10
+ {
11
+ // 1. Frontend Shortcode
12
+ add_shortcode('{{shortcode_prefix}}{{element_slug}}', [$this, 'render_element']);
13
+
14
+ // 2. UX Builder Integration (Flatsome only)
15
+ if (Helper::is_flatsome_theme_activated()) {
16
+ add_action('ux_builder_setup', [$this, 'register_ux_builder_element']);
17
+ }
18
+ }
19
+
20
+ public function register_ux_builder_element()
21
+ {
22
+ if (function_exists('add_ux_builder_shortcode')) {
23
+ // Include the UI registration file
24
+ require_once Helper::get_poly_ux_builder_shortcode('{{element_slug}}');
25
+ }
26
+ }
27
+
28
+ public function render_element($atts, $content = null)
29
+ {
30
+ $atts = shortcode_atts([
31
+ '_id' => '{{element_slug}}-' . rand(),
32
+ 'title' => '',
33
+ 'class' => '',
34
+ 'visibility' => '',
35
+ // Add more attributes here
36
+ ], $atts, '{{shortcode_prefix}}{{element_slug}}');
37
+
38
+ ob_start();
39
+ $view_path = plugin_dir_path({{plugin_dir_const}}) . '/inc/Views/elements/{{element_slug}}.php';
40
+
41
+ if (file_exists($view_path)) {
42
+ include $view_path;
43
+ } else {
44
+ // Fallback inline rendering
45
+ echo '<div class="' . esc_attr($atts['class']) . '">' . esc_html($atts['title']) . '</div>';
46
+ }
47
+
48
+ return ob_get_clean();
49
+ }
50
+ }
@@ -1,23 +1,23 @@
1
- <?php
2
-
3
- use polyxgo\PolyUtilities\Core\Helper;
4
- use polyxgo\PolyUtilities\Core\Options;
5
-
6
- add_ux_builder_shortcode('{{shortcode_prefix}}{{element_slug}}', array(
7
- 'name' => __('{{ElementName}}', 'polyutilities'),
8
- 'category' => __('PolyUtilities', 'polyutilities'),
9
- 'template' => Helper::get_poly_ux_builder_template('{{element_slug}}'),
10
- 'thumbnail' => Helper::get_poly_ux_builder_thumbnail('{{element_slug}}'),
11
- 'info' => '{{ title }}',
12
- 'priority' => 10,
13
- 'options' => array(
14
- 'title' => array(
15
- 'type' => 'textfield',
16
- 'heading' => __('Title', 'polyutilities'),
17
- 'default' => 'Element Title',
18
- 'auto_focus' => true,
19
- ),
20
- // Add more options here (colorpicker, slider, select, etc.)
21
- 'advanced_options' => require Helper::get_poly_ux_builder_element('commons', 'advanced'),
22
- ),
23
- ));
1
+ <?php
2
+
3
+ use polyxgo\PolyUtilities\Core\Helper;
4
+ use polyxgo\PolyUtilities\Core\Options;
5
+
6
+ add_ux_builder_shortcode('{{shortcode_prefix}}{{element_slug}}', array(
7
+ 'name' => __('{{ElementName}}', 'polyutilities'),
8
+ 'category' => __('PolyUtilities', 'polyutilities'),
9
+ 'template' => Helper::get_poly_ux_builder_template('{{element_slug}}'),
10
+ 'thumbnail' => Helper::get_poly_ux_builder_thumbnail('{{element_slug}}'),
11
+ 'info' => '{{ title }}',
12
+ 'priority' => 10,
13
+ 'options' => array(
14
+ 'title' => array(
15
+ 'type' => 'textfield',
16
+ 'heading' => __('Title', 'polyutilities'),
17
+ 'default' => 'Element Title',
18
+ 'auto_focus' => true,
19
+ ),
20
+ // Add more options here (colorpicker, slider, select, etc.)
21
+ 'advanced_options' => require Helper::get_poly_ux_builder_element('commons', 'advanced'),
22
+ ),
23
+ ));
@@ -1,20 +1,20 @@
1
- <span id="{{:: shortcode.$id }}">
2
- <div class="{{class_prefix}}{{element_slug}} {{ shortcode.options.class }} {{ shortcode.options.visibility }}"
3
- ng-style="{
4
- 'color': shortcode.options.textColor,
5
- 'background-color': shortcode.options.bgColor,
6
- 'font-family': shortcode.options.pxgClockFont
7
- }">
8
- <span ng-bind="shortcode.options.title"></span>
9
- </div>
10
-
11
- <style scope="scope">
12
- #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}} {
13
- /* Add scoped styles here */
14
- }
15
-
16
- #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}}:hover {
17
- /* Hover effects */
18
- }
19
- </style>
20
- </span>
1
+ <span id="{{:: shortcode.$id }}">
2
+ <div class="{{class_prefix}}{{element_slug}} {{ shortcode.options.class }} {{ shortcode.options.visibility }}"
3
+ ng-style="{
4
+ 'color': shortcode.options.textColor,
5
+ 'background-color': shortcode.options.bgColor,
6
+ 'font-family': shortcode.options.pxgClockFont
7
+ }">
8
+ <span ng-bind="shortcode.options.title"></span>
9
+ </div>
10
+
11
+ <style scope="scope">
12
+ #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}} {
13
+ /* Add scoped styles here */
14
+ }
15
+
16
+ #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}}:hover {
17
+ /* Hover effects */
18
+ }
19
+ </style>
20
+ </span>
@@ -1,8 +1,8 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="100px" height="68px" viewBox="0 0 100 68" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
- <rect x="0" y="0" width="100" height="68" fill="#FFFFFF"></rect>
4
- <!-- Placeholder: Replace with actual icon geometry -->
5
- <rect x="25" y="20" width="50" height="28" rx="2" fill="#FCA5A5" stroke="#F87171" stroke-width="2"></rect>
6
- <rect x="30" y="28" width="40" height="4" rx="1" fill="#FFFFFF"></rect>
7
- <rect x="30" y="36" width="25" height="4" rx="1" fill="#FFFFFF"></rect>
8
- </svg>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="100px" height="68px" viewBox="0 0 100 68" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
+ <rect x="0" y="0" width="100" height="68" fill="#FFFFFF"></rect>
4
+ <!-- Placeholder: Replace with actual icon geometry -->
5
+ <rect x="25" y="20" width="50" height="28" rx="2" fill="#FCA5A5" stroke="#F87171" stroke-width="2"></rect>
6
+ <rect x="30" y="28" width="40" height="4" rx="1" fill="#FFFFFF"></rect>
7
+ <rect x="30" y="36" width="25" height="4" rx="1" fill="#FFFFFF"></rect>
8
+ </svg>
@@ -1,21 +1,21 @@
1
- <?php
2
- /**
3
- * Frontend view for {{ElementName}}
4
- *
5
- * @var array $atts
6
- */
7
-
8
- $classes = array('{{class_prefix}}{{element_slug}}');
9
- if (!empty($atts['class'])) $classes[] = $atts['class'];
10
- if (!empty($atts['visibility'])) $classes[] = $atts['visibility'];
11
-
12
- $inline_style = '';
13
- if (!empty($atts['textColor'])) $inline_style .= 'color: ' . esc_attr($atts['textColor']) . ';';
14
- if (!empty($atts['bgColor'])) $inline_style .= 'background-color: ' . esc_attr($atts['bgColor']) . ';';
15
-
16
- ?>
17
- <div id="<?php echo esc_attr($atts['_id']); ?>"
18
- class="<?php echo esc_attr(implode(' ', $classes)); ?>"
19
- style="<?php echo esc_attr($inline_style); ?>">
20
- <?php echo esc_html($atts['title']); ?>
21
- </div>
1
+ <?php
2
+ /**
3
+ * Frontend view for {{ElementName}}
4
+ *
5
+ * @var array $atts
6
+ */
7
+
8
+ $classes = array('{{class_prefix}}{{element_slug}}');
9
+ if (!empty($atts['class'])) $classes[] = $atts['class'];
10
+ if (!empty($atts['visibility'])) $classes[] = $atts['visibility'];
11
+
12
+ $inline_style = '';
13
+ if (!empty($atts['textColor'])) $inline_style .= 'color: ' . esc_attr($atts['textColor']) . ';';
14
+ if (!empty($atts['bgColor'])) $inline_style .= 'background-color: ' . esc_attr($atts['bgColor']) . ';';
15
+
16
+ ?>
17
+ <div id="<?php echo esc_attr($atts['_id']); ?>"
18
+ class="<?php echo esc_attr(implode(' ', $classes)); ?>"
19
+ style="<?php echo esc_attr($inline_style); ?>">
20
+ <?php echo esc_html($atts['title']); ?>
21
+ </div>
@@ -1,83 +1,83 @@
1
- # Skill: Flatsome UX Element
2
-
3
- This skill guides the creation of custom UX Builder elements for the Flatsome theme within the PolyUtilities plugin.
4
-
5
- ## Purpose
6
- Standardize the development of UX elements to ensure consistency across controllers, shortcodes, and templates, with special focus on real-time preview functionality. This skill is portable and uses dynamic prefixes for identity (Shortcode, Namespace, CSS Classes).
7
-
8
- ## Required Variables
9
- When calling this skill, define the following identity prefixes:
10
- - `{{namespace_prefix}}`: The root namespace (e.g., `polyxgo\PolyUtilities`).
11
- - `{{shortcode_prefix}}`: Prefix for shortcode names (e.g., `poly_ux_`).
12
- - `{{class_prefix}}`: Prefix for CSS classes (e.g., `poly-`).
13
- - `{{plugin_dir_const}}`: The plugin directory constant (e.g., `__POLYUTILITIES_PLUGIN_DIR__`).
14
-
15
- ## Prerequisites
16
- - Knowledge of PHP, WordPress Shortcodes, and AngularJS (for UX Builder templates).
17
- - Access to `inc/Core/Helper.php` for utility functions.
18
-
19
- ## Implementation Steps
20
-
21
- ### 1. Register Shortcode Logic (The Controller)
22
- Create a new controller class in `inc/Controllers/Elements/`.
23
- - **Namespace**: `{{namespace_prefix}}\Controllers\Elements`
24
- - **Method `register_hooks()`**: Add the shortcode `{{shortcode_prefix}}{{element_slug}}` and `ux_builder_setup` action.
25
- - **Method `render_element($atts, $content)`**: Handle the frontend output.
26
-
27
- ### 2. Register UX Builder UI (The Shortcode)
28
- Create a registration file in `inc/builder/shortcodes/`.
29
- - Use `add_ux_builder_shortcode('{{shortcode_prefix}}{{element_slug}}', ...)`.
30
- - Define options (textfield, select, colorpicker, slider, etc.).
31
- - Link to the AngularJS template using `Helper::get_poly_ux_builder_template()`.
32
-
33
- ### 3. Build the Preview Template (AngularJS)
34
- Create an HTML file in `inc/builder/shortcodes/templates/`.
35
- - **CRITICAL**: Wrap the entire content in a `<span>` with `id="{{:: shortcode.$id }}"`.
36
- - This ensures that clicking the element in the builder correctly selects it and shows options.
37
- - Use `ng-style` and `style scope="scope"` for real-time CSS updates.
38
-
39
- ### 4. Create SVG Thumbnail
40
- Create an SVG file in `inc/builder/shortcodes/thumbnails/`.
41
- - **Naming**: Use `{{element_slug}}.svg`.
42
- - **Dimensions**: Use `100x68px`.
43
- - **Theme**: Use the "Pastel Red" theme (`#F87171` for accents, `#FCA5A5` for fills).
44
-
45
- ### 5. Create the Frontend View
46
- (Optional) Extract the HTML into `inc/Views/elements/` for cleaner controllers.
47
-
48
- ## Standards and Rules
49
-
50
- ### The Wrapping Rule
51
- Every UX Builder template MUST follow this structure:
52
- ```html
53
- <span id="{{:: shortcode.$id }}">
54
- <!-- Main element (e.g., <a>, <div>, <section>) -->
55
- <div class="{{class_prefix}}{{element_slug}}" ng-style="{ 'color': shortcode.options.color }">
56
- {{ shortcode.options.text }}
57
- </div>
58
-
59
- <!-- Scoped styles for hover effects or complex rules -->
60
- <style scope="scope">
61
- #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}}:hover {
62
- opacity: 0.8;
63
- }
64
- </style>
65
- </span>
66
- ```
67
-
68
- ### Variable Naming (PHP vs AngularJS)
69
- **CRITICAL**: When accessing shortcode options in the AngularJS template (`.html`), variables declared with underscores (`_`) in PHP MUST be accessed via **camelCase**.
70
- - **PHP**: `bg_color` → **AngularJS**: `shortcode.options.bgColor`
71
- - **PHP**: `pxg_clock_font` → **AngularJS**: `shortcode.options.pxgClockFont`
72
- - **PHP**: `text_align` → **AngularJS**: `shortcode.options.textAlign`
73
-
74
- ### Color Handling
75
- - Use HEX or RGBA strings consistently.
76
- - Always provide default values in the shortcode registration or handle them in the template/controller.
77
-
78
- ## Templates
79
- - [Controller.php](templates/Controller.php)
80
- - [Shortcode.php](templates/Shortcode.php)
81
- - [Template.html](templates/Template.html)
82
- - [View.php](templates/View.php)
83
- - [Thumbnail.svg](templates/Thumbnail.svg)
1
+ # Skill: Flatsome UX Element
2
+
3
+ This skill guides the creation of custom UX Builder elements for the Flatsome theme within the PolyUtilities plugin.
4
+
5
+ ## Purpose
6
+ Standardize the development of UX elements to ensure consistency across controllers, shortcodes, and templates, with special focus on real-time preview functionality. This skill is portable and uses dynamic prefixes for identity (Shortcode, Namespace, CSS Classes).
7
+
8
+ ## Required Variables
9
+ When calling this skill, define the following identity prefixes:
10
+ - `{{namespace_prefix}}`: The root namespace (e.g., `polyxgo\PolyUtilities`).
11
+ - `{{shortcode_prefix}}`: Prefix for shortcode names (e.g., `poly_ux_`).
12
+ - `{{class_prefix}}`: Prefix for CSS classes (e.g., `poly-`).
13
+ - `{{plugin_dir_const}}`: The plugin directory constant (e.g., `__POLYUTILITIES_PLUGIN_DIR__`).
14
+
15
+ ## Prerequisites
16
+ - Knowledge of PHP, WordPress Shortcodes, and AngularJS (for UX Builder templates).
17
+ - Access to `inc/Core/Helper.php` for utility functions.
18
+
19
+ ## Implementation Steps
20
+
21
+ ### 1. Register Shortcode Logic (The Controller)
22
+ Create a new controller class in `inc/Controllers/Elements/`.
23
+ - **Namespace**: `{{namespace_prefix}}\Controllers\Elements`
24
+ - **Method `register_hooks()`**: Add the shortcode `{{shortcode_prefix}}{{element_slug}}` and `ux_builder_setup` action.
25
+ - **Method `render_element($atts, $content)`**: Handle the frontend output.
26
+
27
+ ### 2. Register UX Builder UI (The Shortcode)
28
+ Create a registration file in `inc/builder/shortcodes/`.
29
+ - Use `add_ux_builder_shortcode('{{shortcode_prefix}}{{element_slug}}', ...)`.
30
+ - Define options (textfield, select, colorpicker, slider, etc.).
31
+ - Link to the AngularJS template using `Helper::get_poly_ux_builder_template()`.
32
+
33
+ ### 3. Build the Preview Template (AngularJS)
34
+ Create an HTML file in `inc/builder/shortcodes/templates/`.
35
+ - **CRITICAL**: Wrap the entire content in a `<span>` with `id="{{:: shortcode.$id }}"`.
36
+ - This ensures that clicking the element in the builder correctly selects it and shows options.
37
+ - Use `ng-style` and `style scope="scope"` for real-time CSS updates.
38
+
39
+ ### 4. Create SVG Thumbnail
40
+ Create an SVG file in `inc/builder/shortcodes/thumbnails/`.
41
+ - **Naming**: Use `{{element_slug}}.svg`.
42
+ - **Dimensions**: Use `100x68px`.
43
+ - **Theme**: Use the "Pastel Red" theme (`#F87171` for accents, `#FCA5A5` for fills).
44
+
45
+ ### 5. Create the Frontend View
46
+ (Optional) Extract the HTML into `inc/Views/elements/` for cleaner controllers.
47
+
48
+ ## Standards and Rules
49
+
50
+ ### The Wrapping Rule
51
+ Every UX Builder template MUST follow this structure:
52
+ ```html
53
+ <span id="{{:: shortcode.$id }}">
54
+ <!-- Main element (e.g., <a>, <div>, <section>) -->
55
+ <div class="{{class_prefix}}{{element_slug}}" ng-style="{ 'color': shortcode.options.color }">
56
+ {{ shortcode.options.text }}
57
+ </div>
58
+
59
+ <!-- Scoped styles for hover effects or complex rules -->
60
+ <style scope="scope">
61
+ #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}}:hover {
62
+ opacity: 0.8;
63
+ }
64
+ </style>
65
+ </span>
66
+ ```
67
+
68
+ ### Variable Naming (PHP vs AngularJS)
69
+ **CRITICAL**: When accessing shortcode options in the AngularJS template (`.html`), variables declared with underscores (`_`) in PHP MUST be accessed via **camelCase**.
70
+ - **PHP**: `bg_color` → **AngularJS**: `shortcode.options.bgColor`
71
+ - **PHP**: `pxg_clock_font` → **AngularJS**: `shortcode.options.pxgClockFont`
72
+ - **PHP**: `text_align` → **AngularJS**: `shortcode.options.textAlign`
73
+
74
+ ### Color Handling
75
+ - Use HEX or RGBA strings consistently.
76
+ - Always provide default values in the shortcode registration or handle them in the template/controller.
77
+
78
+ ## Templates
79
+ - [Controller.php](templates/Controller.php)
80
+ - [Shortcode.php](templates/Shortcode.php)
81
+ - [Template.html](templates/Template.html)
82
+ - [View.php](templates/View.php)
83
+ - [Thumbnail.svg](templates/Thumbnail.svg)