@snap/valdi 1.0.8 → 1.1.5
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/.bootstrap/apps/cli_application/BUILD.bazel.template +7 -0
- package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +11 -0
- package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/src/index.ts +1 -0
- package/.bootstrap/apps/ui_application/.eslint.rc +27 -0
- package/.bootstrap/apps/ui_application/BUILD.bazel.template +19 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +21 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/res/valdi@3x.png +0 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/src/App.tsx +133 -0
- package/.bootstrap/apps/ui_application/package.json +24 -0
- package/.bootstrap/modules/polyglot_bridge_module/BUILD.bazel.template +54 -0
- package/.bootstrap/modules/polyglot_bridge_module/android/CalculatorModuleFactory.kt.template +18 -0
- package/.bootstrap/modules/polyglot_bridge_module/ios/SCCCalculatorModuleFactory.m.template +31 -0
- package/.bootstrap/modules/polyglot_bridge_module/src/Calculator.d.ts +4 -0
- package/.bootstrap/modules/polyglot_bridge_module/web/Calculator.ts +11 -0
- package/.bootstrap/modules/polyglot_bridge_module/web/tsconfig.json +16 -0
- package/.bootstrap/modules/polyglot_view_module/BUILD.bazel.template +75 -0
- package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeView.kt.template +41 -0
- package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeViewAttributesBinder.kt.template +17 -0
- package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.h +8 -0
- package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.m +23 -0
- package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.h +8 -0
- package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.m +23 -0
- package/.bootstrap/modules/polyglot_view_module/src/PolyglotCustomView.tsx.template +23 -0
- package/.bootstrap/modules/polyglot_view_module/web/PolyglotWeb.ts.template +30 -0
- package/.bootstrap/modules/polyglot_view_module/web/tsconfig.json +16 -0
- package/.bootstrap/modules/ui_component/BUILD.bazel.template +34 -0
- package/.bootstrap/modules/ui_component/src/NewModuleComponent.tsx +45 -0
- package/.metadata/.bazelrc.template +92 -0
- package/.metadata/.bazelversion.template +1 -0
- package/.metadata/.editorconfig.template +37 -0
- package/.metadata/.eslintrc.js.template +27 -0
- package/.metadata/.gitignore.template +4 -0
- package/.metadata/.prettierrc.json.template +7 -0
- package/.metadata/.watchmanconfig.template +8 -0
- package/.metadata/AGENTS.md.template +16 -0
- package/.metadata/MODULE.bazel.template +62 -0
- package/.metadata/README.md.template +31 -0
- package/.metadata/config.yaml.template +1 -0
- package/.metadata/package.json.template +23 -0
- package/.metadata/skill-reference.tsx.template +8 -0
- package/.metadata/skill-tests-BUILD.bazel.template +21 -0
- package/.metadata/skill-tests-README.md.template +17 -0
- package/.metadata/skill.md.template +27 -0
- package/bundled-skills/registry.json +14 -2
- package/bundled-skills/skills/valdi-animations/skill.md +197 -0
- package/bundled-skills/skills/valdi-async/tests/src/reference.tsx +1 -1
- package/bundled-skills/skills/valdi-bazel/skill.md +21 -2
- package/bundled-skills/skills/valdi-component-dedup/skill.md +263 -0
- package/bundled-skills/skills/valdi-component-tests/tests/test/ProfileCardTest.spec.tsx +1 -1
- package/bundled-skills/skills/valdi-custom-view/skill.md +49 -5
- package/bundled-skills/skills/valdi-error-handling/skill.md +238 -0
- package/bundled-skills/skills/valdi-gestures/skill.md +198 -0
- package/bundled-skills/skills/valdi-inspect/skill.md +217 -0
- package/bundled-skills/skills/valdi-localization/skill.md +142 -0
- package/bundled-skills/skills/valdi-mock-breakdown/skill.md +327 -0
- package/bundled-skills/skills/valdi-mock-iterate/skill.md +216 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/diff.py +392 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/extract_colors.py +277 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/find_icon.py +303 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/snapshot-and-diff.sh +53 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_diff.py +207 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_extract_colors.py +167 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_find_icon.py +188 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/watch-and-diff.sh +181 -0
- package/bundled-skills/skills/valdi-mock-to-module/skill.md +451 -0
- package/bundled-skills/skills/valdi-navigation/skill.md +187 -0
- package/bundled-skills/skills/valdi-overview/skill.md +7 -4
- package/bundled-skills/skills/valdi-perf/skill.md +223 -0
- package/bundled-skills/skills/valdi-polyglot-module/skill.md +131 -12
- package/bundled-skills/skills/valdi-preview/skill.md +303 -0
- package/bundled-skills/skills/valdi-profile/skill.md +126 -0
- package/bundled-skills/skills/valdi-setup/skill.md +55 -5
- package/bundled-skills/skills/valdi-testing/skill.md +23 -7
- package/bundled-skills/skills/valdi-tsx/skill.md +69 -5
- package/bundled-skills/skills/valdi-tsx/tests/src/reference.tsx +29 -5
- package/dist/commands/agentCheck.js +184 -0
- package/dist/commands/analyze.js +16 -0
- package/dist/commands/analyze_commands/duplicates.js +134 -0
- package/dist/commands/bootstrap.js +57 -73
- package/dist/commands/doctor.js +40 -203
- package/dist/commands/hotreload.js +15 -0
- package/dist/commands/inspect.js +16 -0
- package/dist/commands/inspect_commands/contexts.js +55 -0
- package/dist/commands/inspect_commands/devices.js +53 -0
- package/dist/commands/inspect_commands/heap.js +59 -0
- package/dist/commands/inspect_commands/select.js +43 -0
- package/dist/commands/inspect_commands/snapshot.js +129 -0
- package/dist/commands/inspect_commands/snapshot.spec.js +105 -0
- package/dist/commands/inspect_commands/status.js +68 -0
- package/dist/commands/inspect_commands/tree.js +86 -0
- package/dist/commands/preview.js +81 -0
- package/dist/commands/profile.js +16 -0
- package/dist/commands/profile_commands/capture.js +106 -0
- package/dist/commands/projectsync.js +9 -7
- package/dist/commands/skills_commands/install.js +6 -1
- package/dist/commands/skills_commands/update.js +2 -1
- package/dist/core/analyze/clusterer.js +150 -0
- package/dist/core/analyze/fingerprint.js +2 -0
- package/dist/core/analyze/knownPatterns.js +76 -0
- package/dist/core/analyze/parser.js +177 -0
- package/dist/core/analyze/reporter.js +83 -0
- package/dist/core/analyze/scanner.js +172 -0
- package/dist/core/analyze/similarity.js +56 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/packageFiles.spec.js +29 -0
- package/dist/preview/previewGenerator.js +240 -0
- package/dist/preview/previewGenerator.spec.js +203 -0
- package/dist/preview/viewModelParser.js +86 -0
- package/dist/preview/viewModelParser.spec.js +171 -0
- package/dist/setup/DevSetupHelper.js +0 -51
- package/dist/setup/linuxSetup.js +0 -2
- package/dist/setup/macOSSetup.js +1 -4
- package/dist/utils/BazelClient.js +15 -0
- package/dist/utils/daemonClient.js +344 -0
- package/dist/utils/hermesClient.js +252 -0
- package/dist/utils/skillsAdapters.js +86 -5
- package/dist/utils/skillsAdapters.spec.js +60 -0
- package/dist/utils/skillsRegistry.js +8 -0
- package/dist/utils/stringUtils.spec.js +1 -1
- package/package.json +30 -12
- package/dist/setup/versions.js +0 -8
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Usage Instructions for This Module
|
|
2
|
+
#
|
|
3
|
+
# Step 1: Add this module to your `BUILD.bazel` file dependencies:
|
|
4
|
+
# `//src/valdi/{{MODULE_NAME}}`
|
|
5
|
+
#
|
|
6
|
+
# Step 2: Import the module in your `.tsx` file:
|
|
7
|
+
# `import { NewModuleComponent } from '{{MODULE_NAME}}/src/NewModuleComponent';`
|
|
8
|
+
#
|
|
9
|
+
# Step 3: Render the component in your `onRender()` function:
|
|
10
|
+
# `<NewModuleComponent title={'Valdi'}/>`
|
|
11
|
+
|
|
12
|
+
load("@valdi//bzl/valdi:valdi_module.bzl", "valdi_module")
|
|
13
|
+
|
|
14
|
+
valdi_module(
|
|
15
|
+
name = "{{MODULE_NAME}}",
|
|
16
|
+
srcs = glob(
|
|
17
|
+
[
|
|
18
|
+
"src/**/*.ts",
|
|
19
|
+
"src/**/*.tsx",
|
|
20
|
+
],
|
|
21
|
+
),
|
|
22
|
+
res = glob([
|
|
23
|
+
"res/**/*.jpeg",
|
|
24
|
+
"res/**/*.jpg",
|
|
25
|
+
"res/**/*.png",
|
|
26
|
+
"res/**/*.svg",
|
|
27
|
+
"res/**/*.webp",
|
|
28
|
+
]),
|
|
29
|
+
visibility = ["//visibility:public"],
|
|
30
|
+
deps = [
|
|
31
|
+
"@valdi//src/valdi_modules/src/valdi/valdi_core",
|
|
32
|
+
"@valdi//src/valdi_modules/src/valdi/valdi_tsx",
|
|
33
|
+
],
|
|
34
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component } from 'valdi_core/src/Component';
|
|
2
|
+
import { Label, View } from 'valdi_tsx/src/NativeTemplateElements';
|
|
3
|
+
import { systemFont } from 'valdi_core/src/SystemFont';
|
|
4
|
+
import { Style } from 'valdi_core/src/Style';
|
|
5
|
+
|
|
6
|
+
export interface NewModuleViewModel {
|
|
7
|
+
title: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class NewModuleComponent extends Component<NewModuleViewModel> {
|
|
11
|
+
onCreate() {
|
|
12
|
+
// Called when the component is created in the render-tree
|
|
13
|
+
// Used to prepare some resources, precomputed values or subscribe to observables
|
|
14
|
+
}
|
|
15
|
+
onDestroy() {
|
|
16
|
+
// Called the component is not longer in the render-tree
|
|
17
|
+
// Used to dispose of resources and observables
|
|
18
|
+
}
|
|
19
|
+
onViewModelUpdate(previous?: NewModuleViewModel) {
|
|
20
|
+
// Called every time the view model changes
|
|
21
|
+
// Used to trigger some computations, typically used for asynchronous operations,
|
|
22
|
+
// that would then impact the internal component state
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onRender(): void {
|
|
26
|
+
// Called every time the component needs to be rendered
|
|
27
|
+
// Used to define child components and child render-tree
|
|
28
|
+
// Can access "this.viewModel" that contains the current component parameters values
|
|
29
|
+
<view style={styles.root}>
|
|
30
|
+
<label style={styles.label} value={this.viewModel.title} />
|
|
31
|
+
</view>;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = {
|
|
36
|
+
root: new Style<View>({
|
|
37
|
+
backgroundColor: 'red',
|
|
38
|
+
width: '100%',
|
|
39
|
+
height: '100%',
|
|
40
|
+
}),
|
|
41
|
+
label: new Style<Label>({
|
|
42
|
+
font: systemFont(20),
|
|
43
|
+
color: 'white',
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Valdi custom Bazel registry (patched rules_swift, rules_kotlin, etc.)
|
|
2
|
+
common --registry=https://raw.githubusercontent.com/Snapchat/Valdi/{{VALDI_RELEASE_TAG}}/registry
|
|
3
|
+
common --registry=https://bcr.bazel.build
|
|
4
|
+
|
|
5
|
+
common --bes_instance_name=client
|
|
6
|
+
common --enable_platform_specific_config
|
|
7
|
+
|
|
8
|
+
# Disable workers for repo fetching to prevent OOM
|
|
9
|
+
common --experimental_worker_for_repo_fetching=off
|
|
10
|
+
|
|
11
|
+
# android configuration
|
|
12
|
+
# Expose AndroidResourceInfo provider to Kotlin rules
|
|
13
|
+
common --experimental_google_legacy_api=true
|
|
14
|
+
common --experimental_enable_android_migration_apis=true
|
|
15
|
+
common --incompatible_java_common_parameters=false
|
|
16
|
+
|
|
17
|
+
# Flags for compilation
|
|
18
|
+
common --define enable_web=true
|
|
19
|
+
|
|
20
|
+
build --tool_java_language_version=11
|
|
21
|
+
build --java_language_version=11
|
|
22
|
+
|
|
23
|
+
## Disable sandboxing for macs, both laptops and in CI; the performance hit is much too high.
|
|
24
|
+
build:macos --spawn_strategy=local
|
|
25
|
+
build:linux --sandbox_writable_path=/var/tmp
|
|
26
|
+
|
|
27
|
+
# common cc configuration
|
|
28
|
+
build --cxxopt=-std=c++20
|
|
29
|
+
build --cxxopt=-Wno-ambiguous-reversed-operator
|
|
30
|
+
build --cxxopt=-Wno-nullability-extension
|
|
31
|
+
build --cxxopt=-D_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
|
|
32
|
+
build --host_cxxopt=-std=c++20
|
|
33
|
+
build --host_cxxopt=-Wno-nullability-extension
|
|
34
|
+
|
|
35
|
+
## we need to disable this due to a bug in bazel
|
|
36
|
+
## see https://github.com/bazelbuild/bazel/issues/12381
|
|
37
|
+
build --incompatible_use_specific_tool_files=false
|
|
38
|
+
build --incompatible_enable_cc_toolchain_resolution
|
|
39
|
+
|
|
40
|
+
# iOS and Apple cc changes and hacks
|
|
41
|
+
## For Objective-C source files
|
|
42
|
+
build --per_file_copt=.*\.mm\$@-std=c++20
|
|
43
|
+
build --host_per_file_copt=.*\.mm\$@-std=c++20
|
|
44
|
+
build --ios_minimum_os=12.0
|
|
45
|
+
|
|
46
|
+
## TODO: (dchapp) this is currently needed otherwise -O0 and -DDEBUG=1 get passed to compilations of .mm/.m for production flavor builds
|
|
47
|
+
build --experimental_objc_fastbuild_options=""
|
|
48
|
+
## HACK inject this in the default toolchain which is only used on macos until we switch to bazel_toolchains
|
|
49
|
+
build:macos --copt=-fvisibility=hidden
|
|
50
|
+
|
|
51
|
+
# java configuration
|
|
52
|
+
## Disable some java checks for now, djinni generates code that errors out
|
|
53
|
+
build --javacopt=-XepDisableAllChecks
|
|
54
|
+
build --java_runtime_version=11
|
|
55
|
+
build --tool_java_runtime_version=17
|
|
56
|
+
|
|
57
|
+
build --flag_alias=snap_flavor=@snap_platforms//flavors:snap_flavor
|
|
58
|
+
build --snap_flavor=platform_development
|
|
59
|
+
|
|
60
|
+
build --android_crosstool_top=@androidndk//:toolchain
|
|
61
|
+
build --define=android_dexmerger_tool=d8_dexmerger
|
|
62
|
+
build --define=android_incremental_dexing_tool=d8_dexbuilder
|
|
63
|
+
build --define=android_standalone_dexing_tool=d8_compat_dx
|
|
64
|
+
build --incremental_dexing
|
|
65
|
+
|
|
66
|
+
# Disable 3rd party libs warnings
|
|
67
|
+
build --per_file_copt=external/com_google_protobuf/.*\$@-Wno-everything
|
|
68
|
+
build --per_file_copt=external/boringssl/.*\$@-Wno-everything
|
|
69
|
+
|
|
70
|
+
# Enable persistent worker for Valdi compilation
|
|
71
|
+
build --strategy=ValdiCompile=worker
|
|
72
|
+
|
|
73
|
+
## Disable sandboxing for macs, both laptops and in CI; the performance hit is much too high.
|
|
74
|
+
build:macos --spawn_strategy=local
|
|
75
|
+
build:linux --sandbox_writable_path=/var/tmp
|
|
76
|
+
|
|
77
|
+
# Disable disk cache to save disk space
|
|
78
|
+
# https://docs.google.com/document/d/1N8W_M83n9jhMi7pgUhXuEuxypb3dmlHBu_CG_eXipXI/edit?usp=sharing
|
|
79
|
+
build --disk_cache=""
|
|
80
|
+
|
|
81
|
+
# common build configuration
|
|
82
|
+
build --experimental_generate_json_trace_profile
|
|
83
|
+
# enable grpc log
|
|
84
|
+
build --remote_grpc_log=/tmp/snap_client_grpc.log
|
|
85
|
+
build --experimental_reuse_sandbox_directories
|
|
86
|
+
|
|
87
|
+
# Default JS engine
|
|
88
|
+
build --flag_alias=valdi_js_engine=@valdi//bzl/valdi:js_engine
|
|
89
|
+
build --valdi_js_engine=hermes
|
|
90
|
+
|
|
91
|
+
# Valdi Open Source Flags
|
|
92
|
+
build --define=open_source_build=true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.2.1
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
|
|
9
|
+
[*.{ts,tsx,js,jsx}]
|
|
10
|
+
indent_style = space
|
|
11
|
+
indent_size = 2
|
|
12
|
+
|
|
13
|
+
[*.{cpp,hpp,h,cc}]
|
|
14
|
+
indent_style = space
|
|
15
|
+
indent_size = 4
|
|
16
|
+
|
|
17
|
+
[*.{swift,kt,java}]
|
|
18
|
+
indent_style = space
|
|
19
|
+
indent_size = 4
|
|
20
|
+
|
|
21
|
+
[*.{yml,yaml,json}]
|
|
22
|
+
indent_style = space
|
|
23
|
+
indent_size = 2
|
|
24
|
+
|
|
25
|
+
[*.{bzl,bazel,BUILD}]
|
|
26
|
+
indent_style = space
|
|
27
|
+
indent_size = 4
|
|
28
|
+
|
|
29
|
+
[*.md]
|
|
30
|
+
trim_trailing_whitespace = false
|
|
31
|
+
|
|
32
|
+
[*.{mm,m}]
|
|
33
|
+
indent_style = space
|
|
34
|
+
indent_size = 4
|
|
35
|
+
|
|
36
|
+
[Makefile]
|
|
37
|
+
indent_style = tab
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports = {
|
|
3
|
+
root: true,
|
|
4
|
+
parser: '@typescript-eslint/parser',
|
|
5
|
+
parserOptions: {
|
|
6
|
+
tsconfigRootDir: __dirname,
|
|
7
|
+
project: ['./src/valdi/_configs/eslint.tsconfig.json'],
|
|
8
|
+
},
|
|
9
|
+
plugins: ['@typescript-eslint', 'unused-imports', 'rxjs', 'prettier', '@snapchat/eslint-plugin-valdi'],
|
|
10
|
+
extends: [
|
|
11
|
+
'eslint:recommended',
|
|
12
|
+
'plugin:@typescript-eslint/recommended',
|
|
13
|
+
'plugin:import/recommended',
|
|
14
|
+
'plugin:import/typescript',
|
|
15
|
+
'prettier',
|
|
16
|
+
],
|
|
17
|
+
rules: {
|
|
18
|
+
'@snapchat/valdi/attributed-text-no-array-assignment': 'error',
|
|
19
|
+
'@snapchat/valdi/jsx-no-lambda': 'error',
|
|
20
|
+
'@snapchat/valdi/assign-timer-id': 'error',
|
|
21
|
+
'@snapchat/valdi/only-const-enum': 'off',
|
|
22
|
+
'@snapchat/valdi/no-implicit-index-import': 'error',
|
|
23
|
+
'@snapchat/valdi/mutate-state-without-set-state': 'error',
|
|
24
|
+
'@snapchat/valdi/no-import-from-test-outside-test-dir': 'error',
|
|
25
|
+
'@snapchat/valdi/no-declare-test-without-describe': 'error',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# AI Assistant Context
|
|
2
|
+
|
|
3
|
+
This is a Valdi application. Valdi compiles TypeScript/TSX to native iOS, Android, and macOS views — it is **not React**.
|
|
4
|
+
|
|
5
|
+
## Get AI Skills
|
|
6
|
+
|
|
7
|
+
Install context files so your AI tool generates correct Valdi code instead of React patterns:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @snap/valdi
|
|
11
|
+
valdi skills install # installs skills for Claude Code, Cursor, or Copilot
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Skills are bundled in the npm package and work offline. They cover component patterns, lifecycle, async handling, build rules, testing, and platform bridging.
|
|
15
|
+
|
|
16
|
+
For documentation and support: https://github.com/Snapchat/Valdi
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module(name = "{{WORKSPACE_NAME}}", version = "0.1")
|
|
2
|
+
|
|
3
|
+
# -- Valdi framework (https://github.com/Snapchat/Valdi) ---------------------
|
|
4
|
+
VALDI_TAG = "{{VALDI_RELEASE_TAG}}"
|
|
5
|
+
VALDI_URL = "https://github.com/Snapchat/Valdi/archive/" + VALDI_TAG + ".tar.gz"
|
|
6
|
+
VALDI_PREFIX = "Valdi-" + VALDI_TAG
|
|
7
|
+
|
|
8
|
+
bazel_dep(name = "valdi", version = "0.1")
|
|
9
|
+
archive_override(
|
|
10
|
+
module_name = "valdi",
|
|
11
|
+
urls = [VALDI_URL],
|
|
12
|
+
strip_prefix = VALDI_PREFIX,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# Valdi internal sub-modules: local_path_override in Valdi's own MODULE.bazel
|
|
16
|
+
# only takes effect when Valdi is the root module. Consumers must provide
|
|
17
|
+
# archive_override entries that point into the Valdi release archive.
|
|
18
|
+
bazel_dep(name = "android_macros")
|
|
19
|
+
archive_override(module_name = "android_macros", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bzl/macros")
|
|
20
|
+
|
|
21
|
+
bazel_dep(name = "snap_macros")
|
|
22
|
+
archive_override(module_name = "snap_macros", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bzl/valdi/snap_macros")
|
|
23
|
+
|
|
24
|
+
bazel_dep(name = "snap_client_toolchains")
|
|
25
|
+
archive_override(module_name = "snap_client_toolchains", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bzl/toolchains")
|
|
26
|
+
|
|
27
|
+
bazel_dep(name = "snap_platforms")
|
|
28
|
+
archive_override(module_name = "snap_platforms", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bzl/platforms")
|
|
29
|
+
|
|
30
|
+
bazel_dep(name = "skia_user_config")
|
|
31
|
+
archive_override(module_name = "skia_user_config", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/third-party/skia_user_config")
|
|
32
|
+
|
|
33
|
+
bazel_dep(name = "rules_hdrs")
|
|
34
|
+
archive_override(module_name = "rules_hdrs", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/third-party/rules_hdrs")
|
|
35
|
+
|
|
36
|
+
bazel_dep(name = "valdi_toolchain")
|
|
37
|
+
archive_override(module_name = "valdi_toolchain", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bin")
|
|
38
|
+
|
|
39
|
+
bazel_dep(name = "resvg_libs")
|
|
40
|
+
archive_override(module_name = "resvg_libs", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/third-party/resvg/resvg_libs")
|
|
41
|
+
|
|
42
|
+
# -- Valdi Widgets (https://github.com/Snapchat/Valdi_Widgets) ---------------
|
|
43
|
+
WIDGETS_TAG = "{{VALDI_WIDGETS_RELEASE_TAG}}"
|
|
44
|
+
|
|
45
|
+
bazel_dep(name = "valdi_widgets")
|
|
46
|
+
archive_override(
|
|
47
|
+
module_name = "valdi_widgets",
|
|
48
|
+
urls = ["https://github.com/Snapchat/Valdi_Widgets/archive/" + WIDGETS_TAG + ".tar.gz"],
|
|
49
|
+
strip_prefix = "Valdi_Widgets-" + WIDGETS_TAG,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# -- C++ toolchains (Apple CC before LLVM for ObjC priority) ------------------
|
|
53
|
+
valdi_toolchains = use_extension("@valdi//bzl:valdi_toolchains.bzl", "valdi_toolchains")
|
|
54
|
+
use_repo(valdi_toolchains, "local_config_apple_cc_toolchains", "local_config_apple_cc", "llvm_toolchain", "llvm_toolchain_llvm")
|
|
55
|
+
register_toolchains("@local_config_apple_cc_toolchains//:all")
|
|
56
|
+
register_toolchains("@llvm_toolchain//:all")
|
|
57
|
+
|
|
58
|
+
# -- Version pins (must match Valdi's MODULE.bazel) ---------------------------
|
|
59
|
+
single_version_override(module_name = "protobuf", version = "27.0")
|
|
60
|
+
single_version_override(module_name = "rules_apple", version = "4.0.0")
|
|
61
|
+
single_version_override(module_name = "rules_pkg", version = "0.9.1")
|
|
62
|
+
single_version_override(module_name = "zlib", version = "1.3.2")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# valdi_demo
|
|
2
|
+
Demo of a hello world app using Valdi open source
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
All commands requires `valdi` to be available on PATH.
|
|
7
|
+
|
|
8
|
+
Get auto completion in VSCode
|
|
9
|
+
```sh
|
|
10
|
+
valdi projectsync
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Build and install iOS:
|
|
14
|
+
```sh
|
|
15
|
+
valdi install ios
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Build and install Android:
|
|
19
|
+
```sh
|
|
20
|
+
valdi install android
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Build and install MacOS:
|
|
24
|
+
```sh
|
|
25
|
+
valdi install macos
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Start hot reloader:
|
|
29
|
+
```sh
|
|
30
|
+
valdi hotreload
|
|
31
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
logs_output_dir: ~/.valdi/logs
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hello_world",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Valdi Helloworld app",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@snap/eslint-plugin-valdi": "1.0.2",
|
|
8
|
+
"@types/eslint": "^9.6.1",
|
|
9
|
+
"@types/jasmine": "^5.1.7",
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
11
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
12
|
+
"@typescript-eslint/utils": "^6.21.0",
|
|
13
|
+
"eslint": "^8.27.0",
|
|
14
|
+
"eslint-config-prettier": "^8.5.0",
|
|
15
|
+
"eslint-plugin-import": "^2.26.0",
|
|
16
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
17
|
+
"eslint-plugin-rxjs": "^5.0.2",
|
|
18
|
+
"eslint-plugin-unused-imports": "^3.2.0",
|
|
19
|
+
"jasmine": "^5.6.0",
|
|
20
|
+
"ts-node": "^10.9.2",
|
|
21
|
+
"typescript": "5.3.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SKILL_NAME skill reference — compile check for patterns in ../skill.md.
|
|
2
|
+
// Add code that exercises every import path and API shown in the skill.
|
|
3
|
+
// Run: bazel build //ai-skills/skills/SKILL_NAME/tests:tests
|
|
4
|
+
|
|
5
|
+
import { Component } from 'valdi_core/src/Component';
|
|
6
|
+
|
|
7
|
+
// TODO: add reference examples here
|
|
8
|
+
void Component;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
load("//bzl/valdi:valdi_module.bzl", "valdi_module")
|
|
2
|
+
|
|
3
|
+
valdi_module(
|
|
4
|
+
name = "tests",
|
|
5
|
+
srcs = glob([
|
|
6
|
+
"src/**/*.ts",
|
|
7
|
+
"src/**/*.tsx",
|
|
8
|
+
]) + [
|
|
9
|
+
"tsconfig.json",
|
|
10
|
+
],
|
|
11
|
+
android_output_target = "release",
|
|
12
|
+
ios_module_name = "SKILL_IOS_MODULE_NAME",
|
|
13
|
+
ios_output_target = "release",
|
|
14
|
+
visibility = ["//visibility:public"],
|
|
15
|
+
deps = [
|
|
16
|
+
# Add deps for the imports used in src/reference.tsx
|
|
17
|
+
# Common options: valdi_core, valdi_tsx, valdi_http, foundation, valdi_test, jasmine
|
|
18
|
+
"//src/valdi_modules/src/valdi/valdi_core",
|
|
19
|
+
"//src/valdi_modules/src/valdi/valdi_tsx",
|
|
20
|
+
],
|
|
21
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# SKILL_NAME skill tests
|
|
2
|
+
|
|
3
|
+
Compile check for the patterns taught in `../skill.md`.
|
|
4
|
+
|
|
5
|
+
## Compile check
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd client/src/open_source
|
|
9
|
+
bazel build //ai-skills/skills/SKILL_NAME/tests:tests
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Expected: `Build completed successfully`
|
|
13
|
+
|
|
14
|
+
## Updating
|
|
15
|
+
|
|
16
|
+
When Valdi APIs change (import paths, type signatures), update `src/reference.tsx` to match.
|
|
17
|
+
Also update `../skill.md` with any corrected patterns.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# SKILL_NAME
|
|
2
|
+
|
|
3
|
+
SKILL_DESCRIPTION
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
Describe the scenarios or file types where this skill applies.
|
|
8
|
+
|
|
9
|
+
## Key concepts
|
|
10
|
+
|
|
11
|
+
Explain the important concepts for this area of Valdi.
|
|
12
|
+
|
|
13
|
+
## Correct patterns
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// ✅ Correct example
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Common mistakes
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// ❌ Wrong example — explain why
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## More information
|
|
26
|
+
|
|
27
|
+
- Valdi docs: https://github.com/Snapchat/Valdi
|
|
@@ -12,9 +12,21 @@
|
|
|
12
12
|
{ "name": "valdi-custom-view", "description": "Valdi custom native view integration", "tags": ["custom-view", "native"], "path": "skills/valdi-custom-view/skill.md", "category": ["client"] },
|
|
13
13
|
{ "name": "valdi-overview", "description": "Valdi framework overview and project conventions", "tags": ["overview", "conventions"], "path": "skills/valdi-overview/skill.md", "category": ["client"] },
|
|
14
14
|
{ "name": "valdi-async", "description": "Valdi async lifecycle safety: CancelablePromise, registerDisposable, isDestroyed guards", "tags": ["async", "lifecycle", "http"], "path": "skills/valdi-async/skill.md", "category": ["client"] },
|
|
15
|
-
{ "name": "valdi-perf", "description": "Valdi performance: viewModel identity stability, createReusableCallback, layout vs view, Style interning", "tags": ["performance", "rendering"], "path": "skills/valdi-perf/skill.md", "category": ["client"] },
|
|
15
|
+
{ "name": "valdi-perf", "description": "Valdi performance: viewModel identity stability, createReusableCallback, layout vs view, Style interning, deferring subscriptions to unblock first paint, lazy initialization with Lazy<T>, Provider<T>, dynamic import(), excessive setState calls and batching, caching expensive observables with cacheObservable to avoid switchMap re-subscription cost, when to offload heavy work to a Worker Service", "tags": ["performance", "rendering", "worker-service", "first-paint", "lazy", "deferred-init", "setState", "observables", "rxjs", "cacheObservable"], "path": "skills/valdi-perf/skill.md", "category": ["client"] },
|
|
16
16
|
{ "name": "valdi-component-tests", "description": "Valdi component test patterns: elementKeyFind, componentTypeFind, tapNodeWithKey, discriminated unions, arrays", "tags": ["testing", "components", "jasmine"], "path": "skills/valdi-component-tests/skill.md", "category": ["client"] },
|
|
17
17
|
{ "name": "valdi-setup", "description": "Valdi module setup: BUILD.bazel, valdi_module(), tsconfig, deps, ios_module_name, hot reload", "tags": ["setup", "bazel", "build"], "path": "skills/valdi-setup/skill.md", "category": ["client"] },
|
|
18
|
-
{ "name": "valdi-migrate", "description": "Migrate Flutter, React, or Jetpack Compose code to Valdi — component model, lifecycle, element mapping tables", "tags": ["migration", "flutter", "react", "compose"], "path": "skills/valdi-migrate/skill.md", "category": ["client"] }
|
|
18
|
+
{ "name": "valdi-migrate", "description": "Migrate Flutter, React, or Jetpack Compose code to Valdi — component model, lifecycle, element mapping tables", "tags": ["migration", "flutter", "react", "compose"], "path": "skills/valdi-migrate/skill.md", "category": ["client"] },
|
|
19
|
+
{ "name": "valdi-inspect", "description": "Inspect a live Valdi app: contexts, component trees, screenshots, heap dumps via valdi inspect CLI", "tags": ["inspect", "debug", "runtime", "cli"], "path": "skills/valdi-inspect/skill.md", "category": ["client"] },
|
|
20
|
+
{ "name": "valdi-preview", "description": "Preview a Valdi component: read its API, render it in the preview harness, inspect the view tree, and capture screenshots", "tags": ["preview", "inspect", "components", "widgets"], "path": "skills/valdi-preview/skill.md", "category": ["client"] },
|
|
21
|
+
{ "name": "valdi-mock-breakdown", "description": "Generate Valdi TSX from a screenshot or design mock: analyze layout, decompose into components, produce code", "tags": ["mock", "codegen", "design", "screenshot", "ai"], "path": "skills/valdi-mock-breakdown/skill.md", "category": ["client"] },
|
|
22
|
+
{ "name": "valdi-mock-iterate", "description": "Compare a design mock against a rendered Valdi screenshot and produce specific visual diff feedback", "tags": ["mock", "critique", "visual-diff", "iterate", "ai"], "path": "skills/valdi-mock-iterate/skill.md", "category": ["client"] },
|
|
23
|
+
{ "name": "valdi-mock-to-module", "description": "Turn a screenshot into a running Valdi module: orchestrates breakdown, preview, and critic iteration loop", "tags": ["mock", "codegen", "pipeline", "orchestrator", "ai"], "path": "skills/valdi-mock-to-module/skill.md", "category": ["client"] },
|
|
24
|
+
{ "name": "valdi-profile", "description": "Capture CPU profiles from a running Valdi app: diagnose slow renders, identify hot functions, understand JS thread activity", "tags": ["profile", "performance", "debug", "cli"], "path": "skills/valdi-profile/skill.md", "category": ["client"] },
|
|
25
|
+
{ "name": "valdi-navigation", "description": "Multi-screen navigation: NavigationRoot, push/pop/present/dismiss, NavigationPageComponent, back button handling", "tags": ["navigation", "routing", "pages", "modal"], "path": "skills/valdi-navigation/skill.md", "category": ["client"] },
|
|
26
|
+
{ "name": "valdi-animations", "description": "Imperative animation API: animate/animatePromise, AnimationOptions, spring physics, setStateAnimated", "tags": ["animation", "transitions", "spring"], "path": "skills/valdi-animations/skill.md", "category": ["client"] },
|
|
27
|
+
{ "name": "valdi-gestures", "description": "Touch and gesture handling: onTap, onDrag, onPinch, onRotate, onLongPress, TouchEvent, gesture predicates", "tags": ["gestures", "touch", "input"], "path": "skills/valdi-gestures/skill.md", "category": ["client"] },
|
|
28
|
+
{ "name": "valdi-localization", "description": "Internationalization: strings-en.json, Strings.d.ts generation, template variables, valdi projectsync", "tags": ["localization", "i18n", "strings"], "path": "skills/valdi-localization/skill.md", "category": ["client"] },
|
|
29
|
+
{ "name": "valdi-error-handling", "description": "Error handling patterns: CancelablePromise safety, HTTPClient errors, isDestroyed guards, error UI states", "tags": ["errors", "async", "lifecycle", "safety"], "path": "skills/valdi-error-handling/skill.md", "category": ["client"] },
|
|
30
|
+
{ "name": "valdi-component-dedup", "description": "Find and extract duplicated component patterns across Valdi modules into shared libraries", "tags": ["deduplication", "analysis", "refactoring", "ai"], "path": "skills/valdi-component-dedup/skill.md", "category": ["client"] }
|
|
19
31
|
]
|
|
20
32
|
}
|