opencode-skills-collection 4.0.69 → 4.0.70
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.
- package/bundled-skills/.antigravity-install-manifest.json +39 -1
- package/bundled-skills/api-integration-architect/SKILL.md +241 -0
- package/bundled-skills/apify-generate-output-schema/SKILL.md +438 -0
- package/bundled-skills/apify-integration-development/SKILL.md +168 -0
- package/bundled-skills/apify-integration-development/references/ai-framework-package.md +158 -0
- package/bundled-skills/apify-integration-development/references/ai-harness-plugin.md +192 -0
- package/bundled-skills/apify-integration-development/references/sdk-integration.md +236 -0
- package/bundled-skills/apify-integration-development/references/workflow-automation.md +163 -0
- package/bundled-skills/architecture-review/README.md +42 -0
- package/bundled-skills/architecture-review/SKILL.md +77 -0
- package/bundled-skills/architecture-review/examples.md +11 -0
- package/bundled-skills/architecture-review/reference/best-practices.md +7 -0
- package/bundled-skills/architecture-review/reference/capabilities.md +20 -0
- package/bundled-skills/architecture-review/reference/fallbacks.md +11 -0
- package/bundled-skills/architecture-review/reference/graph.md +15 -0
- package/bundled-skills/architecture-review/reference/mcp.md +14 -0
- package/bundled-skills/architecture-review/reference/workflow.md +15 -0
- package/bundled-skills/architecture-review/templates/architecture-review.md +21 -0
- package/bundled-skills/code-review-sensei/SKILL.md +177 -0
- package/bundled-skills/codebase-onboarding/README.md +42 -0
- package/bundled-skills/codebase-onboarding/SKILL.md +77 -0
- package/bundled-skills/codebase-onboarding/examples.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/best-practices.md +7 -0
- package/bundled-skills/codebase-onboarding/reference/capabilities.md +20 -0
- package/bundled-skills/codebase-onboarding/reference/fallbacks.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/graph.md +15 -0
- package/bundled-skills/codebase-onboarding/reference/mcp.md +14 -0
- package/bundled-skills/codebase-onboarding/reference/workflow.md +15 -0
- package/bundled-skills/codebase-onboarding/templates/repository-onboarding.md +21 -0
- package/bundled-skills/connection-auth-rules/SKILL.md +199 -0
- package/bundled-skills/connection-auth-rules/fetch_schema.py +320 -0
- package/bundled-skills/dependency-analysis/README.md +42 -0
- package/bundled-skills/dependency-analysis/SKILL.md +76 -0
- package/bundled-skills/dependency-analysis/examples.md +11 -0
- package/bundled-skills/dependency-analysis/reference/best-practices.md +7 -0
- package/bundled-skills/dependency-analysis/reference/capabilities.md +20 -0
- package/bundled-skills/dependency-analysis/reference/fallbacks.md +11 -0
- package/bundled-skills/dependency-analysis/reference/graph.md +15 -0
- package/bundled-skills/dependency-analysis/reference/mcp.md +14 -0
- package/bundled-skills/dependency-analysis/reference/workflow.md +15 -0
- package/bundled-skills/dependency-analysis/templates/dependency-review.md +21 -0
- package/bundled-skills/devops-pipeline-builder/SKILL.md +200 -0
- package/bundled-skills/eas-app-stores/SKILL.md +197 -0
- package/bundled-skills/eas-app-stores/agents/openai.yaml +4 -0
- package/bundled-skills/eas-app-stores/references/app-store-metadata.md +497 -0
- package/bundled-skills/eas-app-stores/references/ios-app-store.md +376 -0
- package/bundled-skills/eas-app-stores/references/native-ios.md +167 -0
- package/bundled-skills/eas-app-stores/references/play-store.md +244 -0
- package/bundled-skills/eas-app-stores/references/testflight.md +62 -0
- package/bundled-skills/eas-app-stores/references/workflows.md +120 -0
- package/bundled-skills/eas-hosting/SKILL.md +448 -0
- package/bundled-skills/eas-hosting/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/SKILL.md +75 -0
- package/bundled-skills/eas-observe/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/references/metrics.md +98 -0
- package/bundled-skills/eas-observe/references/queries.md +403 -0
- package/bundled-skills/eas-observe/references/setup.md +476 -0
- package/bundled-skills/eas-observe/references/third-party.md +136 -0
- package/bundled-skills/eas-simulator/SKILL.md +251 -0
- package/bundled-skills/eas-simulator/agents/openai.yaml +4 -0
- package/bundled-skills/eas-simulator/references/controllers.md +135 -0
- package/bundled-skills/eas-simulator/references/run-your-app.md +240 -0
- package/bundled-skills/eas-simulator/references/troubleshooting.md +47 -0
- package/bundled-skills/eas-workflows/SKILL.md +119 -0
- package/bundled-skills/eas-workflows/agents/openai.yaml +4 -0
- package/bundled-skills/eas-workflows/scripts/fetch.js +109 -0
- package/bundled-skills/expo-animation/LICENSE +21 -0
- package/bundled-skills/expo-animation/RECIPES.md +385 -0
- package/bundled-skills/expo-animation/SKILL.md +295 -0
- package/bundled-skills/expo-animation/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/SKILL.md +178 -0
- package/bundled-skills/fact-check-x-unified/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/references/acceptance-criteria.md +44 -0
- package/bundled-skills/fact-check-x-unified/references/contracts.md +39 -0
- package/bundled-skills/fact-check-x-unified/scripts/common.py +31 -0
- package/bundled-skills/fact-check-x-unified/scripts/fact_check_x.py +1832 -0
- package/bundled-skills/fact-check-x-unified/scripts/trusted_search_config.py +324 -0
- package/bundled-skills/fact-check-x-unified/tests/anchor_downgrade_test.py +90 -0
- package/bundled-skills/fact-check-x-unified/tests/multi_platform_test.py +369 -0
- package/bundled-skills/fact-check-x-unified/tests/smoke_test.py +740 -0
- package/bundled-skills/fact-check-x-unified/tests/stage_checkpoint_test.py +103 -0
- package/bundled-skills/fact-check-x-unified/tests/trusted_search_config_test.py +156 -0
- package/bundled-skills/gpt-taste/SKILL.md +8 -1
- package/bundled-skills/hf-cli/SKILL.md +263 -0
- package/bundled-skills/huggingface-community-evals/SKILL.md +228 -0
- package/bundled-skills/huggingface-community-evals/examples/.env.example +3 -0
- package/bundled-skills/huggingface-community-evals/examples/USAGE_EXAMPLES.md +101 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_eval_uv.py +104 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_vllm_uv.py +306 -0
- package/bundled-skills/huggingface-community-evals/scripts/lighteval_vllm_uv.py +297 -0
- package/bundled-skills/huggingface-datasets/SKILL.md +130 -0
- package/bundled-skills/jev-social/SKILL.md +182 -0
- package/bundled-skills/longbridge-derivatives/SKILL.md +117 -0
- package/bundled-skills/longbridge-derivatives/references/option.md +36 -0
- package/bundled-skills/longbridge-derivatives/references/options-advanced.md +101 -0
- package/bundled-skills/longbridge-derivatives/references/options-pnl.md +74 -0
- package/bundled-skills/longbridge-derivatives/references/options-strategy.md +82 -0
- package/bundled-skills/longbridge-derivatives/references/options-volatility.md +70 -0
- package/bundled-skills/longbridge-derivatives/references/warrant.md +12 -0
- package/bundled-skills/longbridge-quant/SKILL.md +151 -0
- package/bundled-skills/longbridge-quant/references/correlation.md +51 -0
- package/bundled-skills/longbridge-quant/references/execution-model.md +68 -0
- package/bundled-skills/longbridge-quant/references/factor-research.md +95 -0
- package/bundled-skills/longbridge-quant/references/factor-screen.md +101 -0
- package/bundled-skills/longbridge-quant/references/hedging.md +136 -0
- package/bundled-skills/longbridge-quant/references/ml-strategy.md +77 -0
- package/bundled-skills/longbridge-quant/references/multifactor.md +68 -0
- package/bundled-skills/longbridge-quant/references/pairs-trading.md +61 -0
- package/bundled-skills/longbridge-quant/references/quant-cli.md +133 -0
- package/bundled-skills/longbridge-quant/references/quant-stats.md +150 -0
- package/bundled-skills/longbridge-quant/references/seasonality.md +50 -0
- package/bundled-skills/longbridge-quant/references/strategy-optimizer.md +68 -0
- package/bundled-skills/longbridge-quant/references/volatility-strategy.md +52 -0
- package/bundled-skills/longbridge-research/SKILL.md +187 -0
- package/bundled-skills/longbridge-research/references/company-profile.md +96 -0
- package/bundled-skills/longbridge-research/references/company-tearsheet.md +82 -0
- package/bundled-skills/longbridge-research/references/competitive-analysis.md +81 -0
- package/bundled-skills/longbridge-research/references/consensus.md +92 -0
- package/bundled-skills/longbridge-research/references/coverage-initiation.md +76 -0
- package/bundled-skills/longbridge-research/references/defi-yield.md +60 -0
- package/bundled-skills/longbridge-research/references/finance-calendar.md +165 -0
- package/bundled-skills/longbridge-research/references/financial-planning.md +77 -0
- package/bundled-skills/longbridge-research/references/forecast-eps.md +39 -0
- package/bundled-skills/longbridge-research/references/fund-holder.md +44 -0
- package/bundled-skills/longbridge-research/references/hkipo-analysis.md +101 -0
- package/bundled-skills/longbridge-research/references/industry-peers.md +46 -0
- package/bundled-skills/longbridge-research/references/industry-rank.md +62 -0
- package/bundled-skills/longbridge-research/references/insider-trades.md +48 -0
- package/bundled-skills/longbridge-research/references/institution-rating.md +62 -0
- package/bundled-skills/longbridge-research/references/investment-ideas.md +69 -0
- package/bundled-skills/longbridge-research/references/investment-proposal.md +95 -0
- package/bundled-skills/longbridge-research/references/investors.md +87 -0
- package/bundled-skills/longbridge-research/references/onchain.md +70 -0
- package/bundled-skills/longbridge-research/references/post-investment.md +76 -0
- package/bundled-skills/longbridge-research/references/shareholder.md +72 -0
- package/bundled-skills/longbridge-research/references/short-positions.md +50 -0
- package/bundled-skills/longbridge-research/references/short-trades.md +50 -0
- package/bundled-skills/longbridge-research/references/stock-research.md +61 -0
- package/bundled-skills/longbridge-research/references/thesis-tracker.md +64 -0
- package/bundled-skills/makepad-2-0-animation/SKILL.md +318 -0
- package/bundled-skills/makepad-2-0-animation/references/animator-reference.md +433 -0
- package/bundled-skills/makepad-2-0-dsl/SKILL.md +492 -0
- package/bundled-skills/makepad-2-0-dsl/references/dsl-syntax-reference.md +511 -0
- package/bundled-skills/makepad-2-0-dsl/references/extended-guide.md +56 -0
- package/bundled-skills/makepad-2-0-dsl/references/property-system.md +757 -0
- package/bundled-skills/makepad-2-0-events/SKILL.md +497 -0
- package/bundled-skills/makepad-2-0-events/references/event-patterns.md +802 -0
- package/bundled-skills/makepad-2-0-events/references/extended-guide.md +590 -0
- package/bundled-skills/makepad-2-0-layout/SKILL.md +499 -0
- package/bundled-skills/makepad-2-0-layout/references/extended-guide.md +243 -0
- package/bundled-skills/makepad-2-0-layout/references/layout-patterns.md +881 -0
- package/bundled-skills/makepad-2-0-widgets/SKILL.md +261 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-advanced.md +648 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-catalog.md +547 -0
- package/bundled-skills/meeting-distiller-pro/SKILL.md +120 -0
- package/bundled-skills/monte-carlo-analyze-root-cause/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-asset-health/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-context-detection/SKILL.md +170 -0
- package/bundled-skills/monte-carlo-context-detection/references/signal-definitions.md +46 -0
- package/bundled-skills/remotion-captions/SKILL.md +57 -0
- package/bundled-skills/remotion-captions/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-captions/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-captions/display-captions.md +190 -0
- package/bundled-skills/remotion-captions/import-srt-captions.md +73 -0
- package/bundled-skills/remotion-captions/transcribe-captions.md +70 -0
- package/bundled-skills/remotion-create/SKILL.md +106 -0
- package/bundled-skills/remotion-create/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-create/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-create/tailwind.md +11 -0
- package/bundled-skills/remotion-create/video-layout.md +9 -0
- package/bundled-skills/remotion-docs/SKILL.md +67 -0
- package/bundled-skills/remotion-docs/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-docs/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-interactivity/SKILL.md +270 -0
- package/bundled-skills/remotion-interactivity/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-interactivity/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/SKILL.md +48 -0
- package/bundled-skills/remotion-render/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-render/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/transparent-videos.md +106 -0
- package/bundled-skills/saas-pricing-strategist/SKILL.md +169 -0
- package/bundled-skills/score-eval/SKILL.md +35 -0
- package/bundled-skills/writing-guidelines/SKILL.md +60 -0
- package/package.json +1 -1
- package/skills_index.json +980 -3
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
# Makepad 2.0 DSL Syntax Reference
|
|
2
|
+
|
|
3
|
+
## Syntax Grammar
|
|
4
|
+
|
|
5
|
+
### Fundamental Rules
|
|
6
|
+
|
|
7
|
+
1. **Colon syntax for properties**: `key: value` (never `key = value`)
|
|
8
|
+
2. **Whitespace/newline separated**: No commas between sibling properties
|
|
9
|
+
3. **Named instances**: `name := Widget{...}` (addressable via `:=`)
|
|
10
|
+
4. **Merge operator**: `key +: {...}` (extends parent, does not replace)
|
|
11
|
+
5. **Dot-path shorthand**: `draw_bg.color: #f00` equals `draw_bg +: { color: #f00 }`
|
|
12
|
+
6. **Let bindings**: `let Name = Widget{...}` (local template)
|
|
13
|
+
7. **Rust integration**: `#(Struct::register_widget(vm))` (Rust struct binding)
|
|
14
|
+
8. **Spread operator**: `..mod.draw.DrawQuad` (inherit all properties)
|
|
15
|
+
9. **Debug logging**: `~expression` (log value during evaluation)
|
|
16
|
+
|
|
17
|
+
### Property Assignment
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
// Simple values
|
|
21
|
+
width: Fill
|
|
22
|
+
height: 200
|
|
23
|
+
color: #ff0000
|
|
24
|
+
visible: true
|
|
25
|
+
text: "Hello world"
|
|
26
|
+
|
|
27
|
+
// Nested objects
|
|
28
|
+
draw_bg: DrawQuad{
|
|
29
|
+
color: #f00
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Merge (extend parent)
|
|
33
|
+
draw_bg +: {
|
|
34
|
+
color: #f00
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Dot-path shorthand (equivalent to merge)
|
|
38
|
+
draw_bg.color: #f00
|
|
39
|
+
draw_text.text_style.font_size: 14
|
|
40
|
+
window.inner_size: vec2(800, 600)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Widget Instantiation
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
// Anonymous widget
|
|
47
|
+
Label{ text: "Hello" }
|
|
48
|
+
|
|
49
|
+
// Named instance (addressable)
|
|
50
|
+
my_label := Label{ text: "Hello" }
|
|
51
|
+
|
|
52
|
+
// Inheriting from a registered type
|
|
53
|
+
mod.widgets.MyButton = mod.widgets.Button{
|
|
54
|
+
draw_bg +: { color: #f00 }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Let binding template
|
|
58
|
+
let MyCard = RoundedView{
|
|
59
|
+
width: Fill height: Fit
|
|
60
|
+
title := Label{ text: "default" }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Instantiation with overrides
|
|
64
|
+
MyCard{ title.text: "Custom Title" }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Value Types
|
|
68
|
+
|
|
69
|
+
#### Numbers
|
|
70
|
+
```
|
|
71
|
+
width: 200 // integer (treated as Fixed size)
|
|
72
|
+
opacity: 0.5 // float
|
|
73
|
+
spacing: 10 // integer
|
|
74
|
+
margin: 0. // explicit float zero
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Strings
|
|
78
|
+
```
|
|
79
|
+
text: "Hello world"
|
|
80
|
+
body: "Line 1\nLine 2"
|
|
81
|
+
empty_text: "Placeholder"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Colors
|
|
85
|
+
```
|
|
86
|
+
#f00 // RGB short (3 hex digits)
|
|
87
|
+
#ff0000 // RGB full (6 hex digits)
|
|
88
|
+
#ff0000ff // RGBA (8 hex digits)
|
|
89
|
+
#0000 // transparent black (4 hex digits)
|
|
90
|
+
#x2ecc71 // #x prefix for hex containing 'e' (avoids Rust parser error)
|
|
91
|
+
#x1e1e2e // REQUIRED when digit precedes 'e'
|
|
92
|
+
vec4(1.0 0.0 0.0 1.0) // explicit RGBA as vec4
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Hex color 'e' rule**: When a digit immediately precedes `e` or `E` in a hex color, the Rust tokenizer misparses it as scientific notation. Use `#x` prefix to escape.
|
|
96
|
+
|
|
97
|
+
#### Booleans
|
|
98
|
+
```
|
|
99
|
+
visible: true
|
|
100
|
+
show_bg: true
|
|
101
|
+
clip_x: false
|
|
102
|
+
grab_key_focus: true
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Enums
|
|
106
|
+
```
|
|
107
|
+
default: @off // @ prefix for enum defaults in animators
|
|
108
|
+
default: @on
|
|
109
|
+
flow: Down // bare enum variant name
|
|
110
|
+
flow: Right
|
|
111
|
+
flow: Overlay
|
|
112
|
+
flow: Flow.Right{wrap: true} // enum variant with fields
|
|
113
|
+
axis: SplitterAxis.Horizontal
|
|
114
|
+
cursor: MouseCursor.Hand // Enum.Variant (NOT @Hand, NOT just Hand)
|
|
115
|
+
fit: ImageFit.Stretch
|
|
116
|
+
side: SlideSide.Left
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Vectors
|
|
120
|
+
```
|
|
121
|
+
vec2(800, 600) // 2D vector
|
|
122
|
+
vec2(0.0 0.0) // spaces also work (no comma)
|
|
123
|
+
vec4(1.0 0.0 0.0 1.0) // 4D vector (RGBA)
|
|
124
|
+
vec4(-1.0, -1.0, -1.0, -1.0) // sentinel value
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Constructors
|
|
128
|
+
```
|
|
129
|
+
Inset{ top: 5 bottom: 5 left: 10 right: 10 } // padding/margin
|
|
130
|
+
Align{ x: 0.5 y: 0.5 } // alignment
|
|
131
|
+
Walk{ width: 16 height: 16 } // icon sizing
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Alignment Presets
|
|
135
|
+
```
|
|
136
|
+
align: Center // Align{x: 0.5 y: 0.5}
|
|
137
|
+
align: HCenter // Align{x: 0.5 y: 0.0}
|
|
138
|
+
align: VCenter // Align{x: 0.0 y: 0.5}
|
|
139
|
+
align: TopLeft // Align{x: 0.0 y: 0.0}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Size Values
|
|
143
|
+
```
|
|
144
|
+
width: Fill // fill available space (default)
|
|
145
|
+
width: Fit // shrink to content
|
|
146
|
+
width: 200 // fixed 200px
|
|
147
|
+
width: Fill{min: 100 max: 500} // constrained fill
|
|
148
|
+
width: Fit{max: Abs(300)} // constrained fit
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Resources
|
|
152
|
+
```
|
|
153
|
+
crate_resource("self://resources/icons/icon.svg") // CORRECT
|
|
154
|
+
// dep("crate://self/resources/icon.svg") // WRONG - old syntax
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Script Module Structure
|
|
158
|
+
|
|
159
|
+
```rust
|
|
160
|
+
script_mod!{
|
|
161
|
+
// 1. Imports (MUST come first - no comments before this!)
|
|
162
|
+
use mod.prelude.widgets.* // App development
|
|
163
|
+
use mod.prelude.widgets_internal.* // Widget library development
|
|
164
|
+
use mod.widgets.* // Access registered widgets
|
|
165
|
+
|
|
166
|
+
// 2. Widget registration
|
|
167
|
+
mod.widgets.MyWidgetBase = #(MyWidget::register_widget(vm))
|
|
168
|
+
|
|
169
|
+
// 3. Styled defaults
|
|
170
|
+
mod.widgets.MyWidget = set_type_default() do mod.widgets.MyWidgetBase{
|
|
171
|
+
width: Fill height: Fit
|
|
172
|
+
draw_bg +: { color: theme.color_bg_app }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 4. Local templates (let bindings)
|
|
176
|
+
let MyCard = RoundedView{
|
|
177
|
+
width: Fill height: Fit
|
|
178
|
+
padding: 16 flow: Down
|
|
179
|
+
title := Label{ text: "Title" }
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 5. App component (with load_all_resources)
|
|
183
|
+
load_all_resources() do #(App::script_component(vm)){
|
|
184
|
+
ui: Root{
|
|
185
|
+
main_window := Window{
|
|
186
|
+
body +: {
|
|
187
|
+
MyCard{ title.text: "Hello" }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Registration Patterns
|
|
196
|
+
|
|
197
|
+
#### Widget (implements Widget trait)
|
|
198
|
+
```
|
|
199
|
+
mod.widgets.MyWidgetBase = #(MyWidget::register_widget(vm))
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Component (non-widget, e.g., App)
|
|
203
|
+
```
|
|
204
|
+
load_all_resources() do #(App::script_component(vm)){ ... }
|
|
205
|
+
// or without load_all_resources:
|
|
206
|
+
mod.widgets.MyComponentBase = #(MyComponent::script_component(vm))
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### Draw Shader (custom draw type)
|
|
210
|
+
```
|
|
211
|
+
set_type_default() do #(DrawMyShader::script_shader(vm)){
|
|
212
|
+
..mod.draw.DrawQuad // inherit from base shader
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### Setting Type Defaults
|
|
217
|
+
```
|
|
218
|
+
mod.widgets.MyWidget = set_type_default() do mod.widgets.MyWidgetBase{
|
|
219
|
+
width: Fill height: Fit
|
|
220
|
+
draw_bg +: { color: #334 }
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Template System
|
|
225
|
+
|
|
226
|
+
#### Let Binding (local to script_mod block)
|
|
227
|
+
```
|
|
228
|
+
let MyRow = View{
|
|
229
|
+
flow: Right height: Fit spacing: 8 align: Align{y: 0.5}
|
|
230
|
+
icon := Icon{}
|
|
231
|
+
label := Label{ text: "default" }
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Use:
|
|
235
|
+
MyRow{ label.text: "Custom text" }
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Named Children and Overrides
|
|
239
|
+
```
|
|
240
|
+
let TodoItem = View{
|
|
241
|
+
width: Fill height: Fit flow: Right spacing: 10
|
|
242
|
+
check := CheckBox{ text: "" }
|
|
243
|
+
label := Label{ text: "task" draw_text.color: #ddd }
|
|
244
|
+
Filler{}
|
|
245
|
+
tag := Label{ text: "" draw_text.color: #888 }
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Override named children via dot-path:
|
|
249
|
+
TodoItem{ label.text: "Buy groceries" tag.text: "errands" }
|
|
250
|
+
TodoItem{ label.text: "Fix bug" tag.text: "urgent" check.text: "" }
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Named Containers Must Form Complete Path
|
|
254
|
+
```
|
|
255
|
+
// WRONG - label inside anonymous View is unreachable
|
|
256
|
+
let Item = View{
|
|
257
|
+
View{ // anonymous - no :=
|
|
258
|
+
label := Label{ text: "x" } // unreachable!
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
Item{ label.text: "fails silently" }
|
|
262
|
+
|
|
263
|
+
// CORRECT - every container in path is named
|
|
264
|
+
let Item = View{
|
|
265
|
+
texts := View{ // named with :=
|
|
266
|
+
flow: Down
|
|
267
|
+
label := Label{ text: "x" }
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
Item{ texts.label.text: "works" } // full dot-path
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Templates in List Widgets
|
|
274
|
+
|
|
275
|
+
Named IDs (`:=`) inside PortalList/FlatList define **templates**, not regular properties:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
list := PortalList{
|
|
279
|
+
width: Fill height: Fill
|
|
280
|
+
flow: Down
|
|
281
|
+
scroll_bar: ScrollBar{} // regular property -> struct field
|
|
282
|
+
|
|
283
|
+
// Templates (stored in templates HashMap via on_after_apply)
|
|
284
|
+
Item := View{
|
|
285
|
+
height: 40
|
|
286
|
+
title := Label{ text: "Default" }
|
|
287
|
+
}
|
|
288
|
+
Header := View{
|
|
289
|
+
draw_bg.color: #333
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Used in Rust draw code:
|
|
295
|
+
```rust
|
|
296
|
+
while let Some(item_id) = list.next_visible_item(cx) {
|
|
297
|
+
let item = list.item(cx, item_id, id!(Item));
|
|
298
|
+
item.label(ids!(title)).set_text(cx, &format!("Item {}", item_id));
|
|
299
|
+
item.draw_all(cx, &mut Scope::empty());
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Dock Templates
|
|
304
|
+
|
|
305
|
+
Three sections in a Dock:
|
|
306
|
+
1. `tab_bar +:` -- tab header templates (how tab buttons look)
|
|
307
|
+
2. `root :=` -- layout tree of DockSplitter/DockTabs
|
|
308
|
+
3. Content templates -- `Name := Widget{}` for tab content
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
Dock{
|
|
312
|
+
width: Fill height: Fill
|
|
313
|
+
|
|
314
|
+
tab_bar +: {
|
|
315
|
+
FilesTab := IconTab{
|
|
316
|
+
draw_icon +: { color: #80FFBF svg: crate_resource("self://icons/file.svg") }
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
root := DockSplitter{
|
|
321
|
+
axis: SplitterAxis.Horizontal
|
|
322
|
+
align: SplitterAlign.FromA(250.0)
|
|
323
|
+
a := left_tabs
|
|
324
|
+
b := center_tabs
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
left_tabs := DockTabs{ tabs: [@files_tab] selected: 0 }
|
|
328
|
+
center_tabs := DockTabs{ tabs: [@edit_tab] selected: 0 }
|
|
329
|
+
|
|
330
|
+
files_tab := DockTab{ name: "Files" template := FilesTab kind := FilesContent }
|
|
331
|
+
edit_tab := DockTab{ name: "Edit" template := EditTab kind := EditContent }
|
|
332
|
+
|
|
333
|
+
FilesContent := View{ width: Fill height: Fill Label{text: "Files"} }
|
|
334
|
+
EditContent := View{ width: Fill height: Fill Label{text: "Editor"} }
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Animator Definition
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
animator: Animator{
|
|
342
|
+
hover: {
|
|
343
|
+
default: @off // @ prefix required for enum defaults
|
|
344
|
+
off: AnimatorState{
|
|
345
|
+
from: {all: Forward {duration: 0.1}}
|
|
346
|
+
apply: {
|
|
347
|
+
draw_bg: {hover: 0.0}
|
|
348
|
+
draw_text: {hover: 0.0}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
on: AnimatorState{
|
|
352
|
+
from: {
|
|
353
|
+
all: Forward {duration: 0.1}
|
|
354
|
+
down: Forward {duration: 0.01} // faster from "down" state
|
|
355
|
+
}
|
|
356
|
+
apply: {
|
|
357
|
+
draw_bg: {hover: snap(1.0)} // snap() = instant jump
|
|
358
|
+
draw_text: {hover: snap(1.0)}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
down: AnimatorState{
|
|
362
|
+
from: {all: Forward {duration: 0.2}}
|
|
363
|
+
apply: {
|
|
364
|
+
draw_bg: {down: snap(1.0) hover: 1.0}
|
|
365
|
+
draw_text: {down: snap(1.0) hover: 1.0}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
focus: {
|
|
370
|
+
default: @off
|
|
371
|
+
off: AnimatorState{
|
|
372
|
+
from: {all: Snap} // instant transition
|
|
373
|
+
apply: { draw_bg: {focus: 0.0} }
|
|
374
|
+
}
|
|
375
|
+
on: AnimatorState{
|
|
376
|
+
from: {all: Snap}
|
|
377
|
+
apply: { draw_bg: {focus: 1.0} }
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
time: {
|
|
381
|
+
default: @off
|
|
382
|
+
off: AnimatorState{
|
|
383
|
+
from: {all: Forward {duration: 0.}}
|
|
384
|
+
apply: {}
|
|
385
|
+
}
|
|
386
|
+
on: AnimatorState{
|
|
387
|
+
from: {all: Loop {duration: 1.0 end: 1000000000.0}}
|
|
388
|
+
apply: {
|
|
389
|
+
draw_bg: {anim_time: timeline(0.0 0.0 1.0 1.0)}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Play Types (Transition Modes)
|
|
397
|
+
```
|
|
398
|
+
Forward {duration: 0.2} // play once forward
|
|
399
|
+
Snap // instant
|
|
400
|
+
Reverse {duration: 0.2 end: 1.0} // play once in reverse
|
|
401
|
+
Loop {duration: 1.0 end: 1000000000.0} // repeat forward
|
|
402
|
+
ReverseLoop {duration: 1.0 end: 1.0} // repeat in reverse
|
|
403
|
+
BounceLoop {duration: 1.0 end: 1.0} // bounce back and forth
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Ease Functions
|
|
407
|
+
```
|
|
408
|
+
Linear
|
|
409
|
+
InQuad OutQuad InOutQuad
|
|
410
|
+
InCubic OutCubic InOutCubic
|
|
411
|
+
InQuart OutQuart InOutQuart
|
|
412
|
+
InQuint OutQuint InOutQuint
|
|
413
|
+
InSine OutSine InOutSine
|
|
414
|
+
InExp OutExp InOutExp
|
|
415
|
+
InCirc OutCirc InOutCirc
|
|
416
|
+
InElastic OutElastic InOutElastic
|
|
417
|
+
InBack OutBack InOutBack
|
|
418
|
+
InBounce OutBounce InOutBounce
|
|
419
|
+
ExpDecay {d1: 0.82 d2: 0.97 max: 100}
|
|
420
|
+
Pow {begin: 0.0 end: 1.0}
|
|
421
|
+
Bezier {cp0: 0.0 cp1: 0.0 cp2: 1.0 cp3: 1.0}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Shader Functions
|
|
425
|
+
|
|
426
|
+
```
|
|
427
|
+
draw_bg +: {
|
|
428
|
+
// Custom named function
|
|
429
|
+
get_color: fn() {
|
|
430
|
+
return self.color
|
|
431
|
+
.mix(self.color_hover, self.hover)
|
|
432
|
+
.mix(self.color_down, self.down)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Function with parameters
|
|
436
|
+
get_color_at: fn(scale: vec2, pan: vec2) {
|
|
437
|
+
return self.my_texture.sample(self.pos * scale + pan)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Pixel shader (fragment shader)
|
|
441
|
+
pixel: fn() {
|
|
442
|
+
let sdf = Sdf2d.viewport(self.pos * self.rect_size)
|
|
443
|
+
sdf.box(0. 0. self.rect_size.x self.rect_size.y 4.0)
|
|
444
|
+
sdf.fill(self.get_color())
|
|
445
|
+
return sdf.result
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// Vertex shader (rarely overridden)
|
|
449
|
+
vertex: fn() {
|
|
450
|
+
return self.clip_and_transform_vertex(self.rect_pos self.rect_size)
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Cross-Module Sharing
|
|
456
|
+
|
|
457
|
+
```rust
|
|
458
|
+
// widget_module.rs - exports to mod.widgets
|
|
459
|
+
script_mod!{
|
|
460
|
+
use mod.prelude.widgets_internal.*
|
|
461
|
+
mod.widgets.MyWidget = set_type_default() do ...
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// app_ui.rs - imports from mod.widgets
|
|
465
|
+
script_mod!{
|
|
466
|
+
use mod.prelude.widgets.*
|
|
467
|
+
use mod.widgets.* // MyWidget is now available
|
|
468
|
+
mod.widgets.AppUI = Window{ body +: { MyWidget{} } }
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// app.rs - uses mod.widgets.AppUI
|
|
472
|
+
script_mod!{
|
|
473
|
+
use mod.prelude.widgets.*
|
|
474
|
+
use mod.widgets.*
|
|
475
|
+
load_all_resources() do #(App::script_component(vm)){
|
|
476
|
+
ui: Root{ AppUI{} }
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**NOTE**: `use crate.module.*` does NOT work. Only `mod.*` paths are valid.
|
|
482
|
+
|
|
483
|
+
### Available Widget Types
|
|
484
|
+
|
|
485
|
+
**Core Containers**: `View`, `SolidView`, `RoundedView`, `RoundedAllView`, `RoundedXView`, `RoundedYView`, `RectView`, `RectShadowView`, `RoundedShadowView`, `CircleView`, `HexagonView`, `GradientXView`, `GradientYView`, `CachedView`, `CachedRoundedView`
|
|
486
|
+
|
|
487
|
+
**Scrollable**: `ScrollXView`, `ScrollYView`, `ScrollXYView`
|
|
488
|
+
|
|
489
|
+
**Text**: `Label`, `Labelbold`, `LabelGradientX`, `LabelGradientY`, `TextBox`, `P`, `Pbold`, `H1`, `H2`, `H3`, `H4`, `TextInput`, `TextInputFlat`, `LinkLabel`
|
|
490
|
+
|
|
491
|
+
**Rich Text**: `TextFlow`, `Markdown`, `Html` (feature-gated)
|
|
492
|
+
|
|
493
|
+
**Buttons**: `Button`, `ButtonFlat`, `ButtonFlatter`
|
|
494
|
+
|
|
495
|
+
**Toggles**: `CheckBox`, `CheckBoxFlat`, `CheckBoxCustom`, `Toggle`, `ToggleFlat`, `RadioButton`, `RadioButtonFlat`
|
|
496
|
+
|
|
497
|
+
**Input**: `Slider`, `SliderMinimal`, `DropDown`, `DropDownFlat`
|
|
498
|
+
|
|
499
|
+
**Layout**: `Splitter`, `FoldButton`, `FoldHeader`, `Hr`, `Vr`, `Filler`
|
|
500
|
+
|
|
501
|
+
**Lists**: `PortalList`, `FlatList`, `ScrollBar`
|
|
502
|
+
|
|
503
|
+
**Navigation**: `StackNavigation`, `ExpandablePanel`, `SlidePanel`, `Modal`, `Tooltip`, `PopupNotification`, `PageFlip`, `SlidesView`
|
|
504
|
+
|
|
505
|
+
**Dock**: `Dock`, `DockFlat`, `DockSplitter`, `DockTabs`, `DockTab`
|
|
506
|
+
|
|
507
|
+
**Media**: `Image`, `Icon`, `LoadingSpinner`
|
|
508
|
+
|
|
509
|
+
**Special**: `FileTree`, `CachedWidget`
|
|
510
|
+
|
|
511
|
+
**Window**: `Window`, `Root`
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
script_mod!{
|
|
2
|
+
// This comment shifts error line info
|
|
3
|
+
use mod.prelude.widgets.*
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// CORRECT - start with real code immediately
|
|
7
|
+
script_mod!{
|
|
8
|
+
use mod.prelude.widgets.*
|
|
9
|
+
// Comments after first code are fine
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Additional Pitfalls
|
|
14
|
+
|
|
15
|
+
- **Cursor values**: Use `cursor: MouseCursor.Hand` not `cursor: Hand` or `cursor: @Hand`
|
|
16
|
+
- **Resource paths**: Use `crate_resource("self://path")` not `dep("crate://self/path")`
|
|
17
|
+
- **Texture declarations**: Use `tex: texture_2d(float)` not `tex: texture2d`
|
|
18
|
+
- **Shader `mod` vs `modf`**: Use `modf(a, b)` for float modulo, NOT `mod(a, b)`
|
|
19
|
+
- **Enum defaults**: Use `default: @off` with `@` prefix for enum default values
|
|
20
|
+
- **DefaultNone derive**: Don't use `DefaultNone` derive; use `#[derive(Default)]` with `#[default]` attribute
|
|
21
|
+
- **Method chaining in shaders**: Use `.method()` not `::method()` (e.g., `Sdf2d.viewport(...)`)
|
|
22
|
+
- **Color mixing**: Prefer `color1.mix(color2, hover)` chaining over nested `mix()` calls
|
|
23
|
+
- **Missing widget registration**: Call `crate::makepad_widgets::script_mod(vm)` in `App::run()` BEFORE your own modules
|
|
24
|
+
|
|
25
|
+
## Syntax Quick Reference
|
|
26
|
+
|
|
27
|
+
| Old (live_design!) | New (script_mod!) |
|
|
28
|
+
|--------------------|-------------------|
|
|
29
|
+
| `<BaseWidget>` | `mod.widgets.BaseWidget{}` or `BaseWidget{}` (if imported) |
|
|
30
|
+
| `{{StructName}}` | `#(Struct::register_widget(vm))` |
|
|
31
|
+
| `(THEME_COLOR_X)` | `theme.color_x` |
|
|
32
|
+
| `<THEME_FONT>` | `theme.font_regular` |
|
|
33
|
+
| `instance hover: 0.0` | `hover: instance(0.0)` |
|
|
34
|
+
| `uniform color: #fff` | `color: uniform(#fff)` |
|
|
35
|
+
| `draw_bg: {}` (replace) | `draw_bg +: {}` (merge) |
|
|
36
|
+
| `default: off` | `default: @off` |
|
|
37
|
+
| `fn pixel(self)` | `pixel: fn()` |
|
|
38
|
+
| `item.apply_over(cx, live!{...})` | `script_apply_eval!(cx, item, {...})` |
|
|
39
|
+
|
|
40
|
+
## Reference Files
|
|
41
|
+
|
|
42
|
+
- [DSL Syntax Reference] -- Complete syntax grammar and examples
|
|
43
|
+
- [Property System] -- Walk, Layout, Draw, and shader properties
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
User: Apply this skill to my current task.
|
|
50
|
+
Assistant: Follow the workflow in this skill, cite limitations, and ask before risky steps.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Limitations
|
|
54
|
+
|
|
55
|
+
- Imported upstream skill; verify credentials, permissions, and safety boundaries before execution.
|
|
56
|
+
- Does not replace environment-specific validation, testing, or maintainer review.
|