Showing preview only (1,569K chars total). Download the full file or copy to clipboard to get everything.
Repository: revery-ui/revery
Branch: master
Commit: 141f70f69d6a
Files: 471
Total size: 1.4 MB
Directory structure:
gitextract_o1re1h8t/
├── .ci/
│ ├── .gitattributes
│ ├── create-docs.yml
│ ├── esy-bench.yml
│ ├── esy-build-steps.yml
│ ├── esy-check-hygiene.yml
│ ├── format.sh
│ ├── publish-build-cache.yml
│ ├── publish-release.yml
│ ├── restore-build-cache.yml
│ └── use-node.yml
├── .gitattributes
├── .github/
│ ├── FUNDING.yml
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── Revery.opam
├── ReveryBench.opam
├── ReveryExampleJs.opam
├── ReveryExamples.opam
├── ReveryTest.opam
├── ThirdPartyLicenses.txt
├── azure-pipelines.yml
├── bench/
│ ├── exe/
│ │ ├── Bench.re
│ │ └── dune
│ └── lib/
│ ├── BenchFramework.re
│ ├── DrawBench.re
│ ├── LayoutBench.re
│ ├── NodeUtility.re
│ ├── PaintBench.re
│ ├── RecalculateBench.re
│ ├── SurfaceUtility.re
│ ├── ViewNodeBench.re
│ └── dune
├── bench.json
├── doc.json
├── dune
├── dune-project
├── dune-workspace
├── examples/
│ ├── AnalogClock.re
│ ├── Border.re
│ ├── Boxshadow.re
│ ├── Calculator.re
│ ├── CanQuitExample.re
│ ├── CanvasExample.re
│ ├── CheckboxExample.re
│ ├── DefaultButton.re
│ ├── DropdownExample.re
│ ├── Examples.re
│ ├── FileDragAndDrop.re
│ ├── Flexbox.re
│ ├── FocusExample.re
│ ├── FontAwesome5FreeSolid.otf
│ ├── FontsExample.re
│ ├── GameOfLife.re
│ ├── Hello.re
│ ├── HitTests.re
│ ├── HoverExample.re
│ ├── ImageQualityExample.re
│ ├── Info.plist
│ ├── InputExample.re
│ ├── LayerExample.re
│ ├── MarkdownExample.re
│ ├── NativeFileExample.re
│ ├── NativeIconExample.re
│ ├── NativeInputExample.re
│ ├── NativeMenuExample.re
│ ├── NativeNotificationExample.re
│ ├── NestedClickable.re
│ ├── RadioButtonExample.re
│ ├── RichTextExample.re
│ ├── SVGExample.re
│ ├── ScreenCapture.re
│ ├── ScrollView.re
│ ├── Slider.re
│ ├── SpringExample.re
│ ├── Stopwatch.re
│ ├── TextExample.re
│ ├── TodoExample.re
│ ├── TreeView.re
│ ├── URLFileOpen.re
│ ├── WavFilePlaybackExample.re
│ ├── WindowControl.re
│ ├── ZoomExample.re
│ ├── dune
│ ├── gl-matrix-min.js
│ ├── index.html
│ └── stubs/
│ ├── ExampleStubs.re
│ ├── dune
│ ├── example_stubs.c
│ └── example_stubs.js
├── examples.json
├── include/
│ ├── COPYING.txt
│ ├── KHR/
│ │ └── khrplatform.h
│ ├── glad/
│ │ └── glad.h
│ └── stb_image.h
├── js.json
├── lsan.supp
├── package.json
├── packages/
│ ├── reason-harfbuzz/
│ │ ├── examples/
│ │ │ └── harfbuzz-cli/
│ │ │ ├── HarfbuzzCli.re
│ │ │ ├── dune
│ │ │ └── run-harfbuzz.sh
│ │ ├── src/
│ │ │ ├── Harfbuzz.re
│ │ │ ├── Harfbuzz.rei
│ │ │ ├── config/
│ │ │ │ ├── discover.re
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ └── harfbuzz.cpp
│ │ └── test/
│ │ ├── FeaturesTest.re
│ │ ├── ShapingTest.re
│ │ ├── TestFramework.re
│ │ └── dune
│ ├── reason-sdl2/
│ │ └── src/
│ │ ├── Float32Array.re
│ │ ├── Uint16Array.re
│ │ ├── config/
│ │ │ ├── discover.re
│ │ │ └── dune
│ │ ├── dune
│ │ ├── sdl2.re
│ │ ├── sdl2_stubs.js
│ │ ├── sdl2_wrapper.cpp
│ │ └── stb_image.cpp
│ ├── reason-skia/
│ │ ├── bench/
│ │ │ ├── BenchFramework.re
│ │ │ ├── CanvasBench.re
│ │ │ ├── ColorBench.re
│ │ │ ├── MatrixBench.re
│ │ │ ├── RectBench.re
│ │ │ ├── SkiaPaintBench.re
│ │ │ └── dune
│ │ ├── examples/
│ │ │ ├── skia-cli/
│ │ │ │ ├── LICENSE_FiraCode.txt
│ │ │ │ ├── LICENSE_ORBITRON.md
│ │ │ │ ├── SkiaCli.re
│ │ │ │ └── dune
│ │ │ ├── skia-font-manager-cli/
│ │ │ │ ├── SkiaFontManagerCli.re
│ │ │ │ ├── dune
│ │ │ │ └── run-skia-fontmanager.sh
│ │ │ └── skia-sdl2/
│ │ │ ├── SkiaSdl.re
│ │ │ └── dune
│ │ ├── src/
│ │ │ ├── Skia.re
│ │ │ ├── Skia.rei
│ │ │ ├── config/
│ │ │ │ ├── discover.re
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ └── wrapped/
│ │ │ ├── bindings/
│ │ │ │ ├── SkiaWrappedBindings.re
│ │ │ │ └── dune
│ │ │ ├── c/
│ │ │ │ ├── c_stubs.c
│ │ │ │ ├── c_stubs.h
│ │ │ │ └── dune
│ │ │ ├── lib/
│ │ │ │ ├── SkiaWrapped.re
│ │ │ │ ├── dune
│ │ │ │ └── raw_bindings.c
│ │ │ ├── stubgen/
│ │ │ │ ├── dune
│ │ │ │ ├── stubgen.ml
│ │ │ │ └── types_stubgen.ml
│ │ │ └── types/
│ │ │ ├── SkiaWrappedTypes.re
│ │ │ └── dune
│ │ └── test/
│ │ ├── ColorTest.re
│ │ ├── MatrixTest.re
│ │ ├── PaintTest.re
│ │ ├── RectTest.re
│ │ ├── TestFramework.re
│ │ └── dune
│ ├── revery-text-wrap/
│ │ ├── examples/
│ │ │ └── text-wrap-cli/
│ │ │ ├── ReveryTextWrapCli.re
│ │ │ └── dune
│ │ └── src/
│ │ ├── Revery_TextWrap.re
│ │ ├── Revery_TextWrap.rei
│ │ ├── Tokenize.re
│ │ └── dune
│ └── zed/
│ └── src/
│ ├── dune
│ ├── zed_utf8.ml
│ └── zed_utf8.mli
├── reason-harfbuzz.opam
├── reason-sdl2.opam
├── reason-skia.opam
├── scripts/
│ ├── docker/
│ │ ├── archlinux/
│ │ │ └── Dockerfile
│ │ └── centos/
│ │ └── Dockerfile
│ ├── docker-build.sh
│ ├── make-binary-file.js
│ └── release.sh
├── src/
│ ├── Core/
│ │ ├── App.re
│ │ ├── App.rei
│ │ ├── Color.re
│ │ ├── Color.rei
│ │ ├── Colors.re
│ │ ├── Environment.re
│ │ ├── Environment.rei
│ │ ├── Event.re
│ │ ├── Events.re
│ │ ├── GarbageCollector.re
│ │ ├── Key.re
│ │ ├── Key.rei
│ │ ├── Log.re
│ │ ├── Log.rei
│ │ ├── MouseButton.re
│ │ ├── MouseButton.rei
│ │ ├── MouseCursors.re
│ │ ├── MouseCursors.rei
│ │ ├── Performance.re
│ │ ├── Revery_Core.re
│ │ ├── TextOverflow.re
│ │ ├── TextWrapping.re
│ │ ├── Tick.re
│ │ ├── Time.re
│ │ ├── Time.rei
│ │ ├── UniqueId.re
│ │ ├── Vsync.re
│ │ ├── Window.re
│ │ ├── Window.rei
│ │ ├── WindowCreateOptions.re
│ │ ├── WindowStyles.re
│ │ └── dune
│ ├── Draw/
│ │ ├── CanvasContext.re
│ │ ├── DebugDraw.re
│ │ ├── ImageResizeMode.re
│ │ ├── Revery_Draw.re
│ │ ├── Text.re
│ │ ├── Text.rei
│ │ └── dune
│ ├── Font/
│ │ ├── Discovery.re
│ │ ├── Feature.re
│ │ ├── Feature.rei
│ │ ├── Features.re
│ │ ├── Features.rei
│ │ ├── FontCache.re
│ │ ├── FontCache.rei
│ │ ├── FontFamily.re
│ │ ├── FontFamily.rei
│ │ ├── FontManager.re
│ │ ├── FontMetrics.re
│ │ ├── FontRenderer.re
│ │ ├── FontWeight.re
│ │ ├── FontWidth.re
│ │ ├── Revery_Font.re
│ │ ├── ShapeResult.re
│ │ ├── Smoothing.re
│ │ ├── dune
│ │ └── files/
│ │ └── Inconsolata.otf
│ ├── IO/
│ │ ├── File.re
│ │ ├── File.rei
│ │ ├── Image.re
│ │ ├── Image.rei
│ │ ├── LwtLetOperators.re
│ │ ├── Revery_IO.re
│ │ └── dune
│ ├── Lwt/
│ │ ├── Revery_Lwt.re
│ │ └── dune
│ ├── Math/
│ │ ├── Angle.re
│ │ ├── BoundingBox2d.re
│ │ ├── BoundingBox2d.rei
│ │ ├── Revery_Math.re
│ │ └── dune
│ ├── Native/
│ │ ├── Dialog.re
│ │ ├── Environment.re
│ │ ├── Gtk.re
│ │ ├── Icon.re
│ │ ├── Initialization.re
│ │ ├── Input.re
│ │ ├── Input.rei
│ │ ├── Locale.re
│ │ ├── Menu.re
│ │ ├── Menu.rei
│ │ ├── NSObject.re
│ │ ├── NSView.re
│ │ ├── Notification.re
│ │ ├── ReveryCocoa.h
│ │ ├── ReveryGtk.h
│ │ ├── ReveryLinux.h
│ │ ├── ReveryMac.h
│ │ ├── ReveryNSObject.c
│ │ ├── ReveryWin32.h
│ │ ├── ReveryWindows.h
│ │ ├── Revery_Native.c
│ │ ├── Revery_Native.re
│ │ ├── Shell.re
│ │ ├── Window.re
│ │ ├── caml_values.h
│ │ ├── cocoa/
│ │ │ ├── ReveryAppDelegate.c
│ │ │ ├── ReveryAppDelegate.h
│ │ │ ├── ReveryAppDelegate_func.c
│ │ │ ├── ReveryAppDelegate_func.h
│ │ │ ├── ReveryButtonTarget.c
│ │ │ ├── ReveryButtonTarget.h
│ │ │ ├── ReveryMenuItemTarget.c
│ │ │ ├── ReveryMenuItemTarget.h
│ │ │ ├── ReveryNSView.c
│ │ │ ├── ReveryNSViewCoords.c
│ │ │ ├── ReveryNSViewCoords.h
│ │ │ ├── ReveryProgressBar.c
│ │ │ ├── ReveryProgressBar.h
│ │ │ └── SDLAppDelegate.h
│ │ ├── config/
│ │ │ ├── discover.re
│ │ │ └── dune
│ │ ├── dialog.c
│ │ ├── dialog.js
│ │ ├── dialog_cocoa.c
│ │ ├── dialog_gtk.c
│ │ ├── dialog_win32.c
│ │ ├── dune
│ │ ├── environment.c
│ │ ├── environment_linux.c
│ │ ├── environment_mac.c
│ │ ├── environment_windows.c
│ │ ├── gtk/
│ │ │ ├── ReveryGtk.c
│ │ │ └── ReveryGtk_Widget.c
│ │ ├── icon.c
│ │ ├── icon_cocoa.c
│ │ ├── icon_win32.c
│ │ ├── input.c
│ │ ├── input_cocoa.c
│ │ ├── locale.c
│ │ ├── locale_cocoa.c
│ │ ├── locale_win32.c
│ │ ├── menu.c
│ │ ├── menu.h
│ │ ├── menu_cocoa.c
│ │ ├── notification.c
│ │ ├── notification_cocoa.c
│ │ ├── shell.c
│ │ ├── shell_cocoa.c
│ │ ├── shell_gtk.c
│ │ ├── shell_win32.c
│ │ ├── utilities.c
│ │ ├── utilities.h
│ │ ├── win32_target.h
│ │ ├── window.c
│ │ └── window_cocoa.c
│ ├── Platform.re
│ ├── Revery.re
│ ├── UI/
│ │ ├── Animation.re
│ │ ├── Animation.rei
│ │ ├── CanvasNode.re
│ │ ├── Container.re
│ │ ├── Dimensions.re
│ │ ├── Easing.re
│ │ ├── FileDrop.re
│ │ ├── Focus.re
│ │ ├── Focus.rei
│ │ ├── HitTest.re
│ │ ├── ImageNode.re
│ │ ├── ImageResizeMode.re
│ │ ├── Keyboard.re
│ │ ├── LayerNode.re
│ │ ├── Layout.re
│ │ ├── Mouse.re
│ │ ├── Mouse.rei
│ │ ├── NativeButtonNode.re
│ │ ├── Node.re
│ │ ├── NodeDrawContext.re
│ │ ├── NodeEvents.re
│ │ ├── Offset.re
│ │ ├── Overflow.re
│ │ ├── React.re
│ │ ├── Reconciler.re
│ │ ├── Render.re
│ │ ├── RenderCondition.re
│ │ ├── RenderContainer.re
│ │ ├── Revery_UI.re
│ │ ├── RichText.re
│ │ ├── RichText.rei
│ │ ├── Selector.re
│ │ ├── Spring.re
│ │ ├── Spring.rei
│ │ ├── Style.re
│ │ ├── TextNode.re
│ │ ├── Transform.re
│ │ ├── Transform.rei
│ │ ├── Ui.re
│ │ ├── Ui.rei
│ │ ├── UiEvents.re
│ │ ├── ViewNode.re
│ │ └── dune
│ ├── UI_Components/
│ │ ├── Button.re
│ │ ├── Button.rei
│ │ ├── Center.re
│ │ ├── Checkbox.re
│ │ ├── Checkbox.rei
│ │ ├── Clickable.re
│ │ ├── Clickable.rei
│ │ ├── ClickableText.re
│ │ ├── ClipContainer.re
│ │ ├── ClipContainer.rei
│ │ ├── Column.re
│ │ ├── Container.re
│ │ ├── Container.rei
│ │ ├── Dropdown.re
│ │ ├── ExpandContainer.re
│ │ ├── Input.re
│ │ ├── Link.re
│ │ ├── Markdown.re
│ │ ├── Markdown.rei
│ │ ├── Positioned.re
│ │ ├── Positioned.rei
│ │ ├── RadioButtons.re
│ │ ├── Revery_UI_Components.re
│ │ ├── RichTextView.re
│ │ ├── Row.re
│ │ ├── SVG.re
│ │ ├── ScrollView.re
│ │ ├── Slider.re
│ │ ├── Stack.re
│ │ ├── Ticker.re
│ │ ├── Ticker.rei
│ │ ├── Tree.re
│ │ └── dune
│ ├── UI_Hooks/
│ │ ├── Effect.re
│ │ ├── Effect.rei
│ │ ├── Reducer.re
│ │ ├── Reducer.rei
│ │ ├── Ref.re
│ │ ├── Ref.rei
│ │ ├── Revery_UI_Hooks.re
│ │ ├── Spring.re
│ │ ├── State.re
│ │ ├── State.rei
│ │ ├── Tick.re
│ │ ├── Tick.rei
│ │ ├── Timer.re
│ │ └── dune
│ ├── UI_Primitives/
│ │ ├── AllowPointer.re
│ │ ├── BoxShadow.re
│ │ ├── Canvas.re
│ │ ├── IgnorePointer.re
│ │ ├── Image.re
│ │ ├── Image.rei
│ │ ├── Layer.re
│ │ ├── NativeButton.re
│ │ ├── Opacity.re
│ │ ├── Padding.re
│ │ ├── PrimitiveNodeFactory.re
│ │ ├── Revery_UI_Primitives.re
│ │ ├── Text.re
│ │ ├── View.re
│ │ └── dune
│ ├── Utility/
│ │ ├── HeadlessWindow.re
│ │ ├── HeadlessWindow.rei
│ │ ├── Revery_Utility.re
│ │ └── dune
│ ├── dune
│ └── index.mld
├── test/
│ ├── Core/
│ │ ├── ColorTests.re
│ │ ├── EnvironmentTests.re
│ │ ├── TestFramework.re
│ │ ├── TextTests.re
│ │ ├── TickTest.re
│ │ └── dune
│ ├── Font/
│ │ ├── FamilyTest.re
│ │ ├── FontCacheTest.re
│ │ ├── TestFramework.re
│ │ └── dune
│ ├── Math/
│ │ ├── BoundingBox2dTests.re
│ │ ├── ClampTest.re
│ │ ├── InterpolateTest.re
│ │ ├── TestFramework.re
│ │ └── dune
│ ├── TestRunner.re
│ ├── UI/
│ │ ├── AnimationTest.re
│ │ ├── HooksTest.re
│ │ ├── MouseTest.re
│ │ ├── NodeTests.re
│ │ ├── ReconcilerTests.re
│ │ ├── StyleTest.re
│ │ ├── TestFramework.re
│ │ └── dune
│ ├── collateral/
│ │ ├── FiraCode-LICENSE.txt
│ │ ├── JetBrainsMono-LICENSE.txt
│ │ ├── dune
│ │ └── test-asset.txt
│ └── dune
├── test.json
└── update-lockfiles.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .ci/.gitattributes
================================================
# Declare shell files to have LF endings on checkout
# On Windows, the default git setting for `core.autocrlf`
# means that when checking out code, LF endings get converted
# to CRLF. This causes problems for shell scripts, as bash
# gets choked up on the extra `\r` character.
*.sh text eol=lf
================================================
FILE: .ci/create-docs.yml
================================================
# These steps are only run on Linux
steps:
- script: "esy '@doc' install"
displayName: "Install doc dependency"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: "esy '@doc' build"
displayName: "Build docs"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: echo '##vso[task.setvariable variable=docsPath]'$(esy '@doc' echo '#{self.target_dir}/default/_doc/_html')
displayName: "Save docsPath in variable"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: Docs"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
inputs:
PathtoPublish: $(docsPath)
ArtifactName: Docs
================================================
FILE: .ci/esy-bench.yml
================================================
# Run benchmarks
steps:
- script: esy @bench install
displayName: 'esy @bench install'
- script: esy @bench build
displayName: 'esy @bench build'
- script: esy @bench x ReveryBench
displayName: 'esy @bench x ReveryBench'
================================================
FILE: .ci/esy-build-steps.yml
================================================
# Cross-platform set of build steps for building esy projects
steps:
- script: npm install -g esy@0.6.7
displayName: 'npm install -g esy@0.6.7'
- script: esy install
displayName: 'esy install'
- script: esy build
displayName: 'esy build'
- script: esy @test install
displayName: 'esy @test install'
- script: esy @test run
displayName: 'esy @test run'
- script: esy @examples install
displayName: 'esy @examples install'
- script: esy @examples run-harfbuzz
displayName: 'esy @examples run-harfbuzz'
- script: esy @examples x SkiaCli
displayName: '@esy @examples x SkiaCli'
- script: esy @examples x SkiaCli.bc
displayName: '@esy @examples x SkiaCli.bc'
- script: esy @examples run-skia-fontmanager
displayName: 'esy @examples run-skia-fontmanager'
- script: esy @examples x ReveryTextWrapCli
displayName: 'esy @examples x ReveryTextWrapCli'
- script: esy @examples x ReveryTextWrapCli.bc
displayName: 'esy @examples x ReveryTextWrapCli.bc'
================================================
FILE: .ci/esy-check-hygiene.yml
================================================
# Cross-platform set of build steps for building esy projects
steps:
- script: npm install -g esy@0.6.7
displayName: 'npm install -g esy@0.6.7'
- script: esy install
displayName: 'esy install'
- script: git diff --exit-code
displayName: 'check that `esy.lock` is up-to-date. If this fails, commit `esy.lock` changes and re-submit PR.'
- script: esy @bench install
displayName: 'esy @bench install'
- script: git diff --exit-code
displayName: 'check that `bench.esy.lock` is up-to-date. If this fails, commit `bench.esy.lock` changes and re-submit PR.'
- script: esy @js install
displayName: 'esy @js install'
- script: git diff --exit-code
displayName: 'check that `js.esy.lock` is up-to-date. If this fails, commit `js.esy.lock` changes and re-submit PR.'
- script: esy @test install
displayName: 'esy @test install'
- script: git diff --exit-code
displayName: 'check that `test.esy.lock` is up-to-date. If this fails, commit `test.esy.lock` changes and re-submit PR.'
- script: esy @doc install
displayName: 'esy @doc install'
- script: git diff --exit-code
displayName: 'check that `doc.esy.lock` is up-to-date. If this fails, commit `doc.esy.lock` changes and re-submit PR.'
- script: esy build
displayName: 'esy build'
- script: esy format
displayName: esy format
- script: git diff --exit-code
displayName: 'check that formatting is correct. If this fails, run `esy format` and re-submit PR.'
- script: esy b dune build @check
displayName: 'esy b dune build @check'
================================================
FILE: .ci/format.sh
================================================
#!/usr/bin/env bash
OS=$1
dune build @fmt --auto-promote
caml_output=$?
if [[ $OS == "windows" ]]
then
files=$(/usr/bin/find $(pwd) -type f \( -iname \*.c -o -iname \*.h -o -iname \*.cpp \) -not -path "*_esy/*")
native_output=$(astyle -n -Q --style=java --s4 $(cygpath -w $files))
elif [[ $OS == "darwin" ]]
then
native_output=$(find -E . -regex '.*\.(c|h|cpp)' -type f -not -path "*_esy/*" -exec astyle -n -Q --style=java --s4 {} \;)
elif [[ $OS == "linux" ]]
then
native_output=$(find ./ -type f \( -iname \*.c -o -iname \*.h -o -iname \*.cpp \) -not -path "*_esy/*" -exec astyle -n -Q --style=java --s4 {} \;)
fi
if [[ $native_output ]]
then
printf "\nFormatted the following native stubs:\n%s\n" "$native_output"
fi
if [[ $caml_output != 0 ]] || [[ $native_output != "" ]]
then
exit 1
fi
================================================
FILE: .ci/publish-build-cache.yml
================================================
# Steps for publishing project cache
steps:
- bash: 'mkdir -p $(STAGING_DIRECTORY)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Publish] Create cache directory'
- bash: |
cd $(ESY__CACHE_INSTALL_PATH)
pwd
STDIR=$STAGING_DIRECTORY
if [ "$AGENT_OS" == "Windows_NT" ]; then
STDIR=$( cygpath --unix --absolute "$STAGING_DIRECTORY")
fi
echo "STDIR: $STDIR"
tar -czf "$STDIR/esy-cache.tar" .
workingDirectory: ''
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Publish] Tar esy cache directory'
# - bash: 'cd $(ESY__NPM_ROOT) && tar -czf $(STAGING_DIRECTORY)/npm-cache.tar .'
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
# displayName: '[Cache][Publish] Tar npm cache directory'
- task: PublishBuildArtifacts@1
displayName: '[Cache][Publish] Upload tarball'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
pathToPublish: '$(STAGING_DIRECTORY)'
artifactName: 'cache-$(Agent.OS)-install'
parallel: true
parallelCount: 8
================================================
FILE: .ci/publish-release.yml
================================================
# Steps for publishing project cache
steps:
- task: PublishBuildArtifacts@1
displayName: '[Release]'
inputs:
pathToPublish: '_release'
artifactName: 'release-$(Agent.OS)'
parallel: true
parallelCount: 8
================================================
FILE: .ci/restore-build-cache.yml
================================================
# Steps for restoring project cache
steps:
- task: DownloadBuildArtifacts@0
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Restore install'
inputs:
buildType: 'specific'
project: '$(System.TeamProject)'
pipeline: '$(Build.DefinitionName)'
branchName: 'refs/heads/master'
buildVersionToDownload: 'latestFromBranch'
downloadType: 'single'
artifactName: 'cache-$(Agent.OS)-install'
downloadPath: '$(STAGING_DIRECTORY)'
continueOnError: true
- bash: 'mkdir -p $(ESY__CACHE_INSTALL_PATH)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Create cache directory'
# - bash: 'cd $(ESY__NPM_ROOT) && tar -xf $(STAGING_DIRECTORY)/cache-$(Agent.OS)-install/npm-cache.tar -C .'
# continueOnError: true
# condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
# displayName: '[Cache][Restore] Untar npm cache directory'
- bash: |
cd $(ESY__CACHE_INSTALL_PATH)
pwd
STDIR=$STAGING_DIRECTORY
if [ "$AGENT_OS" == "Windows_NT" ]; then
STDIR=$( cygpath --unix --absolute "$STAGING_DIRECTORY")
fi
echo "STDIR: $STDIR"
tar -xf "$STDIR/cache-$(Agent.OS)-install/esy-cache.tar" -C .
continueOnError: true
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Untar esy cache directory'
- bash: 'rm -rf *'
continueOnError: true
workingDirectory: '$(STAGING_DIRECTORY)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Clean up'
================================================
FILE: .ci/use-node.yml
================================================
steps:
- task: NodeTool@0
displayName: 'Use Node 12.x'
inputs:
versionSpec: 12.x
================================================
FILE: .gitattributes
================================================
# Declare shell files to have LF endings on checkout
# On Windows, the default git setting for `core.autocrlf`
# means that when checking out code, LF endings get converted
# to CRLF. This causes problems for shell scripts, as bash
# gets choked up on the extra `\r` character.
*.sh text eol=lf
# Hide lockfile updates
*esy.lock/* linguist-generated
# Recognize all re files as Reason
*.re linguist-language=Reason
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
open_collective: revery
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug Report
about: Create a report to help us improve
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest master build to make sure your issue has not already been fixed -->
- Operating System:
- Revery Version:
- OCaml version:
- Native, Bytecode, or JS build:
<!--
Please try to narrow down the code to a minimal repro.
This will speed up investigation time. In addition, including
a link to the github repo, if available, will help!
-->
- Link to github repo:
- Steps to reproduce:
- Actual Result:
- Expected Result:
- Additional Information:
- Search terms used:
<!-- Please include the search terms you used when searching the issue tracker. This will make it easier for others to find! -->
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature Request
about: Suggest an idea for this project
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Describe the feature you'd like. -->
================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
# missing trailing slash since it's a symlink with esy
node_modules
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
# dune build folder
_esy/
# install files
*.install
**/.merlin
#macOS
.DS_Store
skia-c-example.png
skia-svg-example.png
skia-font-manager-output.png
Arial.ttf
.vscode
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at oss@outrunlabs.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2018 Bryan Phelps
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<p align="center">
<a href="https://www.outrunlabs.com/revery" title="Revery">
<img src="./assets/logo.png" alt="Logo">
</a>
</p>
<p align="center">
<span>Build <b>native</b>, <i>high-performance</i>, <b>cross-platform</b> desktop apps with <a href="https://reasonml.github.io">reason!</a></span>
</p>
<p align="center">
<a href="https://github.com/revery-ui/revery/actions"><img src="https://github.com/revery-ui/revery/workflows/Validate%20Pull%20Request/badge.svg" /></a>
<a href="https://dev.azure.com/revery-ui/revery/_build/latest?definitionId=2?branchName=master">
<img src="https://dev.azure.com/revery-ui/revery/_apis/build/status/revery-ui.revery?branchName=master" alt="Build Status"/>
</a>
<a href="https://badge.fury.io/js/revery">
<img src="https://badge.fury.io/js/revery.svg" alt="npm version"/>
</a>
<a href="https://discord.gg/4pxY5Cp">
<img src="https://img.shields.io/discord/526111832478449695.svg" alt="Join the chat on discord!"/>
</a>
<a href="#backers">
<img src="https://opencollective.com/revery/backers/badge.svg" alt="Backers"/>
</a>
</p>
---
<p align="center">
<a href="https://www.outrunlabs.com/revery/playground" title="Playground">
<img src="./assets/screenshot.png" alt="Slider components">
</a>
</p>
:construction: __NOTE:__ Revery is a work-in-progress and in active development! :construction:
To get a taste of Revery, check out our JavaScript + WebGL build on the [playground](https://outrunlabs.com/revery/playground). For the best experience, though, you'll want to try a [native build](https://github.com/revery-ui/revery/wiki/Building-&-Installing).
## Motivation
Today, [Electron](https://electronjs.org/) is one of the most popular tools for building desktop apps - using an HTML, JS, CSS stack. However, it has a heavy footprint in terms of both RAM and CPU - __essentially packing an entire browser into the app.__ Even with that tradeoff, it has a lot of great aspects - it's the quickest way to build a cross-platform app & it provides a great development experience - as can be testified by its usage in popular apps like VSCode, Discord, and Slack.
Revery is kind of like super-fast, _native code_ Electron - with bundled React-like/Redux-like libraries and a fast build system - all ready to go!
Revery is built with [reasonml](https://reasonml.github.io), which is a javascript-like syntax on top of [OCaml](https://ocaml.org) This means that the language is accessible to JS developers.
Your apps are compiled to native code with the Reason / OCaml toolchain - with __instant startup__ and __performance comparable to native C code.__ Revery features platform-accelerated, GPU-accelerated rendering. The compiler itself is fast, too!
Revery is an experiment - can we provide a great developer experience and help teams be productive, without making sacrifices on performance?
### Design Decisions
- __Consistent cross-platform behavior__
A major value prop of Electron is that you can build for all platforms at once. You have great confidence as a developer that your app will look and work the same across different platforms. Revery is the same - aside from platform-specific behavior, if your app looks or behaves differently on another platform, that's a bug! As a consequence, Revery is like [flutter](https://flutter.io) in that it __does not use native widgets__. This means more work for us, but also that we have more predictable functionality cross-platform!
> __NOTE:__ If you're looking for something that does leverage native widgets, check out [briskml](https://github.com/briskml/brisk). Another alternative is the [cuite](https://github.com/let-def/cuite) OCaml binding for [Qt](https://github.com/let-def/cuite).
- __High performance__
Performance should be at the forefront, and not a compromise - we need to develop and build benchmarks that help ensure top-notch performance and start-up time.
- __Type-safe, functional code__
We might have some dirty mutable objects for performance - but our high-level API should be purely functional. You should be able to follow the React model of modelling your UI as a _pure function_ of application state -> UI.
## Getting Started
- Check out [revery-quick-start](https://github.com/revery-ui/revery-quick-start) to get up and running with your own Revery app!
- Try out our [interactive playground](https://www.outrunlabs.com/revery/playground/)
- Read through our [docs](https://www.outrunlabs.com/revery/api/revery/)
## Contributing
We'd love your help, and welcome PRs and contributions.
Some ideas for getting started:
- [Build and run](https://github.com/revery-ui/revery/wiki/Building-&-Installing) Revery
- View our [Roadmap](https://github.com/revery-ui/revery/wiki/Roadmap)
- Help us improve our [documentation](https://github.com/revery-ui/revery/blob/master/src/index.mld)
- Help us build [examples](https://github.com/revery-ui/revery/tree/master/examples)
- Help us [fix bugs](https://github.com/revery-ui/revery/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+label%3A%22bug%22) and [build features](https://github.com/revery-ui/revery/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22++-label%3Abug)
- Help us [log bugs and open issues](https://github.com/bryphe/revery/issues/new)
- Support the project on [OpenCollective](https://opencollective.com/revery)
- Follow us on [Twitter](https://twitter.com/reveryui) or chat with us on [Discord](https://discord.gg/UvQ2cFn)!
## License
Revery is provided under the [MIT License](LICENSE).
Revery bundles several dependencies under their own license terms - please refer to [ThirdPartyLicenses.txt](./ThirdPartyLicenses.txt).
## Contributors
Thanks to everyone who has [contributed](https://github.com/revery-ui/revery/graphs/contributors) to Revery!
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/revery#backer)]
<a href="https://opencollective.com/revery#backers" target="_blank"><img src="https://opencollective.com/revery/backers.svg?width=890"></a>
## Built with Revery
<p align="left">
<a href="https://v2.onivim.io/">
<img src="./assets/onivim-logo.png" alt="Onivim 2" />
</a>
</p>
## Special Thanks
`revery` would not be possible without a bunch of cool tech:
- [ocaml](https://ocaml.org) made these tools possible - thanks [Inria](http://gallium.inria.fr/) & [OCaml Labs](http://ocamllabs.io/)!
- [reasonml](https://reasonml.github.io) made revery possible - thanks @jordwalke!
- [flex](https://github.com/jordwalke/flex) by @jordwalke
- [briskml](https://github.com/briskml)
- [brisk-reconciler](https://github.com/briskml/brisk-reconciler) - the "native React" implementation.
- [reason-sdl2](https://github.com/revery-ui/reason-sdl2)
- [SDL2](https://www.libsdl.org)
- [stb-image](https://github.com/nothings/stb)
- [reason-fontkit](https://github.com/bryphe/reason-fontkit)
- [freetype2](https://www.freetype.org)
- [harfbuzz](https://www.freedesktop.org/wiki/Software/HarfBuzz)
- [reason-gl-matrix](https://github.com/bryphe/reason-gl-matrix)
- [gl-matrix](http://glmatrix.net)
- [glm](https://glm.g-truc.net/0.9.9/index.html)
- [@reason-native/console](https://github.com/facebookexperimental/reason-native/tree/master/src/console)
`revery` was inspired by some __awesome projects:__
- [react-native](https://facebook.github.io/react-native/)
- [ReactMini](https://github.com/reasonml/reason-react/tree/master/ReactMini)
- [cuite](https://github.com/let-def/cuite)
- [wall](https://github.com/let-def/wall)
- [elm](https://elm-lang.org/)
- [reprocessing](https://github.com/Schmavery/reprocessing)
# Hot reload
We don't have a Hot Reload yet but it is on our roadmap. In the meantime, you can check branch [feat/hot-reload](https://github.com/revery-ui/revery/tree/feat/hot-reload) to see the progression.
In the meantime @mbernat has done a [script](https://gist.github.com/mbernat/abf651653c123374037c27377f41d0a0) that allow to relaunch the APP when the binary changed.
================================================
FILE: Revery.opam
================================================
opam-version: "1.2"
version: "dev"
maintainer: "bryphe@outlook.com"
author: ["Bryan Phelps"]
build: [
]
================================================
FILE: ReveryBench.opam
================================================
opam-version: "1.2"
version: "dev"
maintainer: "bryphe@outlook.com"
author: ["Bryan Phelps"]
build: [
]
================================================
FILE: ReveryExampleJs.opam
================================================
opam-version: "1.2"
version: "dev"
maintainer: "bryphe@outlook.com"
author: ["Bryan Phelps"]
build: [
]
================================================
FILE: ReveryExamples.opam
================================================
opam-version: "1.2"
version: "dev"
maintainer: "bryphe@outlook.com"
author: ["Bryan Phelps"]
build: [
]
================================================
FILE: ReveryTest.opam
================================================
opam-version: "1.2"
version: "dev"
maintainer: "bryphe@outlook.com"
author: ["Bryan Phelps"]
build: [
]
================================================
FILE: ThirdPartyLicenses.txt
================================================
Revery
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Outrun Labs, LLC received such components are set forth below. Outrun Labs, LLC reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
1. MinCW Runtime License (https://sourceforge.net/p/mingw/mingw-org-wsl/ci/21762bb4a1bd0c88c38eead03f59e8d994349e83/tree/LICENSE)
2. Roboto Font by Google (https://github.com/google/fonts/tree/master/apache/roboto)
3. FontAwesome/Font-Awesome (https://github.com/FontAwesome/Font-Awesome)
4. SDL2 (https://www.libsdl.org)
5. Zed (https://github.com/ocaml-community/zed)
%% MingW Runtime License NOTICES AND INFORMATION BEGIN HERE
==============================================
Copyright (c) 2012 MinGW.org project
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice, this permission notice and the below disclaimer
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
==============================================
END of MingW Runtime License NOTICES AND INFORMATION
%% Roboto Font NOTICES AND INFORMATION BEGIN HERE
==============================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================
END of Roboto Font NOTICES AND INFORMATION
%% FontAwesome NOTICES AND INFORMATION BEGIN HERE
==============================================
Font Awesome Free License
-------------------------
Font Awesome Free is free, open source, and GPL friendly. You can use it for
commercial projects, open source projects, or really almost whatever you want.
Full Font Awesome Free license: https://fontawesome.com/license/free.
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
packaged as SVG and JS file types.
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
In the Font Awesome Free download, the SIL OLF license applies to all icons
packaged as web and desktop font files.
# Code: MIT License (https://opensource.org/licenses/MIT)
In the Font Awesome Free download, the MIT license applies to all non-font and
non-icon files.
# Attribution
Attribution is required by MIT, SIL OLF, and CC BY licenses. Downloaded Font
Awesome Free files already contain embedded comments with sufficient
attribution, so you shouldn't need to do anything additional when using these
files normally.
We've kept attribution comments terse, so we ask that you do not actively work
to remove them from files, especially code. They're a great way for folks to
learn about Font Awesome.
# Brand Icons
All brand icons are trademarks of their respective owners. The use of these
trademarks does not indicate endorsement of the trademark holder by Font
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
to represent the company, product, or service to which they refer.**
==============================================
END of FontAwesome NOTICES AND INFORMATION
%% SDL 2 NOTICES AND INFORMATION BEGIN HERE
==============================================
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
==============================================
END of SDL 2 NOTICES AND INFORMATION
%% Zed NOTICES AND INFORMATION BEGIN HERE
==============================================
Copyright (c) 2011, Jeremie Dimino <jeremie@dimino.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Jeremie Dimino nor the names of his
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==============================================
END of Zed NOTICES AND INFORMATION
%% <template> NOTICES AND INFORMATION BEGIN HERE
==============================================
==============================================
END of <template> NOTICES AND INFORMATION
================================================
FILE: azure-pipelines.yml
================================================
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
name: $(Build.SourceVersion)
# Master build triggers
trigger:
- master
# PR Triggers
pr:
autoCancel: true
branches:
include:
- master
paths:
exclude:
- README.md
jobs:
- job: Linux
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu-20.04'
variables:
STAGING_DIRECTORY: $(Build.StagingDirectory)
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source/i
# ESY__NPM_ROOT: /opt/hostedtoolcache/node/8.14.0/x64/lib/node_modules/esy
steps:
- script: sudo apt-get update
- script: sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-utils mesa-utils-extra ragel libgtk-3-dev nasm libxxf86vm-dev
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/esy-bench.yml
- template: .ci/create-docs.yml
- template: .ci/publish-build-cache.yml
- job: CentOS
displayName: 'Linux - CentOS - Docker Image'
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu-20.04'
variables:
STAGING_DIRECTORY: $(Build.StagingDirectory)
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source/i
# ESY__NPM_ROOT: /opt/hostedtoolcache/node/8.14.0/x64/lib/node_modules/esy
steps:
- script: docker build -t centos scripts/docker/centos
displayName: 'docker build'
- script: docker run --rm --mount src=`pwd`,target=/revery,type=bind centos /bin/bash -c 'cd revery && ls -a'
- script: docker run --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined --rm --mount src=`pwd`,target=/revery,type=bind centos /bin/bash -c 'cd revery && ./scripts/docker-build.sh'
- job: Hygiene_Checks
displayName: 'Hygiene Checks'
timeoutInMinutes: 0
pool:
vmImage: 'macOS 10.14'
variables:
STAGING_DIRECTORY: $(Build.StagingDirectory)
ESY__CACHE_INSTALL_PATH: /Users/runner/.esy/3__________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/runner/.esy/source/i
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy
steps:
- script: brew update-reset
- script: brew install libpng ragel
- script: node --version
- template: .ci/restore-build-cache.yml
- template: .ci/esy-check-hygiene.yml
- template: .ci/publish-build-cache.yml
- job: MacOS
timeoutInMinutes: 0
pool:
vmImage: 'macOS 10.14'
variables:
STAGING_DIRECTORY: $(Build.StagingDirectory)
ESY__CACHE_INSTALL_PATH: /Users/runner/.esy/3__________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/runner/.esy/source/i
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy
steps:
- script: brew update-reset
- script: brew install libpng ragel
- script: node --version
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/esy-bench.yml
- template: .ci/publish-build-cache.yml
- job: Windows
timeoutInMinutes: 0
pool:
vmImage: 'vs2017-win2016'
variables:
STAGING_DIRECTORY: $(Build.StagingDirectory)
ESY__CACHE_INSTALL_PATH: /C/Users/VssAdministrator/.esy/3______________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /C/Users/VssAdministrator/.esy/source/i
# ESY__NPM_ROOT: /C/npm/prefix/node_modules/esy
steps:
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/esy-bench.yml
- template: .ci/publish-build-cache.yml
================================================
FILE: bench/exe/Bench.re
================================================
ReveryBench.BenchFramework.cli();
Skia_Bench.BenchFramework.cli();
================================================
FILE: bench/exe/dune
================================================
(executable
(name bench)
(public_name ReveryBench)
(libraries ReveryBench.lib Skia_Bench)
(package ReveryBench))
(install
(section bin)
(package ReveryBench)
(files TestFont.ttf))
================================================
FILE: bench/lib/BenchFramework.re
================================================
include Reperf.Make({
let config = Reperf.Config.create(~snapshotDir="bench/__snapshots__", ());
});
================================================
FILE: bench/lib/DrawBench.re
================================================
open BenchFramework;
open Revery;
open Revery.Draw;
let options = Reperf.Options.create(~iterations=10000, ());
let setup = () => {
let surface = SurfaceUtility.makeSurface(800l, 600l) |> Option.get;
CanvasContext.createFromSurface(surface);
};
module Data = {
let testString = String.make(50, 'a') ++ String.make(50, 'X');
let testFallbackString = "ABC鬼";
let paint = {
let textPaint = Skia.Paint.make();
Skia.Paint.setTextEncoding(textPaint, GlyphId);
Skia.Paint.setLcdRenderText(textPaint, true);
Skia.Paint.setAntiAlias(textPaint, true);
Skia.Paint.setTextSize(textPaint, 20.);
textPaint;
};
let rectPaint = Skia.Paint.make();
};
let drawText = canvasContext => {
let maybeSkia =
Revery.Font.Family.fromFile("TestFont.ttf")
|> Revery.Font.Family.toSkia(Normal);
switch (Revery.Font.load(maybeSkia)) {
| Error(_) => failwith("Unable to load font!")
| Ok(font) =>
Skia.Paint.setColor(Data.paint, Revery_Core.Color.toSkia(Colors.white));
let shapedText =
Data.testString
|> Revery.Font.shape(font)
|> Revery.Font.ShapeResult.getGlyphStrings;
shapedText
|> List.iter(((typeface, string)) => {
Skia.Paint.setTypeface(Data.paint, typeface);
CanvasContext.drawText(
~x=1.,
~y=1.,
~paint=Data.paint,
~text=string,
canvasContext,
);
});
};
};
let drawFallbackText = canvasContext => {
let maybeSkia =
Revery.Font.Family.system("Arial") |> Revery.Font.Family.toSkia(Normal);
switch (Revery.Font.load(maybeSkia)) {
| Error(_) => failwith("Unable to load font!")
| Ok(font) =>
Skia.Paint.setColor(Data.paint, Revery_Core.Color.toSkia(Colors.white));
let shapedText =
Data.testFallbackString
|> Revery.Font.shape(font)
|> Revery.Font.ShapeResult.getGlyphStrings;
shapedText
|> List.iter(((typeface, string)) => {
Skia.Paint.setTypeface(Data.paint, typeface);
CanvasContext.drawText(
~x=1.,
~y=1.,
~paint=Data.paint,
~text=string,
canvasContext,
);
});
};
};
let drawRect = canvasContext => {
Skia.Paint.setColor(Data.rectPaint, Revery.Color.toSkia(Colors.green));
CanvasContext.drawRectLtwh(
~paint=Data.rectPaint,
~left=1.,
~top=1.,
~width=10.,
~height=20.,
canvasContext,
);
};
bench(~name="Draw: drawText", ~options, ~setup, ~f=drawText, ());
bench(
~name="Draw: drawText (second iteration, cached)",
~options,
~setup,
~f=drawText,
(),
);
bench(
~name="Draw: drawFallbackText",
~options,
~setup,
~f=drawFallbackText,
(),
);
bench(
~name="Draw: drawFallbackText (second iteration, cached)",
~options,
~setup,
~f=drawFallbackText,
(),
);
bench(~name="Draw: drawRectLtwh", ~options, ~setup, ~f=drawRect, ());
================================================
FILE: bench/lib/LayoutBench.re
================================================
open BenchFramework;
open Revery.UI;
let options = Reperf.Options.create(~iterations=10000, ());
let createNode = () => {
let _ = (new node)();
();
};
let layoutNode = (force: bool, n: node) => {
Layout.layout(~force, n);
};
bench(
~name="Node: create single node",
~options,
~setup=() => (),
~f=createNode,
(),
);
bench(
~name="Layout: layout single node (force re-layout)",
~options,
~setup=
NodeUtility.setupNode(~style=Style.make(~width=100, ~height=100, ())),
~f=layoutNode(true),
(),
);
bench(
~name="Layout: layout node tree (4 deep, 4 wide) (force re-layout))",
~options,
~setup=NodeUtility.setupNodeTree(~depth=4, ~breadth=4),
~f=layoutNode(true),
(),
);
bench(
~name="Layout: layout single node",
~options,
~setup=
NodeUtility.setupNode(~style=Style.make(~width=100, ~height=100, ())),
~f=layoutNode(false),
(),
);
bench(
~name="Layout: layout node tree (4 deep, 4 wide)",
~options,
~setup=NodeUtility.setupNodeTree(~depth=4, ~breadth=4),
~f=layoutNode(false),
(),
);
================================================
FILE: bench/lib/NodeUtility.re
================================================
open Revery.UI;
let setupNode = (~style, ()) => {
let n = (new node)();
n#setStyle(style);
n;
};
let rec setupNodeTree =
(
~depth: int,
~breadth: int,
~style=Style.make(~width=400, ~height=400, ()),
(),
) => {
let i = ref(breadth);
let n = setupNode(~style, ());
while (i^ > 0 && depth > 0) {
let newNode = setupNodeTree(~depth=depth - 1, ~breadth, ());
n#addChild(newNode, 0);
decr(i);
};
n;
};
================================================
FILE: bench/lib/PaintBench.re
================================================
open BenchFramework;
open Revery;
open Revery.Draw;
let options = Reperf.Options.create(~iterations=10000, ());
module Data = {
let color = Colors.red;
let paint = Skia.Paint.make();
};
let setPaintColor = () => {
let () = Skia.Paint.setColor(Data.paint, Revery.Color.toSkia(Data.color));
();
};
bench(
~name="Paint: Set color",
~options,
~setup=() => (),
~f=setPaintColor,
(),
);
================================================
FILE: bench/lib/RecalculateBench.re
================================================
open BenchFramework;
open Revery.UI;
let options = Reperf.Options.create(~iterations=1000, ());
let recalculate = (n: node) => {
n#recalculate();
};
bench(
~name="Recalculate: recalculate single node",
~options,
~setup=
NodeUtility.setupNode(~style=Style.make(~width=100, ~height=100, ())),
~f=recalculate,
(),
);
bench(
~name="Recalculate: recalculate node tree (4 deep, 4 wide)",
~options,
~setup=NodeUtility.setupNodeTree(~depth=4, ~breadth=4),
~f=recalculate,
(),
);
================================================
FILE: bench/lib/SurfaceUtility.re
================================================
open Skia;
let makeSurface = (width, height) => {
let imageInfo = Skia.ImageInfo.make(width, height, Rgba8888, Premul, None);
Surface.makeRaster(imageInfo, 0, None);
};
================================================
FILE: bench/lib/ViewNodeBench.re
================================================
open BenchFramework;
open Revery.Draw;
open Revery.UI;
let options = Reperf.Options.create(~iterations=10000, ());
let createViewNode = () => {
let viewNode = (new viewNode)();
viewNode#recalculate();
viewNode;
};
let setup = () => {
let surface = SurfaceUtility.makeSurface(800l, 600l) |> Option.get;
let canvas = CanvasContext.createFromSurface(surface);
NodeDrawContext.create(
~dpi=1.0,
~canvasScalingFactor=1.0,
~debug=false,
~canvas,
~zIndex=0,
~opacity=1.0,
(),
);
};
module Data = {
let viewNode = createViewNode();
};
let draw = context => {
Data.viewNode#draw(context);
};
bench(~name="ViewNode: draw single node", ~options, ~setup, ~f=draw, ());
================================================
FILE: bench/lib/dune
================================================
(library
(name ReveryBench)
(public_name ReveryBench.lib)
(ocamlopt_flags -linkall)
(libraries Revery reperf.lib))
================================================
FILE: bench.json
================================================
{
"source": "./package.json",
"scripts": {
"run": "esy '@bench' x ReveryBench"
},
"override": {
"build": ["dune build -p reason-harfbuzz,reason-skia,reason-sdl2,Revery,ReveryBench -j4"],
"install": [
"esy-installer ReveryBench.install"
]
}
}
================================================
FILE: doc.json
================================================
{
"source": "./package.json",
"scripts": {
"run": "esy '@doc' x http-server #{self.target_dir}/default/_doc/_html",
"print": "esy '@doc' echo #{self.target_dir}/default/_doc/_html"
},
"override": {
"build": ["dune build @doc -p reason-harfbuzz,reason-skia,reason-sdl2,Revery -j4"],
"dependencies": {
"@opam/odoc": "*",
"http-server": "*"
}
}
}
================================================
FILE: dune
================================================
(dirs src packages test examples bench)
================================================
FILE: dune-project
================================================
(lang dune 2.5)
(formatting (enabled_for reason))
================================================
FILE: dune-workspace
================================================
(lang dune 2.0)
(context (default
(disable_dynamically_linked_foreign_archives true)))
================================================
FILE: examples/AnalogClock.re
================================================
open Revery;
open Revery.Math;
open Revery.UI;
module AnalogClock = {
module DegreeUtils = {
type t = {
hourDegrees: float,
minuteDegrees: float,
secondDegrees: float,
};
let numberToPercentage = (~number, ~max) => number /. max *. 100.;
let percentageToDegrees = percentage => percentage *. 360. /. 100.;
let getDegreesFromTime = ({tm_hour, tm_min, tm_sec, _}: Unix.tm) => {
let hourDegrees =
numberToPercentage(~number=float_of_int(tm_hour), ~max=12.)
|> percentageToDegrees;
let minuteDegrees =
numberToPercentage(~number=float_of_int(tm_min), ~max=60.)
|> percentageToDegrees;
let secondDegrees =
numberToPercentage(~number=float_of_int(tm_sec), ~max=60.)
|> percentageToDegrees;
{hourDegrees, minuteDegrees, secondDegrees};
};
};
type action =
| UpdateTime;
type state = {currentTime: Unix.tm};
let reducer = (action, _state) => {
switch (action) {
| UpdateTime => {currentTime: Unix.time() |> Unix.localtime}
};
};
let%component make = () => {
let%hook (state, dispatch) =
Hooks.reducer(
~initialState={currentTime: Unix.time() |> Unix.localtime},
reducer,
);
let {hourDegrees, minuteDegrees, secondDegrees}: DegreeUtils.t =
state.currentTime |> DegreeUtils.getDegreesFromTime;
let%hook () =
Hooks.effect(
OnMount,
() => {
let clear =
Tick.interval(
~name="Clock Timer",
_ => dispatch(UpdateTime),
Time.seconds(1),
);
Some(clear);
},
);
let containerStyle =
Style.[
alignItems(`Center),
bottom(0),
justifyContent(`Center),
left(0),
position(`Absolute),
right(0),
top(0),
];
let clockContainer =
Style.[
border(~width=4, ~color=Colors.white),
height(300),
padding(15),
position(`Relative),
width(300),
];
let clockPointer = Style.[position(`Absolute), left(150)];
let hourStyle =
Style.(
merge(
~source=clockPointer,
~target=[
backgroundColor(Colors.white),
height(90),
top(105),
transform([
Transform.Rotate(Angle.from_degrees(hourDegrees)),
Transform.TranslateY(-45.),
]),
width(4),
],
)
);
let minutesStyle =
Style.(
merge(
~source=clockPointer,
~target=[
backgroundColor(Colors.white),
height(120),
top(90),
transform([
Transform.Rotate(Angle.from_degrees(minuteDegrees)),
Transform.TranslateY(-60.),
]),
width(4),
],
)
);
let secondsStyle =
Style.(
merge(
~source=clockPointer,
~target=[
backgroundColor(Colors.red),
height(150),
top(75),
transform([
Transform.Rotate(Angle.from_degrees(secondDegrees)),
Transform.TranslateY(-75.),
]),
width(2),
],
)
);
<View style=containerStyle>
<View style=clockContainer>
<View style=secondsStyle />
<View style=minutesStyle />
<View style=hourStyle />
</View>
</View>;
};
};
let render = () => <AnalogClock />;
================================================
FILE: examples/Border.re
================================================
open Revery;
open Revery.UI;
let defaultStyle =
Style.[
backgroundColor(Color.multiplyAlpha(0.2, Colors.white)),
position(`Relative),
left(100),
top(100),
width(200),
height(200),
border(~width=15, ~color=Colors.red),
borderHorizontal(~width=8, ~color=Colors.blue),
borderTop(~width=15, ~color=Colors.red),
borderLeft(~width=30, ~color=Colors.green),
borderRadius(16.0),
];
let innerStyle =
Style.[
backgroundColor(Colors.yellow),
position(`Relative),
left(0),
top(0),
width(30),
height(30),
borderHorizontal(~color=Colors.black, ~width=3),
];
let textStyle = Style.[color(Colors.black)];
let render = () =>
<View style=defaultStyle>
<View style=innerStyle />
<Text style=textStyle fontSize=20. text="Inner Text" />
</View>;
================================================
FILE: examples/Boxshadow.re
================================================
open Revery;
open Revery.UI;
let parentStyles =
Style.[
position(`Relative),
flexGrow(1),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let blackShadow =
Style.[
backgroundColor(Colors.blue),
position(`Relative),
width(100),
height(100),
boxShadow(
~yOffset=-10.,
~xOffset=0.,
~blurRadius=15.,
~color=Colors.black,
~spreadRadius=10.,
),
marginVertical(30),
];
let subtleBlackShadow =
Style.[
backgroundColor(Colors.teal),
position(`Relative),
width(100),
height(100),
boxShadow(
~yOffset=1.,
~xOffset=1.,
~blurRadius=5.,
~color=Color.rgba(0., 0., 0., 0.2),
~spreadRadius=0.,
),
marginVertical(30),
];
let greenShadow =
Style.[
backgroundColor(Colors.red),
position(`Relative),
width(100),
height(100),
boxShadow(
~yOffset=10.,
~xOffset=-30.,
~blurRadius=20.,
~color=Colors.green,
~spreadRadius=0.,
),
marginVertical(30),
];
let render = () =>
<View style=parentStyles>
<View style=blackShadow />
<View style=subtleBlackShadow />
<View style=greenShadow />
</View>;
================================================
FILE: examples/Calculator.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Row = {
let make = (~children, ()) => {
let style =
Style.[
flexDirection(`Row),
alignItems(`Stretch),
justifyContent(`Center),
flexGrow(1),
];
<View style> ...children </View>;
};
};
module Column = {
let make = (~children, ()) => {
let style =
Style.[
flexDirection(`Column),
alignItems(`Stretch),
justifyContent(`Center),
backgroundColor(Colors.darkGrey),
flexGrow(1),
];
<View style> ...children </View>;
};
};
module Button = {
let make =
(~fontFamily=Font.Family.default, ~contents: string, ~onClick, ()) => {
let clickableStyle =
Style.[
position(`Relative),
backgroundColor(Colors.lightGrey),
justifyContent(`Center),
alignItems(`Center),
flexGrow(1),
/* Min width */
width(125),
margin(10),
];
let viewStyle =
Style.[
position(`Relative),
justifyContent(`Center),
alignItems(`Center),
];
let textStyle =
Style.[color(Colors.black), textWrap(TextWrapping.NoWrap)];
<Clickable style=clickableStyle onClick>
<View style=viewStyle>
<Text style=textStyle fontFamily fontSize=32. text=contents />
</View>
</Clickable>;
};
};
module Display = {
let make = (~display: string, ~curNum: string, ()) => {
let viewStyle =
Style.[
backgroundColor(Colors.white),
height(120),
flexDirection(`Column),
alignItems(`Stretch),
justifyContent(`FlexStart),
flexGrow(2),
];
let displayStyle = Style.[color(Colors.black), margin(15)];
let numStyle = Style.[color(Colors.black), margin(15)];
<View style=viewStyle>
<Text style=displayStyle fontSize=20. text=display />
<Text style=numStyle fontSize=32. text=curNum />
</View>;
};
};
type operator = [ | `Nop | `Add | `Sub | `Mul | `Div];
let showFloat = float => {
let string = string_of_float(float);
if (String.length(string) > 1 && string.[String.length(string) - 1] == '.') {
String.sub(string, 0, String.length(string) - 1);
} else {
string;
};
};
type state = {
operator, /* Current operator being applied */
result: float, /* The actual numerical result */
display: string, /* The equation displayed */
number: string /* Current number being typed */
};
type action =
| BackspaceKeyPressed
| ClearKeyPressed(bool) /* true = AC pressed */
| DotKeyPressed
| NumberKeyPressed(string)
| OperationKeyPressed(operator)
| PlusMinusKeyPressed
| ResultKeyPressed;
let eval = (state, newOp) => {
/* Figure out what the string for the next operation will be */
let newOpString =
switch (newOp) {
| `Nop => ""
| `Add => "+"
| `Sub => "-"
| `Mul => "×"
| `Div => "÷"
};
/* Split the current display on ! and get everything after (to clear errors) */
let partitionedDisplay = String.split_on_char('!', state.display);
let display =
List.nth(partitionedDisplay, List.length(partitionedDisplay) - 1);
let (newDisplay, newResult) =
switch (state.operator) {
| #operator when state.number == "" => (
"Error: Can't evaluate binary operator without input!",
state.result,
)
| `Nop => (state.number ++ newOpString, float_of_string(state.number))
| `Add => (
display ++ state.number ++ newOpString,
state.result +. float_of_string(state.number),
)
| `Sub => (
display ++ state.number ++ newOpString,
state.result -. float_of_string(state.number),
)
| `Mul => (
display ++ state.number ++ newOpString,
state.result *. float_of_string(state.number),
)
| `Div =>
if (float_of_string(state.number) != 0.) {
(
display ++ state.number ++ newOpString,
state.result /. float_of_string(state.number),
);
} else {
("Error: Divide by zero!", state.result);
}
};
(newResult, newDisplay);
};
let reducer = (action, state) =>
switch (action) {
| BackspaceKeyPressed =>
state.number == ""
? state
: {
...state,
number: String.sub(state.number, 0, String.length(state.number) - 1),
}
| ClearKeyPressed(ac) =>
ac
? {operator: `Nop, result: 0., display: "", number: ""}
: {...state, number: ""}
| DotKeyPressed =>
String.contains(state.number, '.')
? state : {...state, number: state.number ++ "."}
| NumberKeyPressed(n) => {...state, number: state.number ++ n}
| OperationKeyPressed(o) =>
let (result, display) = eval(state, o);
{operator: o, result, display, number: ""};
| PlusMinusKeyPressed =>
if (state.number != "" && state.number.[0] == '-') {
{
...state,
number: String.sub(state.number, 1, String.length(state.number) - 1),
};
} else {
{...state, number: "-" ++ state.number};
}
| ResultKeyPressed =>
let (result, display) = eval(state, `Nop);
{operator: `Nop, result, display, number: showFloat(result)};
};
module KeyboardInput = {
type state = {
ref: option(node),
hasFocus: bool,
};
type action =
| Focused(bool)
| SetRef(node);
let reducer = (action, state) =>
switch (action) {
| Focused(v) => {...state, hasFocus: v}
| SetRef(v) => {...state, ref: Some(v)}
};
let%component make = (~dispatch as parentDispatch, ()) => {
let%hook (v, dispatch) =
Hooks.reducer(~initialState={ref: None, hasFocus: false}, reducer);
let%hook () =
Hooks.effect(
Always,
() => {
if (!v.hasFocus) {
switch (v.ref) {
| Some(v) => Focus.focus(v)
| None => ()
};
};
None;
},
);
let onBlur = () => {
dispatch(Focused(false));
};
let onFocus = () => {
dispatch(Focused(true));
};
let respondToKeys = (event: NodeEvents.keyEventParams) => {
Key.Keycode.(
switch (event.keycode) {
| v when v == backspace => parentDispatch(BackspaceKeyPressed)
| v when v == c && event.ctrlKey =>
parentDispatch(ClearKeyPressed(true))
| v when v == c => parentDispatch(ClearKeyPressed(false))
/* + key */
| v when v == Key.Keycode.equals && event.shiftKey =>
parentDispatch(OperationKeyPressed(`Add))
| v when v == Key.Keycode.equals && event.ctrlKey =>
parentDispatch(PlusMinusKeyPressed)
| v when v == Key.Keycode.minus =>
parentDispatch(OperationKeyPressed(`Sub))
/* * key */
| v when v == digit8 && event.shiftKey =>
parentDispatch(OperationKeyPressed(`Mul))
| v when v == slash => parentDispatch(OperationKeyPressed(`Div))
| v when v == period => parentDispatch(DotKeyPressed)
| v when v == equals => parentDispatch(ResultKeyPressed)
| v when v == digit0 => parentDispatch(NumberKeyPressed("0"))
| v when v == digit1 => parentDispatch(NumberKeyPressed("1"))
| v when v == digit2 => parentDispatch(NumberKeyPressed("2"))
| v when v == digit3 => parentDispatch(NumberKeyPressed("3"))
| v when v == digit4 => parentDispatch(NumberKeyPressed("4"))
| v when v == digit5 => parentDispatch(NumberKeyPressed("5"))
| v when v == digit6 => parentDispatch(NumberKeyPressed("6"))
| v when v == digit7 => parentDispatch(NumberKeyPressed("7"))
| v when v == digit8 => parentDispatch(NumberKeyPressed("8"))
| v when v == digit9 => parentDispatch(NumberKeyPressed("9"))
| _ => ()
}
);
};
<View
ref={r => dispatch(SetRef(r))}
onBlur
onFocus
style=Style.[position(`Absolute), width(1), height(1)]
onKeyDown=respondToKeys
/>;
};
};
module Calculator = {
let%component make = () => {
let%hook ({display, number, _}, dispatch) =
Hooks.reducer(
~initialState={operator: `Nop, result: 0., display: "", number: ""},
reducer,
);
<Column>
<KeyboardInput dispatch />
<Display display curNum=number />
<Row>
<Button
contents="AC"
onClick={_ => dispatch(ClearKeyPressed(true))}
/>
<Button
contents="C"
onClick={_ => dispatch(ClearKeyPressed(false))}
/>
<Button contents="±" onClick={_ => dispatch(PlusMinusKeyPressed)} />
/* TODO: Switch to a font with a backspace character */
<Button
fontFamily={Font.Family.fromFile("FontAwesome5FreeSolid.otf")}
contents={||}
onClick={_ => dispatch(BackspaceKeyPressed)}
/>
</Row>
<Row>
<Button
contents="7"
onClick={_ => dispatch(NumberKeyPressed("7"))}
/>
<Button
contents="8"
onClick={_ => dispatch(NumberKeyPressed("8"))}
/>
<Button
contents="9"
onClick={_ => dispatch(NumberKeyPressed("9"))}
/>
<Button
contents="÷"
onClick={_ => dispatch(OperationKeyPressed(`Div))}
/>
</Row>
<Row>
<Button
contents="4"
onClick={_ => dispatch(NumberKeyPressed("4"))}
/>
<Button
contents="5"
onClick={_ => dispatch(NumberKeyPressed("5"))}
/>
<Button
contents="6"
onClick={_ => dispatch(NumberKeyPressed("6"))}
/>
<Button
contents="×"
onClick={_ => dispatch(OperationKeyPressed(`Mul))}
/>
</Row>
<Row>
<Button
contents="1"
onClick={_ => dispatch(NumberKeyPressed("1"))}
/>
<Button
contents="2"
onClick={_ => dispatch(NumberKeyPressed("2"))}
/>
<Button
contents="3"
onClick={_ => dispatch(NumberKeyPressed("3"))}
/>
<Button
contents="-"
onClick={_ => dispatch(OperationKeyPressed(`Sub))}
/>
</Row>
<Row>
<Button contents="." onClick={_ => dispatch(DotKeyPressed)} />
<Button
contents="0"
onClick={_ => dispatch(NumberKeyPressed("0"))}
/>
<Button contents="=" onClick={_ => dispatch(ResultKeyPressed)} />
<Button
contents="+"
onClick={_ => dispatch(OperationKeyPressed(`Add))}
/>
</Row>
</Column>;
};
};
let render = _ => <Calculator />;
================================================
FILE: examples/CanQuitExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module CanQuit = {
type checkboxState = {canQuit: bool};
let%component make = () => {
let initialCheckboxState = {canQuit: true};
let%hook ({canQuit}, setCheckboxState) =
Hooks.state(initialCheckboxState);
<View
style=Style.[
width(500),
height(500),
justifyContent(`Center),
alignItems(`Center),
]>
<Checkbox
checkedColor=Colors.green
onChange={() => {
let win = getActiveWindow();
switch (win) {
| Some(win) => Window.setCanQuitCallback(win, () => !canQuit)
| None => ()
};
setCheckboxState(({canQuit}) => {canQuit: !canQuit});
}}
style=Style.[border(~width=2, ~color=Colors.green)]
checked=canQuit
/>
<Text
text={"Can quit: " ++ (canQuit ? "Yes" : "No")}
fontSize=20.
style=Style.[marginTop(10)]
/>
</View>;
};
};
let render = () => {
<CanQuit />;
};
================================================
FILE: examples/CanvasExample.re
================================================
open Revery;
open Revery.Font;
open Revery.Draw;
open Revery.UI;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let outerBox =
Style.[width(450), height(450), backgroundColor(Colors.black)];
module Sample = {
let make = () => {
<View style=containerStyle>
<Canvas
style=outerBox
render={(canvasContext, _dimensions) => {
let transform = Skia.Matrix.make();
Skia.Matrix.setIdentity(transform);
CanvasContext.concat(transform, canvasContext);
let paint = Skia.Paint.make();
Skia.Paint.setColor(
paint,
Skia.Color.makeArgb(0xFFl, 0xFFl, 0x00l, 0x00l),
);
let rect = Skia.Rect.makeLtrb(1.0, 1.0, 101., 201.);
CanvasContext.drawRect(~rect, ~paint, canvasContext);
let stroke = Skia.Paint.make();
Skia.Paint.setColor(
stroke,
Skia.Color.makeArgb(0xFFl, 0xFFl, 0xFFl, 0x00l),
);
Skia.Paint.setAntiAlias(stroke, true);
Skia.Paint.setStyle(stroke, Stroke);
Skia.Paint.setStrokeWidth(stroke, 2.);
let innerPath = Skia.Path.make();
Skia.Path.lineTo(innerPath, 5., 5.);
Skia.Path.lineTo(innerPath, 15., -5.);
Skia.Path.lineTo(innerPath, 20., 0.);
let translate = Skia.Matrix.makeScale(20., 20., 20., 20.);
let pathEffect =
Skia.PathEffect.create2dPath(~matrix=translate, innerPath);
Skia.Paint.setPathEffect(stroke, pathEffect);
let path = Skia.Path.make();
Skia.Path.addCircle(path, 125., 125., ~radius=100., ());
CanvasContext.drawPath(~path, ~paint=stroke, canvasContext);
let maybeSkia =
Revery_Font.Family.fromFile("Roboto-Regular.ttf")
|> Revery_Font.Family.toSkia(Revery_Font.Weight.Normal);
switch (Revery_Font.load(maybeSkia)) {
| Error(_) => ()
| Ok(font) =>
let textPaint = Skia.Paint.make();
Skia.Paint.setColor(textPaint, Color.toSkia(Colors.white));
Skia.Paint.setLcdRenderText(textPaint, true);
Skia.Paint.setAntiAlias(textPaint, true);
Skia.Paint.setTextSize(textPaint, 20.);
let shapedText =
"Hello, World"
|> FontCache.shape(font)
|> ShapeResult.getGlyphStrings;
Skia.Paint.setTextEncoding(textPaint, GlyphId);
shapedText
|> List.iter(((typeface, string)) => {
Skia.Paint.setTypeface(textPaint, typeface);
CanvasContext.drawText(
~paint=textPaint,
~x=10.0,
~y=20.0,
~text=string,
canvasContext,
);
});
};
let fill = Skia.Paint.make();
Skia.Paint.setColor(
fill,
Skia.Color.makeArgb(0xFFl, 0xFFl, 0x00l, 0x00l),
);
let rect = Skia.Rect.makeLtrb(200., 150., 250., 300.);
CanvasContext.drawOval(~rect, ~paint=fill, canvasContext);
let red = Skia.Color.makeArgb(0xFFl, 0xFFl, 0x00l, 0x00l);
let blue = Skia.Color.makeArgb(0xFFl, 0x00l, 0x00l, 0xFFl);
// Test out some layers...
let layer =
CanvasContext.createLayer(
~width=128l,
~height=128l,
canvasContext,
)
|> Option.get;
// Draw a circle onto our new layer...
let paint = Skia.Paint.make();
let linearGradient =
Skia.Shader.makeLinearGradient2(
~startPoint=Skia.Point.make(16., 16.0),
~stopPoint=Skia.Point.make(48.0, 48.0),
~startColor=red,
~stopColor=blue,
~tileMode=`clamp,
);
Skia.Paint.setShader(paint, linearGradient);
Skia.Paint.setColor(
paint,
Skia.Color.makeArgb(0xFFl, 0x00l, 0xFFl, 0x00l),
);
CanvasContext.drawCircle(
~x=32.,
~y=32.,
~radius=16.,
~paint,
layer,
);
// And then draw the layer a bunch of places!
let paint = Skia.Paint.make();
CanvasContext.drawLayer(
~paint,
~layer,
~x=300.,
~y=300.,
canvasContext,
);
CanvasContext.drawLayer(
~paint,
~layer,
~x=264.,
~y=264.,
canvasContext,
);
CanvasContext.drawLayer(
~paint,
~layer,
~x=264.,
~y=300.,
canvasContext,
);
CanvasContext.drawLayer(
~paint,
~layer,
~x=300.,
~y=264.,
canvasContext,
);
}}
/>
</View>;
};
};
let render = () => <Sample />;
================================================
FILE: examples/CheckboxExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Check = {
type checkboxState = {
first: bool,
second: bool,
};
let getCheckboxText = checked => checked ? "Checked!" : "Not Checked!";
let%component make = () => {
let initialCheckboxState = {first: false, second: true};
let%hook ({first, second}, setCheckboxState) =
Hooks.state(initialCheckboxState);
<View
style=Style.[
width(500),
height(500),
justifyContent(`Center),
alignItems(`Center),
]>
<Checkbox
checked=first
onChange={() => setCheckboxState(_ => {first: !first, second})}
style=Style.[marginBottom(10)]
/>
<Text
text={getCheckboxText(first)}
fontSize=20.
style=Style.[marginBottom(10)]
/>
<Checkbox
checkedColor=Colors.green
onChange={() => setCheckboxState(_ => {second: !second, first})}
style=Style.[border(~width=2, ~color=Colors.green)]
checked=second
/>
<Text
text={
"Default state: " ++ getCheckboxText(initialCheckboxState.second)
}
fontSize=20.
style=Style.[marginTop(10)]
/>
</View>;
};
};
let render = () => {
<Check />;
};
================================================
FILE: examples/DefaultButton.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module DefaultButtonWithCounter = {
let%component make = () => {
let%hook (count, setCount) = Hooks.state(0);
let increment = () => setCount(_ => count + 1);
let containerStyle =
Style.[justifyContent(`Center), alignItems(`Center)];
let countContainer =
Style.[
width(300),
height(300),
alignItems(`Center),
justifyContent(`Center),
];
let countStyle = Style.[margin(24), color(Colors.black)];
let countStr = string_of_int(count);
<View style=containerStyle>
<View style=countContainer>
<Text fontSize=50. style=countStyle text=countStr />
</View>
<Button title="click me!" onClick=increment />
<Button disabled=true title="(disabled)" onClick=increment />
</View>;
};
};
let render = () => <View> <DefaultButtonWithCounter /> </View>;
================================================
FILE: examples/DropdownExample.re
================================================
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
];
let textStyle = Style.[marginBottom(20)];
module DropdownExample = {
let items: DropdownInt.items = [
{value: 1, label: "First option"},
{value: 2, label: "Second option"},
{value: 3, label: "Third option"},
{value: 4, label: "Fourth option"},
{value: 5, label: "A really, really, really long option"},
];
let%component make = () => {
let%hook (selectedItem, setSelectedItem) =
Hooks.state(List.nth(items, 0));
<View style=containerStyle>
<Text
style=textStyle
fontSize=20.
text={"Selected Item: " ++ selectedItem.label}
/>
<DropdownInt items onItemSelected={item => setSelectedItem(_ => item)} />
</View>;
};
};
let render = () => <DropdownExample />;
================================================
FILE: examples/Examples.re
================================================
open Revery;
open ExampleStubs;
module SliderExample = Slider;
module ScrollViewExample = ScrollView;
open Revery.UI;
open Revery.UI.Components;
let bgColor = Color.hex("#212733");
let activeBackgroundColor = Color.hex("#2E3440");
let inactiveBackgroundColor = Color.hex("#272d39");
let selectionHighlight = Color.hex("#90f7ff");
type example = {
name: string,
render: Window.t => element,
source: string,
};
let examples = [
{name: "Animation", render: _w => Hello.render(), source: "Hello.re"},
{
name: "Spring",
render: _w => SpringExample.render(),
source: "SpringExample.re",
},
{
name: "CanQuit",
render: _ => CanQuitExample.render(),
source: "CanQuit.re",
},
{
name: "Button",
render: _ => DefaultButton.render(),
source: "DefaultButton.re",
},
{
name: "Checkbox",
render: _ => CheckboxExample.render(),
source: "CheckboxExample.re",
},
{name: "Slider", render: _ => SliderExample.render(), source: "Slider.re"},
{name: "Border", render: _ => Border.render(), source: "Border.re"},
{
name: "ScrollView",
render: _ => ScrollViewExample.render(),
source: "ScrollView.re",
},
{
name: "Calculator",
render: w => Calculator.render(w),
source: "Calculator.re",
},
{name: "Flexbox", render: _ => Flexbox.render(), source: "Flexbox.re"},
{
name: "Box Shadow",
render: _ => Boxshadow.render(),
source: "Boxshadow.re",
},
{name: "Focus", render: _ => FocusExample.render(), source: "Focus.re"},
{name: "Fonts", render: _ => FontsExample.render(), source: "Fonts.re"},
{
name: "Stopwatch",
render: _ => Stopwatch.render(),
source: "Stopwatch.re",
},
{
name: "Native: File(s)/Folders(s)",
render: _ => NativeFileExample.render(),
source: "NativeFileExample.re",
},
{
name: "Native: Notifications",
render: _ => NativeNotificationExample.render(),
source: "NativeNotificationExample.re",
},
{
name: "Native: Icon Features",
render: w => NativeIconExample.render(w),
source: "NativeIconExample.re",
},
{
name: "Native: OSX Menu",
render: w => NativeMenuExample.render(w),
source: "NativeMenuExample.re",
},
{
name: "Native: Inputs",
render: _ => NativeInputExample.render(),
source: "NativeInputExample.re",
},
{
name: "Input",
render: _ => InputExample.render(),
source: "InputExample.re",
},
{
name: "Radio Button",
render: _ => RadioButtonExample.render(),
source: "RadioButtonExample.re",
},
{
name: "Game Of Life",
render: _ => GameOfLife.render(),
source: "GameOfLife.re",
},
{
name: "Screen Capture",
render: w => ScreenCapture.render(w),
source: "ScreenCapture.re",
},
{
name: "Tree View",
render: w => TreeView.render(w),
source: "TreeView.re",
},
{
name: "Analog Clock",
render: _ => AnalogClock.render(),
source: "AnalogClock.re",
},
{
name: "TodoMVC",
render: _ => TodoExample.render(),
source: "TodoExample.re",
},
{
name: "Dropdown",
render: _ => DropdownExample.render(),
source: "DropdownExample.re",
},
{
name: "Text",
render: _w => TextExample.render(),
source: "TextExample.re",
},
{
name: "Hover Example",
render: _ => HoverExample.render(),
source: "HoverExample.re",
},
{
name: "Canvas Example",
render: _ => CanvasExample.render(),
source: "CanvasExample.re",
},
{
name: "SVG Example",
render: _ => SVGExample.render(),
source: "SVGExample.re",
},
{
name: "Zoom Example",
render: _ => ZoomExample.render(),
source: "ZoomExample.re",
},
{
name: "Nested Clickables",
render: _ => NestedClickable.render(),
source: "NestedClickable.re",
},
{
name: "File Drag & Drop",
render: _ => FileDragAndDrop.render(),
source: "FileDragAndDrop.re",
},
{
name: "Rich Text Example",
render: _ => RichTextExample.render(),
source: "RichTextExample.re",
},
{
name: "Shell: Open URL",
render: _ => URLFileOpen.render(),
source: "URLFileOpen.re",
},
{
name: "Window: Hit Tests/Zones",
render: w => HitTests.render(w),
source: "HitTests.re",
},
{
name: "Window: Control",
render: w => WindowControl.render(w),
source: "WindowControl.re",
},
{
name: "Markdown",
render: _ => MarkdownExample.render(),
source: "MarkdownExample.re",
},
{
name: "ImageQuality",
render: _ => ImageQualityExample.render(),
source: "ImageQualityExample.re",
},
{
name: "Layer",
render: _ => LayerExample.render(),
source: "LayerExample.re",
},
{
name: "WavFilePlayback",
render: _ => WavFilePlaybackExample.render(),
source: "WavFilePlaybackExample.re",
},
];
let getExampleByName = name =>
List.find(example => example.name == name, examples);
let noop = () => ();
module ExampleButton = {
let make = (~isActive, ~name, ~onClick, ()) => {
let highlightColor =
isActive ? selectionHighlight : Colors.transparentWhite;
let buttonOpacity = 1.0;
let bgColor = isActive ? activeBackgroundColor : inactiveBackgroundColor;
let wrapperStyle =
Style.[
borderLeft(~width=4, ~color=highlightColor),
backgroundColor(bgColor),
];
let textColor = isActive ? Colors.white : Colors.grey;
let textHeaderStyle = Style.[color(textColor), margin(16)];
<Opacity opacity=buttonOpacity>
<Clickable style=wrapperStyle onClick>
<Text style=textHeaderStyle text=name />
</Clickable>
</Opacity>;
};
};
module ExampleHost = {
let%component make = (~window, ~initialExample, ()) => {
let%hook (selectedExample, setSelectedExample) =
Hooks.state(getExampleByName(initialExample));
let renderButton = example => {
let isActive = example === selectedExample;
let onClick = _ => {
Window.setTitle(window, "Revery Example - " ++ example.name);
prerr_endline("SOURCE FILE: " ++ example.source);
notifyExampleSwitched(example.source);
setSelectedExample(_ => example);
};
<ExampleButton isActive name={example.name} onClick />;
};
let buttons = List.map(renderButton, examples);
let exampleView = selectedExample.render(window);
<View
onMouseWheel={_evt => ()}
style=Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
backgroundColor(bgColor),
bottom(0),
top(0),
left(0),
right(0),
flexDirection(`Row),
]>
<ScrollView
style=Style.[
position(`Absolute),
top(0),
left(0),
width(175),
bottom(0),
backgroundColor(bgColor),
]>
<View> {buttons |> React.listToElement} </View>
</ScrollView>
<View
style=Style.[
position(`Absolute),
top(0),
left(175),
right(0),
bottom(0),
backgroundColor(activeBackgroundColor),
]>
exampleView
</View>
</View>;
};
};
let init = app => {
Revery.App.initConsole();
Timber.App.enable(Timber.Reporter.console());
Timber.App.setLevel(Timber.Level.perf);
App.onIdle(app, () => prerr_endline("Idle!"))
|> (ignore: Revery.App.unsubscribe => unit);
App.onBeforeQuit(
app,
(_code: int) => {
prerr_endline("Quitting!");
App.AllowQuit;
},
)
|> (ignore: Revery.App.unsubscribe => unit);
let initialExample = ref("Canvas Example");
let decorated = ref(true);
let forceScaleFactor = ref(None);
let showFPSCounter = ref(false);
Arg.parse(
[
("--trace", Unit(() => Timber.App.setLevel(Timber.Level.trace)), ""),
("--no-decoration", Unit(() => decorated := false), ""),
("--example", String(name => initialExample := name), ""),
(
"--force-device-scale-factor",
Float(scaleFactor => forceScaleFactor := Some(scaleFactor)),
"",
),
("--show-fps", Unit(() => showFPSCounter := true), ""),
],
_ => (),
"There is only --trace, --example, --no-decoration, --show-fps, and --force-device-scale-factor",
);
let initialExample = initialExample^;
let maximized = Environment.webGL;
let windowWidth = 800;
let windowHeight = 480;
print_endline("Hello from example app");
let window =
App.createWindow(
~createOptions=
WindowCreateOptions.create(
~width=windowWidth,
~height=windowHeight,
~maximized,
~titlebarStyle=Transparent,
~icon=Some("revery-icon.png"),
~decorated=decorated^,
~forceScaleFactor=forceScaleFactor^,
~acceleration=`Auto,
(),
),
app,
"Welcome to Revery!",
);
if (showFPSCounter^) {
Window.showFPSCounter(window);
};
if (Environment.webGL) {
Window.maximize(window);
};
/* NOTE: If you want to use network-calls or other IO, uncomment this line */
// let _startEventLoop = Revery_Lwt.startEventLoop();
let _unsubscribe =
Window.onFocusGained(window, () => print_endline("Focus gained"));
let _unsubscribe =
Window.onFocusLost(window, () => print_endline("Focus lost"));
let _unsubscribe =
Window.onMaximized(window, () => print_endline("Maximized!"));
let _unsubscribe =
Window.onFullscreen(window, () => print_endline("Fullscreen!"));
let _unsubscribe =
Window.onMinimized(window, () => print_endline("Minimized!"));
let _unsubscribe =
Window.onRestored(window, () => print_endline("Restored!"));
let _unsubscribe =
Window.onSizeChanged(window, ({width, height}) =>
print_endline(Printf.sprintf("Size changed: %d x %d", width, height))
);
let _unsubscribe =
Window.onMoved(window, ((x, y)) =>
print_endline(Printf.sprintf("Moved: %d x %d", x, y))
);
print_endline(
Printf.sprintf("Operating system: %s", Environment.osString),
);
let _renderFunction =
UI.start(window, <ExampleHost window initialExample />);
();
};
Printexc.record_backtrace(true);
App.start(init);
================================================
FILE: examples/FileDragAndDrop.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Styles = {
open Style;
let droppable = [
width(100),
height(100),
backgroundColor(Colors.blue),
justifyContent(`Center),
alignItems(`Center),
];
let outer = [
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
justifyContent(`Center),
alignItems(`Center),
];
let text = Style.[color(Colors.white)];
let activeStyle = Style.[color(Colors.blue)];
let inactiveStyle = Style.[color(Colors.lightBlue)];
};
let filesToText = files =>
List.map(
file =>
<ClickableText
onClick={_ => Native.Shell.openFile(file) |> ignore}
text=file
activeStyle=Styles.activeStyle
inactiveStyle=Styles.inactiveStyle
/>,
files,
);
let%component dnd = () => {
let%hook (files: list(string), setFiles) = Hooks.state([]);
<View style=Styles.outer>
{React.listToElement(filesToText(files))}
<View style=Styles.droppable onFileDropped={e => setFiles(_ => e.paths)}>
<Text style=Styles.text text="Drop here!" />
</View>
</View>;
};
let render = () => <dnd />;
================================================
FILE: examples/Flexbox.re
================================================
open Revery;
open Revery.UI;
let parentWidth = 400;
let childWidth = 300;
let parentStyles =
(~alignment as a=`Auto, ~direction as d=`Row, ~justify as j=`Center, ()) =>
Style.[
backgroundColor(Colors.green),
position(`Relative),
width(parentWidth),
height(100),
alignItems(a),
justifyContent(j),
flexDirection(d),
];
let childStyles =
Style.[
backgroundColor(Colors.blue),
position(`Relative),
width(childWidth),
height(40),
];
let defaultTextStyles =
Style.[color(Colors.white), backgroundColor(Colors.blue)];
let parentColumnStyle = parentStyles(~direction=`Column);
let headerStyle =
Style.[marginTop(25), marginBottom(25), color(Colors.white)];
let horizontalStyles =
<View>
<Text style=headerStyle fontSize=30. text="Flex Direction Row" />
<View style={parentColumnStyle(~alignment=`Auto, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Default Flex" />
</View>
</View>
<View style={parentColumnStyle(~alignment=`Center, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Center" />
</View>
</View>
<View style={parentColumnStyle(~alignment=`FlexStart, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Flex Start" />
</View>
</View>
<View style={parentColumnStyle(~alignment=`FlexEnd, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Flex End" />
</View>
</View>
<View style={parentColumnStyle(~alignment=`Stretch, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Flex Stretch" />
</View>
</View>
</View>;
let verticalStyles =
<View>
<Text style=headerStyle fontSize=30. text="Flex Direction Column" />
<View style={parentStyles(~direction=`Column, ~justify=`FlexStart, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Align Flex Start" />
</View>
</View>
<View style={parentStyles(~direction=`Column, ~justify=`Center, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Align Flex Center" />
</View>
</View>
<View style={parentStyles(~direction=`Column, ~justify=`FlexEnd, ())}>
<View style=childStyles>
<Text style=defaultTextStyles fontSize=20. text="Align Flex End" />
</View>
</View>
</View>;
let render = () => <View> horizontalStyles verticalStyles </View>;
================================================
FILE: examples/FocusExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module SimpleButton = {
let%component make = () => {
let%hook (count, setCount) = Hooks.state(0);
let%hook (focused, setFocus) = Hooks.state(false);
let increment = () => setCount(_ => count + 1);
let txt = focused ? "Focused" : "Unfocused";
let textContent = txt ++ " me: " ++ string_of_int(count);
<Clickable
onClick=increment
tabindex=0
onFocus={() => setFocus(_ => true)}
onBlur={() => setFocus(_ => false)}>
<View
style=Style.[
backgroundColor(Color.rgba(1., 1., 1., 0.1)),
border(~width=2, ~color=Colors.white),
margin(16),
]>
<Text
fontSize=20.
style=Style.[color(Colors.white), margin(4)]
text=textContent
/>
</View>
</Clickable>;
};
};
let render = () =>
<View
style=Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
]>
<SimpleButton />
</View>;
================================================
FILE: examples/FontsExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module FontComponent = {
type state = {
family: string,
bold: bool,
italic: bool,
};
let initialState: state = {family: "Arial", bold: false, italic: false};
type actions =
| SetBold(bool)
| SetItalic(bool)
| SetFamily(string);
let reducer = (action: actions, state: state) => {
let state =
switch (action) {
| SetBold(v) => {...state, bold: v}
| SetItalic(v) => {...state, italic: v}
| SetFamily(v) => {...state, family: v}
};
state;
};
let%component make = () => {
let%hook (state, dispatch) = Hooks.reducer(~initialState, reducer);
let fontExample =
<Text
text="Lorem ipsum dolor sit amet"
fontFamily={Font.Family.system(state.family)}
fontWeight={state.bold ? Font.Weight.Bold : Font.Weight.Normal}
italic={state.italic}
fontSize=24.
/>;
<Container width=500 height=500>
<Center>
<Padding padding=10>
<Row>
<Input
placeholder="Type font name"
onChange={(value, _) => dispatch(SetFamily(value))}
value={state.family}
/>
</Row>
</Padding>
<Padding padding=10>
<Row>
<Padding padding=16>
<Checkbox
checked={state.bold}
onChange={() => dispatch(SetBold(!state.bold))}
/>
</Padding>
<Center>
<Text text="Bold" fontSize=20. style=Style.[width(150)] />
</Center>
</Row>
</Padding>
<Padding padding=10>
<Row>
<Padding padding=16>
<Checkbox
checked={state.italic}
onChange={() => dispatch(SetItalic(!state.italic))}
/>
</Padding>
<Center>
<Text text="Italic" fontSize=20. style=Style.[width(150)] />
</Center>
</Row>
</Padding>
<Padding padding=16> <Row> fontExample </Row> </Padding>
</Center>
</Container>;
};
};
let render = () => {
<FontComponent />;
};
================================================
FILE: examples/GameOfLife.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module ViewPort = {
type t = {
xMin: int,
yMin: int,
xMax: int,
yMax: int,
};
type direction =
| North
| East
| South
| West;
let create = size => {xMin: 0, xMax: size, yMin: 0, yMax: size};
let changeDirection = (viewPort, direction) =>
switch (direction) {
| North => {...viewPort, yMin: viewPort.yMin - 1, yMax: viewPort.yMax - 1}
| East => {...viewPort, xMin: viewPort.xMin + 1, xMax: viewPort.xMax + 1}
| South => {...viewPort, yMin: viewPort.yMin + 1, yMax: viewPort.yMax + 1}
| West => {...viewPort, xMin: viewPort.xMin - 1, xMax: viewPort.xMax - 1}
};
let zoomOut = viewPort => {
xMin: viewPort.xMin - 1,
xMax: viewPort.xMax + 1,
yMin: viewPort.yMin - 1,
yMax: viewPort.yMax + 1,
};
let zoomIn = viewPort =>
if (viewPort.xMax > viewPort.xMin + 2) {
{
xMin: viewPort.xMin + 1,
xMax: viewPort.xMax - 1,
yMin: viewPort.yMin + 1,
yMax: viewPort.yMax - 1,
};
} else {
viewPort;
};
};
module Position = {
type t = (int, int);
};
type cell =
| Alive
| Dead;
module Universe = {
module T =
Map.Make({
type t = Position.t;
let compare = compare;
});
include T;
let universeFromList = positions =>
List.fold_left(
(acc, pos) => T.add(pos, Alive, acc),
T.empty,
positions,
);
};
module Examples = {
let blinker = Universe.universeFromList([(5, 4), (5, 5), (5, 6)]);
let pulsar =
Universe.universeFromList([
(4, 2),
(5, 2),
(6, 2),
(10, 2),
(11, 2),
(12, 2),
(2, 4),
(7, 4),
(9, 4),
(14, 4),
(2, 5),
(7, 5),
(9, 5),
(14, 5),
(2, 6),
(7, 6),
(9, 6),
(14, 6),
(4, 7),
(5, 7),
(6, 7),
(10, 7),
(11, 7),
(12, 7),
(4, 9),
(5, 9),
(6, 9),
(10, 9),
(11, 9),
(12, 9),
(2, 10),
(7, 10),
(9, 10),
(14, 10),
(2, 11),
(7, 11),
(9, 11),
(14, 11),
(2, 12),
(7, 12),
(9, 12),
(14, 12),
(4, 14),
(5, 14),
(6, 14),
(10, 14),
(11, 14),
(12, 14),
]);
};
module GameOfLife = {
/* helper function for options */
let withDefault = (opt, ~default) =>
switch (opt) {
| Some(x) => x
| None => default
};
let findCell = (universe, position) =>
Universe.find_opt(position, universe)
|> withDefault(~default=Dead)
|> (cell => (position, cell));
let numberOfLive = neighbours =>
neighbours
|> List.filter(x =>
switch (x) {
| Alive => true
| _ => false
}
)
|> List.length;
type lifeCycle =
| Dies
| Revives
| Same;
let underPopulationRule = (cell, neighbours) =>
switch (cell) {
| Alive =>
if (numberOfLive(neighbours) < 2) {
Dies;
} else {
Same;
}
| Dead => Same
};
let livesOnRule = (cell, neighbours) =>
switch (cell) {
| Alive =>
let numberOfLiveNeighbours = numberOfLive(neighbours);
if (numberOfLiveNeighbours == 2 || numberOfLiveNeighbours == 3) {
Same;
} else {
Dies;
};
| Dead => Same
};
let overPopulationRule = (cell, neighbours) =>
switch (cell) {
| Alive =>
if (numberOfLive(neighbours) > 3) {
Dies;
} else {
Same;
}
| Dead => Same
};
let reproductionRule = (cell, neighbours) =>
switch (cell) {
| Alive => Same
| Dead =>
if (numberOfLive(neighbours) == 3) {
Revives;
} else {
Same;
}
};
let reduceLifeCycle = (cell, neighbours) => {
let actions = [
underPopulationRule(cell, neighbours),
livesOnRule(cell, neighbours),
overPopulationRule(cell, neighbours),
reproductionRule(cell, neighbours),
];
let reducedLifeCycle =
actions |> List.filter((!=)(Same)) |> (l => List.nth_opt(l, 0));
withDefault(reducedLifeCycle, ~default=Same);
};
let applyRules = (cell, neighbours) => {
let action = reduceLifeCycle(cell, neighbours);
switch (action) {
| Dies => Dead
| Revives => Alive
| Same => cell
};
};
let neighbourPositions = ((x, y)) => [
(x - 1, y - 1),
(x, y - 1),
(x + 1, y - 1),
(x - 1, y),
(x + 1, y),
(x - 1, y + 1),
(x, y + 1),
(x + 1, y + 1),
];
let evolveCell = (universe, (position, cell)) => {
let neighbours =
List.map(
position => findCell(universe, position) |> snd,
neighbourPositions(position),
);
let evolvedCell = applyRules(cell, neighbours);
(position, evolvedCell);
};
let evolve = universe => {
let find_relevant_cells = position =>
neighbourPositions(position) |> List.map(findCell(universe));
let keys = Universe.bindings(universe) |> List.map(fst);
keys
|> List.map(find_relevant_cells)
|> List.concat
|> List.sort_uniq(compare)
|> List.map(evolveCell(universe))
|> List.filter(x => snd(x) |> (==)(Alive))
|> List.map(fst)
|> Universe.universeFromList;
};
};
module Row = {
let style =
Style.[
flexDirection(`Row),
alignItems(`Stretch),
justifyContent(`Center),
backgroundColor(Colors.darkGrey),
flexGrow(1),
];
let make = (~children, ()) => <View style> ...children </View>;
};
module Column = {
let style =
Style.[
flexDirection(`Column),
alignItems(`Stretch),
justifyContent(`Center),
flexGrow(1),
];
let make = (~children, ()) => <View style> ...children </View>;
};
module Cell = {
let clickableStyle =
Style.[
position(`Relative),
backgroundColor(Colors.transparentWhite),
justifyContent(`Center),
alignItems(`Stretch),
flexGrow(1),
margin(0),
];
let baseStyle =
Style.[
flexDirection(`Column),
alignItems(`Stretch),
justifyContent(`Center),
flexGrow(1),
];
let aliveStyle =
Style.(merge(~source=baseStyle, ~target=[backgroundColor(Colors.red)]));
let deadStyle =
Style.(
merge(~source=baseStyle, ~target=[backgroundColor(Colors.black)])
);
let make = (~cell, ~onClick, ()) => {
let style =
switch (cell) {
| Alive => <View style=aliveStyle />
| Dead => <View style=deadStyle />
};
<Clickable style=clickableStyle onClick> style </Clickable>;
};
};
let viewPortRender =
(viewPort: ViewPort.t, universe: Universe.t(cell), onClick) => {
let cell = pos =>
switch (Universe.find_opt(pos, universe)) {
| Some(_) => Alive
| None => Dead
};
let rec range = (min, max, result) =>
if (min == max) {
result;
} else {
range(min, max - 1, [max, ...result]);
};
let cols = range(viewPort.xMin, viewPort.xMax, []);
let rows = range(viewPort.yMin, viewPort.yMax, []);
List.map(
x =>
<Column>
{List.map(
y =>
<Row>
<Cell cell={cell((x, y))} onClick={() => onClick((x, y))} />
</Row>,
rows,
)
|> React.listToElement}
</Column>,
cols,
);
};
type state = {
viewPort: ViewPort.t,
universe: Universe.t(cell),
isRunning: bool,
dispose,
}
and dispose = unit => unit;
type action =
| TimerTick(Time.t)
| StartTimer(dispose)
| StopTimer
| ToggleAlive(Position.t)
| MoveViewPort(ViewPort.direction)
| ZoomViewPort(zoom)
and zoom =
| ZoomIn
| ZoomOut;
let noop = () => ();
let reducer = (action, state) =>
switch (action) {
| TimerTick(_t) => {...state, universe: GameOfLife.evolve(state.universe)}
| StartTimer(dispose) => {...state, dispose, isRunning: true}
| StopTimer =>
state.dispose();
{...state, dispose: noop, isRunning: false};
| ToggleAlive(position) => {
...state,
universe:
Universe.update(
position,
cell =>
switch (cell) {
| Some(Alive) => None
| _ => Some(Alive)
},
state.universe,
),
}
| MoveViewPort(direction) => {
...state,
viewPort: ViewPort.changeDirection(state.viewPort, direction),
}
| ZoomViewPort(zoom) => {
...state,
viewPort:
switch (zoom) {
| ZoomIn => ViewPort.zoomIn(state.viewPort)
| ZoomOut => ViewPort.zoomOut(state.viewPort)
},
}
};
module GameOfLiveComponent = {
let controlsStyle = Style.[height(120), flexDirection(`Row)];
let%component make = (~state, ()) => {
let%hook (state, dispatch) = Hooks.reducer(~initialState=state, reducer);
let%hook () =
Hooks.effect(OnMount, () => Some(() => dispatch(StopTimer)));
let toggleAlive = pos => dispatch(ToggleAlive(pos));
let startStop = () =>
state.isRunning
? dispatch(StopTimer)
: {
let dispose =
Tick.interval(
~name="GameOfLife Timer",
t => dispatch(TimerTick(t)),
Time.zero,
);
dispatch(StartTimer(dispose));
};
let iconFamily = Font.Family.fromFile("FontAwesome5FreeSolid.otf");
<Column>
<Row>
{viewPortRender(state.viewPort, state.universe, toggleAlive)
|> React.listToElement}
</Row>
<View style=controlsStyle>
<Button
fontFamily=iconFamily
title={state.isRunning ? {||} : {||}}
onClick=startStop
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(MoveViewPort(North))}
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(MoveViewPort(South))}
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(MoveViewPort(East))}
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(MoveViewPort(West))}
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(ZoomViewPort(ZoomIn))}
/>
<Button
fontFamily=iconFamily
title={||}
onClick={_ => dispatch(ZoomViewPort(ZoomOut))}
/>
</View>
</Column>;
};
};
let render = () => {
let viewPort = ViewPort.create(15);
let state = {
viewPort,
universe: Examples.pulsar,
isRunning: false,
dispose: noop,
};
<GameOfLiveComponent state />;
};
================================================
FILE: examples/Hello.re
================================================
open Revery;
open Revery.Math;
open Revery.UI;
open Revery.UI.Components;
module RepoLink = {
let make = () => {
let activeStyle = Style.[color(Colors.blue)];
let inactiveStyle = Style.[color(Colors.lightBlue)];
<Link
text="View on GitHub"
href="https://github.com/revery-ui/revery"
activeStyle
inactiveStyle
/>;
};
};
module Logo = {
let rotationAnimation =
Animation.(
zip((
animate(Time.seconds(9))
|> tween(0., 6.28)
|> repeat
|> delay(Time.seconds(1)),
animate(Time.seconds(4))
|> tween(0., 6.28)
|> repeat
|> delay(Time.ms(500)),
))
);
let%component make = () => {
let%hook (shouldRotate, setShouldRotate) = Hooks.state(true);
let%hook ((rotationX, rotationY), _animationState, resetRotation) =
Hooks.animation(
~name="Rotation Animation",
rotationAnimation,
~active=shouldRotate,
);
let%hook (opacity, setOpacity) = Hooks.state(1.0);
let%hook transitionedOpacity =
Hooks.transition(~name="Opacity Transition Animation", opacity);
<View>
<Opacity opacity=transitionedOpacity>
<Image
src={`File("outrun-logo.png")}
style=Style.[
transform([
Transform.RotateY(Angle.from_radians(rotationY)),
Transform.RotateX(Angle.from_radians(rotationX)),
]),
]
/>
<View style=Style.[alignItems(`Center)]> <RepoLink /> </View>
<Row>
<Button
width=200
height=80
onClick={() => setShouldRotate((!))}
title={shouldRotate ? "Pause" : "Resume"}
/>
<Button
width=200
height=80
onClick={() => {
setShouldRotate(_ => true);
resetRotation();
}}
title="Restart"
/>
</Row>
</Opacity>
<Row>
<Button
width=200
height=80
onClick={() => setOpacity(_ => 1.0)}
title="Show it"
/>
<Button
width=200
height=80
onClick={() => setOpacity(_ => 0.0)}
title="Hide it"
/>
</Row>
</View>;
};
};
module AnimatedText = {
let%component make = (~text: string, ~delay: Time.t, ()) => {
let%hook (animatedOpacity, _state, _reset) =
Hooks.animation(
~name="Text Opacity Animation",
Animation.(
animate(Time.seconds(1))
|> delay(Time.seconds(1))
|> ease(Easing.easeOut)
|> tween(0., 1.)
),
);
let%hook (translate, _state, _reset) =
Hooks.animation(
~name="Text Translate Animation",
Animation.animate(Time.ms(500))
|> Animation.delay(delay)
|> Animation.ease(Easing.easeOut)
|> Animation.tween(50., 0.),
);
let textHeaderStyle =
Style.[
color(Colors.white),
marginHorizontal(8),
transform([Transform.TranslateY(translate)]),
];
<Opacity opacity=animatedOpacity>
<Text style=textHeaderStyle fontSize=24. text />
</Opacity>;
};
};
let render = () =>
<Center>
<Row>
<AnimatedText delay=Time.zero text="Welcome" />
<AnimatedText delay={Time.ms(500)} text="to" />
<AnimatedText delay={Time.seconds(1)} text="Revery 😃" />
</Row>
<Logo />
</Center>;
================================================
FILE: examples/HitTests.re
================================================
open Revery;
open Revery.UI;
module Styles = {
open Style;
let outer = [
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
justifyContent(`Center),
alignItems(`Center),
];
let draggable = [
width(100),
height(100),
backgroundColor(Colors.blue),
justifyContent(`Center),
alignItems(`Center),
];
let text = Style.[color(Colors.white)];
};
let hitTests = (~window, ()) =>
<View style=Styles.outer>
{Window.isDecorated(window)
? <Text
text="Window decorations must not be enabled.\nRestart with --no-decoration"
style=Styles.text
/>
: <View style=Styles.draggable mouseBehavior=Draggable>
<Text
text="Drag window from here!"
style=Styles.text
mouseBehavior=Draggable
/>
</View>}
</View>;
let render = window => <hitTests window />;
================================================
FILE: examples/HoverExample.re
================================================
open Revery;
open Revery.UI;
type state = {
parentBackground: Color.t,
childOneBackground: Color.t,
childTwoBackground: Color.t,
childThreeBackground: Color.t,
childFourBackground: Color.t,
};
type action =
| SetParentBackground(Color.t)
| SetChildOneBackground(Color.t)
| SetChildTwoBackground(Color.t)
| SetChildThreeBackground(Color.t)
| SetChildFourBackground(Color.t);
let reducer = (action: action, state) => {
switch (action) {
| SetParentBackground(c) => {...state, parentBackground: c}
| SetChildOneBackground(c) => {...state, childOneBackground: c}
| SetChildTwoBackground(c) => {...state, childTwoBackground: c}
| SetChildThreeBackground(c) => {...state, childThreeBackground: c}
| SetChildFourBackground(c) => {...state, childFourBackground: c}
};
};
module HoverExample = {
let initialState = {
parentBackground: Colors.darkGray,
childOneBackground: Colors.blanchedAlmond,
childTwoBackground: Colors.blueViolet,
childThreeBackground: Colors.burlyWood,
childFourBackground: Colors.cornflowerBlue,
};
let%component make = () => {
let%hook (state, dispatch) = Hooks.reducer(~initialState, reducer);
<View
style=Style.[
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
width(500),
height(500),
backgroundColor(state.parentBackground),
]
onMouseOver={_ => dispatch(SetParentBackground(Colors.lightGray))}
onMouseOut={_ =>
dispatch(SetParentBackground(initialState.parentBackground))
}>
<View
style=Style.[
flexDirection(`Row),
flexWrap(`Wrap),
justifyContent(`SpaceAround),
alignItems(`Center),
]>
<View
style=Style.[
width(175),
height(175),
backgroundColor(state.childOneBackground),
]
onMouseEnter={_ =>
dispatch(SetChildOneBackground(Colors.aquamarine))
}
onMouseLeave={_ =>
dispatch(SetChildOneBackground(initialState.childOneBackground))
}
/>
<View
style=Style.[
width(175),
height(175),
backgroundColor(state.childTwoBackground),
]
onMouseOver={_ =>
dispatch(SetChildTwoBackground(Colors.forestGreen))
}
onMouseOut={_ =>
dispatch(SetChildTwoBackground(initialState.childTwoBackground))
}
/>
<View
style=Style.[
width(175),
height(175),
backgroundColor(state.childThreeBackground),
]
onMouseOver={_ =>
dispatch(SetChildThreeBackground(Colors.darkSalmon))
}
onMouseOut={_ =>
dispatch(
SetChildThreeBackground(initialState.childThreeBackground),
)
}
/>
<View
style=Style.[
width(175),
height(175),
backgroundColor(state.childFourBackground),
]
onMouseEnter={_ => dispatch(SetChildFourBackground(Colors.tomato))}
onMouseLeave={_ =>
dispatch(
SetChildFourBackground(initialState.childFourBackground),
)
}
/>
</View>
</View>;
};
};
let render = () => {
<View
style=Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
]>
<HoverExample />
</View>;
};
================================================
FILE: examples/ImageQualityExample.re
================================================
open Revery.UI;
module ImageSample = {
let make = (~quality, ()) => {
<View style=Style.[padding(8)]>
<Image height=50 width=50 src={`File("reason-logo.png")} quality />
</View>;
};
};
module Images = {
let make = () => {
<View
style=Style.[
flexDirection(`Column),
flexGrow(1),
justifyContent(`Center),
alignItems(`Center),
]>
<ImageSample quality=`none />
<ImageSample quality=`low />
<ImageSample quality=`medium />
<ImageSample quality=`high />
</View>;
};
};
let render = () => <Images />;
================================================
FILE: examples/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.revery.examples</string>
</dict>
</plist>
================================================
FILE: examples/InputExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let controlsStyle =
Style.[
margin(10),
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
];
let textStyle =
Style.[
color(Colors.white),
width(100),
margin(14),
textWrap(TextWrapping.NoWrap),
];
module Example = {
type inputFields = {
first: string,
second: string,
third: string,
isPassword: bool,
};
let%component make = () => {
let%hook ({first, isPassword, _}, setValue) =
Hooks.state({first: "", second: "", third: "", isPassword: false});
<View style=containerStyle>
<View
style=Style.[
flexDirection(`Row),
alignItems(`Center),
justifyContent(`Center),
]>
<Input
placeholder="Insert text here"
onChange={(value, _) =>
setValue(state => {...state, first: value})
}
value=first
/>
<Button
height=50
width=100
fontSize=15.
title="Reset"
onClick={() => setValue(state => {...state, first: ""})}
/>
<Button
height=50
width=100
fontSize=15.
title="Set value"
onClick={() => setValue(state => {...state, first: "New value"})}
/>
<Button
height=50
width=100
fontSize=15.
title="Emoji"
onClick={() => Native.Input.openEmojiPanel()}
/>
</View>
<Padding padding=20>
<View
style=Style.[
flexDirection(`Row),
alignItems(`Center),
justifyContent(`Center),
]>
<Input
placeholder="Insert text here"
onChange={(value, _) =>
setValue(state => {...state, first: value})
}
value=first
isPassword
/>
<View style=controlsStyle>
<Text fontSize=16. style=textStyle text="Obscure Input" />
<Checkbox
checkedColor=Colors.green
onChange={() =>
setValue(state => {...state, isPassword: !state.isPassword})
}
style=Style.[border(~width=2, ~color=Colors.green)]
checked=isPassword
/>
</View>
</View>
</Padding>
<Padding padding=20>
<BoxShadow
boxShadow={Style.BoxShadow.make(
~xOffset=-5.,
~yOffset=2.,
~color=Colors.black,
~blurRadius=20.,
~spreadRadius=0.,
(),
)}>
<Input
placeholder="custom input"
placeholderColor=Colors.plum
cursorColor=Colors.white
autofocus=true
onFocus={() => print_endline("Input example focused")}
onBlur={() => print_endline("Input example blurred")}
onChange={(value, _) =>
setValue(state => {...state, second: value})
}
onKeyDown={_ => print_endline("key event")}
style=Style.[
backgroundColor(Colors.paleVioletRed),
color(Colors.white),
height(50),
]
/>
</BoxShadow>
</Padding>
</View>;
};
};
let render = () => <Example />;
================================================
FILE: examples/LayerExample.re
================================================
open Revery.UI;
module Layers = {
let make = () => {
<Layer
condition=Layer.Condition.always
style=Style.[flexGrow(1)]
backgroundColor=Revery.Colors.red>
<View
style=Style.[
flexDirection(`Column),
flexGrow(1),
justifyContent(`Center),
alignItems(`Center),
]>
<Text text="Hello from inside a layer!" />
</View>
</Layer>;
};
};
let render = () => <Layers />;
================================================
FILE: examples/MarkdownExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Styles = {
open Style;
let outer = [
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
margin(6),
justifyContent(`FlexStart),
alignItems(`FlexStart),
];
let whiteText = [color(Colors.white)];
let linkActive = [color(Colors.blue)];
let linkInactive = [color(Colors.lightBlue)];
};
let markdown =
Markdown.make(
~paragraphStyle=Styles.whiteText,
~h1Style=Styles.whiteText,
~h2Style=Styles.whiteText,
~h3Style=Styles.whiteText,
~h4Style=Styles.whiteText,
~h5Style=Styles.whiteText,
~h6Style=Styles.whiteText,
~activeLinkStyle=Styles.linkActive,
~inactiveLinkStyle=Styles.linkInactive,
);
let example = () =>
<View style=Styles.outer>
<markdown
markdown={markdown|
An h2 header
------------
Here's a numbered list:
1. first item
2. second item
3. third item
Note again how the actual text starts at 4 columns in (4 characters
from the left side). Here's a code sample:
# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }
As you probably guessed, indented 4 spaces. By the way, instead of
indenting the block, you can use delimited blocks, if you like:
~~~
define foobar() {
print "Welcome to flavor country!";
}
~~~
(which makes copying & pasting easier). You can optionally mark the
delimited block for Pandoc to syntax highlight it:
~~~python
import time
# Quick, count to ten!
for i in range(10):
# (but not *too* quick)
time.sleep(0.5)
print(i)
~~~
|markdown}
/>
</View>;
let render = () => <example />;
================================================
FILE: examples/NativeFileExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
open Revery.Native;
module NativeFileExamples = {
let%component make = () => {
let%hook (fileListOpt, setFileListOpt) = Hooks.state(None);
let%hook (allowMultiple, setAllowMultiple) = Hooks.state(false);
let%hook (showHidden, setShowHidden) = Hooks.state(false);
let%hook (openFolders, setOpenFolders) = Hooks.state(false);
let openFile = () => {
let o =
Dialog.openFiles(
~allowMultiple,
~canChooseDirectories=openFolders,
~showHidden,
~title="Revery Open File Example",
~buttonText=
allowMultiple ? "Open file(s) in Revery" : "Open file in Revery",
(),
);
setFileListOpt(_ => o);
};
let optionStyle = Style.[color(Colors.white)];
let titleStyle = Style.[color(Colors.white)];
let renderFilePath = (path: string) =>
<Text fontSize=12. style=Style.[color(Colors.white)] text=path />;
let containerStyle =
Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
];
<View style=containerStyle>
<Text style=titleStyle fontSize=20. text="Open Files and Folders" />
<Row>
<Text style=optionStyle text="Allow multiple?" />
<Checkbox
checked=allowMultiple
checkedColor=Colors.green
onChange={() => setAllowMultiple(am => !am)}
/>
</Row>
<Row>
<Text style=optionStyle text="Show hidden?" />
<Checkbox
checked=showHidden
checkedColor=Colors.green
onChange={() => setShowHidden(sh => !sh)}
/>
</Row>
<Row>
<Text style=optionStyle text="Open folders?" />
<Checkbox
checked=openFolders
checkedColor=Colors.green
onChange={() => setOpenFolders(ofv => !ofv)}
/>
</Row>
<Button title="Open File" onClick=openFile />
{switch (fileListOpt) {
| Some(fileList) =>
fileList
|> Array.map(renderFilePath)
|> Array.to_list
|> React.listToElement
| None => <View />
}}
</View>;
};
};
let render = () => <NativeFileExamples />;
================================================
FILE: examples/NativeIconExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
open Revery.Native;
module Window = Revery.Window;
module NativeFileExamples = {
let%component make = (~window as w, ()) => {
let%hook (maybeIcon, setMaybeIcon) = Hooks.state(None);
let%hook (progress, setIconProgress) =
Hooks.state(Icon.Determinate(0.));
let%hook () =
Hooks.effect(
OnMount,
() => {
let ih = Icon.get();
setMaybeIcon(_ => Some(ih));
Some(() => Icon.hideProgress(w |> Window.getSdlWindow, ih));
},
);
let%hook () =
Hooks.effect(
If((!=), progress),
() => {
maybeIcon
|> Option.iter(icon =>
Icon.setProgress(w |> Window.getSdlWindow, icon, progress)
);
None;
},
);
let optionStyle = Style.[color(Colors.white)];
let titleStyle = Style.[color(Colors.white)];
let containerStyle =
Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
];
<View style=containerStyle>
<Text style=titleStyle fontSize=20. text="Icon Progress Bar" />
<Slider
onValueChanged={x => setIconProgress(_ => Icon.Determinate(x))}
maximumValue=1.0
/>
<Text
style=optionStyle
text={
"Progress: "
++ (
switch (progress) {
| Indeterminate => "Indeterminate"
| Determinate(n) => string_of_float(n)
}
)
}
/>
<Button
title="Set Indeterminate"
height=24
width=120
fontSize=12.
onClick={() => setIconProgress(_ => Icon.Indeterminate)}
/>
</View>;
};
};
let render = window => <NativeFileExamples window />;
================================================
FILE: examples/NativeInputExample.re
================================================
open Revery;
open Revery.UI;
module View = {
let noop = () => ();
let%component make = () => {
let%hook (isColumn, setIsColumn) = Hooks.state(true);
let containerStyle =
Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
flexDirection(isColumn ? `Column : `Row),
bottom(0),
top(0),
left(0),
right(0),
];
<View style=containerStyle>
<NativeButton
title="Toggle Direction"
onClick={() => setIsColumn(ic => !ic)}
style=Style.[flexGrow(1), color(Colors.teal)]
onMouseEnter={_ => print_endline("Mouse Entered!")}
/>
<NativeButton
title="Print to STDOUT"
onClick={() => print_endline("You clicked a button!")}
/>
<NativeButton title="Custom Width" style=Style.[width(200)] />
<NativeButton title="Custom Height" style=Style.[height(50)] />
<NativeButton
title="Custom Both"
style=Style.[width(200), height(50)]
/>
</View>;
};
};
let render = () => <View />;
================================================
FILE: examples/NativeMenuExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
open Revery.Native;
module Internal = {
let nonce = ref(0);
};
module View = {
let make = (~window, ()) => {
let onClickCreateMenu = () => {
incr(Internal.nonce);
let currentNonce = Internal.nonce^;
let startTime = Time.now();
let menuBar = Menu.getMenuBarHandle();
Menu.clear(menuBar);
let menu1 = Menu.create("Test 1");
Menu.addSubmenu(~parent=menuBar, ~child=menu1);
let menuCallback = (str, ~fromKeyPress, ()) => {
print_endline(
Printf.sprintf(
"%s clicked: %d (from key press: %b)",
str,
currentNonce,
fromKeyPress,
),
);
};
let item11 =
Menu.Item.create(
~title="Item 1.1",
~onClick=menuCallback("Item 1.1"),
~keyEquivalent=Menu.KeyEquivalent.ofString("a"),
(),
);
Menu.addItem(menu1, item11);
let menu2 = Menu.create("Test 2");
Menu.addSubmenu(~parent=menuBar, ~child=menu2);
let item12 =
Menu.Item.create(
~title="Item 1.2",
~onClick=menuCallback("Item 1.2"),
~keyEquivalent=
Menu.KeyEquivalent.ofString("b")
|> (ke => Menu.KeyEquivalent.enableShift(ke, true)),
(),
);
let item13 =
Menu.Item.create(
~title="Item 1.3",
~onClick=menuCallback("Item 1.3"),
~keyEquivalent=
Menu.KeyEquivalent.ofString("Space")
|> (ke => Menu.KeyEquivalent.enableCtrl(ke, true)),
(),
);
let item14 =
Menu.Item.create(
~title="Item 1.4",
~onClick=menuCallback("Item 1.4"),
~keyEquivalent=Menu.KeyEquivalent.ofString("ESC"),
(),
);
let item15 =
Menu.Item.create(
~title="Item 1.5",
~onClick=menuCallback("Item 1.5"),
~keyEquivalent=Menu.KeyEquivalent.ofString("Tab"),
(),
);
Menu.addItem(menu2, item12);
Menu.addItem(menu2, item13);
Menu.addItem(menu2, item14);
Menu.addItem(menu2, item15);
let menu3 = Menu.create("Test 3");
Menu.addSubmenu(~parent=menuBar, ~child=menu3);
let subMenu31 = Menu.create("Submenu 1");
Menu.addSubmenu(~parent=menu3, ~child=subMenu31);
let item311 =
Menu.Item.create(
~title="Item 3.1.1",
~onClick=menuCallback("Item 3.1.1"),
~keyEquivalent=
Menu.KeyEquivalent.ofString("c")
|> (ke => Menu.KeyEquivalent.enableAlt(ke, true)),
(),
);
let separator = Menu.Item.createSeparator();
let item312 =
Menu.Item.create(
~title="Item 3.1.2",
~onClick=menuCallback("Item 3.1.2"),
(),
);
Menu.Item.setEnabled(item312, false);
let item313 =
Menu.Item.create(
~title="Item 3.1.3",
~onClick=menuCallback("Item 3.1.3"),
(),
);
Menu.Item.setVisible(item313, false); // Shouldn't show up
Menu.addItem(subMenu31, item311);
Menu.addItem(subMenu31, separator);
Menu.addItem(subMenu31, item312);
Menu.addItem(subMenu31, item313);
let endTime = Time.now();
let delta = Time.(endTime - startTime) |> Time.toFloatSeconds;
print_endline("Render time: " ++ string_of_float(delta));
};
let onMouseUp = (evt: NodeEvents.mouseButtonEventParams) =>
if (evt.button == MouseButton.BUTTON_RIGHT) {
let menu = Menu.create("Right click");
let item1 =
Menu.Item.create(
~title="Click me 1",
~onClick=
(~fromKeyPress as _, ()) => print_endline("You clicked me!"),
(),
);
let item2 =
Menu.Item.create(
~title="Click me 2",
~onClick=
(~fromKeyPress as _, ()) => print_endline("You clicked me!"),
(),
);
Menu.addItem(menu, item1);
Menu.addItem(menu, item2);
Menu.displayIn(
~x=int_of_float(evt.mouseX),
~y=int_of_float(evt.mouseY),
menu,
window |> Revery.Window.getSdlWindow,
);
};
let containerStyle =
Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
];
<View style=containerStyle onMouseUp>
<Button title="Create Menu" onClick=onClickCreateMenu />
<Text text="Or right click anywhere!" italic=true />
</View>;
};
};
let render = window => <View window />;
================================================
FILE: examples/NativeNotificationExample.re
================================================
open Revery.UI;
open Revery.UI.Components;
open Revery.Native;
module Example = {
let make = () => {
let notification =
Notification.create(
~title="Revery Test",
~body="This is a test!",
~mute=false,
~onClick=() => print_endline("Notification clicked!"),
(),
);
<View>
<Center>
<Button
title="Dispatch!"
onClick={() => Notification.dispatch(notification)}
/>
<Button
title="Schedule 5s From Now!"
onClick={() => Notification.scheduleFromNow(5, notification)}
/>
</Center>
</View>;
};
};
let render = () => <Example />;
================================================
FILE: examples/NestedClickable.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Styles = {
open Style;
let outer = [
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
justifyContent(`Center),
alignItems(`Center),
backgroundColor(Colors.yellow),
];
};
let%component clickies = () => {
let%hook (text, setText) = Hooks.state("Click something");
<Clickable
style=Styles.outer onClick={() => setText(_ => "Clicked outside")}>
<Button title=text onClick={() => setText(_ => "Clicked inside")} />
</Clickable>;
};
let render = () => <clickies />;
================================================
FILE: examples/RadioButtonExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module RadioExample = {
let%component make = () => {
let%hook (radioVal, setRadioVal) = Hooks.state("Select a button!");
<View
style=Style.[
width(500),
height(500),
justifyContent(`Center),
alignItems(`Center),
backgroundColor(Color.rgba(1., 1., 1., 0.1)),
]>
<Text
text="Radio Button"
fontSize=20.
style=Style.[marginBottom(20)]
/>
<RadioButtonsInt
onChange={txt =>
setRadioVal(_ => "Radio Button Value: " ++ string_of_int(txt))
}
defaultSelected=0
iconSize=20.
buttons=[
{text: "Button 1", value: 1},
{text: "Button 2", value: 2},
{text: "Button 3", value: 3},
{text: "Button 4", value: 4},
]
/>
<Text text=radioVal fontSize=20. style=Style.[marginTop(20)] />
</View>;
};
};
let render = () => <RadioExample />;
================================================
FILE: examples/RichTextExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
open Revery.Font;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
module SampleRichText = {
let make = () => {
let richtext =
RichText.(
text("Hello ", ~color=Colors.red, ~fontWeight=Weight.Bold)
++ text("world", ~color=Colors.green)
++ text("!", ~color=Colors.yellow)
|> fontSize(20.)
|> italic
);
let dimensions = RichText.measure(richtext);
let widthText = "Width: " ++ string_of_int(dimensions.width);
let heightText = "Height: " ++ string_of_int(dimensions.height);
<View style=containerStyle>
<RichTextView richtext />
<Text text=widthText />
<Text text=heightText />
</View>;
};
};
let render = () => <SampleRichText />;
================================================
FILE: examples/SVGExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let examples = [
(
"<polygon>",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon -->
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<!-- Example of a polygon with the default fill -->
<polygon points="0,100 50,25 50,75 100,0" />
<!-- Example of the same polygon shape with stroke and no fill -->
<polygon points="100,100 150,25 150,75 200,0"
fill="none" stroke="black" />
</svg>
|},
),
(
"<polyline>",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline -->
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<!-- Example of a polyline with the default fill -->
<polyline points="0,100 50,25 50,75 100,0" />
<!-- Example of the same polyline shape with stroke and no fill -->
<polyline points="100,100 150,25 150,75 200,0"
fill="none" stroke="black" />
</svg>
|},
),
(
"<rect>",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect -->
<svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg">
<!-- Simple rectangle -->
<rect width="100" height="100" />
<!-- Rounded corner rectangle -->
<rect x="120" width="100" height="100" rx="15" />
</svg>
|},
),
(
"<path> - heart",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="red"
d="M 10,30
A 20,20 0,0,1 50,30
A 20,20 0,0,1 90,30
Q 90,60 50,90
Q 10,60 10,30 z" />
</svg>
|},
),
(
"<path> - moveTo",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="red"
d="M 10,10 h 10
m 0,10 h 10
m 0,10 h 10
M 40,20 h 10
m 0,10 h 10
m 0,10 h 10
m 0,10 h 10
M 50,50 h 10
m-20,10 h 10
m-20,10 h 10
m-20,10 h 10" />
</svg>
|},
),
(
"<path> - lineTo",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<!-- LineTo commands with absolute coordinates -->
<path fill="none" stroke="red"
d="M 10,10
L 90,90
V 10
H 50" />
<!-- LineTo commands with relative coordinates -->
<path fill="none" stroke="red"
d="M 110,10
l 80,80
v -80
h -40" />
</svg>
|},
),
(
"<path> - cubic bezier",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Cubic Bézier curve with absolute coordinates -->
<path fill="none" stroke="red"
d="M 10,90
C 30,90 25,10 50,10
S 70,90 90,90" />
<!-- Cubic Bézier curve with relative coordinates -->
<path fill="none" stroke="red"
d="M 110,90
c 20,0 15,-80 40,-80
s 20,80 40,80" />
<!-- Highlight the curve vertex and control points -->
<g id="ControlPoints">
<!-- First cubic command control points -->
<line x1="10" y1="90" x2="30" y2="90" stroke="lightgrey" />
<circle cx="30" cy="90" r="1.5"/>
<line x1="50" y1="10" x2="25" y2="10" stroke="lightgrey" />
<circle cx="25" cy="10" r="1.5"/>
<!-- Second smooth command control points (the first one is implicit) -->
<line x1="50" y1="10" x2="75" y2="10" stroke="lightgrey" stroke-dasharray="2" />
<circle cx="75" cy="10" r="1.5" fill="lightgrey"/>
<line x1="90" y1="90" x2="70" y2="90" stroke="lightgrey" />
<circle cx="70" cy="90" r="1.5" />
<!-- curve vertex points -->
<circle cx="10" cy="90" r="1.5"/>
<circle cx="50" cy="10" r="1.5"/>
<circle cx="90" cy="90" r="1.5"/>
</g>
<use xlink:href="#ControlPoints" x="100" />
</svg>
|},
),
(
"<path> - quadratic bezier",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Quadratic Bézier curve with implicit repetition -->
<path fill="none" stroke="red"
d="M 10,50
Q 25,25 40,50
t 30,0 30,0 30,0 30,0 30,0" />
<!-- Highlight the curve vertex and control points -->
<g>
<polyline points="10,50 25,25 40,50" stroke="rgba(0,0,0,.2)" fill="none" />
<circle cx="25" cy="25" r="1.5" />
<!-- Curve vertex points -->
<circle cx="10" cy="50" r="1.5"/>
<circle cx="40" cy="50" r="1.5"/>
<g id="SmoothQuadraticDown">
<polyline points="40,50 55,75 70,50" stroke="rgba(0,0,0,.2)" stroke-dasharray="2" fill="none" />
<circle cx="55" cy="75" r="1.5" fill="lightgrey" />
<circle cx="70" cy="50" r="1.5" />
</g>
<g id="SmoothQuadraticUp">
<polyline points="70,50 85,25 100,50" stroke="rgba(0,0,0,.2)" stroke-dasharray="2" fill="none" />
<circle cx="85" cy="25" r="1.5" fill="lightgrey" />
<circle cx="100" cy="50" r="1.5" />
</g>
<use xlink:href="#SmoothQuadraticDown" x="60" />
<use xlink:href="#SmoothQuadraticUp" x="60" />
<use xlink:href="#SmoothQuadraticDown" x="120" />
</g>
</svg>
|},
),
(
"<path> - quadratic bezier*",
{|
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Quadratic Bézier curve with implicit repetition -->
<path fill="none" stroke="red"
d="M 10,50
Q 25,25 40,50
q 15,25 30,0
q 15,-25 30,0
q 15,25 30,0
q 15,-25 30,0
q 15,25 30,0
q 15,-25 30,0" />
<!-- Highlight the curve vertex and control points -->
<g>
<polyline points="10,50 25,25 40,50" stroke="#0003" fill="none" />
<circle cx="25" cy="25" r="1.5" />
<!-- Curve vertex points -->
<circle cx="10" cy="50" r="1.5"/>
<circle cx="40" cy="50" r="1.5"/>
<g id="SmoothQuadraticDown">
<polyline points="40,50 55,75 70,50" stroke="#0003" stroke-dasharray="2" fill="none" />
<circle cx="55" cy="75" r="1.5" fill="lightgrey" />
<circle cx="70" cy="50" r="1.5" />
</g>
<g id="SmoothQuadraticUp">
<polyline points="70,50 85,25 100,50" stroke="#0003" stroke-dasharray="2" fill="none" />
<circle cx="85" cy="25" r="1.5" fill="lightgrey" />
<circle cx="100" cy="50" r="1.5" />
</g>
<use xlink:href="#SmoothQuadraticDown" x="60" />
<use xlink:href="#SmoothQuadraticUp" x="60" />
<use xlink:href="#SmoothQuadraticDown" x="120" />
</g>
</svg>
|},
),
(
"<path> - quadratic bezier 2",
{|
<svg width="12cm" height="6cm" viewBox="0 0 1200 600"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>Example quad01 - quadratic Bézier commands in path data</title>
<desc>Picture showing a "Q" a "T" command,
along with annotations showing the control points
and end points</desc>
<rect x="1" y="1" width="1198" height="598"
fill="none" stroke="blue" stroke-width="1" />
<path d="M200,300 Q400,50 600,300 T1000,300"
fill="none" stroke="red" stroke-width="5" />
<!-- End points -->
<g fill="black" >
<circle cx="200" cy="300" r="10"/>
<circle cx="600" cy="300" r="10"/>
<circle cx="1000" cy="300" r="10"/>
</g>
<!-- Control points and lines from end points to control points -->
<g fill="#888888" >
<circle cx="400" cy="50" r="10"/>
<circle cx="800" cy="550" r="10"/>
</g>
<path d="M200,300 L400,50 L600,300
L800,550 L1000,300"
fill="none" stroke="#888888" stroke-width="2" />
</svg>
|},
),
(
"<path> - elliptic arc",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<!-- The influence of the arc flags with which the arc is drawn -->
<path fill="none" stroke="red"
d="M 6,10
A 6 4 10 1 0 14,10" />
<path fill="none" stroke="lime"
d="M 6,10
A 6 4 10 1 1 14,10" />
<path fill="none" stroke="purple"
d="M 6,10
A 6 4 10 0 1 14,10" />
<path fill="none" stroke="pink"
d="M 6,10
A 6 4 10 0 0 14,10" />
</svg>
|},
),
(
"<path> - close path",
{|
<!-- Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Path_commands -->
<svg viewBox="0 -1 30 11" xmlns="http://www.w3.org/2000/svg">
<!--
An open shape with the last point of
the path different to the first one
-->
<path stroke="red"
d="M 5,1
l -4,8 8,0" />
<!--
An open shape with the last point of
the path matching the first one
-->
<path stroke="red"
d="M 15,1
l -4,8 8,0 -4,-8" />
<!--
A closed shape with the last point of
the path different to the first one
-->
<path stroke="red"
d="M 25,1
l -4,8 8,0
z" />
</svg>
|},
),
(
"Material - disc",
{|
<!-- Source: https://github.com/PKief/vscode-material-icon-theme/blob/master/icons/disc.svg?short_path=60ae136 -->
<svg version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m12 14.5c-1.3875 0-2.5-1.125-2.5-2.5 0-1.3875 1.1125-2.5 2.5-2.5s2.5 1.1125 2.5 2.5a2.5 2.5 0 0 1-2.5 2.5m0-12.5a10 10 0 0 0-10 10 10 10 0 0 0 10 10 10 10 0 0 0 10-10 10 10 0 0 0-10-10z" style="fill:#b0bec5;stroke-width:1.25"/></svg>
|},
),
(
"Material - flash",
{|
<!-- Source: https://github.com/PKief/vscode-material-icon-theme/blob/master/icons/flash.svg?short_path=987e419 -->
<svg version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient4150" x1="2.373" x2="21.86" y1="12.027" y2="12.027" gradientTransform="translate(-.11669 -24.027)" gradientUnits="userSpaceOnUse">
<stop stop-color="#d92f3c" offset="0"/>
<stop stop-color="#791223" offset="1"/>
</linearGradient>
</defs>
<g>
<rect transform="rotate(90)" x="2.2563" y="-21.744" width="19.487" height="19.487" ry="0" fill="url(#linearGradient4150)"/>
<path d="m16.56 5.9994c-.0046.000383-.0087.00127-.01324.00165-.42659.03629-.83051.09268-1.1813.19192-.55415.166-1.0532.40447-1.494.71803-.4282.32278-.81705.72086-1.1697 1.1912-.34004.47956-.6824 1.0323-1.0224 1.6594-.12109.22868-.23331.42505-.35074.63696v.0017c-1e-4.000183-.0032-.000183-.0033 0l-1.3401 2.394-.005-.0017c-.23782.4425-.46149.84702-.66509 1.1978-.2141.36889-.45189.6815-.71637.93972-.26448.25822-.56659.45561-.90663.59394-.071945.02731-.1614.04195-.24155.06287-.0005144.000134-.00114-.000134-.00165 0h-.9877v2.4138h.98935v-.0017c.42844-.03628.83244-.09229 1.1846-.19192.55415-.166 1.0532-.40447 1.494-.71803.4282-.32278.8187-.72086 1.1713-1.1912.34005-.47956.68074-1.0323 1.0208-1.6594.12084-.22819.23523-.42557.3524-.63696l.0066.0017.0033-.005.0364-.06618h2.5296v.0017h1.125v-2.4072h-.33089v-.0017h-1.9787c.21975-.40713.43079-.78837.62041-1.1151.2141-.36889.45189-.6815.71637-.93972.26448-.25822.56659-.45561.90663-.59394.07046-.026754.15931-.041111.23824-.061214h.99266v-.00331h-.0017v-2.4105h-.97777v-.00165z" fill="#fff"/>
</g>
</svg>
|},
),
(
"Onivim logo",
{|
<!-- Source: https://raw.githubusercontent.com/onivim/oni2/master/assets/images/logo.svg -->
<svg id="Layer_1" data-name="Layer 1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="1023.62" height="990.06" viewBox="0 0 1023.62 990.06">
<defs>
<linearGradient id="linear-gradient" x1="495.41" y1="803.4" x2="495.41" y2="128.72" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#e6537c"/>
<stop offset="1" stop-color="#ffe8c7"/>
</linearGradient>
</defs>
<title>logo</title>
<g id="Icon">
<g id="O_2" data-name="O&2">
<path d="M755.74,378.89a4.49,4.49,0,0,1-4.48-4.49V222.33a4.48,4.48,0,0,1,4.48-4.48H974.65V202.6a47.15,47.15,0,0,0-47.1-47.1H755.74a4.49,4.49,0,0,1-4.48-4.49V110.63a4.48,4.48,0,0,1,4.48-4.48H927.55A96.56,96.56,0,0,1,1024,202.6v60.11a4.48,4.48,0,0,1-4.49,4.48H800.61v62.35h174a49.17,49.17,0,0,1,49.1,44.42,4.48,4.48,0,0,1-4.46,4.93ZM990.44,512a496.53,496.53,0,0,0-9.51-96.51,7.37,7.37,0,0,0-7.23-5.93H951.11a7.37,7.37,0,0,0-7.22,8.87A460.16,460.16,0,0,1,953.6,512c0,252.65-205.54,458.19-458.19,458.19S37.22,764.68,37.22,512,242.76,53.84,495.41,53.84A459.15,459.15,0,0,1,709.74,107.1a7.37,7.37,0,0,0,10.82-6.51V75.91a7.37,7.37,0,0,0-4.06-6.58A488.6,488.6,0,0,0,495.41,17c-273,0-495,222.07-495,495s222.07,495,495,495S990.44,785,990.44,512Z" transform="translate(-0.38 -17)" style="fill:#3af5e9"/>
</g>
<path id="S" d="M499.5,845.25c-88.24,0-177.54-29.33-258.23-84.78-6-4.08-9.24-14.07-7.89-23.93s7-16.93,13.46-16.93H752.17c6.5,0,12.11,7.06,13.46,16.93s-2,19.85-7.89,23.93C677.05,815.92,587.75,845.25,499.5,845.25ZM194,647.67c-2.73,0-5.27-3-6.75-7.9-4.36-14.57-8.58-29.78-12.55-45.19a34.89,34.89,0,0,1,.12-17c1.44-5.22,4.06-8.44,6.89-16.1H817.83c2.83,7.66,5.45,10.88,6.89,16.1a34.77,34.77,0,0,1,.12,17c-4,15.41-8.19,30.62-12.55,45.19-1.47,4.93-4,7.9-6.75,7.9ZM162.11,497.22a7.39,7.39,0,0,1-7.35-7.85c11.66-178.76,161.29-318.79,340.65-318.79A341.32,341.32,0,0,1,718,253.14a7.36,7.36,0,0,1,2.56,5.59V374.41a35.22,35.22,0,0,0,35.18,35.18h59.88a7.35,7.35,0,0,1,7.06,5.27,340.84,340.84,0,0,1,13.37,74.5,7.37,7.37,0,0,1-7.35,7.86Z" transform="translate(-0.38 -17)" style="fill:url(#linear-gradient)"/>
</g>
</svg>
|},
),
];
module SVGExample = {
module Styles = {
open Style;
let container = [
backgroundColor(Color.rgba(1., 1., 1., 0.1)),
flexDirection(`Row),
];
let buttons = [width(200), color(Colors.white), marginLeft(10)];
};
let%component make = () => {
let%hook (currentExample, setExample) = {
let (_, data) = List.hd(examples);
Hooks.state(data);
};
let%hook (width, setWidth) = Hooks.state(300.);
let%hook (height, setHeight) = Hooks.state(300.);
let buttons =
List.map(
((text, value)) => RadioButtonsString.{text, value},
examples,
);
let onChange = data => setExample(_ => data);
<View style=Styles.container>
<View>
<RadioButtonsString
style=Styles.buttons
onChange
defaultSelected=0
buttons
/>
<Slider
onValueChanged={w => setWidth(_ => w)}
maximumValue=300.
minimumValue=50.
initialValue=width
/>
<Slider
onValueChanged={h => setHeight(_ => h)}
maximumValue=500.
minimumValue=50.
initialValue=height
/>
</View>
<SVG width height src={`Str(currentExample)} scaleMode=`Fit />
</View>;
};
};
let render = () => <SVGExample />;
================================================
FILE: examples/ScreenCapture.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let backgroundColor = Color.hex("#212733");
let activeBackgroundColor = Color.hex("#2E3440");
let inactiveBackgroundColor = Color.hex("#272d39");
let selectionHighlight = Color.hex("#90f7ff");
module ActionButton = {
let make = (~name, ~onClick, ()) => {
let wrapperStyle =
Style.[
backgroundColor(selectionHighlight),
border(~width=4, ~color=activeBackgroundColor),
];
let textHeaderStyle = Style.[color(Colors.black), margin(16)];
<Clickable style=wrapperStyle onClick>
<Text style=textHeaderStyle text=name />
</Clickable>;
};
};
module CaptureArea = {
let%component make = (~w, ()) => {
let%hook (count, setCount) = Hooks.state(0);
let%hook (file, setFile) = Hooks.state(None);
let capture = () => {
let exed = Environment.getExecutingDirectory();
let filename = Printf.sprintf("Scrot_%d.tga", count);
let fullname = exed ++ filename;
Window.takeScreenshot(w, fullname);
setCount(_ => count + 1);
setFile(_ => Some(filename));
};
let viewStyle =
Style.[
position(`Absolute),
left(0),
right(0),
top(0),
bottom(0),
flexDirection(`Column),
];
let imageStyle = Style.[width(400), height(300)];
<View style=viewStyle>
<ActionButton name="Take a screenshot!" onClick=capture />
{switch (file) {
| None => <View />
| Some(src) => <Image style=imageStyle src={`File(src)} />
}}
</View>;
};
};
let render = w => <CaptureArea w />;
================================================
FILE: examples/ScrollView.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let outerBox =
Style.[width(200), height(200), backgroundColor(Colors.black)];
let innerBox =
Style.[
width(450),
height(450),
backgroundColor(Color.rgba(0., 1., 0., 0.5)),
];
module Sample = {
let%component make = () => {
let%hook (bounce, setBounce) = Hooks.state(true);
<View style=containerStyle>
<Text text="Bounce" fontSize=20. style=Style.[marginBottom(10)] />
<Checkbox
onChange={() => setBounce(isBounce => !isBounce)}
checked=bounce
style=Style.[marginBottom(10)]
/>
<ScrollView style=outerBox bounce>
<Image
src={`File("outrun-logo.png")}
/* Exercise the case in #579 */
style=Style.[overflow(`Hidden), width(512), height(256)]
/>
<Image
src={`File("outrun-logo.png")}
style=Style.[width(512), height(256)]
/>
<Image
src={`File("outrun-logo.png")}
style=Style.[width(512), height(256)]
/>
</ScrollView>
<Text
text="To scroll horizontally use Mouse Wheel while holding Shift Key"
fontSize=20.
style=Style.[marginTop(10)]
/>
</View>;
};
};
let render = () => <Sample />;
================================================
FILE: examples/Slider.re
================================================
open Revery;
open Revery.Math;
open Revery.UI;
open Revery.UI.Components;
module AdjustableLogo = {
let%component make = () => {
let%hook (rotationX, setRotationX) =
Hooks.reducer(~initialState=0., (value, _) => value);
let%hook (rotationY, setRotationY) =
Hooks.reducer(~initialState=0., (value, _) => value);
let%hook (rotationZ, setRotationZ) =
Hooks.reducer(~initialState=0., (value, _) => value);
let containerStyle =
Style.[
flexGrow(1),
justifyContent(`Center),
alignItems(`Center),
flexDirection(`Column),
];
let textStyle = Style.[color(Colors.white), width(100), margin(14)];
let controlsStyle =
Style.[
margin(10),
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
];
let sliderContainerStyle =
Style.[
margin(10),
borderBottom(~width=1, ~color=Colors.darkGray),
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
];
let verticalSliderContainerStyle =
Style.[
margin(10),
borderRight(~width=1, ~color=Colors.darkGray),
flexDirection(`Column),
justifyContent(`Center),
alignItems(`Center),
];
let toDeg = r => 180. *. r /. pi;
let toDegString = r => r |> toDeg |> floor |> string_of_float;
let twoPi = 2. *. pi;
<View style=containerStyle>
<View>
<Image
src={`File("outrun-logo.png")}
style=Style.[
width(512),
height(256),
transform([
Transform.RotateZ(Angle.from_radians(rotationZ)),
Transform.RotateY(Angle.from_radians(rotationY)),
Transform.RotateX(Angle.from_radians(rotationX)),
]),
]
/>
</View>
<View style=controlsStyle>
<View style=verticalSliderContainerStyle>
<Text style=textStyle fontSize=16. text="Rotation Y: " />
<Slider
vertical=true
onValueChanged=setRotationY
maximumValue=twoPi
/>
<Text
style=textStyle
fontSize=16.
text={"Value: " ++ toDegString(rotationY)}
/>
</View>
<View style=containerStyle>
<View style=sliderContainerStyle>
<Text style=textStyle fontSize=16. text="Rotation X: " />
<Slider
onValueChanged=setRotationX
initialValue=twoPi
maximumValue=twoPi
/>
<Text
style=textStyle
fontSize=16.
text={"Value: " ++ toDegString(rotationX)}
/>
</View>
<View style=sliderContainerStyle>
<Text style=textStyle fontSize=16. text="Rotation Z: " />
<Slider onValueChanged=setRotationZ maximumValue=twoPi />
<Text
style=textStyle
fontSize=16.
text={"Value: " ++ toDegString(rotationZ)}
/>
</View>
</View>
</View>
</View>;
};
};
let render = () => <AdjustableLogo />;
================================================
FILE: examples/SpringExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module SpringyLogo = {
let make = (~width, ~onMouseDown, ~onMouseUp, ()) => {
let intWidth = int_of_float(width);
<View onMouseDown onMouseUp>
<Image
src={`File("outrun-logo.png")}
style=Style.[
width(intWidth),
height(128),
cursor(MouseCursors.pointer),
]
/>
</View>;
};
};
module SliderControl = {
module Styles = {
let sliderContainerStyle =
Style.[
margin(10),
borderBottom(~width=1, ~color=Colors.darkGray),
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
];
let textStyle = Style.[color(Colors.white), width(100), margin(14)];
};
let float_rounded_string = v => v |> int_of_float |> string_of_int;
let make =
(~text, ~minimumValue, ~maximumValue, ~value, ~onValueChanged, ()) => {
<View style=Styles.sliderContainerStyle>
<Text style=Styles.textStyle fontSize=16. text />
<Slider
onValueChanged={v => onValueChanged(v)}
value
minimumValue
maximumValue
/>
<Text
style=Styles.textStyle
fontSize=16.
text={"Value: " ++ float_rounded_string(value)}
/>
</View>;
};
};
module Example = {
module Styles = {
let containerStyle =
Style.[
flexGrow(1),
justifyContent(`Center),
alignItems(`Center),
flexDirection(`Column),
];
};
let%component make = () => {
let%hook (stiffness, setStiffness) =
Hooks.reducer(~initialState=160., (value, _) => value);
let%hook (damping, setDamping) =
Hooks.reducer(~initialState=10., (value, _) => value);
let%hook (targetPosition, setTargetPosition) =
Hooks.reducer(~initialState=256.0, (value, _) => value);
let%hook (logoWidth, setImmediately) =
Hooks.spring(
~name="Spring",
~target=targetPosition,
~initialState=
Spring.{
value: 256.,
velocity: 100.,
acceleration: 0.,
time: Time.now(),
},
~restThreshold=1.0,
Spring.Options.create(~damping, ~stiffness, ()),
);
let setImmediately = value => {
setTargetPosition(value);
setImmediately(value);
};
let onMouseDown = _ => {
setTargetPosition(512.0);
};
let onMouseUp = _ => setTargetPosition(256.0);
<Center>
<Center> <SpringyLogo width=logoWidth onMouseDown onMouseUp /> </Center>
<View style=Styles.containerStyle>
<SliderControl
text="Damping: "
minimumValue=1.
maximumValue=100.
value=damping
onValueChanged={v => setDamping(v)}
/>
<SliderControl
text="Stiffness: "
minimumValue=1.
maximumValue=500.
value=stiffness
onValueChanged={v => setStiffness(v)}
/>
<SliderControl
text="Width: "
minimumValue=128.
maximumValue=640.
value=logoWidth
onValueChanged={v => setImmediately(v)}
/>
</View>
</Center>;
};
};
let render = () => <Example />;
================================================
FILE: examples/Stopwatch.re
================================================
open Revery;
open Revery.Math;
open Revery.UI;
open Revery.UI.Components;
module Clock = {
type dispose = unit => unit;
let noop = () => ();
type state = {
dispose,
isRunning: bool,
elapsedTime: Time.t,
};
type action =
| Start(dispose)
| Stop
| TimerTick(Time.t);
let reducer = (a, s) =>
switch (a) {
| Start(f) => {dispose: f, isRunning: true, elapsedTime: Time.zero}
| Stop =>
s.dispose();
let ret = {dispose: noop, isRunning: false, elapsedTime: Time.zero};
ret;
| TimerTick(t) => {
...s,
elapsedTime: s.isRunning ? Time.(s.elapsedTime + t) : s.elapsedTime,
}
};
let%component make = () => {
let%hook (state, dispatch) =
Hooks.reducer(
~initialState={
isRunning: false,
dispose: noop,
elapsedTime: Time.zero,
},
reducer,
);
/*
* We'll make sure to dispatch the 'Stop' action when unmounting,
* so we don't have a runaway timer!
*/
let%hook () = Hooks.effect(OnMount, () => Some(() => dispatch(Stop)));
let startStop = () =>
state.isRunning
? dispatch(Stop)
/*
* If we're not already running, we'll start a timer job
* and use the delta time it passes to update our reducer.
*/
: {
let dispose =
Tick.interval(
~name="Stopwatch Interval",
t => dispatch(TimerTick(t)),
Time.zero,
);
/* We'll also keep a handle on the dispose function so we can make sure its called on stop*/
dispatch(Start(dispose));
};
let buttonText = state.isRunning ? "STOP" : "START";
let marcherOpacity = state.isRunning ? 1.0 : 0.0;
let getMarcherPosition = t =>
sin(Time.toFloatSeconds(t) *. 2. *. pi) /. 2. +. 0.5;
<View
style=Style.[
position(`Absolute),
justifyContent(`Center),
alignItems(`Center),
bottom(0),
top(0),
left(0),
right(0),
]>
<View
style=Style.[
margin(20),
width(150),
borderBottom(~color=Colors.gray, ~width=2),
]>
<Text
style=Style.[color(Colors.white), marginVertical(20), width(200)]
fontSize=24.
text={Time.toString(state.elapsedTime)}
/>
<Opacity opacity=marcherOpacity>
<View
style=Style.[
position(`Absolute),
bottom(0),
left(
int_of_float(getMarcherPosition(state.elapsedTime) *. 146.),
),
width(4),
height(4),
backgroundColor(Color.hex("#90f7ff")),
]
/>
</Opacity>
</View>
<Button title=buttonText onClick=startStop />
</View>;
};
};
let render = () => <Clock />;
================================================
FILE: examples/TextExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`SpaceAround),
flexDirection(`Column),
];
let slidersViewStyle = Style.[height(300)];
let textStyle =
Style.[
color(Colors.white),
width(100),
margin(14),
textWrap(TextWrapping.NoWrap),
];
let controlsStyle =
Style.[
margin(10),
flexDirection(`Row),
justifyContent(`Center),
alignItems(`Center),
];
let overflowStyles = (style, textWidth) =>
Style.[
color(Colors.white),
width(textWidth),
textOverflow(style),
lineHeight(1.5),
border(~color=Colors.blueViolet, ~width=1),
backgroundColor(Colors.black),
];
module SampleText = {
let%component make = () => {
let%hook (fontSizeSliderVal, setFontSize) =
Hooks.reducer(~initialState=20., (value, _) => value);
let%hook (widthSliderVal, setWidth) =
Hooks.reducer(~initialState=200., (value, _) => value);
let%hook (hyphenate, setHyphenate) = Hooks.state(false);
let textContent =
"All work and no play makes Jack a dull boy. "
++ "The quick brown fox jumps over the lazy dog.";
let maxFontSize = 40.;
let maxWidth = 400.;
let textFontSize = fontSizeSliderVal;
let textWidth = int_of_float(widthSliderVal);
let wrapping =
if (hyphenate) {TextWrapping.WrapHyphenate} else {TextWrapping.Wrap};
<View style=containerStyle>
<View>
<View style=Style.[height(40), marginBottom(8)]>
<Text
fontSize=textFontSize
style={overflowStyles(`Ellipsis, textWidth)}
text={textContent ++ " " ++ textContent}
/>
</View>
<View style=Style.[height(40), marginBottom(8)]>
<Text
fontSize=textFontSize
style={overflowStyles(`UserDefined("£"), textWidth)}
text={textContent ++ " " ++ textContent}
/>
</View>
<View style=Style.[height(80)]>
<Text
style=Style.[
color(Colors.white),
lineHeight(1.5),
textWrap(wrapping),
width(int_of_float(widthSliderVal)),
border(~color=Colors.blueViolet, ~width=1),
backgroundColor(Colors.black),
]
fontSize=textFontSize
text=textContent
/>
</View>
</View>
<View>
<View style=controlsStyle>
<Text style=textStyle fontSize=16. text="Font size: " />
<Slider
onValueChanged={v => setFontSize(v)}
value=fontSizeSliderVal
maximumValue=maxFontSize
/>
<Text
style=textStyle
fontSize=16.
text={"Value: " ++ (fontSizeSliderVal |> string_of_float)}
/>
</View>
<View style=controlsStyle>
<Text style=textStyle fontSize=16. text="Width: " />
<Slider
onValueChanged={w => setWidth(w)}
value=widthSliderVal
maximumValue=maxWidth
/>
<Text
style=textStyle
fontSize=16.
text={"Value: " ++ (widthSliderVal |> string_of_float)}
/>
</View>
<View style=controlsStyle>
<Text style=textStyle fontSize=16. text="Hyphenate?" />
<Checkbox
checkedColor=Colors.green
onChange={() => setHyphenate(h => !h)}
style=Style.[border(~width=2, ~color=Colors.green)]
checked=hyphenate
/>
</View>
</View>
</View>;
};
};
let render = () => <SampleText />;
================================================
FILE: examples/TodoExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module Constants = {
let fontSize = 12.;
};
module Theme = {
let fontSize = 16.;
let rem = factor => fontSize *. factor;
let remi = factor => rem(factor) |> int_of_float;
let appBackground = Color.hex("#f4edfe");
let textColor = Color.hex("#513B70");
let dimmedTextColor = Color.hex("#DAC5F7");
let titleTextColor = Color.hex("#EADDFC");
let panelBackground = Color.hex("#F9F5FF");
let panelBorderColor = Color.hex("#EADDFC");
let panelBorder = Style.border(~width=1, ~color=panelBorderColor);
let buttonColor = Color.hex("#9573C4");
let hoveredButtonColor = Color.hex("#C9AEF0");
let dangerColor = Color.hex("#f7c5c6");
};
module Filter = {
type t =
| All
| Active
| Completed;
let toString = (v: t) =>
switch (v) {
| All => "All"
| Active => "Active"
| Completed => "Completed"
};
};
module Button = {
module Styles = {
let box = (~isSelected, ~isHovered) =>
Style.[
position(`Relative),
justifyContent(`Center),
alignItems(`Center),
paddingVertical(Theme.remi(0.15)),
paddingHorizontal(Theme.remi(0.5)),
marginHorizontal(Theme.remi(0.2)),
border(
~width=1,
~color=
switch (isSelected, isHovered) {
| (true, _) => Theme.buttonColor
| (false, true) => Theme.hoveredButtonColor
| (false, false) => Colors.transparentWhite
},
),
borderRadius(2.),
];
let text =
Style.[color(Theme.buttonColor), textWrap(TextWrapping.NoWrap)];
};
let%component make =
(
~label,
~onClick=?,
~isSelected=false,
~tabindex=?,
~onFocus=?,
~onBlur=?,
(),
) => {
let%hook (isHovered, onMouseOver, onMouseOut) = Hooks.hover();
<Clickable ?onClick ?onFocus ?onBlur ?tabindex>
<View
style={Styles.box(~isSelected, ~isHovered)} onMouseOver onMouseOut>
<Text style=Styles.text text=label fontSize={Theme.rem(0.8)} />
</View>
</Clickable>;
};
};
module Checkbox = {
module Styles = {
let box =
Style.[
width(Theme.remi(1.5)),
height(Theme.remi(1.5)),
justifyContent(`Center),
alignItems(`Center),
Theme.panelBorder,
];
let checkmark =
Style.[
color(Theme.hoveredButtonColor),
textWrap(TextWrapping.NoWrap),
transform(Transform.[TranslateY(2.)]),
];
};
let make = (~isChecked, ~onToggle, ()) => {
<Clickable onClick=onToggle>
<View style=Styles.box>
<Text
text={isChecked ? {||} : ""}
fontSize=Theme.fontSize
fontFamily={Font.Family.fromFile("FontAwesome5FreeSolid.otf")}
style=Styles.checkmark
/>
</View>
</Clickable>;
};
};
module AddTodo = {
module Styles = {
let container =
Style.[
flexDirection(`Row),
backgroundColor(Theme.panelBackground),
Theme.panelBorder,
margin(2),
alignItems(`Center),
overflow(`Hidden),
];
let toggleAll = areAllCompleted =>
Style.[
color(areAllCompleted ? Theme.textColor : Theme.dimmedTextColor),
transform(Transform.[TranslateY(2.)]),
marginLeft(12),
];
let input =
Style.[border(~width=0, ~color=Colors.transparentWhite), width(4000)]; // Not ideal, should be possible to use flexGrow(1) instead
};
let make = (~text, ~areAllCompleted, ~onInput, ~onSubmit, ~onToggleAll, ()) => {
let onKeyDown = (event: NodeEvents.keyEventParams) =>
if (event.keycode == 13) {
onSubmit();
};
<View style=Styles.container>
<Clickable onClick=onToggleAll>
<Text
text={||}
fontSize=Theme.fontSize
fontFamily={Font.Family.fromFile("FontAwesome5FreeSolid.otf")}
style={Styles.toggleAll(areAllCompleted)}
/>
</Clickable>
<Input
style=Styles.input
fontSize=Theme.fontSize
placeholder="Add your Todo here"
value=text
onChange={(value, _) => onInput(value)}
onKeyDown
/>
</View>;
};
};
module Todo = {
module Styles = {
let box =
Style.[
flexDirection(`Row),
margin(2),
paddingVertical(4),
paddingHorizontal(8),
alignItems(`Center),
backgroundColor(Theme.panelBackground),
Theme.panelBorder,
];
let text = isChecked =>
Style.[
margin(6),
color(isChecked ? Theme.dimmedTextColor : Theme.textColor),
flexGrow(1),
];
let removeButton = isHovered =>
Style.[
color(isHovered ? Theme.dangerColor : Colors.transparentWhite),
transform(Transform.[TranslateY(2.)]),
marginRight(6),
];
};
type t = {
id: int,
task: string,
isDone: bool,
};
let%component make = (~task, ~onToggle, ~onRemove, ()) => {
let%hook (isHovered, setHovered) = Hooks.state(false);
<View
style=Styles.box
onMouseOver={_ => setHovered(_wasHovered => true)}
onMouseOut={_ => setHovered(_wasHovered => false)}>
<Checkbox isChecked={task.isDone} onToggle />
<Text
style={Styles.text(task.isDone)}
fontSize=Theme.fontSize
text={task.task}
/>
<Clickable onClick=onRemove>
<Text
text={||}
fontFamily={Font.Family.fromFile("FontAwesome5FreeSolid.otf")}
fontSize=Theme.fontSize
style={Styles.removeButton(isHovered)}
/>
</Clickable>
</View>;
};
};
module Footer = {
module Styles = {
let container =
Style.[flexDirection(`Row), justifyContent(`SpaceBetween)];
let filterButtonsContainer =
Style.[
flexGrow(1),
width(0),
flexDirection(`Row),
alignItems(`Center),
justifyContent(`Center),
alignSelf(`Center),
transform(Transform.[TranslateY(-2.)]),
];
let leftFlexContainer = Style.[flexGrow(1), width(0)];
let rightFlexContainer =
Style.[
flexGrow(1),
width(0),
flexDirection(`Row),
justifyContent(`FlexEnd),
];
let itemsLeft =
Style.[color(Theme.buttonColor), textWrap(TextWrapping.NoWrap)];
let clearCompleted = isHovered =>
Style.[
color(isHovered ? Theme.hoveredButtonColor : Theme.buttonColor),
textWrap(TextWrapping.NoWrap),
];
};
let make =
(
~activeCount,
~completedCount,
~currentFilter,
~onSelectFilter,
~onClearCompleted,
(),
) => {
let itemsLeft = {
let text =
switch (activeCount) {
| 1 => "1 item left"
| n => Printf.sprintf("%i items left", n)
};
<Text text fontSize={Theme.rem(0.85)} style=Styles.itemsLeft />;
};
let filterButtonsView = {
let button = filter =>
<Button
label={Filter.toString(filter)}
isSelected={currentFilter == filter}
onClick={() => onSelectFilter(filter)}
/>;
<View style=Styles.filterButtonsContainer>
{button(All)}
{button(Active)}
{button(Completed)}
</View>;
};
module ClearCompleted = {
let%component make = (~onClearCompleted, ~completedCount, ()) => {
let%hook (isHovered, setHovered) = Hooks.state(false);
let text =
switch (completedCount) {
| 0 => ""
| n => Printf.sprintf("Clear completed (%i)", n)
};
<Clickable onClick=onClearCompleted>
<View
onMouseOver={_ => setHovered(_wasHovered => true)}
onMouseOut={_ => setHovered(_wasHovered => false)}>
<Text
text
fontSize={Theme.rem(0.85)}
style={Styles.clearCompleted(isHovered)}
/>
</View>
</Clickable>;
};
};
<View style=Styles.container>
<View style=Styles.leftFlexContainer> itemsLeft </View>
filterButtonsView
<View style=Styles.rightFlexContainer>
<ClearCompleted onClearCompleted completedCount />
</View>
</View>;
};
};
module TodoMVC = {
module Styles = {
let appContainer =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Stretch),
justifyContent(`Center),
flexDirection(`Column),
backgroundColor(Theme.appBackground),
paddingVertical(2),
paddingHorizontal(6),
overflow(`Hidden),
];
let title =
Style.[
color(Theme.titleTextColor),
alignSelf(`Center),
marginTop(Theme.remi(2.)),
textWrap(TextWrapping.NoWrap),
];
let todoList = Style.[flexGrow(1)];
};
type state = {
todos: list(Todo.t),
filter: Filter.t,
inputValue: string,
nextId: int,
};
let initialState = {
todos:
Todo.[
{id: 0, task: "Buy Milk", isDone: false},
{id: 1, task: "Wag the Dog", isDone: true},
],
filter: All,
inputValue: "",
nextId: 2,
};
type action =
| Add
| SetFilter(Filter.t)
| UpdateInput(string)
| Toggle(int)
| Remove(int)
| ToggleAll
| ClearCompleted;
let reducer = (action: action, state: state) =>
switch (action) {
| Add => {
...state,
todos: [
{id: state.nextId, task: state.inputValue, isDone: false},
...state.todos,
],
inputValue: "",
nextId: state.nextId + 1,
}
| UpdateInput(text) => {...state, inputValue: text}
| Toggle(id) =>
let todos =
List.map(
(item: Todo.t) =>
item.id == id ? {...item, isDone: !item.isDone} : item,
state.todos,
);
{...state, todos};
| Remove(id) =>
let todos = List.filter((item: Todo.t) => item.id != id, state.todos);
{...state, todos};
| SetFilter(filter) => {...state, filter}
| ToggleAll =>
let areAllCompleted =
List.for_all((item: Todo.t) => item.isDone, state.todos);
let todos =
List.map(
(item: Todo.t) => {...item, isDone: !areAllCompleted},
state.todos,
);
{...state, todos};
| ClearCompleted =>
let todos = List.filter((item: Todo.t) => !item.isDone, state.todos);
{...state, todos};
};
let%component make = () => {
let%hook ({todos, inputValue, filter as currentFilter, _}, dispatch) =
Hooks.reducer(~initialState, reducer);
let header = {
<Text text="todoMVC" fontSize={Theme.rem(4.)} style=Styles.title />;
};
let addTodoView = {
let onInput = value => dispatch(UpdateInput(value));
let onSubmit = () => dispatch(Add);
let onToggleAll = () => dispatch(ToggleAll);
let areAllCompleted =
List.for_all((item: Todo.t) => item.isDone, todos);
<AddTodo text=inputValue areAllCompleted onInput onSubmit onToggleAll />;
};
let todoListView = {
let onToggle = (id, ()) => dispatch(Toggle(id));
let onRemove = (id, ()) => dispatch(Remove(id));
let filteredTodos =
List.filter(
task =>
switch (filter) {
| All => true
| Active => !task.Todo.isDone
| Completed => task.Todo.isDone
},
todos,
);
<ScrollView style=Styles.todoList>
<View>
{List.map(
(task: Todo.t) =>
<Todo
task
onToggle={onToggle(task.id)}
onRemove={onRemove(task.id)}
/>,
filteredTodos,
)
|> React.listToElement}
</View>
</ScrollView>;
};
let footer = {
let onSelectFilter = filter => dispatch(SetFilter(filter));
let onClearCompleted = () => dispatch(ClearCompleted);
let activeCount =
todos |> List.filter((item: Todo.t) => !item.isDone) |> List.length;
let completedCount =
todos |> List.filter((item: Todo.t) => item.isDone) |> List.length;
<Footer
activeCount
completedCount
currentFilter
onSelectFilter
onClearCompleted
/>;
};
<View style=Styles.appContainer>
header
addTodoView
todoListView
footer
</View>;
};
};
let render = () => <TodoMVC />;
================================================
FILE: examples/TreeView.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
module TreeView = {
let stringTree =
Tree.(
Node(
{data: "root", id: 1, status: Open},
[
Node(
{data: "subfolder 1", id: 2, status: Open},
[
Node(
{data: "subdirectory 1", id: 3, status: Closed},
[Empty, Empty],
),
],
),
Node(
{data: "home", id: 4, status: Open},
[
Node(
{status: Closed, id: 5, data: "downloads"},
[Empty, Empty],
),
Node(
{data: "desktop", id: 6, status: Open},
[
Node(
{status: Open, id: 7, data: "subfolder 2"},
[
Node(
{status: Open, id: 8, data: "pictures"},
[
Node({status: Closed, id: 12, data: "Images"}, []),
Node(
{status: Closed, id: 10, data: "holiday 2018"},
[],
),
Node(
{status: Closed, id: 11, data: "Graduation 2017"},
[],
),
],
),
Empty,
],
),
Node(
{data: "subfolder 3", id: 9, status: Closed},
[Empty, Empty],
),
],
),
],
),
],
)
);
type heirarchy = {
name: string,
level: string,
};
let animalKingdom =
Tree.(
Node(
{
id: 1,
status: Open,
data: {
name: "Animalia",
level: "Kingdom",
},
},
[
Node(
{
id: 2,
data: {
name: "chordate",
level: "phylum",
},
status: Open,
},
[
Node(
{
id: 3,
status: Open,
data: {
name: "mammal",
level: "class",
},
},
[
Node(
{
id: 4,
status: Open,
data: {
name: "carnivora",
level: "order",
},
},
[Empty, Empty],
),
Empty,
],
),
Empty,
],
),
Node(
{
id: 5,
status: Open,
data: {
name: "anthropoda",
level: "phylum",
},
},
[
Node(
{
id: 6,
status: Open,
data: {
name: "insect",
level: "class",
},
},
[
Node(
{
id: 7,
status: Open,
data: {
name: "dipthera",
level: "order",
},
},
[Empty, Empty],
),
Empty,
],
),
Empty,
],
),
],
)
);
let emptyRenderer =
Some(
indent =>
<Text
text={"There is no file present" ++ "\n"}
fontSize=10.
style=Style.[marginLeft(indent * 20), color(Colors.rebeccaPurple)]
/>,
);
let make = (~renderer=?, ()) => {
switch (renderer) {
| Some(fn) => <Tree tree=animalKingdom nodeRenderer=fn />
| None => <Tree tree=stringTree nodeRenderer=Tree.default emptyRenderer />
};
};
let customRenderer = (~indent, content) => {
open Tree;
let {data, _} = content;
let textStyles = Style.[color(Colors.black)];
<Padding padding=5>
<View
style=Style.[
justifyContent(`Center),
alignItems(`Center),
marginLeft(indent * 30),
backgroundColor(Colors.white),
width(80),
height(40),
]>
<Text text={data.name} fontSize=10. style=textStyles />
<Text text={data.level} fontSize=10. style=textStyles />
</View>
</Padding>;
};
};
let titleStyles = Style.[color(Colors.white), marginVertical(10)];
let render = _w => {
let exampleContainer =
Style.[
flexDirection(`Column),
justifyContent(`Center),
alignItems(`Center),
width(200),
];
<View
style=Style.[
paddingTop(10),
justifyContent(`Center),
alignItems(`FlexStart),
flexDirection(`Row),
position(`Absolute),
top(0),
right(0),
left(0),
bottom(0),
]>
<View style=exampleContainer>
<Text style=titleStyles fontSize=15. text="Custom Renderer" />
<TreeView renderer=TreeView.customRenderer />
</View>
<View style=exampleContainer>
<Text
style=titleStyles
fontSize=15.
text="Default Renderer (with emptyRenderer)"
/>
<TreeView />
</View>
</View>;
};
================================================
FILE: examples/URLFileOpen.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
let containerStyle =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
module Example = {
let%component make = () => {
let%hook (url, setURL) =
Hooks.state("https://github.com/revery-ui/revery");
<View style=containerStyle>
<Input
placeholder="URL to open"
onChange={(value, _) => setURL(_ => value)}
value=url
/>
<Button
onClick={_ => Native.Shell.openURL(url) |> ignore}
title="Open!"
/>
</View>;
};
};
let render = () => <Example />;
================================================
FILE: examples/WavFilePlaybackExample.re
================================================
open Revery;
open Revery.UI;
open Revery.UI.Components;
open Revery.Native;
module AudioHelpers = {
let getBitsPerSample =
fun
| Sdl2.Audio.Format.U8
| S8 => 8
| S16LSB
| S16MSB
| U16LSB
| U16MSB => 16
| S32LSB
| S32MSB
| F32LSB
| F32MSB => 32;
let getAudioDuration = (spec: Sdl2.Audio.Spec.t, bytes) => {
bytes / (spec.freq * spec.channels * (getBitsPerSample(spec.format) / 8));
};
};
module Styles = {
let container =
Style.[
position(`Absolute),
top(0),
bottom(0),
left(0),
right(0),
alignItems(`Center),
justifyContent(`Center),
flexDirection(`Column),
];
let text = Style.[color(Colors.white), margin(14)];
let audioPlayerTrack =
Style.[
width(200),
marginBottom(14),
padding(2),
borderRadius(8.),
backgroundColor(Colors.dimGrey),
alignItems(`Center),
flexDirection(`Row),
justifyContent(`Center),
];
};
module WavFilePlaybackExamples = {
let%component make = () => {
let%hook (filename, setFilename) = Hooks.state("");
let%hook (audioData, setAudioData) = Hooks.state(None);
let%hook (audioDevice, setAudioDevice) = Hooks.state(None);
let%hook (audioDeviceStatus, setAudioDeviceStatus) =
Hooks.state(Sdl2.Audio.Device.Status.Stopped);
let%hook (audioQueuedBytes, setAudioQueuedBytes) = Hooks.state(0);
let%hook () =
Hooks.tick(~name="", ~tickRate=Time.milliseconds(50), _ => {
switch (audioDevice) {
| Some(device) =>
let status = Sdl2.Audio.Device.getStatus(device);
setAudioDeviceStatus(_ => status);
let bytes = Sdl2.Audio.getQueuedSize(device);
setAudioQueuedBytes(_ => bytes);
| _ => ()
}
});
let audioQueuedBytes = float(audioQueuedBytes);
let audioTotalBytes =
switch (audioData) {
| Some((_, _, len)) => float(len)
| _ => 0.
};
let audioPlayedBytes =
audioQueuedBytes > 0. ? audioTotalBytes -. audioQueuedBytes : 0.;
let audioPlaybackProgress = audioPlayedBytes /. audioTotalBytes;
let audioDuration =
switch (audioData) {
| Some((spec: Sdl2.Audio.Spec.t, _, bytes)) =>
AudioHelpers.getAudioDuration(spec, bytes)
| _ => 0
};
let audioElapsed =
int_of_float(float(audioDuration) *. audioPlaybackProgress);
let openAudioDevice = desiredSpec => {
switch (audioDevice) {
| Some(device) => Sdl2.Audio.Device.close(device)
| _ => ()
};
switch (
Sdl2.Audio.Device.open_(
None,
false,
desiredSpec,
Sdl2.Audio.Device.AllowedChanges.none,
gitextract_o1re1h8t/ ├── .ci/ │ ├── .gitattributes │ ├── create-docs.yml │ ├── esy-bench.yml │ ├── esy-build-steps.yml │ ├── esy-check-hygiene.yml │ ├── format.sh │ ├── publish-build-cache.yml │ ├── publish-release.yml │ ├── restore-build-cache.yml │ └── use-node.yml ├── .gitattributes ├── .github/ │ ├── FUNDING.yml │ └── ISSUE_TEMPLATE/ │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── Revery.opam ├── ReveryBench.opam ├── ReveryExampleJs.opam ├── ReveryExamples.opam ├── ReveryTest.opam ├── ThirdPartyLicenses.txt ├── azure-pipelines.yml ├── bench/ │ ├── exe/ │ │ ├── Bench.re │ │ └── dune │ └── lib/ │ ├── BenchFramework.re │ ├── DrawBench.re │ ├── LayoutBench.re │ ├── NodeUtility.re │ ├── PaintBench.re │ ├── RecalculateBench.re │ ├── SurfaceUtility.re │ ├── ViewNodeBench.re │ └── dune ├── bench.json ├── doc.json ├── dune ├── dune-project ├── dune-workspace ├── examples/ │ ├── AnalogClock.re │ ├── Border.re │ ├── Boxshadow.re │ ├── Calculator.re │ ├── CanQuitExample.re │ ├── CanvasExample.re │ ├── CheckboxExample.re │ ├── DefaultButton.re │ ├── DropdownExample.re │ ├── Examples.re │ ├── FileDragAndDrop.re │ ├── Flexbox.re │ ├── FocusExample.re │ ├── FontAwesome5FreeSolid.otf │ ├── FontsExample.re │ ├── GameOfLife.re │ ├── Hello.re │ ├── HitTests.re │ ├── HoverExample.re │ ├── ImageQualityExample.re │ ├── Info.plist │ ├── InputExample.re │ ├── LayerExample.re │ ├── MarkdownExample.re │ ├── NativeFileExample.re │ ├── NativeIconExample.re │ ├── NativeInputExample.re │ ├── NativeMenuExample.re │ ├── NativeNotificationExample.re │ ├── NestedClickable.re │ ├── RadioButtonExample.re │ ├── RichTextExample.re │ ├── SVGExample.re │ ├── ScreenCapture.re │ ├── ScrollView.re │ ├── Slider.re │ ├── SpringExample.re │ ├── Stopwatch.re │ ├── TextExample.re │ ├── TodoExample.re │ ├── TreeView.re │ ├── URLFileOpen.re │ ├── WavFilePlaybackExample.re │ ├── WindowControl.re │ ├── ZoomExample.re │ ├── dune │ ├── gl-matrix-min.js │ ├── index.html │ └── stubs/ │ ├── ExampleStubs.re │ ├── dune │ ├── example_stubs.c │ └── example_stubs.js ├── examples.json ├── include/ │ ├── COPYING.txt │ ├── KHR/ │ │ └── khrplatform.h │ ├── glad/ │ │ └── glad.h │ └── stb_image.h ├── js.json ├── lsan.supp ├── package.json ├── packages/ │ ├── reason-harfbuzz/ │ │ ├── examples/ │ │ │ └── harfbuzz-cli/ │ │ │ ├── HarfbuzzCli.re │ │ │ ├── dune │ │ │ └── run-harfbuzz.sh │ │ ├── src/ │ │ │ ├── Harfbuzz.re │ │ │ ├── Harfbuzz.rei │ │ │ ├── config/ │ │ │ │ ├── discover.re │ │ │ │ └── dune │ │ │ ├── dune │ │ │ └── harfbuzz.cpp │ │ └── test/ │ │ ├── FeaturesTest.re │ │ ├── ShapingTest.re │ │ ├── TestFramework.re │ │ └── dune │ ├── reason-sdl2/ │ │ └── src/ │ │ ├── Float32Array.re │ │ ├── Uint16Array.re │ │ ├── config/ │ │ │ ├── discover.re │ │ │ └── dune │ │ ├── dune │ │ ├── sdl2.re │ │ ├── sdl2_stubs.js │ │ ├── sdl2_wrapper.cpp │ │ └── stb_image.cpp │ ├── reason-skia/ │ │ ├── bench/ │ │ │ ├── BenchFramework.re │ │ │ ├── CanvasBench.re │ │ │ ├── ColorBench.re │ │ │ ├── MatrixBench.re │ │ │ ├── RectBench.re │ │ │ ├── SkiaPaintBench.re │ │ │ └── dune │ │ ├── examples/ │ │ │ ├── skia-cli/ │ │ │ │ ├── LICENSE_FiraCode.txt │ │ │ │ ├── LICENSE_ORBITRON.md │ │ │ │ ├── SkiaCli.re │ │ │ │ └── dune │ │ │ ├── skia-font-manager-cli/ │ │ │ │ ├── SkiaFontManagerCli.re │ │ │ │ ├── dune │ │ │ │ └── run-skia-fontmanager.sh │ │ │ └── skia-sdl2/ │ │ │ ├── SkiaSdl.re │ │ │ └── dune │ │ ├── src/ │ │ │ ├── Skia.re │ │ │ ├── Skia.rei │ │ │ ├── config/ │ │ │ │ ├── discover.re │ │ │ │ └── dune │ │ │ ├── dune │ │ │ └── wrapped/ │ │ │ ├── bindings/ │ │ │ │ ├── SkiaWrappedBindings.re │ │ │ │ └── dune │ │ │ ├── c/ │ │ │ │ ├── c_stubs.c │ │ │ │ ├── c_stubs.h │ │ │ │ └── dune │ │ │ ├── lib/ │ │ │ │ ├── SkiaWrapped.re │ │ │ │ ├── dune │ │ │ │ └── raw_bindings.c │ │ │ ├── stubgen/ │ │ │ │ ├── dune │ │ │ │ ├── stubgen.ml │ │ │ │ └── types_stubgen.ml │ │ │ └── types/ │ │ │ ├── SkiaWrappedTypes.re │ │ │ └── dune │ │ └── test/ │ │ ├── ColorTest.re │ │ ├── MatrixTest.re │ │ ├── PaintTest.re │ │ ├── RectTest.re │ │ ├── TestFramework.re │ │ └── dune │ ├── revery-text-wrap/ │ │ ├── examples/ │ │ │ └── text-wrap-cli/ │ │ │ ├── ReveryTextWrapCli.re │ │ │ └── dune │ │ └── src/ │ │ ├── Revery_TextWrap.re │ │ ├── Revery_TextWrap.rei │ │ ├── Tokenize.re │ │ └── dune │ └── zed/ │ └── src/ │ ├── dune │ ├── zed_utf8.ml │ └── zed_utf8.mli ├── reason-harfbuzz.opam ├── reason-sdl2.opam ├── reason-skia.opam ├── scripts/ │ ├── docker/ │ │ ├── archlinux/ │ │ │ └── Dockerfile │ │ └── centos/ │ │ └── Dockerfile │ ├── docker-build.sh │ ├── make-binary-file.js │ └── release.sh ├── src/ │ ├── Core/ │ │ ├── App.re │ │ ├── App.rei │ │ ├── Color.re │ │ ├── Color.rei │ │ ├── Colors.re │ │ ├── Environment.re │ │ ├── Environment.rei │ │ ├── Event.re │ │ ├── Events.re │ │ ├── GarbageCollector.re │ │ ├── Key.re │ │ ├── Key.rei │ │ ├── Log.re │ │ ├── Log.rei │ │ ├── MouseButton.re │ │ ├── MouseButton.rei │ │ ├── MouseCursors.re │ │ ├── MouseCursors.rei │ │ ├── Performance.re │ │ ├── Revery_Core.re │ │ ├── TextOverflow.re │ │ ├── TextWrapping.re │ │ ├── Tick.re │ │ ├── Time.re │ │ ├── Time.rei │ │ ├── UniqueId.re │ │ ├── Vsync.re │ │ ├── Window.re │ │ ├── Window.rei │ │ ├── WindowCreateOptions.re │ │ ├── WindowStyles.re │ │ └── dune │ ├── Draw/ │ │ ├── CanvasContext.re │ │ ├── DebugDraw.re │ │ ├── ImageResizeMode.re │ │ ├── Revery_Draw.re │ │ ├── Text.re │ │ ├── Text.rei │ │ └── dune │ ├── Font/ │ │ ├── Discovery.re │ │ ├── Feature.re │ │ ├── Feature.rei │ │ ├── Features.re │ │ ├── Features.rei │ │ ├── FontCache.re │ │ ├── FontCache.rei │ │ ├── FontFamily.re │ │ ├── FontFamily.rei │ │ ├── FontManager.re │ │ ├── FontMetrics.re │ │ ├── FontRenderer.re │ │ ├── FontWeight.re │ │ ├── FontWidth.re │ │ ├── Revery_Font.re │ │ ├── ShapeResult.re │ │ ├── Smoothing.re │ │ ├── dune │ │ └── files/ │ │ └── Inconsolata.otf │ ├── IO/ │ │ ├── File.re │ │ ├── File.rei │ │ ├── Image.re │ │ ├── Image.rei │ │ ├── LwtLetOperators.re │ │ ├── Revery_IO.re │ │ └── dune │ ├── Lwt/ │ │ ├── Revery_Lwt.re │ │ └── dune │ ├── Math/ │ │ ├── Angle.re │ │ ├── BoundingBox2d.re │ │ ├── BoundingBox2d.rei │ │ ├── Revery_Math.re │ │ └── dune │ ├── Native/ │ │ ├── Dialog.re │ │ ├── Environment.re │ │ ├── Gtk.re │ │ ├── Icon.re │ │ ├── Initialization.re │ │ ├── Input.re │ │ ├── Input.rei │ │ ├── Locale.re │ │ ├── Menu.re │ │ ├── Menu.rei │ │ ├── NSObject.re │ │ ├── NSView.re │ │ ├── Notification.re │ │ ├── ReveryCocoa.h │ │ ├── ReveryGtk.h │ │ ├── ReveryLinux.h │ │ ├── ReveryMac.h │ │ ├── ReveryNSObject.c │ │ ├── ReveryWin32.h │ │ ├── ReveryWindows.h │ │ ├── Revery_Native.c │ │ ├── Revery_Native.re │ │ ├── Shell.re │ │ ├── Window.re │ │ ├── caml_values.h │ │ ├── cocoa/ │ │ │ ├── ReveryAppDelegate.c │ │ │ ├── ReveryAppDelegate.h │ │ │ ├── ReveryAppDelegate_func.c │ │ │ ├── ReveryAppDelegate_func.h │ │ │ ├── ReveryButtonTarget.c │ │ │ ├── ReveryButtonTarget.h │ │ │ ├── ReveryMenuItemTarget.c │ │ │ ├── ReveryMenuItemTarget.h │ │ │ ├── ReveryNSView.c │ │ │ ├── ReveryNSViewCoords.c │ │ │ ├── ReveryNSViewCoords.h │ │ │ ├── ReveryProgressBar.c │ │ │ ├── ReveryProgressBar.h │ │ │ └── SDLAppDelegate.h │ │ ├── config/ │ │ │ ├── discover.re │ │ │ └── dune │ │ ├── dialog.c │ │ ├── dialog.js │ │ ├── dialog_cocoa.c │ │ ├── dialog_gtk.c │ │ ├── dialog_win32.c │ │ ├── dune │ │ ├── environment.c │ │ ├── environment_linux.c │ │ ├── environment_mac.c │ │ ├── environment_windows.c │ │ ├── gtk/ │ │ │ ├── ReveryGtk.c │ │ │ └── ReveryGtk_Widget.c │ │ ├── icon.c │ │ ├── icon_cocoa.c │ │ ├── icon_win32.c │ │ ├── input.c │ │ ├── input_cocoa.c │ │ ├── locale.c │ │ ├── locale_cocoa.c │ │ ├── locale_win32.c │ │ ├── menu.c │ │ ├── menu.h │ │ ├── menu_cocoa.c │ │ ├── notification.c │ │ ├── notification_cocoa.c │ │ ├── shell.c │ │ ├── shell_cocoa.c │ │ ├── shell_gtk.c │ │ ├── shell_win32.c │ │ ├── utilities.c │ │ ├── utilities.h │ │ ├── win32_target.h │ │ ├── window.c │ │ └── window_cocoa.c │ ├── Platform.re │ ├── Revery.re │ ├── UI/ │ │ ├── Animation.re │ │ ├── Animation.rei │ │ ├── CanvasNode.re │ │ ├── Container.re │ │ ├── Dimensions.re │ │ ├── Easing.re │ │ ├── FileDrop.re │ │ ├── Focus.re │ │ ├── Focus.rei │ │ ├── HitTest.re │ │ ├── ImageNode.re │ │ ├── ImageResizeMode.re │ │ ├── Keyboard.re │ │ ├── LayerNode.re │ │ ├── Layout.re │ │ ├── Mouse.re │ │ ├── Mouse.rei │ │ ├── NativeButtonNode.re │ │ ├── Node.re │ │ ├── NodeDrawContext.re │ │ ├── NodeEvents.re │ │ ├── Offset.re │ │ ├── Overflow.re │ │ ├── React.re │ │ ├── Reconciler.re │ │ ├── Render.re │ │ ├── RenderCondition.re │ │ ├── RenderContainer.re │ │ ├── Revery_UI.re │ │ ├── RichText.re │ │ ├── RichText.rei │ │ ├── Selector.re │ │ ├── Spring.re │ │ ├── Spring.rei │ │ ├── Style.re │ │ ├── TextNode.re │ │ ├── Transform.re │ │ ├── Transform.rei │ │ ├── Ui.re │ │ ├── Ui.rei │ │ ├── UiEvents.re │ │ ├── ViewNode.re │ │ └── dune │ ├── UI_Components/ │ │ ├── Button.re │ │ ├── Button.rei │ │ ├── Center.re │ │ ├── Checkbox.re │ │ ├── Checkbox.rei │ │ ├── Clickable.re │ │ ├── Clickable.rei │ │ ├── ClickableText.re │ │ ├── ClipContainer.re │ │ ├── ClipContainer.rei │ │ ├── Column.re │ │ ├── Container.re │ │ ├── Container.rei │ │ ├── Dropdown.re │ │ ├── ExpandContainer.re │ │ ├── Input.re │ │ ├── Link.re │ │ ├── Markdown.re │ │ ├── Markdown.rei │ │ ├── Positioned.re │ │ ├── Positioned.rei │ │ ├── RadioButtons.re │ │ ├── Revery_UI_Components.re │ │ ├── RichTextView.re │ │ ├── Row.re │ │ ├── SVG.re │ │ ├── ScrollView.re │ │ ├── Slider.re │ │ ├── Stack.re │ │ ├── Ticker.re │ │ ├── Ticker.rei │ │ ├── Tree.re │ │ └── dune │ ├── UI_Hooks/ │ │ ├── Effect.re │ │ ├── Effect.rei │ │ ├── Reducer.re │ │ ├── Reducer.rei │ │ ├── Ref.re │ │ ├── Ref.rei │ │ ├── Revery_UI_Hooks.re │ │ ├── Spring.re │ │ ├── State.re │ │ ├── State.rei │ │ ├── Tick.re │ │ ├── Tick.rei │ │ ├── Timer.re │ │ └── dune │ ├── UI_Primitives/ │ │ ├── AllowPointer.re │ │ ├── BoxShadow.re │ │ ├── Canvas.re │ │ ├── IgnorePointer.re │ │ ├── Image.re │ │ ├── Image.rei │ │ ├── Layer.re │ │ ├── NativeButton.re │ │ ├── Opacity.re │ │ ├── Padding.re │ │ ├── PrimitiveNodeFactory.re │ │ ├── Revery_UI_Primitives.re │ │ ├── Text.re │ │ ├── View.re │ │ └── dune │ ├── Utility/ │ │ ├── HeadlessWindow.re │ │ ├── HeadlessWindow.rei │ │ ├── Revery_Utility.re │ │ └── dune │ ├── dune │ └── index.mld ├── test/ │ ├── Core/ │ │ ├── ColorTests.re │ │ ├── EnvironmentTests.re │ │ ├── TestFramework.re │ │ ├── TextTests.re │ │ ├── TickTest.re │ │ └── dune │ ├── Font/ │ │ ├── FamilyTest.re │ │ ├── FontCacheTest.re │ │ ├── TestFramework.re │ │ └── dune │ ├── Math/ │ │ ├── BoundingBox2dTests.re │ │ ├── ClampTest.re │ │ ├── InterpolateTest.re │ │ ├── TestFramework.re │ │ └── dune │ ├── TestRunner.re │ ├── UI/ │ │ ├── AnimationTest.re │ │ ├── HooksTest.re │ │ ├── MouseTest.re │ │ ├── NodeTests.re │ │ ├── ReconcilerTests.re │ │ ├── StyleTest.re │ │ ├── TestFramework.re │ │ └── dune │ ├── collateral/ │ │ ├── FiraCode-LICENSE.txt │ │ ├── JetBrainsMono-LICENSE.txt │ │ ├── dune │ │ └── test-asset.txt │ └── dune ├── test.json └── update-lockfiles.sh
SYMBOL INDEX (693 symbols across 47 files)
FILE: examples/gl-matrix-min.js
function r (line 28) | function r(a){if(n[a])return n[a].exports;var e=n[a]={i:a,l:!1,exports:{...
function e (line 28) | function e(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array...
function u (line 28) | function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[...
function o (line 28) | function o(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t[...
function i (line 28) | function i(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t[...
function s (line 28) | function s(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];retu...
function c (line 28) | function c(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];retu...
function f (line 28) | function f(t){var n=t[0],r=t[1],a=t[2],e=t[3];return Math.sqrt(n*n+r*r+a...
function M (line 28) | function M(t){var n=t[0],r=t[1],a=t[2],e=t[3];return n*n+r*r+a*a+e*e}
function e (line 28) | function e(){var t=new a.ARRAY_TYPE(3);return a.ARRAY_TYPE!=Float32Array...
function u (line 28) | function u(t){var n=t[0],r=t[1],a=t[2];return Math.sqrt(n*n+r*r+a*a)}
function o (line 28) | function o(t,n,r){var e=new a.ARRAY_TYPE(3);return e[0]=t,e[1]=n,e[2]=r,e}
function i (line 28) | function i(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t}
function s (line 28) | function s(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t}
function c (line 28) | function c(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t}
function f (line 28) | function f(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return Math.sqrt...
function M (line 28) | function M(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return r*r+a*a+e*e}
function h (line 28) | function h(t){var n=t[0],r=t[1],a=t[2];return n*n+r*r+a*a}
function l (line 28) | function l(t,n){var r=n[0],a=n[1],e=n[2],u=r*r+a*a+e*e;return u>0&&(u=1/...
function v (line 28) | function v(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}
function i (line 28) | function i(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r ...
function s (line 28) | function s(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array...
function c (line 28) | function c(t,n,r){r*=.5;var a=Math.sin(r);return t[0]=a*n[0],t[1]=a*n[1]...
function f (line 28) | function f(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f...
function M (line 28) | function M(t,n,r,e){var u=n[0],o=n[1],i=n[2],s=n[3],c=r[0],f=r[1],M=r[2]...
function h (line 28) | function h(t,n){var r=n[0]+n[4]+n[8],a=void 0;if(r>0)a=Math.sqrt(r+1),t[...
function e (line 28) | function e(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[...
function u (line 28) | function u(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f...
function o (line 28) | function o(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=a+a,s=e+e,c=u+u,f=a*...
function i (line 28) | function i(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[...
function e (line 28) | function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f...
function u (line 28) | function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[...
function e (line 28) | function e(){var t=new a.ARRAY_TYPE(2);return a.ARRAY_TYPE!=Float32Array...
function u (line 28) | function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t}
function o (line 28) | function o(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t}
function i (line 28) | function i(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t}
function s (line 28) | function s(t,n){var r=n[0]-t[0],a=n[1]-t[1];return Math.sqrt(r*r+a*a)}
function c (line 28) | function c(t,n){var r=n[0]-t[0],a=n[1]-t[1];return r*r+a*a}
function f (line 28) | function f(t){var n=t[0],r=t[1];return Math.sqrt(n*n+r*r)}
function M (line 28) | function M(t){var n=t[0],r=t[1];return n*n+r*r}
function o (line 28) | function o(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r ...
function i (line 28) | function i(t,n,r){var a=.5*r[0],e=.5*r[1],u=.5*r[2],o=n[0],i=n[1],s=n[2]...
function s (line 28) | function s(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4]...
function c (line 28) | function c(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[4],s=r[5],c=r[6],f...
function e (line 28) | function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f...
function u (line 28) | function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[...
function e (line 28) | function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f...
function u (line 28) | function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[...
function l (line 28) | function l(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r ...
FILE: examples/stubs/example_stubs.c
function CAMLprim (line 8) | CAMLprim value revery_example_notify_changed(value vExample) {
FILE: examples/stubs/example_stubs.js
function revery_example_notify_changed (line 3) | function revery_example_notify_changed(src) {
FILE: include/KHR/khrplatform.h
type khronos_int32_t (line 142) | typedef int32_t khronos_int32_t;
type khronos_uint32_t (line 143) | typedef uint32_t khronos_uint32_t;
type khronos_int64_t (line 144) | typedef int64_t khronos_int64_t;
type khronos_uint64_t (line 145) | typedef uint64_t khronos_uint64_t;
type khronos_int32_t (line 155) | typedef int32_t khronos_int32_t;
type khronos_uint32_t (line 156) | typedef uint32_t khronos_uint32_t;
type khronos_int64_t (line 157) | typedef int64_t khronos_int64_t;
type khronos_uint64_t (line 158) | typedef uint64_t khronos_uint64_t;
type __int32 (line 167) | typedef __int32 khronos_int32_t;
type khronos_uint32_t (line 168) | typedef unsigned __int32 khronos_uint32_t;
type __int64 (line 169) | typedef __int64 khronos_int64_t;
type khronos_uint64_t (line 170) | typedef unsigned __int64 khronos_uint64_t;
type khronos_int32_t (line 179) | typedef int khronos_int32_t;
type khronos_uint32_t (line 180) | typedef unsigned int khronos_uint32_t;
type khronos_int64_t (line 182) | typedef long int khronos_int64_t;
type khronos_uint64_t (line 183) | typedef unsigned long int khronos_uint64_t;
type khronos_int64_t (line 185) | typedef long long int khronos_int64_t;
type khronos_uint64_t (line 186) | typedef unsigned long long int khronos_uint64_t;
type khronos_int32_t (line 196) | typedef int khronos_int32_t;
type khronos_uint32_t (line 197) | typedef unsigned int khronos_uint32_t;
type khronos_int32_t (line 207) | typedef int32_t khronos_int32_t;
type khronos_uint32_t (line 208) | typedef uint32_t khronos_uint32_t;
type khronos_int64_t (line 209) | typedef int64_t khronos_int64_t;
type khronos_uint64_t (line 210) | typedef uint64_t khronos_uint64_t;
type khronos_int8_t (line 220) | typedef signed char khronos_int8_t;
type khronos_uint8_t (line 221) | typedef unsigned char khronos_uint8_t;
type khronos_int16_t (line 222) | typedef signed short int khronos_int16_t;
type khronos_uint16_t (line 223) | typedef unsigned short int khronos_uint16_t;
type khronos_intptr_t (line 231) | typedef signed long long int khronos_intptr_t;
type khronos_uintptr_t (line 232) | typedef unsigned long long int khronos_uintptr_t;
type khronos_ssize_t (line 233) | typedef signed long long int khronos_ssize_t;
type khronos_usize_t (line 234) | typedef unsigned long long int khronos_usize_t;
type khronos_intptr_t (line 236) | typedef signed long int khronos_intptr_t;
type khronos_uintptr_t (line 237) | typedef unsigned long int khronos_uintptr_t;
type khronos_ssize_t (line 238) | typedef signed long int khronos_ssize_t;
type khronos_usize_t (line 239) | typedef unsigned long int khronos_usize_t;
type khronos_float_t (line 246) | typedef float khronos_float_t;
type khronos_uint64_t (line 259) | typedef khronos_uint64_t khronos_utime_nanoseconds_t;
type khronos_int64_t (line 260) | typedef khronos_int64_t khronos_stime_nanoseconds_t;
type khronos_boolean_enum_t (line 276) | typedef enum {
FILE: include/glad/glad.h
type gladGLversionStruct (line 61) | struct gladGLversionStruct {
type __int32 (line 128) | typedef __int32 int32_t;
type __int64 (line 129) | typedef __int64 int64_t;
type GLenum (line 136) | typedef unsigned int GLenum;
type GLboolean (line 137) | typedef unsigned char GLboolean;
type GLbitfield (line 138) | typedef unsigned int GLbitfield;
type GLvoid (line 139) | typedef void GLvoid;
type GLbyte (line 140) | typedef signed char GLbyte;
type GLshort (line 141) | typedef short GLshort;
type GLint (line 142) | typedef int GLint;
type GLclampx (line 143) | typedef int GLclampx;
type GLubyte (line 144) | typedef unsigned char GLubyte;
type GLushort (line 145) | typedef unsigned short GLushort;
type GLuint (line 146) | typedef unsigned int GLuint;
type GLsizei (line 147) | typedef int GLsizei;
type GLfloat (line 148) | typedef float GLfloat;
type GLclampf (line 149) | typedef float GLclampf;
type GLdouble (line 150) | typedef double GLdouble;
type GLclampd (line 151) | typedef double GLclampd;
type GLchar (line 154) | typedef char GLchar;
type GLcharARB (line 155) | typedef char GLcharARB;
type GLhandleARB (line 159) | typedef unsigned int GLhandleARB;
type GLhalfARB (line 161) | typedef unsigned short GLhalfARB;
type GLhalf (line 162) | typedef unsigned short GLhalf;
type GLint (line 163) | typedef GLint GLfixed;
type khronos_intptr_t (line 164) | typedef khronos_intptr_t GLintptr;
type khronos_ssize_t (line 165) | typedef khronos_ssize_t GLsizeiptr;
type GLint64 (line 166) | typedef int64_t GLint64;
type GLuint64 (line 167) | typedef uint64_t GLuint64;
type GLintptrARB (line 169) | typedef long GLintptrARB;
type GLintptrARB (line 171) | typedef ptrdiff_t GLintptrARB;
type GLsizeiptrARB (line 174) | typedef long GLsizeiptrARB;
type GLsizeiptrARB (line 176) | typedef ptrdiff_t GLsizeiptrARB;
type GLint64EXT (line 178) | typedef int64_t GLint64EXT;
type GLuint64EXT (line 179) | typedef uint64_t GLuint64EXT;
type __GLsync (line 180) | struct __GLsync
type _cl_context (line 181) | struct _cl_context
type _cl_event (line 182) | struct _cl_event
type GLhalfNV (line 187) | typedef unsigned short GLhalfNV;
type GLintptr (line 188) | typedef GLintptr GLvdpauSurfaceNV;
type GLubyte (line 707) | typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name);
FILE: include/stb_image.h
type stbi_uc (line 321) | typedef unsigned char stbi_uc;
type stbi_us (line 322) | typedef unsigned short stbi_us;
type stbi_io_callbacks (line 343) | typedef struct {
type stbi__uint16 (line 539) | typedef unsigned short stbi__uint16;
type stbi__int16 (line 540) | typedef signed short stbi__int16;
type stbi__uint32 (line 541) | typedef unsigned int stbi__uint32;
type stbi__int32 (line 542) | typedef signed int stbi__int32;
type stbi__uint16 (line 545) | typedef uint16_t stbi__uint16;
type stbi__int16 (line 546) | typedef int16_t stbi__int16;
type stbi__uint32 (line 547) | typedef uint32_t stbi__uint32;
type stbi__int32 (line 548) | typedef int32_t stbi__int32;
function stbi__cpuid3 (line 629) | static int stbi__cpuid3(void) {
function stbi__sse2_available (line 648) | static int stbi__sse2_available(void) {
function stbi__sse2_available (line 655) | static int stbi__sse2_available(void) {
type stbi__context (line 685) | typedef struct {
function stbi__start_mem (line 704) | static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int...
function stbi__start_callbacks (line 712) | static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c...
function stbi__stdio_read (line 724) | static int stbi__stdio_read(void *user, char *data, int size) {
function stbi__stdio_skip (line 728) | static void stbi__stdio_skip(void *user, int n) {
function stbi__stdio_eof (line 732) | static int stbi__stdio_eof(void *user) {
function stbi__start_file (line 742) | static void stbi__start_file(stbi__context *s, FILE *f) {
function stbi__rewind (line 750) | static void stbi__rewind(stbi__context *s) {
type stbi__result_info (line 763) | typedef struct {
function STBIDEF (line 829) | STBIDEF const char *stbi_failure_reason(void) {
function stbi__err (line 833) | static int stbi__err(const char *str) {
function stbi__addsizes_valid (line 854) | static int stbi__addsizes_valid(int a, int b) {
function stbi__mul2sizes_valid (line 865) | static int stbi__mul2sizes_valid(int a, int b) {
function stbi__mad2sizes_valid (line 873) | static int stbi__mad2sizes_valid(int a, int b, int add) {
function stbi__mad3sizes_valid (line 878) | static int stbi__mad3sizes_valid(int a, int b, int c, int add) {
function stbi__mad4sizes_valid (line 885) | static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) {
function STBIDEF (line 924) | STBIDEF void stbi_image_free(void *retval_from_stbi_load) {
function STBIDEF (line 938) | STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_fl...
function stbi_uc (line 986) | static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, ...
function stbi__uint16 (line 1001) | static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, ...
function stbi__vertical_flip (line 1016) | static void stbi__vertical_flip(void *image, int w, int h, int bytes_per...
function stbi__vertical_flip_slices (line 1039) | static void stbi__vertical_flip_slices(void *image, int w, int h, int z,...
function stbi__uint16 (line 1073) | static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, ...
function stbi__float_postprocess (line 1098) | static void stbi__float_postprocess(float *result, int *x, int *y, int *...
function FILE (line 1108) | static FILE *stbi__fopen(char const *filename, char const *mode) {
function STBIDEF (line 1120) | STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *co...
function STBIDEF (line 1129) | STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp,...
function STBIDEF (line 1141) | STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, in...
function STBIDEF (line 1153) | STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int ...
function STBIDEF (line 1165) | STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len...
function STBIDEF (line 1171) | STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *cl...
function STBIDEF (line 1177) | STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, i...
function STBIDEF (line 1183) | STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk,...
function STBIDEF (line 1190) | STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int le...
function STBIDEF (line 1222) | STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, in...
function STBIDEF (line 1228) | STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, ...
function STBIDEF (line 1235) | STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *com...
function STBIDEF (line 1244) | STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, ...
function STBIDEF (line 1257) | STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) {
function STBIDEF (line 1270) | STBIDEF int stbi_is_hdr (char const *filename) {
function STBIDEF (line 1280) | STBIDEF int stbi_is_hdr_from_file(FILE *f) {
function STBIDEF (line 1296) | STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clb...
function STBIDEF (line 1311) | STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) {
function STBIDEF (line 1314) | STBIDEF void stbi_ldr_to_hdr_scale(float scale) {
function STBIDEF (line 1321) | STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) {
function STBIDEF (line 1324) | STBIDEF void stbi_hdr_to_ldr_scale(float scale) {
function stbi__refill_buffer (line 1340) | static void stbi__refill_buffer(stbi__context *s) {
function stbi_inline (line 1355) | stbi_inline static stbi_uc stbi__get8(stbi__context *s) {
function stbi_inline (line 1365) | stbi_inline static int stbi__at_eof(stbi__context *s) {
function stbi__skip (line 1376) | static void stbi__skip(stbi__context *s, int n) {
function stbi__getn (line 1392) | static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) {
function stbi__get16be (line 1415) | static int stbi__get16be(stbi__context *s) {
function stbi__uint32 (line 1420) | static stbi__uint32 stbi__get32be(stbi__context *s) {
function stbi__get16le (line 1428) | static int stbi__get16le(stbi__context *s) {
function stbi__uint32 (line 1435) | static stbi__uint32 stbi__get32le(stbi__context *s) {
function stbi_uc (line 1455) | static stbi_uc stbi__compute_y(int r, int g, int b) {
function stbi__uint16 (line 1539) | static stbi__uint16 stbi__compute_y_16(int r, int g, int b) {
function stbi__uint16 (line 1543) | static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_...
function stbi_uc (line 1649) | static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp) {
type stbi__huffman (line 1706) | typedef struct {
type stbi__jpeg (line 1716) | typedef struct {
function stbi__build_huffman (line 1768) | static int stbi__build_huffman(stbi__huffman *h, int *count) {
function stbi__build_fast_ac (line 1811) | static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) {
function stbi__grow_buffer_unsafe (line 1835) | static void stbi__grow_buffer_unsafe(stbi__jpeg *j) {
function stbi_inline (line 1856) | stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffm...
function stbi_inline (line 1909) | stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n) {
function stbi_inline (line 1924) | stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) {
function stbi_inline (line 1934) | stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) {
function stbi__jpeg_decode_block (line 1960) | static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__...
function stbi__jpeg_decode_block_prog_dc (line 2011) | static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64]...
function stbi__jpeg_decode_block_prog_ac (line 2037) | static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64]...
function stbi_inline (line 2156) | stbi_inline static stbi_uc stbi__clamp(int x) {
function stbi__idct_block (line 2206) | static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64...
function stbi__idct_simd (line 2271) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) {
function stbi__idct_simd (line 2458) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) {
function stbi_uc (line 2672) | static stbi_uc stbi__get_marker(stbi__jpeg *j) {
function stbi__jpeg_reset (line 2692) | static void stbi__jpeg_reset(stbi__jpeg *j) {
function stbi__parse_entropy_coded_data (line 2704) | static int stbi__parse_entropy_coded_data(stbi__jpeg *z) {
function stbi__jpeg_dequantize (line 2827) | static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) {
function stbi__jpeg_finish (line 2833) | static void stbi__jpeg_finish(stbi__jpeg *z) {
function stbi__process_marker (line 2851) | static int stbi__process_marker(stbi__jpeg *z, int m) {
function stbi__process_scan_header (line 2953) | static int stbi__process_scan_header(stbi__jpeg *z) {
function stbi__free_jpeg_components (line 2993) | static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why) {
function stbi__process_frame_header (line 3014) | static int stbi__process_frame_header(stbi__jpeg *z, int scan) {
function stbi__decode_jpeg_header (line 3112) | static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan) {
function stbi__decode_jpeg_image (line 3136) | static int stbi__decode_jpeg_image(stbi__jpeg *j) {
type stbi_uc (line 3177) | typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_u...
function stbi_uc (line 3182) | static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *...
function stbi_uc (line 3190) | static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, s...
function stbi_uc (line 3199) | static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 3228) | static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 3252) | static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_n...
function stbi_uc (line 3367) | static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_nea...
function stbi__YCbCr_to_RGB_row (line 3380) | static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const...
function stbi__YCbCr_to_RGB_simd (line 3414) | static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi...
function stbi__setup_jpeg (line 3557) | static void stbi__setup_jpeg(stbi__jpeg *j) {
function stbi__cleanup_jpeg (line 3578) | static void stbi__cleanup_jpeg(stbi__jpeg *j) {
type stbi__resample (line 3582) | typedef struct {
function stbi_uc (line 3592) | static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y) {
function stbi_uc (line 3597) | static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, i...
function stbi__jpeg_test (line 3775) | static int stbi__jpeg_test(stbi__context *s) {
function stbi__jpeg_info_raw (line 3786) | static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) {
function stbi__jpeg_info (line 3797) | static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) {
type stbi__zhuffman (line 3822) | typedef struct {
function stbi_inline (line 3831) | stbi_inline static int stbi__bitreverse16(int n) {
function stbi_inline (line 3839) | stbi_inline static int stbi__bit_reverse(int v, int bits) {
function stbi__zbuild_huffman (line 3846) | static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizeli...
type stbi__zbuf (line 3898) | typedef struct {
function stbi_inline (line 3911) | stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z) {
function stbi__fill_bits (line 3916) | static void stbi__fill_bits(stbi__zbuf *z) {
function stbi__zreceive (line 3924) | int stbi__zreceive(stbi__zbuf *z, int n) {
function stbi__zhuffman_decode_slowpath (line 3933) | static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman ...
function stbi_inline (line 3950) | stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffm...
function stbi__zexpand (line 3963) | static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) { // need to ...
function stbi__parse_huffman_block (line 3997) | static int stbi__parse_huffman_block(stbi__zbuf *a) {
function stbi__compute_huffman_codes (line 4044) | static int stbi__compute_huffman_codes(stbi__zbuf *a) {
function stbi__parse_uncompressed_block (line 4092) | static int stbi__parse_uncompressed_block(stbi__zbuf *a) {
function stbi__parse_zlib_header (line 4120) | static int stbi__parse_zlib_header(stbi__zbuf *a) {
function stbi__parse_zlib (line 4159) | static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) {
function stbi__do_zlib (line 4186) | static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, i...
function STBIDEF (line 4195) | STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int ...
function STBIDEF (line 4210) | STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *...
function STBIDEF (line 4214) | STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *b...
function STBIDEF (line 4229) | STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const ...
function STBIDEF (line 4239) | STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int l...
function STBIDEF (line 4254) | STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, co...
type stbi__pngchunk (line 4276) | typedef struct {
function stbi__pngchunk (line 4281) | static stbi__pngchunk stbi__get_chunk_header(stbi__context *s) {
function stbi__check_png_header (line 4288) | static int stbi__check_png_header(stbi__context *s) {
type stbi__png (line 4296) | typedef struct {
function stbi__paeth (line 4322) | static int stbi__paeth(int a, int b, int c) {
function stbi__create_png_image_raw (line 4335) | static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__...
function stbi__create_png_image (line 4601) | static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stb...
function stbi__compute_transparency (line 4644) | static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int o...
function stbi__compute_transparency16 (line 4668) | static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3]...
function stbi__expand_png_palette (line 4692) | static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int ...
function STBIDEF (line 4731) | STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpr...
function STBIDEF (line 4735) | STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_conv...
function stbi__de_iphone (line 4739) | static void stbi__de_iphone(stbi__png *z) {
function stbi__parse_png_file (line 4783) | static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) {
function stbi__png_test (line 5009) | static int stbi__png_test(stbi__context *s) {
function stbi__png_info_raw (line 5016) | static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) {
function stbi__png_info (line 5027) | static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__png_is16 (line 5033) | static int stbi__png_is16(stbi__context *s) {
function stbi__bmp_test_raw (line 5049) | static int stbi__bmp_test_raw(stbi__context *s) {
function stbi__bmp_test (line 5063) | static int stbi__bmp_test(stbi__context *s) {
function stbi__high_bit (line 5071) | static int stbi__high_bit(unsigned int z) {
function stbi__bitcount (line 5082) | static int stbi__bitcount(unsigned int a) {
function stbi__shiftsigned (line 5094) | static int stbi__shiftsigned(int v, int shift, int bits) {
type stbi__bmp_data (line 5113) | typedef struct {
function stbi__tga_get_comp (line 5393) | static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_r...
function stbi__tga_info (line 5413) | static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__tga_test (line 5477) | static int stbi__tga_test(stbi__context *s) {
function stbi__tga_read_rgb16 (line 5508) | static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) {
function stbi__psd_test (line 5709) | static int stbi__psd_test(stbi__context *s) {
function stbi__psd_decode_rle (line 5715) | static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelC...
function stbi__pic_is4 (line 5958) | static int stbi__pic_is4(stbi__context *s,const char *str) {
function stbi__pic_test_core (line 5967) | static int stbi__pic_test_core(stbi__context *s) {
type stbi__pic_packet (line 5982) | typedef struct {
function stbi_uc (line 5986) | static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *de...
function stbi__copyval (line 5999) | static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src) {
function stbi_uc (line 6007) | static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int heigh...
function stbi__pic_test (line 6150) | static int stbi__pic_test(stbi__context *s) {
type stbi__gif_lzw (line 6161) | typedef struct {
type stbi__gif (line 6167) | typedef struct {
function stbi__gif_test_raw (line 6186) | static int stbi__gif_test_raw(stbi__context *s) {
function stbi__gif_test (line 6195) | static int stbi__gif_test(stbi__context *s) {
function stbi__gif_parse_colortable (line 6201) | static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256...
function stbi__gif_header (line 6211) | static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, i...
function stbi__gif_info_raw (line 6238) | static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *com...
function stbi__out_gif_code (line 6251) | static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) {
function stbi_uc (line 6287) | static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) {
function stbi_uc (line 6373) | static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int ...
function stbi__gif_info (line 6617) | static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__hdr_test_core (line 6626) | static int stbi__hdr_test_core(stbi__context *s, const char *signature) {
function stbi__hdr_test (line 6635) | static int stbi__hdr_test(stbi__context* s) {
function stbi__hdr_convert (line 6667) | static void stbi__hdr_convert(float *output, stbi_uc *input, int req_com...
function stbi__hdr_info (line 6836) | static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__bmp_info (line 6881) | static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__psd_info (line 6898) | static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__psd_is16 (line 6932) | static int stbi__psd_is16(stbi__context *s) {
function stbi__pic_info (line 6960) | static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp) {
function stbi__pnm_test (line 7031) | static int stbi__pnm_test(stbi__context *s) {
function stbi__pnm_isspace (line 7067) | static int stbi__pnm_isspace(char c) {
function stbi__pnm_skip_whitespace (line 7071) | static void stbi__pnm_skip_whitespace(stbi__context *s, char *c) {
function stbi__pnm_isdigit (line 7084) | static int stbi__pnm_isdigit(char c) {
function stbi__pnm_getinteger (line 7088) | static int stbi__pnm_getinteger(stbi__context *s, char *c) {
function stbi__pnm_info (line 7099) | static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *co...
function stbi__info_main (line 7137) | static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) {
function stbi__is_16_main (line 7178) | static int stbi__is_16_main(stbi__context *s) {
function STBIDEF (line 7191) | STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) {
function STBIDEF (line 7200) | STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) {
function STBIDEF (line 7210) | STBIDEF int stbi_is_16_bit(char const *filename) {
function STBIDEF (line 7219) | STBIDEF int stbi_is_16_bit_from_file(FILE *f) {
function STBIDEF (line 7230) | STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x...
function STBIDEF (line 7236) | STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *u...
function STBIDEF (line 7242) | STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len) {
function STBIDEF (line 7248) | STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, vo...
FILE: packages/reason-harfbuzz/src/harfbuzz.cpp
function CAMLprim (line 23) | CAMLprim value Val_success(value v) {
function CAMLprim (line 31) | CAMLprim value Val_error(const char *szMsg) {
function hb_font_t (line 41) | hb_font_t *get_font_ot(char *data, int length, int size) {
function CAMLprim (line 56) | CAMLprim value rehb_destroy_face(value vFont) {
function CAMLprim (line 67) | CAMLprim value rehb_face_from_path(value vString) {
function CAMLprim (line 98) | CAMLprim value rehb_face_from_bytes(value vPtr, value vLength) {
function value (line 119) | static value createShapeTuple(unsigned int codepoint, unsigned int clust...
function CAMLprim (line 129) | CAMLprim value rehb_shape(value vFace, value vString, value vFeatures, v...
function CAMLprim (line 170) | CAMLprim value rehb_version_string_compiled() {
function CAMLprim (line 179) | CAMLprim value rehb_version_string_runtime() {
FILE: packages/reason-sdl2/src/sdl2_stubs.js
function resdl_SDL_Init (line 2) | function resdl_SDL_Init() {
function caml_glfwGetCursorPos (line 98) | function caml_glfwGetCursorPos(w) {
function resdl_SDL_CreateSystemCursor (line 106) | function resdl_SDL_CreateSystemCursor(shape) {
function resdl_SDL_EnableScreenSaver (line 126) | function resdl_SDL_EnableScreenSaver() {
function resdl_SDL_DisableScreenSaver (line 131) | function resdl_SDL_DisableScreenSaver() {
function resdl_SDL_IsScreenSaverEnabled (line 136) | function resdl_SDL_IsScreenSaverEnabled() {
function resdl_SDL_GL_SetSwapInterval (line 141) | function resdl_SDL_GL_SetSwapInterval() {
function resdl_SDL_PushEvent (line 146) | function resdl_SDL_PushEvent() {
function resdl_SDL_GL_MakeCurrent (line 151) | function resdl_SDL_GL_MakeCurrent() {
function resdl_SDL_SetWin32ProcessDPIAware (line 156) | function resdl_SDL_SetWin32ProcessDPIAware() {
function resdl_SDL_GetWin32ScaleFactor (line 161) | function resdl_SDL_GetWin32ScaleFactor() {
function resdl_SDL_GetWindowDisplayIndex (line 166) | function resdl_SDL_GetWindowDisplayIndex() {
function resdl_SDL_GetDisplayDPI (line 171) | function resdl_SDL_GetDisplayDPI() {
function resdl_SDL_GetDesktopDisplayMode (line 176) | function resdl_SDL_GetDesktopDisplayMode() {
function resdl_SDL_WindowCenter (line 181) | function resdl_SDL_WindowCenter() {
function caml_glfwDestroyCursor (line 186) | function caml_glfwDestroyCursor(cursor) {
function resdl_SDL_SetCursor (line 191) | function resdl_SDL_SetCursor(cursor) {
function resdl_SDL_SetWindowMinimumSize (line 196) | function resdl_SDL_SetWindowMinimumSize(win, minWidth, minHeight) {
function caml_glfwGetTime_byte (line 201) | function caml_glfwGetTime_byte() {
function caml_glfwSetTime_byte (line 206) | function caml_glfwSetTime_byte(t) {
function caml_glfwGetPrimaryMonitor (line 212) | function caml_glfwGetPrimaryMonitor() {
function caml_glfwGetVideoMode (line 217) | function caml_glfwGetVideoMode() {
function caml_glfwGetMonitorPos (line 223) | function caml_glfwGetMonitorPos() {
function caml_glfwGetMonitorPhysicalSize (line 228) | function caml_glfwGetMonitorPhysicalSize() {
function resdl_SDL_GetWindowSize (line 237) | function resdl_SDL_GetWindowSize(w) {
function resdl_SDL_GetWindowId (line 245) | function resdl_SDL_GetWindowId(w) {
function resdl_SDL_GL_GetDrawableSize (line 250) | function resdl_SDL_GL_GetDrawableSize(w) {
function caml_glfwDefaultWindowHints (line 258) | function caml_glfwDefaultWindowHints(w) {
function caml_glfwShowWindow (line 263) | function caml_glfwShowWindow(w) {
function caml_glfwHideWindow (line 268) | function caml_glfwHideWindow(w) {
function caml_test_callback_success (line 273) | function caml_test_callback_success(s, f) {
function resdl__javascript__renderloop (line 278) | function resdl__javascript__renderloop(loopFunc) {
function resdl_SDL_ShowWindow (line 291) | function resdl_SDL_ShowWindow(w) {
function resdl_SDL_CreateWindow (line 296) | function resdl_SDL_CreateWindow(width, height, title) {
function resdl_SDL_SetWindowPosition (line 389) | function resdl_SDL_SetWindowPosition(w, x, y) {
function resdl_SDL_SetWindowSize (line 397) | function resdl_SDL_SetWindowSize(w, width, height) {
function resdl_SDL_SetWindowTitle (line 407) | function resdl_SDL_SetWindowTitle(w, title) {
function resdl_SDL_CreateRGBSurfaceFromImage (line 414) | function resdl_SDL_CreateRGBSurfaceFromImage(path) {
function resdl_SDL_SetWindowIcon (line 419) | function resdl_SDL_SetWindowIcon(w, surface) {
function resdl_SDL_SetTextInputRect (line 429) | function resdl_SDL_SetTextInputRect(x, y, w, h) {
function resdl_SDL_StartTextInput (line 434) | function resdl_SDL_StartTextInput() {
function resdl_SDL_MaximizeWindow (line 439) | function resdl_SDL_MaximizeWindow(w) {
function resdl_SDL_GL_Setup (line 453) | function resdl_SDL_GL_Setup(win) {
function resdl_SDL_PollEvent (line 525) | function resdl_SDL_PollEvent() {
function resdl_SDL_ShowSimpleMessageBox (line 535) | function resdl_SDL_ShowSimpleMessageBox(flags, title, msg, win) {
function resdl_SDL_GetNativeWindow (line 540) | function resdl_SDL_GetNativeWindow(win) {
function resdl_SDL_WinAttachConsole (line 546) | function resdl_SDL_WinAttachConsole() {
function resdl_SDL_WinAllocConsole (line 552) | function resdl_SDL_WinAllocConsole() {
function resdl_SDL_GetPlatform (line 559) | function resdl_SDL_GetPlatform() {
function resdl_SDL_GetVersion (line 565) | function resdl_SDL_GetVersion() {
function resdl_SDL_SetMacBackgroundColor (line 570) | function resdl_SDL_SetMacBackgroundColor() {
function resdl_SDL_SetMacTitlebarTransparent (line 575) | function resdl_SDL_SetMacTitlebarTransparent() {
function resdl_SDL_EnableHitTest (line 580) | function resdl_SDL_EnableHitTest() {
function resdl_SDL_DisableHitTest (line 585) | function resdl_SDL_DisableHitTest() {
function resdl_SDL_SetWindowBordered (line 590) | function resdl_SDL_SetWindowBordered() {
function resdl_SDL_SetWindowResizable (line 595) | function resdl_SDL_SetWindowResizable() {
function resdl_SDL_GetModState (line 600) | function resdl_SDL_GetModState() {
function resdl_SDL_WaitTimeoutEvent (line 606) | function resdl_SDL_WaitTimeoutEvent() {
function resdl_SDL_GL_SwapWindow (line 612) | function resdl_SDL_GL_SwapWindow() {
FILE: packages/reason-sdl2/src/sdl2_wrapper.cpp
function value (line 36) | static value Val_some(value v) {
function value (line 44) | static value Val_ok(value v) {
function value (line 52) | static value Val_error(value v) {
function value (line 62) | value resdl_wrapPointer(void *p) {
function CAMLprim (line 73) | CAMLprim value resdl_SDL_EnableScreenSaver() {
function CAMLprim (line 79) | CAMLprim value resdl_SDL_DisableScreenSaver() {
function CAMLprim (line 85) | CAMLprim value resdl_SDL_IsScreenSaverEnabled() {
function CAMLprim (line 91) | CAMLprim value resdl_SDL_SetMainReady() {
function CAMLprim (line 96) | CAMLprim value resdl_SDL_DestroyWindow(value vWin) {
function SDL_HitTestResult (line 103) | SDL_HitTestResult resdl_hit_test(SDL_Window *win, const SDL_Point *area,
function CAMLprim (line 155) | CAMLprim value resdl_SDL_EnableHitTest(value vWin) {
function CAMLprim (line 162) | CAMLprim value resdl_SDL_DisableHitTest(value vWin) {
function CAMLprim (line 169) | CAMLprim value resdl_SDL_Delay(value delay) {
type PROCESS_DPI_AWARENESS (line 179) | enum PROCESS_DPI_AWARENESS {
function HWND (line 185) | HWND getHWNDFromSDLWindow(SDL_Window *win) {
function CAMLprim (line 194) | CAMLprim value resdl_SDL_GetPlatform() {
function CAMLprim (line 204) | CAMLprim value resdl_SDL_GetVersion() {
function CAMLprim (line 221) | CAMLprim value resdl_SDL_GetNativeWindow(value vWin) {
function resdl_Win32AttachStdIO (line 277) | void resdl_Win32AttachStdIO() {
function CAMLprim (line 312) | CAMLprim value resdl_SDL_WinAttachConsole() {
function CAMLprim (line 331) | CAMLprim value resdl_SDL_WinAllocConsole() {
function CAMLprim (line 343) | CAMLprim value resdl_SDL_SetMacTitlebarHidden(value vWin) {
function CAMLprim (line 359) | CAMLprim value resdl_SDL_SetMacTitlebarTransparent(value vWin) {
function CAMLprim (line 377) | CAMLprim value resdl_SDL_GetMacTitlebarHeight(value vWin) {
function CAMLprim (line 418) | CAMLprim value resdl_SDL_SetWin32ProcessDPIAware(value vWin) {
function CAMLprim (line 453) | CAMLprim value resdl_SDL_GetWin32ScaleFactor(value vWin) {
function CAMLprim (line 484) | CAMLprim value resdl_SDL_GetDisplayDPI(value vDisplay) {
function CAMLprim (line 499) | CAMLprim value resdl_SDL_GetCurrentDisplayMode(value vDisplay) {
function CAMLprim (line 516) | CAMLprim value resdl_SDL_GetDesktopDisplayMode(value vDisplay) {
function CAMLprim (line 533) | CAMLprim value resdl_SDL_GetDisplayBounds(value vDisplay) {
function CAMLprim (line 550) | CAMLprim value resdl_SDL_GetDisplayName(value vDisplay) {
function CAMLprim (line 564) | CAMLprim value resdl_SDL_GetDisplayUsableBounds(value vDisplay) {
function CAMLprim (line 581) | CAMLprim value resdl_SDL_GetNumVideoDisplays(value vUnit) {
function CAMLprim (line 587) | CAMLprim value resdl_SDL_GetPixelFormatName(value vPixelFormat) {
function CAMLprim (line 603) | CAMLprim value resdl_SDL_GetWindowDisplayIndex(value vWin) {
function CAMLprim (line 610) | CAMLprim value resdl_SDL_GetWindowPixelFormat(value vWin) {
function CAMLprim (line 617) | CAMLprim value resdl_SDL_GL_SetSwapInterval(value vInterval) {
function CAMLprim (line 623) | CAMLprim value resdl_SDL_GL_Setup(value vWin) {
function CAMLprim (line 641) | CAMLprim value resdl_SDL_GL_GetString(value vStr) {
function CAMLprim (line 681) | CAMLprim value resdl_SDL_GL_GetFramebufferBinding(value vInt) {
function CAMLprim (line 702) | CAMLprim value resdl_SDL_GL_MakeCurrent(value vWin, value vContext) {
function CAMLprim (line 712) | CAMLprim value resdl_SDL_GetClipboardText(value vUnit) {
function CAMLprim (line 726) | CAMLprim value resdl_SDL_HasClipboardText(value vUnit) {
function CAMLprim (line 732) | CAMLprim value resdl_SDL_SetClipboardText(value vText) {
function CAMLprim (line 738) | CAMLprim value Val_SDL_WindowEvent(int type, int windowID) {
function CAMLprim (line 751) | CAMLprim value Val_SDL_WindowEventWithData(int type, int windowID, int d...
function getNonFocusedMousePosition (line 767) | void getNonFocusedMousePosition(SDL_Window *window, int *localMouseX, in...
function CAMLprim (line 776) | CAMLprim value Val_SDL_Event(SDL_Event *event) {
function CAMLprim (line 1024) | CAMLprim value resdl_SDL_PollEvent() {
function CAMLprim (line 1041) | CAMLprim value resdl_SDL_WaitEvent() {
function CAMLprim (line 1058) | CAMLprim value resdl_SDL_PushEvent() {
function CAMLprim (line 1068) | CAMLprim value resdl_SDL_WaitTimeoutEvent(value vTimeout) {
function CAMLprim (line 1086) | CAMLprim value resdl_SDL_GetTicks() {
function CAMLprim (line 1094) | CAMLprim value resdl_SDL_GetWindowSize(value vWindow) {
function CAMLprim (line 1106) | CAMLprim value resdl_SDL_GetWindowPosition(value vWindow) {
function CAMLprim (line 1122) | CAMLprim value resdl_SDL_GL_GetDrawableSize(value vWindow) {
function CAMLprim (line 1134) | CAMLprim value resdl_SDL_SetWindowIcon(value vWindow, value vIcon) {
function CAMLprim (line 1144) | CAMLprim value resdl_SDL_SetWindowTransparency(value vWindow,
function CAMLprim (line 1161) | CAMLprim value resdl_SDL_CreateSystemCursor(value vCursor) {
function CAMLprim (line 1212) | CAMLprim value resdl_SDL_StartTextInput() {
function CAMLprim (line 1217) | CAMLprim value resdl_SDL_StopTextInput() {
function CAMLprim (line 1222) | CAMLprim value resdl_SDL_SetTextInputRect(value vX, value vY, value vWidth,
function CAMLprim (line 1239) | CAMLprim value resdl_SDL_IsTextInputActive() {
function CAMLprim (line 1243) | CAMLprim value resdl_SDL_SetCursor(value vCursor) {
function SDL_AudioFormat (line 1250) | static SDL_AudioFormat SDL_AudioFormat_val(value tag) {
function CAMLprim (line 1277) | CAMLprim value Val_SDL_AudioFormat(SDL_AudioFormat format) {
function CAMLprim (line 1315) | CAMLprim value Val_SDL_AudioSpec(SDL_AudioSpec spec) {
function CAMLprim (line 1329) | CAMLprim value resdl_SDL_LoadWAV(value vPath) {
function CAMLprim (line 1349) | CAMLprim value resdl_SDL_OpenAudioDevice(
function CAMLprim (line 1388) | CAMLprim value resdl_SDL_CloseAudioDevice(value vDevice) {
function CAMLprim (line 1395) | CAMLprim value resdl_SDL_GetAudioDeviceStatus(value vDevice) {
function CAMLprim (line 1402) | CAMLprim value resdl_SDL_PauseAudioDevice(value vDevice, value vPauseOn) {
function CAMLprim (line 1410) | CAMLprim value resdl_SDL_QueueAudio(value vDevice, value vBuf, value vLe...
function CAMLprim (line 1424) | CAMLprim value resdl_SDL_ClearQueuedAudio(value vDevice) {
function CAMLprim (line 1431) | CAMLprim value resdl_SDL_GetQueuedAudioSize(value vDevice) {
function CAMLprim (line 1438) | CAMLprim value resdl_SDL_CreateRGBSurfaceFromImage(value vPath) {
function CAMLprim (line 1491) | CAMLprim value resdl_SDL_GL_SwapWindow(value vWin) {
function SDL_HitTestResult (line 1500) | SDL_HitTestResult hittest(SDL_Window *win, const SDL_Point *area, void *...
function CAMLprim (line 1504) | CAMLprim value resdl_SDL_SetWindowSize(value vWin, value vW, value vH) {
function CAMLprim (line 1515) | CAMLprim value resdl_SDL_SetWindowMinimumSize(value vWin, value vW, valu...
function CAMLprim (line 1526) | CAMLprim value resdl_SDL_SetWindowTitle(value vWin, value vTitle) {
function CAMLprim (line 1536) | CAMLprim value resdl_SDL_SetWindowPosition(value vWin, value vX, value v...
function CAMLprim (line 1547) | CAMLprim value resdl_SDL_WindowCenter(value vWin) {
function resdl_eventWatcher (line 1556) | int resdl_eventWatcher(void *data, SDL_Event *event) {
function CAMLprim (line 1574) | CAMLprim value resdl_SDL_CreateWindow(value vName, value vX, value vY,
function CAMLprim (line 1660) | CAMLprim value resdl_SDL_CreateWindow_byte(value *argv, int argn) {
function CAMLprim (line 1671) | CAMLprim value resdl_SDL_SetWindowBordered(value vWin, value vBordered) {
function CAMLprim (line 1681) | CAMLprim value resdl_SDL_SetWindowResizable(value vWin, value vResizable) {
function CAMLprim (line 1691) | CAMLprim value resdl_SDL_HideWindow(value vWin) {
function CAMLprim (line 1700) | CAMLprim value resdl_SDL_MaximizeWindow(value vWin) {
function CAMLprim (line 1709) | CAMLprim value resdl_SDL_IsWindowMaximized(value vWin) {
function CAMLprim (line 1719) | CAMLprim value resdl_SDL_IsWindowFullscreen(value vWin) {
function CAMLprim (line 1738) | CAMLprim value resdl_SDL_MinimizeWindow(value vWin) {
function CAMLprim (line 1747) | CAMLprim value resdl_SDL_RaiseWindow(value vWin) {
function CAMLprim (line 1756) | CAMLprim value resdl_SDL_RestoreWindow(value vWin) {
function CAMLprim (line 1765) | CAMLprim value resdl_SDL_ShowWindow(value vWin) {
function CAMLprim (line 1774) | CAMLprim value resdl_SDL_GetWindowId(value vWindow) {
function resdl_onLog (line 1781) | void resdl_onLog(void *unused, int category, SDL_LogPriority priority,
function CAMLprim (line 1860) | CAMLprim value resdl_SDL_Init() {
function resdl_uikit_SDL_main (line 1877) | int resdl_uikit_SDL_main (int argc, char *argv[]) {
function CAMLprim (line 1883) | CAMLprim value resdl_SDL_main(value ml_argc, value ml_argv, value closur...
function CAMLprim (line 1903) | CAMLprim value resdl_SDL_GetScancodeName(value vScancode) {
function CAMLprim (line 1912) | CAMLprim value resdl_SDL_GetKeyFromName(value vKeyName) {
function CAMLprim (line 1920) | CAMLprim value resdl_SDL_GetScancodeFromName(value vScancodeName) {
function CAMLprim (line 1928) | CAMLprim value resdl_SDL_GetKeyName(value vKey) {
function CAMLprim (line 1937) | CAMLprim value resdl_SDL_GetKeyFromScancode(value vScancode) {
function CAMLprim (line 1942) | CAMLprim value resdl_SDL_GetScancodeFromKey(value vKey) {
function CAMLprim (line 1947) | CAMLprim value resdl_SDL_ModLeftShift(value vMod) {
function CAMLprim (line 1951) | CAMLprim value resdl_SDL_ModRightShift(value vMod) {
function CAMLprim (line 1955) | CAMLprim value resdl_SDL_ModLeftControl(value vMod) {
function CAMLprim (line 1959) | CAMLprim value resdl_SDL_ModRightControl(value vMod) {
function CAMLprim (line 1963) | CAMLprim value resdl_SDL_ModLeftAlt(value vMod) {
function CAMLprim (line 1967) | CAMLprim value resdl_SDL_ModRightAlt(value vMod) {
function CAMLprim (line 1971) | CAMLprim value resdl_SDL_ModLeftGui(value vMod) {
function CAMLprim (line 1975) | CAMLprim value resdl_SDL_ModRightGui(value vMod) {
function CAMLprim (line 1979) | CAMLprim value resdl_SDL_ModNumLockDown(value vMod) {
function CAMLprim (line 1983) | CAMLprim value resdl_SDL_ModCapsLockDown(value vMod) {
function CAMLprim (line 1987) | CAMLprim value resdl_SDL_ModAltGrDown(value vMod) {
function CAMLprim (line 1991) | CAMLprim value resdl_SDL_GetModState(value vUnit) {
function CAMLprim (line 1995) | CAMLprim value resdl_SDL_SetModState(value vMod) {
function CAMLprim (line 2000) | CAMLprim value resdl_SDL_GetCompiledVersion(value vUnit) {
function CAMLprim (line 2015) | CAMLprim value resdl_SDL_GetLinkedVersion(value vUnit) {
function CAMLprim (line 2030) | CAMLprim value resdl_SDL_ShowSimpleMessageBox(value vFlags, value vTitle,
function CAMLprim (line 2061) | CAMLprim value resdl_SDL_CaptureMouse(value vEnabled) {
function CAMLprim (line 2067) | CAMLprim value resdl_SDL_GetGlobalMouseState(value vUnit) {
function CAMLprim (line 2081) | CAMLprim value resdl_PassThrough(value v) {
function CAMLprim (line 2085) | CAMLprim value resdl__javascript__renderloop() {
FILE: packages/reason-skia/src/wrapped/c/c_stubs.c
function reason_skia_stub_sk_canvas_draw_rect_ltwh (line 11) | void reason_skia_stub_sk_canvas_draw_rect_ltwh(sk_canvas_t *canvas, floa...
function gr_glinterface_t (line 28) | gr_glinterface_t *reason_skia_make_sdl2_gl_interface() {
function gr_glinterface_t (line 34) | gr_glinterface_t *reason_skia_make_sdl2_gles_interface() {
function sk_shader_t (line 40) | sk_shader_t* reason_skia_stub_linear_gradient2(
function sk_shader_t (line 69) | sk_shader_t* reason_skia_stub_linear_gradient(
FILE: packages/reason-skia/src/wrapped/lib/raw_bindings.c
function CAMLprim (line 21) | CAMLprim value reason_skia_paint_set_color(value vPaint, int32_t color) {
function CAMLprim (line 27) | CAMLprim value reason_skia_paint_set_alphaf(value vPaint, double alpha) {
function CAMLprim (line 42) | CAMLprim value reason_skia_paint_set_alphaf_byte(value vPaint, value vAl...
function CAMLprim (line 47) | CAMLprim value reason_skia_paint_set_color_byte(value vPaint, value vCol...
function reason_skia_stub_sk_color_float_get_b (line 53) | double reason_skia_stub_sk_color_float_get_b(int32_t color) {
function CAMLprim (line 57) | CAMLprim value reason_skia_stub_sk_color_float_get_b_byte(value vColor) {
function reason_skia_stub_sk_color_float_get_g (line 62) | double reason_skia_stub_sk_color_float_get_g(int32_t color) {
function CAMLprim (line 66) | CAMLprim value reason_skia_stub_sk_color_float_get_g_byte(value vColor) {
function reason_skia_stub_sk_color_float_get_r (line 71) | double reason_skia_stub_sk_color_float_get_r(int32_t color) {
function CAMLprim (line 75) | CAMLprim value reason_skia_stub_sk_color_float_get_r_byte(value vColor) {
function reason_skia_stub_sk_color_float_get_a (line 80) | double reason_skia_stub_sk_color_float_get_a(int32_t color) {
function CAMLprim (line 84) | CAMLprim value reason_skia_stub_sk_color_float_get_a_byte(value vColor) {
function reason_skia_color_float_make_argb (line 89) | uint32_t reason_skia_color_float_make_argb(double a, double r, double g,
function CAMLprim (line 98) | CAMLprim value reason_skia_color_float_make_argb_byte(value vA, value vR,
function reason_skia_stub_sk_color_get_a (line 104) | uint32_t reason_skia_stub_sk_color_get_a(int32_t color) {
function CAMLprim (line 108) | CAMLprim value reason_skia_stub_sk_color_get_a_byte(value vColor) {
function reason_skia_stub_sk_color_get_r (line 112) | uint32_t reason_skia_stub_sk_color_get_r(int32_t color) {
function CAMLprim (line 116) | CAMLprim value reason_skia_stub_sk_color_get_r_byte(value vColor) {
function reason_skia_stub_sk_color_get_g (line 120) | uint32_t reason_skia_stub_sk_color_get_g(int32_t color) {
function CAMLprim (line 124) | CAMLprim value reason_skia_stub_sk_color_get_g_byte(value vColor) {
function reason_skia_stub_sk_color_get_b (line 128) | uint32_t reason_skia_stub_sk_color_get_b(int32_t color) {
function CAMLprim (line 132) | CAMLprim value reason_skia_stub_sk_color_get_b_byte(value vColor) {
function reason_skia_stub_sk_color_set_argb (line 136) | uint32_t reason_skia_stub_sk_color_set_argb(int32_t alpha, int32_t red,
function CAMLprim (line 141) | CAMLprim value reason_skia_stub_sk_color_set_argb_byte(value vAlpha, val...
function reason_skia_rect_get_bottom (line 148) | double reason_skia_rect_get_bottom(value vRect) {
function CAMLprim (line 153) | CAMLprim value reason_skia_rect_get_bottom_byte(value vRect) {
function reason_skia_rect_get_right (line 157) | double reason_skia_rect_get_right(value vRect) {
function CAMLprim (line 162) | CAMLprim value reason_skia_rect_get_right_byte(value vRect) {
function reason_skia_rect_get_top (line 166) | double reason_skia_rect_get_top(value vRect) {
function CAMLprim (line 171) | CAMLprim value reason_skia_rect_get_top_byte(value vRect) {
function reason_skia_rect_get_left (line 175) | double reason_skia_rect_get_left(value vRect) {
function CAMLprim (line 180) | CAMLprim value reason_skia_rect_get_left_byte(value vRect) {
function CAMLprim (line 184) | CAMLprim value reason_skia_rect_set(value vRect, double left, double top,
function CAMLprim (line 195) | CAMLprim value reason_skia_rect_set_byte(value vRect, value vLeft, value...
function CAMLprim (line 201) | CAMLprim value reason_skia_matrix_set_scale(value vMatrix, double scaleX,
function CAMLprim (line 217) | CAMLprim value reason_skia_matrix_set_scale_byte(value vMatrix, value vS...
function CAMLprim (line 225) | CAMLprim value reason_skia_matrix_set_translate(value vMatrix,
function CAMLprim (line 241) | CAMLprim value reason_skia_matrix_set_translate_byte(value vMatrix,
FILE: src/Native/ReveryNSObject.c
function CAMLprim (line 12) | CAMLprim value revery_NSObject_equal(value vNSObjA, value vNSObjB) {
function CAMLprim (line 22) | CAMLprim value revery_NSObject_hash(value vNSObj) {
function CAMLprim (line 31) | CAMLprim value revery_NSObject_toString(value vNSObj) {
function CAMLprim (line 43) | CAMLprim value revery_NSObject_className(value vNSObj) {
function CAMLprim (line 55) | CAMLprim value revery_NSObject_release(value vNSObj) {
FILE: src/Native/Revery_Native.c
function CAMLprim (line 23) | CAMLprim value revery_initializeApp() {
function CAMLprim (line 39) | CAMLprim value revery_uninitializeApp() {
function CAMLprim (line 47) | CAMLprim value revery_initializeWindow(value vWin) {
FILE: src/Native/caml_values.h
function value (line 6) | static inline value Val_some(value v) {
FILE: src/Native/cocoa/ReveryAppDelegate_func.c
function CAMLprim (line 17) | CAMLprim value _revery_appDelegate_openFile(const char *path) {
function revery_appDelegate_openFile (line 33) | void revery_appDelegate_openFile(const char *path) {
FILE: src/Native/cocoa/ReveryNSView.c
function CAMLprim (line 13) | CAMLprim value revery_NSView_remove(value vNSView) {
function CAMLprim (line 22) | CAMLprim value revery_NSView_setFrame(value vNSView, value vX, value vY,...
function CAMLprim (line 42) | CAMLprim value revery_NSView_displayIn(value vNSView, value vNSWindow) {
function CAMLprim (line 55) | CAMLprim value revery_NSView_getDefaultWidth(value vNSView) {
function CAMLprim (line 66) | CAMLprim value revery_NSView_getDefaultHeight(value vNSView) {
FILE: src/Native/cocoa/ReveryProgressBar.c
function implementation (line 6) | implementation ReveryProgressBar
FILE: src/Native/dialog.c
function CAMLprim (line 23) | CAMLprim value revery_alertSupported() {
function CAMLprim (line 31) | CAMLprim value revery_alert(value vWindow, value vMessage) {
function CAMLprim (line 50) | CAMLprim value revery_alertOpenFiles_native(
function CAMLprim (line 154) | CAMLprim value revery_alertOpenFiles_bytecode(value *argv, int argn) {
FILE: src/Native/dialog.js
function revery_alertSupported (line 2) | function revery_alertSupported() {
function revery_alert (line 7) | function revery_alert(win, msg) {
FILE: src/Native/dialog_cocoa.c
function revery_alert_cocoa (line 9) | void revery_alert_cocoa(void *pWin, const char *szMessage) {
FILE: src/Native/dialog_gtk.c
function activate (line 7) | static void activate(GtkApplication *app, const char *user_data) {
function revery_alert_gtk (line 18) | void revery_alert_gtk(void *pWin, const char *szMessage) {
type FileChooserOptions (line 40) | struct FileChooserOptions {
function activate_filechooser (line 53) | void activate_filechooser(GtkApplication *app, struct FileChooserOptions...
type FileChooserOptions (line 106) | struct FileChooserOptions
FILE: src/Native/dialog_win32.c
function revery_alert_win32 (line 11) | void revery_alert_win32(void *pWin, const char *szMessage) {
FILE: src/Native/environment.c
function CAMLprim (line 22) | CAMLprim value revery_getOperatingSystem() {
FILE: src/Native/environment_linux.c
function getOperatingSystemVersion_linux (line 8) | void getOperatingSystemVersion_linux(int *kernel, int *major, int *minor...
FILE: src/Native/environment_mac.c
function getOperatingSystemVersion_mac (line 5) | void getOperatingSystemVersion_mac(int *major, int *minor, int *bugfix) {
FILE: src/Native/environment_windows.c
function getOperatingSystemVersion_windows (line 6) | void getOperatingSystemVersion_windows(int *major, int *minor, int *buil...
FILE: src/Native/gtk/ReveryGtk.c
function CAMLprim (line 11) | CAMLprim value revery_gtkEventsPending() {
function CAMLprim (line 17) | CAMLprim value revery_gtkMainIteration() {
FILE: src/Native/gtk/ReveryGtk_Widget.c
function revery_gtkRealize (line 16) | static void revery_gtkRealize(GtkWidget *gWidget, gpointer data) {
function CAMLprim (line 20) | CAMLprim value revery_createGtkWidgetFromXWindow(value vXWindow) {
function CAMLprim (line 41) | CAMLprim value revery_gtkWidgetShowAll(value vWidget) {
function CAMLprim (line 50) | CAMLprim value revery_gtkWidgetGetPath(value vWidget) {
function CAMLprim (line 65) | CAMLprim value revery_gtkWidgetSetOpacity(value vWidget, value vOpacity) {
function CAMLprim (line 76) | CAMLprim value revery_gtkWidgetDestroy(value vWidget) {
function CAMLprim (line 86) | CAMLprim value revery_gtkWidgetGetOpacity(value vWidget) {
function CAMLprim (line 96) | CAMLprim value revery_gtkWidgetGetDepth(value vWidget) {
FILE: src/Native/icon.c
function CAMLprim (line 21) | CAMLprim value revery_getIconHandle() {
function CAMLprim (line 36) | CAMLprim value revery_setIconProgress(value vWin, value vIconHandle,
function CAMLprim (line 74) | CAMLprim value revery_hideIconProgress(value vWin, value vIconHandle) {
FILE: src/Native/icon_cocoa.c
function NSProgressIndicator (line 13) | NSProgressIndicator *get_progress_indicator(NSDockTile *dock_tile) {
function revery_setIconProgress_cocoa (line 36) | void revery_setIconProgress_cocoa(void *dt, double progress) {
function revery_setIconProgressIndeterminate_cocoa (line 46) | void revery_setIconProgressIndeterminate_cocoa(void *dt) {
function revery_hideIconProgress_cocoa (line 58) | void revery_hideIconProgress_cocoa(void *dt) {
FILE: src/Native/icon_win32.c
function revery_setIconProgress_win32 (line 16) | void revery_setIconProgress_win32(void *win, void *ih, float progress) {
function revery_setIconProgressIndeterminate_win32 (line 23) | void revery_setIconProgressIndeterminate_win32(void *win, void *ih) {
function revery_hideIconProgress_win32 (line 29) | void revery_hideIconProgress_win32(void *win, void *ih) {
FILE: src/Native/input.c
function CAMLprim (line 21) | CAMLprim value revery_buttonCreate(value vTitle) {
function CAMLprim (line 39) | CAMLprim value revery_buttonSetColor(value vButton, value vRed, value vG...
function CAMLprim (line 60) | CAMLprim value revery_openEmojiPanel() {
FILE: src/Native/input_cocoa.c
function NSButton (line 12) | NSButton *revery_buttonCreate_cocoa(const char *title) {
function revery_buttonSetColor_cocoa (line 27) | void revery_buttonSetColor_cocoa(NSButton *nsButton, double red, double ...
function revery_openEmojiPanel_cocoa (line 37) | void revery_openEmojiPanel_cocoa() {
FILE: src/Native/locale.c
function CAMLprim (line 24) | CAMLprim value revery_getUserLocale() {
FILE: src/Native/menu.c
function CAMLprim (line 21) | CAMLprim value revery_getMenuBarHandle() {
function CAMLprim (line 37) | CAMLprim value revery_menuCreate(value vTitle) {
function convertCamlKeyEquivalent (line 55) | void convertCamlKeyEquivalent(value vKeyEquivalent, struct KeyEquivalent...
function CAMLprim (line 62) | CAMLprim value revery_menuItemCreate(value vTitle, value vKeyEquivalent) {
function CAMLprim (line 84) | CAMLprim value revery_menuNth(value vMenu, value vIdx) {
function CAMLprim (line 106) | CAMLprim value revery_menuAddItem(value vMenu, value vMenuItem) {
function CAMLprim (line 121) | CAMLprim value revery_menuItemGetSubmenu(value vMenuItem) {
function CAMLprim (line 141) | CAMLprim value revery_menuRemoveItem(value vMenu, value vMenuItem) {
function CAMLprim (line 156) | CAMLprim value revery_menuAddSubmenu(value vParent, value vChild) {
function CAMLprim (line 171) | CAMLprim value revery_menuRemoveSubmenu(value vParent, value vChild) {
function CAMLprim (line 186) | CAMLprim value revery_menuInsertItemAt(value vMenu, value vMenuItem, val...
function CAMLprim (line 204) | CAMLprim value revery_menuInsertSubmenuAt(value vParent, value vChild, v...
function CAMLprim (line 222) | CAMLprim value revery_menuClear(value vMenu) {
function CAMLprim (line 235) | CAMLprim value revery_menuDisplayIn(value vMenu, value vWindow, value vX...
function CAMLprim (line 254) | CAMLprim value revery_menuItemCreateSeparator() {
function CAMLprim (line 269) | CAMLprim value revery_menuItemSetEnabled(value vMenuItem, value vTruth) {
function CAMLprim (line 285) | CAMLprim value revery_menuItemSetVisible(value vMenuItem, value vTruth) {
FILE: src/Native/menu.h
type KeyEquivalent (line 3) | struct KeyEquivalent {
FILE: src/Native/menu_cocoa.c
function NSMenu (line 11) | NSMenu *revery_getMenuBarHandle_cocoa() {
function NSMenu (line 15) | NSMenu *revery_menuCreate_cocoa(const char *title) {
function NSMenuItem (line 22) | NSMenuItem *revery_menuItemCreate_cocoa(const char *title, struct KeyEqu...
function NSMenuItem (line 51) | NSMenuItem *revery_menuNth_cocoa(NSMenu *nsMenu, int idx) {
function revery_menuAddItem_cocoa (line 59) | void revery_menuAddItem_cocoa(NSMenu *nsMenu, NSMenuItem *nsMenuItem) {
function revery_menuAddSubmenu_cocoa (line 71) | void revery_menuAddSubmenu_cocoa(NSMenu *parent, NSMenu *child) {
function revery_menuRemoveSubmenu_cocoa (line 78) | void revery_menuRemoveSubmenu_cocoa(NSMenu *parent, NSMenu *child) {
FILE: src/Native/notification.c
function CAMLprim (line 21) | CAMLprim value revery_dispatchNotification(value vNotificationT) {
function CAMLprim (line 47) | CAMLprim value revery_scheduleNotificationFromNow(value vSeconds, value ...
FILE: src/Native/notification_cocoa.c
function revery_dispatchNotification_cocoa (line 8) | void revery_dispatchNotification_cocoa(const char *title, const char *body,
function revery_scheduleNotificationFromNow_cocoa (line 34) | void revery_scheduleNotificationFromNow_cocoa(const char *title, const c...
FILE: src/Native/shell.c
function CAMLprim (line 20) | CAMLprim value revery_openURL(value vURL) {
function CAMLprim (line 39) | CAMLprim value revery_openFile(value vPath) {
FILE: src/Native/shell_cocoa.c
function revery_openURL_cocoa (line 5) | int revery_openURL_cocoa(const char *url_string) {
function revery_openFile_cocoa (line 19) | int revery_openFile_cocoa(const char *path_string) {
FILE: src/Native/shell_gtk.c
function revery_openURL_gtk (line 7) | int revery_openURL_gtk(const char *url_string) {
function revery_openFile_gtk (line 19) | int revery_openFile_gtk(const char *path_string) {
FILE: src/Native/shell_win32.c
function revery_openURL_win32 (line 8) | int revery_openURL_win32(const char *url_string) {
FILE: src/Native/utilities.c
function revery_caml_call_n (line 13) | void revery_caml_call_n(camlValue f, int argCount, camlValue *args) {
function revery_caml_call (line 25) | void revery_caml_call(camlValue f) {
function value (line 31) | value revery_wrapPointer(void *p) {
function CAMLprim (line 45) | CAMLprim value revery_wrapOptionalPointer(void *p) {
FILE: src/Native/utilities.h
type intnat (line 9) | typedef long intnat;
type uintnat (line 10) | typedef unsigned long uintnat;
type intnat (line 14) | typedef int intnat;
type uintnat (line 15) | typedef unsigned int uintnat;
type intnat (line 19) | typedef int64_t intnat;
type uintnat (line 20) | typedef uint64_t uintnat;
type intnat (line 26) | typedef intnat camlValue;
FILE: src/Native/window.c
function CAMLprim (line 20) | CAMLprim value revery_windowSetUnsavedWork(value vWindow, value vTruth) {
FILE: src/Native/window_cocoa.c
function revery_windowSetUnsavedWork_cocoa (line 6) | void revery_windowSetUnsavedWork_cocoa(NSWindow *window, int truth) {
Condensed preview — 471 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,576K chars).
[
{
"path": ".ci/.gitattributes",
"chars": 295,
"preview": "# Declare shell files to have LF endings on checkout\n# On Windows, the default git setting for `core.autocrlf`\n# means t"
},
{
"path": ".ci/create-docs.yml",
"chars": 765,
"preview": "# These steps are only run on Linux\n\nsteps:\n - script: \"esy '@doc' install\"\n displayName: \"Install doc dependency\"\n "
},
{
"path": ".ci/esy-bench.yml",
"chars": 240,
"preview": "# Run benchmarks\n\nsteps:\n - script: esy @bench install\n displayName: 'esy @bench install'\n - script: esy @bench bui"
},
{
"path": ".ci/esy-build-steps.yml",
"chars": 1014,
"preview": "# Cross-platform set of build steps for building esy projects\n\nsteps:\n - script: npm install -g esy@0.6.7\n displayNa"
},
{
"path": ".ci/esy-check-hygiene.yml",
"chars": 1563,
"preview": "# Cross-platform set of build steps for building esy projects\n\nsteps:\n - script: npm install -g esy@0.6.7\n displayNa"
},
{
"path": ".ci/format.sh",
"chars": 821,
"preview": "#!/usr/bin/env bash\nOS=$1\n\ndune build @fmt --auto-promote\n\ncaml_output=$?\n\nif [[ $OS == \"windows\" ]]\nthen\n files=$(/u"
},
{
"path": ".ci/publish-build-cache.yml",
"chars": 1259,
"preview": "# Steps for publishing project cache\n\nsteps:\n - bash: 'mkdir -p $(STAGING_DIRECTORY)'\n condition: and(succeeded(), e"
},
{
"path": ".ci/publish-release.yml",
"chars": 246,
"preview": "# Steps for publishing project cache\n\nsteps:\n - task: PublishBuildArtifacts@1\n displayName: '[Release]'\n inputs:\n"
},
{
"path": ".ci/restore-build-cache.yml",
"chars": 1797,
"preview": "# Steps for restoring project cache\n\nsteps:\n - task: DownloadBuildArtifacts@0\n condition: and(succeeded(), ne(variab"
},
{
"path": ".ci/use-node.yml",
"chars": 97,
"preview": "steps:\n - task: NodeTool@0\n displayName: 'Use Node 12.x'\n inputs:\n versionSpec: 12.x\n"
},
{
"path": ".gitattributes",
"chars": 417,
"preview": "# Declare shell files to have LF endings on checkout\n# On Windows, the default git setting for `core.autocrlf`\n# means t"
},
{
"path": ".github/FUNDING.yml",
"chars": 71,
"preview": "# These are supported funding model platforms\n\nopen_collective: revery\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 790,
"preview": "---\nname: Bug Report\nabout: Create a report to help us improve\n---\n\n<!-- Please search existing issues to avoid creating"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 183,
"preview": "---\nname: Feature Request\nabout: Suggest an idea for this project\n---\n\n<!-- Please search existing issues to avoid creat"
},
{
"path": ".gitignore",
"chars": 1141,
"preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directo"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3350,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "LICENSE",
"chars": 1069,
"preview": "MIT License\n\nCopyright (c) 2018 Bryan Phelps\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
},
{
"path": "README.md",
"chars": 8075,
"preview": "<p align=\"center\">\n\t<a href=\"https://www.outrunlabs.com/revery\" title=\"Revery\">\n\t\t<img src=\"./assets/logo.png\" alt=\"Logo"
},
{
"path": "Revery.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "ReveryBench.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "ReveryExampleJs.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "ReveryExamples.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "ReveryTest.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "ThirdPartyLicenses.txt",
"chars": 18177,
"preview": "Revery\n\nTHIRD-PARTY SOFTWARE NOTICES AND INFORMATION\n\nThis project incorporates components from the projects listed belo"
},
{
"path": "azure-pipelines.yml",
"chars": 3926,
"preview": "# Starter pipeline\n# Start with a minimal pipeline that you can customize to build and deploy your code.\n# Add steps tha"
},
{
"path": "bench/exe/Bench.re",
"chars": 67,
"preview": "ReveryBench.BenchFramework.cli();\nSkia_Bench.BenchFramework.cli();\n"
},
{
"path": "bench/exe/dune",
"chars": 188,
"preview": "(executable\n (name bench)\n (public_name ReveryBench)\n (libraries ReveryBench.lib Skia_Bench)\n (package ReveryBench))\n\n(i"
},
{
"path": "bench/lib/BenchFramework.re",
"chars": 103,
"preview": "include Reperf.Make({\n let config = Reperf.Config.create(~snapshotDir=\"bench/__snapshots__\", ());\n});\n"
},
{
"path": "bench/lib/DrawBench.re",
"chars": 2889,
"preview": "open BenchFramework;\n\nopen Revery;\nopen Revery.Draw;\n\nlet options = Reperf.Options.create(~iterations=10000, ());\n\nlet s"
},
{
"path": "bench/lib/LayoutBench.re",
"chars": 1051,
"preview": "open BenchFramework;\n\nopen Revery.UI;\n\nlet options = Reperf.Options.create(~iterations=10000, ());\n\nlet createNode = () "
},
{
"path": "bench/lib/NodeUtility.re",
"chars": 486,
"preview": "open Revery.UI;\n\nlet setupNode = (~style, ()) => {\n let n = (new node)();\n n#setStyle(style);\n n;\n};\n\nlet rec setupNo"
},
{
"path": "bench/lib/PaintBench.re",
"chars": 404,
"preview": "open BenchFramework;\n\nopen Revery;\nopen Revery.Draw;\n\nlet options = Reperf.Options.create(~iterations=10000, ());\n\nmodul"
},
{
"path": "bench/lib/RecalculateBench.re",
"chars": 502,
"preview": "open BenchFramework;\n\nopen Revery.UI;\n\nlet options = Reperf.Options.create(~iterations=1000, ());\n\nlet recalculate = (n:"
},
{
"path": "bench/lib/SurfaceUtility.re",
"chars": 174,
"preview": "open Skia;\n\nlet makeSurface = (width, height) => {\n let imageInfo = Skia.ImageInfo.make(width, height, Rgba8888, Premul"
},
{
"path": "bench/lib/ViewNodeBench.re",
"chars": 711,
"preview": "open BenchFramework;\n\nopen Revery.Draw;\nopen Revery.UI;\n\nlet options = Reperf.Options.create(~iterations=10000, ());\n\nle"
},
{
"path": "bench/lib/dune",
"chars": 119,
"preview": "(library\n (name ReveryBench)\n (public_name ReveryBench.lib)\n (ocamlopt_flags -linkall)\n (libraries Revery reperf.lib))\n"
},
{
"path": "bench.json",
"chars": 286,
"preview": "{\n \"source\": \"./package.json\",\n \"scripts\": {\n \"run\": \"esy '@bench' x ReveryBench\"\n },\n \"override\": {\n \"bui"
},
{
"path": "doc.json",
"chars": 381,
"preview": "{\n \"source\": \"./package.json\",\n \"scripts\": {\n \"run\": \"esy '@doc' x http-server #{self.target_dir}/default/_doc/_htm"
},
{
"path": "dune",
"chars": 40,
"preview": "(dirs src packages test examples bench)\n"
},
{
"path": "dune-project",
"chars": 51,
"preview": "(lang dune 2.5)\n\n(formatting (enabled_for reason))\n"
},
{
"path": "dune-workspace",
"chars": 88,
"preview": "(lang dune 2.0)\n(context (default\n (disable_dynamically_linked_foreign_archives true)))\n"
},
{
"path": "examples/AnalogClock.re",
"chars": 3556,
"preview": "open Revery;\nopen Revery.Math;\nopen Revery.UI;\n\nmodule AnalogClock = {\n module DegreeUtils = {\n type t = {\n hou"
},
{
"path": "examples/Border.re",
"chars": 821,
"preview": "open Revery;\nopen Revery.UI;\n\nlet defaultStyle =\n Style.[\n backgroundColor(Color.multiplyAlpha(0.2, Colors.white)),\n"
},
{
"path": "examples/Boxshadow.re",
"chars": 1223,
"preview": "open Revery;\nopen Revery.UI;\n\nlet parentStyles =\n Style.[\n position(`Relative),\n flexGrow(1),\n alignItems(`Cen"
},
{
"path": "examples/Calculator.re",
"chars": 10670,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Row = {\n let make = (~children, ()) => {\n let style "
},
{
"path": "examples/CanQuitExample.re",
"chars": 1036,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule CanQuit = {\n type checkboxState = {canQuit: bool};\n\n l"
},
{
"path": "examples/CanvasExample.re",
"chars": 5167,
"preview": "open Revery;\nopen Revery.Font;\nopen Revery.Draw;\nopen Revery.UI;\n\nlet containerStyle =\n Style.[\n position(`Absolute)"
},
{
"path": "examples/CheckboxExample.re",
"chars": 1272,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Check = {\n type checkboxState = {\n first: bool,\n "
},
{
"path": "examples/DefaultButton.re",
"chars": 917,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule DefaultButtonWithCounter = {\n let%component make = () ="
},
{
"path": "examples/DropdownExample.re",
"chars": 958,
"preview": "open Revery.UI;\nopen Revery.UI.Components;\n\nlet containerStyle =\n Style.[\n position(`Absolute),\n top(0),\n bott"
},
{
"path": "examples/Examples.re",
"chars": 10213,
"preview": "open Revery;\nopen ExampleStubs;\n\nmodule SliderExample = Slider;\nmodule ScrollViewExample = ScrollView;\n\nopen Revery.UI;\n"
},
{
"path": "examples/FileDragAndDrop.re",
"chars": 1152,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Styles = {\n open Style;\n\n let droppable = [\n width("
},
{
"path": "examples/Flexbox.re",
"chars": 2592,
"preview": "open Revery;\nopen Revery.UI;\n\nlet parentWidth = 400;\nlet childWidth = 300;\n\nlet parentStyles =\n (~alignment as a=`Aut"
},
{
"path": "examples/FocusExample.re",
"chars": 1097,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule SimpleButton = {\n let%component make = () => {\n let%"
},
{
"path": "examples/FontsExample.re",
"chars": 2204,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule FontComponent = {\n type state = {\n family: string,\n "
},
{
"path": "examples/GameOfLife.re",
"chars": 10699,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule ViewPort = {\n type t = {\n xMin: int,\n yMin: int,\n"
},
{
"path": "examples/Hello.re",
"chars": 3471,
"preview": "open Revery;\nopen Revery.Math;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule RepoLink = {\n let make = () => {\n "
},
{
"path": "examples/HitTests.re",
"chars": 926,
"preview": "open Revery;\nopen Revery.UI;\n\nmodule Styles = {\n open Style;\n\n let outer = [\n position(`Absolute),\n top(0),\n "
},
{
"path": "examples/HoverExample.re",
"chars": 3603,
"preview": "open Revery;\nopen Revery.UI;\n\ntype state = {\n parentBackground: Color.t,\n childOneBackground: Color.t,\n childTwoBackg"
},
{
"path": "examples/ImageQualityExample.re",
"chars": 596,
"preview": "open Revery.UI;\n\nmodule ImageSample = {\n let make = (~quality, ()) => {\n <View style=Style.[padding(8)]>\n <Imag"
},
{
"path": "examples/Info.plist",
"chars": 258,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "examples/InputExample.re",
"chars": 3565,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet containerStyle =\n Style.[\n position(`Absolute),\n top"
},
{
"path": "examples/LayerExample.re",
"chars": 466,
"preview": "open Revery.UI;\n\nmodule Layers = {\n let make = () => {\n <Layer\n condition=Layer.Condition.always\n style=St"
},
{
"path": "examples/MarkdownExample.re",
"chars": 1632,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Styles = {\n open Style;\n\n let outer = [\n position(`"
},
{
"path": "examples/NativeFileExample.re",
"chars": 2324,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nopen Revery.Native;\n\nmodule NativeFileExamples = {\n let%compon"
},
{
"path": "examples/NativeIconExample.re",
"chars": 1883,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nopen Revery.Native;\n\nmodule Window = Revery.Window;\n\nmodule Nat"
},
{
"path": "examples/NativeInputExample.re",
"chars": 1090,
"preview": "open Revery;\nopen Revery.UI;\n\nmodule View = {\n let noop = () => ();\n let%component make = () => {\n let%hook (isColu"
},
{
"path": "examples/NativeMenuExample.re",
"chars": 4744,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nopen Revery.Native;\n\nmodule Internal = {\n let nonce = ref(0);\n"
},
{
"path": "examples/NativeNotificationExample.re",
"chars": 675,
"preview": "open Revery.UI;\nopen Revery.UI.Components;\n\nopen Revery.Native;\n\nmodule Example = {\n let make = () => {\n let notific"
},
{
"path": "examples/NestedClickable.re",
"chars": 590,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Styles = {\n open Style;\n\n let outer = [\n position(`"
},
{
"path": "examples/RadioButtonExample.re",
"chars": 994,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule RadioExample = {\n let%component make = () => {\n let%"
},
{
"path": "examples/RichTextExample.re",
"chars": 935,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\nopen Revery.Font;\n\nlet containerStyle =\n Style.[\n position(`"
},
{
"path": "examples/SVGExample.re",
"chars": 16629,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet examples = [\n (\n \"<polygon>\",\n {|\n <!-- Source:"
},
{
"path": "examples/ScreenCapture.re",
"chars": 1610,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet backgroundColor = Color.hex(\"#212733\");\nlet activeBackgroun"
},
{
"path": "examples/ScrollView.re",
"chars": 1481,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet containerStyle =\n Style.[\n position(`Absolute),\n top"
},
{
"path": "examples/Slider.re",
"chars": 3194,
"preview": "open Revery;\nopen Revery.Math;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule AdjustableLogo = {\n let%component mak"
},
{
"path": "examples/SpringExample.re",
"chars": 3232,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule SpringyLogo = {\n let make = (~width, ~onMouseDown, ~onM"
},
{
"path": "examples/Stopwatch.re",
"chars": 2919,
"preview": "open Revery;\nopen Revery.Math;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Clock = {\n type dispose = unit => uni"
},
{
"path": "examples/TextExample.re",
"chars": 3745,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet containerStyle =\n Style.[\n position(`Absolute),\n top"
},
{
"path": "examples/TodoExample.re",
"chars": 12697,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Constants = {\n let fontSize = 12.;\n};\n\nmodule Theme = {"
},
{
"path": "examples/TreeView.re",
"chars": 5692,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule TreeView = {\n let stringTree =\n Tree.(\n Node(\n "
},
{
"path": "examples/URLFileOpen.re",
"chars": 709,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nlet containerStyle =\n Style.[\n position(`Absolute),\n top"
},
{
"path": "examples/WavFilePlaybackExample.re",
"chars": 6364,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\nopen Revery.Native;\n\nmodule AudioHelpers = {\n let getBitsPerSam"
},
{
"path": "examples/WindowControl.re",
"chars": 640,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule Styles = {\n open Style;\n\n let outer = [\n position(`"
},
{
"path": "examples/ZoomExample.re",
"chars": 1354,
"preview": "open Revery;\nopen Revery.UI;\nopen Revery.UI.Components;\n\nmodule ZoomButton = {\n let make = (~zoom, ~onClick, ()) => {\n "
},
{
"path": "examples/dune",
"chars": 430,
"preview": "(executables\n (names Examples)\n (preprocess\n (pps brisk-reconciler.ppx lwt_ppx))\n (package ReveryExamples)\n (public_nam"
},
{
"path": "examples/gl-matrix-min.js",
"chars": 55991,
"preview": "/*!\n@fileoverview gl-matrix - High performance matrix and vector operations\n@author Brandon Jones\n@author Colin MacKenzi"
},
{
"path": "examples/index.html",
"chars": 938,
"preview": "<!doctype html>\n<html>\n <head>\n <title>This is the title of the webpage!</title>\n <style>\n html,"
},
{
"path": "examples/stubs/ExampleStubs.re",
"chars": 137,
"preview": "/* Notify external environments of switching tabs */\nexternal notifyExampleSwitched: string => unit =\n \"revery_example_"
},
{
"path": "examples/stubs/dune",
"chars": 182,
"preview": "(library\n (name ExampleStubs)\n (foreign_stubs\n (language c)\n (names example_stubs)\n (flags :standard -Wall -Wextra -W"
},
{
"path": "examples/stubs/example_stubs.c",
"chars": 356,
"preview": "#include <stdio.h>\n\n#include <caml/alloc.h>\n#include <caml/callback.h>\n#include <caml/memory.h>\n#include <caml/mlvalues."
},
{
"path": "examples/stubs/example_stubs.js",
"chars": 331,
"preview": "// Provides: revery_example_notify_changed\n// Requires: caml_to_js_string\nfunction revery_example_notify_changed(src) {\n"
},
{
"path": "examples.json",
"chars": 588,
"preview": "{\n \"source\": \"./package.json\",\n \"scripts\": {\n \"run\": \"esy @examples x Examples\",\n \"run-harfbuzz\": \"esy @exam"
},
{
"path": "include/COPYING.txt",
"chars": 928,
"preview": "Copyright (c) 2002-2006 Marcus Geelnard\nCopyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org>\n\nThis software is"
},
{
"path": "include/KHR/khrplatform.h",
"chars": 10033,
"preview": "#ifndef __khrplatform_h_\n#define __khrplatform_h_\n\n/*\n** Copyright (c) 2008-2018 The Khronos Group Inc.\n**\n** Permission"
},
{
"path": "include/glad/glad.h",
"chars": 42534,
"preview": "/*\n\n OpenGL ES loader generated by glad 0.1.27 on Tue Sep 11 02:18:13 2018.\n\n Language/Generator: C/C++\n Specif"
},
{
"path": "include/stb_image.h",
"chars": 271648,
"preview": "/* stb_image - v2.19 - public domain image loader - http://nothings.org/stb\n no warrant"
},
{
"path": "js.json",
"chars": 445,
"preview": "{\n \"source\": \"./package.json\",\n \"scripts\": {\n \"run\": \"esy '@js' x bash -c 'http-server #{self.bin}'\"\n },\n \"overri"
},
{
"path": "lsan.supp",
"chars": 80,
"preview": "# Add suppression for libfontconfig, which has known leaks\nleak:*libfontconfig*\n"
},
{
"path": "package.json",
"chars": 2648,
"preview": "{\n \"name\": \"revery\",\n \"version\": \"0.32.0\",\n \"description\": \"App toolkit built with Reason\",\n \"license\": \"MIT\",\n \"bu"
},
{
"path": "packages/reason-harfbuzz/examples/harfbuzz-cli/HarfbuzzCli.re",
"chars": 1407,
"preview": "open Harfbuzz;\n\nPrintexc.record_backtrace(true);\n\nlet isNative =\n switch (Sys.backend_type) {\n | Native => true\n | By"
},
{
"path": "packages/reason-harfbuzz/examples/harfbuzz-cli/dune",
"chars": 225,
"preview": "(executable\n (name HarfbuzzCli)\n (package ReveryExamples)\n (public_name HarfbuzzCli)\n (libraries bigarray harfbuzz reaso"
},
{
"path": "packages/reason-harfbuzz/examples/harfbuzz-cli/run-harfbuzz.sh",
"chars": 175,
"preview": "set -e\n\nCWD=$(dirname $0)\nif [[ $1 == 'windows' ]]; then executable=\"HarfbuzzCli.exe\"; else executable=\"HarfbuzzCli\"; fi"
},
{
"path": "packages/reason-harfbuzz/src/Harfbuzz.re",
"chars": 2356,
"preview": "type hb_shape = {\n glyphId: int,\n cluster: int,\n};\n\nmodule Internal = {\n type face;\n type feature = {\n tag: strin"
},
{
"path": "packages/reason-harfbuzz/src/Harfbuzz.rei",
"chars": 685,
"preview": "type hb_face;\n\ntype hb_shape = {\n glyphId: int,\n cluster: int,\n};\n\ntype position = [ | `Start | `End | `Position(int)]"
},
{
"path": "packages/reason-harfbuzz/src/config/discover.re",
"chars": 1887,
"preview": "module Configurator = Configurator.V1;\n\ntype os =\n | Android\n | IOS\n | Linux\n | Mac\n | Windows;\n\nlet detect_system_"
},
{
"path": "packages/reason-harfbuzz/src/config/dune",
"chars": 61,
"preview": "(executable\n (name discover)\n (libraries dune-configurator))\n"
},
{
"path": "packages/reason-harfbuzz/src/dune",
"chars": 390,
"preview": "(library\n (name harfbuzz)\n (public_name reason-harfbuzz)\n (foreign_stubs\n (language c)\n (flags\n (:include c_flags.se"
},
{
"path": "packages/reason-harfbuzz/src/harfbuzz.cpp",
"chars": 5269,
"preview": "#include <stdio.h>\n#include <cstring>\n\n#include <caml/alloc.h>\n#include <caml/bigarray.h>\n#include <caml/callback.h>\n#in"
},
{
"path": "packages/reason-harfbuzz/test/FeaturesTest.re",
"chars": 1131,
"preview": "open Harfbuzz;\nopen TestFramework;\n\ndescribe(\"Features\", ({test, _}) => {\n test(\"default (ff)\", ({expect, _}) => {\n "
},
{
"path": "packages/reason-harfbuzz/test/ShapingTest.re",
"chars": 816,
"preview": "open Harfbuzz;\nopen TestFramework;\n\ndescribe(\"Shaping\", ({test, _}) => {\n test(\"whole string\", ({expect, _}) => {\n l"
},
{
"path": "packages/reason-harfbuzz/test/TestFramework.re",
"chars": 241,
"preview": "include Rely.Make({\n let config =\n Rely.TestFrameworkConfig.initialize({\n snapshotDir: \"./__snapshots__\",\n "
},
{
"path": "packages/reason-harfbuzz/test/dune",
"chars": 114,
"preview": "(library\n (name Harfbuzz_Test)\n (ocamlopt_flags -linkall -g)\n (libraries rely.lib rely.internal reason-harfbuzz))\n"
},
{
"path": "packages/reason-sdl2/src/Float32Array.re",
"chars": 173,
"preview": "type t = Bigarray.Array1.t(float, Bigarray.float32_elt, Bigarray.c_layout);\n\nlet of_array = array =>\n Bigarray.Array1.o"
},
{
"path": "packages/reason-sdl2/src/Uint16Array.re",
"chars": 187,
"preview": "type t =\n Bigarray.Array1.t(int, Bigarray.int16_unsigned_elt, Bigarray.c_layout);\n\nlet of_array = array =>\n Bigarray.A"
},
{
"path": "packages/reason-sdl2/src/config/discover.re",
"chars": 4366,
"preview": "module Configurator = Configurator.V1;\n\ntype os =\n | Android\n | IOS\n | Linux\n | Mac\n | Windows;\n\nlet detect_system_"
},
{
"path": "packages/reason-sdl2/src/config/dune",
"chars": 61,
"preview": "(executable\n (name discover)\n (libraries dune.configurator))\n"
},
{
"path": "packages/reason-sdl2/src/dune",
"chars": 470,
"preview": "(library\n (name sdl2)\n (public_name reason-sdl2)\n (library_flags\n (:include flags.sexp))\n (c_library_flags\n (:include "
},
{
"path": "packages/reason-sdl2/src/sdl2.re",
"chars": 24558,
"preview": "module Float32Array = Float32Array;\nmodule Uint16Array = Uint16Array;\n\nmodule Size = {\n type t = {\n width: int,\n "
},
{
"path": "packages/reason-sdl2/src/sdl2_stubs.js",
"chars": 16576,
"preview": "//Provides: resdl_SDL_Init\nfunction resdl_SDL_Init() {\n joo_global_object._time = {\n start: Date.now(),\n "
},
{
"path": "packages/reason-sdl2/src/sdl2_wrapper.cpp",
"chars": 64454,
"preview": "#include <cstdint>\n#include <cstdio>\n\n#include <algorithm>\n#include <array>\n\n#include <caml/alloc.h>\n#include <caml/biga"
},
{
"path": "packages/reason-sdl2/src/stb_image.cpp",
"chars": 56,
"preview": "#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n"
},
{
"path": "packages/reason-skia/bench/BenchFramework.re",
"chars": 103,
"preview": "include Reperf.Make({\n let config = Reperf.Config.create(~snapshotDir=\"bench/__snapshots__\", ());\n});\n"
},
{
"path": "packages/reason-skia/bench/CanvasBench.re",
"chars": 612,
"preview": "open BenchFramework;\n\nopen Skia;\n\nlet options = Reperf.Options.create(~iterations=100000, ());\n\nmodule Data = {\n let ma"
},
{
"path": "packages/reason-skia/bench/ColorBench.re",
"chars": 908,
"preview": "open BenchFramework;\n\nlet options = Reperf.Options.create(~iterations=100000, ());\n\nmodule Data = {\n let initialColor ="
},
{
"path": "packages/reason-skia/bench/MatrixBench.re",
"chars": 1612,
"preview": "open BenchFramework;\n\nlet options = Reperf.Options.create(~iterations=100000, ());\n\nmodule Data = {\n let initialMatrix "
},
{
"path": "packages/reason-skia/bench/RectBench.re",
"chars": 682,
"preview": "open BenchFramework;\n\nlet options = Reperf.Options.create(~iterations=100000, ());\n\nmodule Data = {\n let initialRect = "
},
{
"path": "packages/reason-skia/bench/SkiaPaintBench.re",
"chars": 521,
"preview": "open BenchFramework;\n\nopen Skia;\n\nlet options = Reperf.Options.create(~iterations=100000, ());\n\nmodule Data = {\n let in"
},
{
"path": "packages/reason-skia/bench/dune",
"chars": 144,
"preview": "(library\n (name Skia_Bench)\n (ocamlopt_flags -linkall)\n (libraries reason-skia reason-skia.wrapped reason-skia.wrapped.b"
},
{
"path": "packages/reason-skia/examples/skia-cli/LICENSE_FiraCode.txt",
"chars": 4389,
"preview": "Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)\n\nThis Font Software is licensed u"
},
{
"path": "packages/reason-skia/examples/skia-cli/LICENSE_ORBITRON.md",
"chars": 4435,
"preview": "\n Copyright (c) 2009, Matt McInerney <matt@pixelspread.com>, with Reserved Font Name: \"Orbitron\".\n \n\tThis Font Sof"
},
{
"path": "packages/reason-skia/examples/skia-cli/SkiaCli.re",
"chars": 10678,
"preview": "open Skia;\n\nlet makeSurface = (width, height) => {\n let imageInfo = ImageInfo.make(width, height, Rgba8888, Premul, Non"
},
{
"path": "packages/reason-skia/examples/skia-cli/dune",
"chars": 282,
"preview": "(executables\n (names SkiaCli)\n (package ReveryExamples)\n (public_names SkiaCli)\n (modes native byte)\n (libraries reason-"
},
{
"path": "packages/reason-skia/examples/skia-font-manager-cli/SkiaFontManagerCli.re",
"chars": 4483,
"preview": "open Skia;\n\nlet emitPng = (path, surface) => {\n let image = Surface.makeImageSnapshot(surface);\n let data = Image.enco"
},
{
"path": "packages/reason-skia/examples/skia-font-manager-cli/dune",
"chars": 350,
"preview": "(executables\n (names SkiaFontManagerCli)\n (package ReveryExamples)\n (public_names SkiaFontManagerCli)\n (modes native byt"
},
{
"path": "packages/reason-skia/examples/skia-font-manager-cli/run-skia-fontmanager.sh",
"chars": 189,
"preview": "set -e\n\nCWD=$(dirname $0)\nif [[ $1 == 'windows' ]]; then executable=\"SkiaFontManagerCli.exe\"; else executable=\"SkiaFontM"
},
{
"path": "packages/reason-skia/examples/skia-sdl2/SkiaSdl.re",
"chars": 3934,
"preview": "open Skia;\n\nlet ctx = ref(None);\n\nlet printEnv = env =>\n switch (Sys.getenv_opt(env)) {\n | None => print_endline(env +"
},
{
"path": "packages/reason-skia/examples/skia-sdl2/dune",
"chars": 269,
"preview": "(executables\n (names SkiaSdl)\n (package ReveryExamples)\n (public_names SkiaSdl)\n (modes native byte)\n (libraries reason-"
},
{
"path": "packages/reason-skia/src/Skia.re",
"chars": 27687,
"preview": "type colorType = SkiaWrapped.colorType;\ntype alphaType = SkiaWrapped.alphaType;\n\nmodule Color = {\n type t = int32;\n [@"
},
{
"path": "packages/reason-skia/src/Skia.rei",
"chars": 13233,
"preview": "type colorType = SkiaWrapped.colorType;\ntype alphaType = SkiaWrapped.alphaType;\ntype data = SkiaWrapped.data;\n\nmodule Co"
},
{
"path": "packages/reason-skia/src/config/discover.re",
"chars": 6967,
"preview": "module Configurator = Configurator.V1;\n\nlet getenv = name =>\n try(Sys.getenv(name)) {\n | Not_found => failwith(\"Error:"
},
{
"path": "packages/reason-skia/src/config/dune",
"chars": 61,
"preview": "(executable\n (name discover)\n (libraries dune.configurator))\n"
},
{
"path": "packages/reason-skia/src/dune",
"chars": 305,
"preview": "(rule\n (targets c_library_flags.sexp c_flags.sexp flags.sexp)\n (deps\n (:discover config/discover.exe))\n (action\n (run "
},
{
"path": "packages/reason-skia/src/wrapped/bindings/SkiaWrappedBindings.re",
"chars": 33322,
"preview": "open Ctypes;\n\nmodule SkiaTypes = SkiaWrappedTypes.M(Skia_generated_type_stubs);\n\nmodule M = (F: FOREIGN) => {\n // modul"
},
{
"path": "packages/reason-skia/src/wrapped/bindings/dune",
"chars": 338,
"preview": "(rule\n (targets skia_generated_type_stubs.ml)\n (deps ../stubgen/ml_types_stubgen.exe)\n (action\n (with-stdout-to\n %{ta"
},
{
"path": "packages/reason-skia/src/wrapped/c/c_stubs.c",
"chars": 2087,
"preview": "/*\n * Use this file for building any C-layer functionality that we want to keep out\n * of Reason\n */\n\n#include \"c_stubs."
},
{
"path": "packages/reason-skia/src/wrapped/c/c_stubs.h",
"chars": 839,
"preview": "#include \"gr_context.h\"\n#include \"sk_canvas.h\"\n#include \"sk_paint.h\"\n#include \"sk_patheffect.h\"\n#include \"sk_shader.h\"\n#"
},
{
"path": "packages/reason-skia/src/wrapped/c/dune",
"chars": 837,
"preview": "(rule\n (targets c_flags.txt c_library_flags.txt)\n (deps\n (:discover ../../config/discover.exe))\n (action\n (run %{disco"
},
{
"path": "packages/reason-skia/src/wrapped/lib/SkiaWrapped.re",
"chars": 53,
"preview": "include SkiaWrappedBindings.M(Skia_generated_stubs);\n"
},
{
"path": "packages/reason-skia/src/wrapped/lib/dune",
"chars": 669,
"preview": "(rule\n (targets skia_generated_stubs.ml)\n (deps ../stubgen/stubgen.exe)\n (action\n (with-stdout-to\n %{targets}\n (run"
},
{
"path": "packages/reason-skia/src/wrapped/lib/raw_bindings.c",
"chars": 7737,
"preview": "\n/*\n * Use this file for any manual, raw bindings - ie,\n * ones that use [@noalloc], [@unboxed].\n */\n\n#include \"c_stubs."
},
{
"path": "packages/reason-skia/src/wrapped/stubgen/dune",
"chars": 828,
"preview": "(executable\n (name stubgen)\n (package reason-skia)\n (modules stubgen)\n (public_name stubgen.exe)\n (libraries reason-skia"
},
{
"path": "packages/reason-skia/src/wrapped/stubgen/stubgen.ml",
"chars": 1085,
"preview": "let prefix = \"skia_wrapped_stub\"\n\nlet prologue = {|\n#include \"c_stubs.h\"\n#include \"gr_context.h\"\n#include \"sk_canvas.h\"\n"
},
{
"path": "packages/reason-skia/src/wrapped/stubgen/types_stubgen.ml",
"chars": 185,
"preview": "let prefix = \"skia_wrapped_stub\"\n\nlet prologue = \"\n#include \\\"sk_types.h\\\"\n\"\n\nlet () =\n print_endline prologue;\n Cstub"
},
{
"path": "packages/reason-skia/src/wrapped/types/SkiaWrappedTypes.re",
"chars": 13500,
"preview": "open Ctypes;\n\nmodule M = (T: TYPE) => {\n open T;\n\n let skiaCEnum = (name, mapping) =>\n enum(\n name,\n ~typ"
},
{
"path": "packages/reason-skia/src/wrapped/types/dune",
"chars": 96,
"preview": "(library\n (name SkiaWrappedTypes)\n (public_name reason-skia.wrapped.types)\n (libraries ctypes))\n"
},
{
"path": "packages/reason-skia/test/ColorTest.re",
"chars": 1426,
"preview": "open Skia;\nopen TestFramework;\n\ndescribe(\"Color\", ({describe, test, _}) => {\n describe(\"float\", ({test, _}) => {\n te"
},
{
"path": "packages/reason-skia/test/MatrixTest.re",
"chars": 726,
"preview": "open Skia;\nopen TestFramework;\n\ndescribe(\"Matrix\", ({test, _}) => {\n test(\"setTranslate\", ({expect, _}) => {\n let ma"
},
{
"path": "packages/reason-skia/test/PaintTest.re",
"chars": 745,
"preview": "open Skia;\nopen TestFramework;\n\ndescribe(\"Paint\", ({describe, _}) => {\n describe(\"hinting\", ({test, _}) => {\n test(\""
},
{
"path": "packages/reason-skia/test/RectTest.re",
"chars": 924,
"preview": "open Skia;\nopen TestFramework;\n\ndescribe(\"Rect\", ({test, _}) => {\n test(\"makeLtrb\", ({expect, _}) => {\n let rect = R"
},
{
"path": "packages/reason-skia/test/TestFramework.re",
"chars": 149,
"preview": "include Rely.Make({\n let config =\n Rely.TestFrameworkConfig.initialize({\n snapshotDir: \"./__snapshots__\",\n "
},
{
"path": "packages/reason-skia/test/dune",
"chars": 193,
"preview": "(library\n (name Skia_Test)\n (flags\n (:standard\n (-w -39)))\n (ocamlopt_flags -linkall -g)\n (libraries rely.lib rely.in"
},
{
"path": "packages/revery-text-wrap/examples/text-wrap-cli/ReveryTextWrapCli.re",
"chars": 1475,
"preview": "open Revery_TextWrap;\n\n/* Get the width of a character */\nlet width_of_token = str => {\n String.length(str) |> float;\n}"
},
{
"path": "packages/revery-text-wrap/examples/text-wrap-cli/dune",
"chars": 245,
"preview": "(executables\n (names ReveryTextWrapCli)\n (package ReveryExamples)\n (public_names ReveryTextWrapCli)\n (modes native byte)"
},
{
"path": "packages/revery-text-wrap/src/Revery_TextWrap.re",
"chars": 8609,
"preview": "open Tokenize;\n\nmodule Log = (val Timber.Log.withNamespace(\"Revery.TextWrap\"));\n\nlet rec list_of_queue = q =>\n if (Queu"
},
{
"path": "packages/revery-text-wrap/src/Revery_TextWrap.rei",
"chars": 175,
"preview": "let wrap:\n (\n ~max_width: float,\n ~width_of_token: string => float,\n ~hyphenate: bool=?,\n ~ignore_preceding"
},
{
"path": "packages/revery-text-wrap/src/Tokenize.re",
"chars": 2152,
"preview": "let slice = (~first, ~last, string) => {\n let length = last - first;\n String.sub(string, first, length);\n};\n\n/* Split "
},
{
"path": "packages/revery-text-wrap/src/dune",
"chars": 97,
"preview": "(library\n (name Revery_TextWrap)\n (public_name Revery.text-wrap)\n (libraries Revery.zed timber))\n"
},
{
"path": "packages/zed/src/dune",
"chars": 159,
"preview": "(library\n (name Revery_Zed)\n (public_name Revery.zed)\n (wrapped false)\n (flags\n (:standard -safe-string))\n (libraries b"
},
{
"path": "packages/zed/src/zed_utf8.ml",
"chars": 30908,
"preview": "(*\n * zed_utf8.ml\n * -----------\n * Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org>\n * Licence : BSD3\n *\n * "
},
{
"path": "packages/zed/src/zed_utf8.mli",
"chars": 11273,
"preview": "(*\n * zed_utf8.mli\n * ------------\n * Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org>\n * Licence : BSD3\n *\n "
},
{
"path": "reason-harfbuzz.opam",
"chars": 108,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outrunlabs.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "reason-sdl2.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "reason-skia.opam",
"chars": 105,
"preview": "opam-version: \"1.2\"\nversion: \"dev\"\nmaintainer: \"bryphe@outlook.com\"\nauthor: [\"Bryan Phelps\"]\nbuild: [\n\n]\n"
},
{
"path": "scripts/docker/archlinux/Dockerfile",
"chars": 686,
"preview": "FROM archlinux:latest\n\nRUN pacman -Syu --noconfirm\nRUN pacman -S --noconfirm base base-devel git npm perl\n#perl for shas"
},
{
"path": "scripts/docker/centos/Dockerfile",
"chars": 1237,
"preview": "FROM centos:7\n\nRUN yum -y update\n\nRUN yum -y install centos-release-scl\nRUN yum-config-manager --enable rhel-server-rhsc"
},
{
"path": "scripts/docker-build.sh",
"chars": 263,
"preview": "source /opt/rh/llvm-toolset-7.0/enable\nclang -v\n\n# Workaround for: https://github.com/esy/esy/issues/1227\n# Concurrent f"
},
{
"path": "scripts/make-binary-file.js",
"chars": 207,
"preview": "const fs = require(\"fs\");\n\nconst testData = new Uint8Array(5);\ntestData[0] = 255;\ntestData[1] = 0;\ntestData[2] = 1;\ntest"
},
{
"path": "scripts/release.sh",
"chars": 95,
"preview": "# Set path\nRELEASE_PATH=\"$(pwd)/_release\"\nmkdir -p $RELEASE_PATH\n\ncp $cur__bin/* $RELEASE_PATH\n"
},
{
"path": "src/Core/App.re",
"chars": 9840,
"preview": "%import\n\"../Native/config.h\";\n\nmodule AppLog = (val Log.withNamespace(\"Revery.App\"));\nmodule SdlLog = (val Log.withNames"
},
{
"path": "src/Core/App.rei",
"chars": 3201,
"preview": "/** [t] is the type representing the running app instance\n\n There is only ever a single app instance, but an app instan"
},
{
"path": "src/Core/Color.re",
"chars": 4128,
"preview": "type t = Skia.Color.t;\n\nlet rgba = (r, g, b, a) => Skia.Color.Float.makeArgb(a, r, g, b);\n\nlet rgb = (r, g, b) => Skia.C"
},
{
"path": "src/Core/Color.rei",
"chars": 509,
"preview": "exception ColorHexParseException(string);\n\ntype t;\n\nlet rgba: (float, float, float, float) => t;\nlet rgb: (float, float,"
},
{
"path": "src/Core/Colors.re",
"chars": 12608,
"preview": "open Color;\n\nlet transparentWhite = rgba(1.0, 1.0, 1.0, 0.0);\nlet transparentBlack = rgba(0., 0., 0., 0.);\n\nlet aliceBlu"
},
{
"path": "src/Core/Environment.re",
"chars": 3374,
"preview": "let isNative =\n switch (Sys.backend_type) {\n | Native => true\n | Bytecode => true\n | _ => false\n };\n\nlet webGL = !i"
},
{
"path": "src/Core/Environment.rei",
"chars": 1720,
"preview": "/**\n [Environment] provides information about the run-time environment\n*/\n\n/** [true] if native / bytecode build, [fals"
},
{
"path": "src/Core/Event.re",
"chars": 876,
"preview": "/* Event.re */\n\nmodule Fanout = {\n /* An event where subscribers can respond with a value */\n type cb('a, 'b) = 'a => "
},
{
"path": "src/Core/Events.re",
"chars": 1174,
"preview": "type keyPressEvent = {\n codepoint: int,\n character: string,\n};\n\ntype textInputEvent = {text: string};\n\ntype textEditEv"
},
{
"path": "src/Core/GarbageCollector.re",
"chars": 336,
"preview": "/*\n * GarbageCollector.re\n *\n * Thin wrapper over the 'Gc' module to support some\n * basic primitives for tuning perform"
},
{
"path": "src/Core/Key.re",
"chars": 368,
"preview": "module Scancode = {\n type t = Sdl2.Scancode.t;\n\n let getName = Sdl2.Scancode.getName;\n let toString = getName;\n};\n\nmo"
},
{
"path": "src/Core/Key.rei",
"chars": 2262,
"preview": "module Scancode: {\n type t = int;\n\n let getName: t => string;\n let toString: t => string;\n};\n\nmodule Keycode: {\n typ"
},
{
"path": "src/Core/Log.re",
"chars": 57,
"preview": "include Timber.Log;\n\nmodule type Logger = Timber.Logger;\n"
},
{
"path": "src/Core/Log.rei",
"chars": 495,
"preview": "module type Logger = {\n let errorf: Timber.msgf(_, unit) => unit;\n let error: string => unit;\n let warnf: Timber.msgf"
},
{
"path": "src/Core/MouseButton.re",
"chars": 336,
"preview": "[@deriving show({with_path: false})]\ntype t =\n | BUTTON_LEFT\n | BUTTON_MIDDLE\n | BUTTON_RIGHT\n | BUTTON_UNKNOWN;\n\nle"
},
{
"path": "src/Core/MouseButton.rei",
"chars": 136,
"preview": "[@deriving show]\ntype t =\n | BUTTON_LEFT\n | BUTTON_MIDDLE\n | BUTTON_RIGHT\n | BUTTON_UNKNOWN;\n\nlet convert: Sdl2.Mous"
},
{
"path": "src/Core/MouseCursors.re",
"chars": 1501,
"preview": "open Sdl2;\n\n/* This module must use lazy values for the cursors, because GLFW will return\n [GLFW_NOT_INITIALIZED] (whi"
},
{
"path": "src/Core/MouseCursors.rei",
"chars": 173,
"preview": "type t;\n\nlet setCursor: t => unit;\n\nlet arrow: t;\nlet text: t;\nlet pointer: t;\nlet crosshair: t;\nlet horizontalResize: t"
},
{
"path": "src/Core/Performance.re",
"chars": 1819,
"preview": "type performanceFunction('a) = unit => 'a;\n\nlet nestingLevel = ref(0);\n\nmodule Log = (val Log.withNamespace(\"Revery.Core"
},
{
"path": "src/Core/Revery_Core.re",
"chars": 702,
"preview": "module Color = Color;\nmodule Colors = Colors;\nmodule Key = Key;\nmodule MouseButton = MouseButton;\nmodule MouseCursors = "
},
{
"path": "src/Core/TextOverflow.re",
"chars": 509,
"preview": "type t =\n | Overflow\n | Clip\n | Ellipsis\n | UserDefined(string);\n\nlet removeLineBreaks = text => {\n let re = Str.re"
}
]
// ... and 271 more files (download for full content)
About this extraction
This page contains the full source code of the revery-ui/revery GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 471 files (1.4 MB), approximately 439.0k tokens, and a symbol index with 693 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.