From badf4dbdf5fbb669b3786925ebea25a667ecf2d6 Mon Sep 17 00:00:00 2001
From: Julio <30329843+julio4@users.noreply.github.com>
Date: Thu, 21 Nov 2024 16:37:59 +0700
Subject: [PATCH 01/13] Prepare release 2.8.2 (#257)
* dep: fix patch to latest shikijs for cairo hl
* fix(app): correct sidebar placement
* fix(app): responsive content centering
* fix(app): responsive content centering
* doc: branch guidelines
* fix(app): top section nav links
---
CONTRIBUTING.md | 6 +
package.json | 8 +
patches/vocs.patch | 1416 ++------------------------------------------
pnpm-lock.yaml | 135 +++--
routes.ts | 4 -
styles.css | 95 +--
6 files changed, 183 insertions(+), 1481 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1ac94b34..0543b466 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,6 +4,12 @@ When contributing to this repository, please first discuss the change you wish t
Join the telegram channel: https://t.me/StarknetByExample
+The release branch is `main`. The development branch is `dev` and is considered stable (but not released yet).
+When you want to contribute, please create a new branch from `dev` and open a pull request to merge your changes back into `dev`.
+You should never open a pull request to merge your changes directly into `main`.
+
+The `dev` branch is deployed at https://starknet-by-example-dev.voyager.online/
+
Please note we have a code of conduct, please follow it in all your interactions with the project.
## Table of Contents
diff --git a/package.json b/package.json
index 032ce81a..4d683183 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,14 @@
"pnpm": {
"patchedDependencies": {
"vocs": "patches/vocs.patch"
+ },
+ "overrides": {
+ "vocs>shiki": "^1.23.0",
+ "vocs>@shikijs/core": "^1.23.0",
+ "vocs>@shikijs/types": "^1.23.0",
+ "vocs>@shikijs/rehype": "^1.23.0",
+ "vocs>@shikijs/twoslash": "^1.23.0",
+ "vocs>@shikijs/transformers": "^1.23.0"
}
}
}
diff --git a/patches/vocs.patch b/patches/vocs.patch
index 0bd0899a..db1208c9 100644
--- a/patches/vocs.patch
+++ b/patches/vocs.patch
@@ -1,1394 +1,46 @@
-diff --git a/_lib/vite/plugins/cairo.json b/_lib/vite/plugins/cairo.json
-new file mode 100644
-index 0000000000000000000000000000000000000000..9078642c2c1dc8b472469c269619b1898734459c
---- /dev/null
-+++ b/_lib/vite/plugins/cairo.json
-@@ -0,0 +1,996 @@
-+{
-+ "credits": "Pulled from: https://raw.githubusercontent.com/starkware-libs/cairo/main/vscode-cairo/syntaxes/cairo.tmLanguage.json. This grammar is heavily modified Rust grammar from VSCode repository: https://github.com/microsoft/vscode/blob/11f415d4d77f7739c202905ccd02e27774146b75/extensions/rust/syntaxes/rust.tmLanguage.json",
-+ "name": "Cairo",
-+ "scopeName": "source.cairo",
-+ "patterns": [
-+ {
-+ "comment": "boxed slice literal",
-+ "begin": "(<)(\\[)",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "punctuation.brackets.angle.cairo"
-+ },
-+ "2": {
-+ "name": "punctuation.brackets.square.cairo"
-+ }
-+ },
-+ "end": ">",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.angle.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#types"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "modules",
-+ "match": "(mod)\\s+([a-z][A-Za-z0-9_]*)",
-+ "captures": {
-+ "1": {
-+ "name": "storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.module.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "use statements",
-+ "name": "meta.use.cairo",
-+ "begin": "\\b(use)\\s",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "keyword.other.cairo"
-+ }
-+ },
-+ "end": ";",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.semi.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#namespaces"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#lvariables"
-+ }
-+ ]
-+ },
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#attributes"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#constants"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#functions"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#macros"
-+ },
-+ {
-+ "include": "#namespaces"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#strings"
-+ },
-+ {
-+ "include": "#variables"
-+ }
-+ ],
-+ "repository": {
-+ "comments": {
-+ "patterns": [
-+ {
-+ "comment": "documentation comments",
-+ "name": "comment.line.documentation.cairo",
-+ "match": "(///).*$",
-+ "captures": {
-+ "1": {
-+ "name": "punctuation.definition.comment.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "line comments",
-+ "name": "comment.line.double-slash.cairo",
-+ "match": "(//).*$",
-+ "captures": {
-+ "1": {
-+ "name": "punctuation.definition.comment.cairo"
-+ }
-+ }
-+ }
-+ ]
-+ },
-+ "block-comments": {
-+ "patterns": [
-+ {
-+ "comment": "empty block comments",
-+ "name": "comment.block.cairo",
-+ "match": "/\\*\\*/"
-+ },
-+ {
-+ "comment": "block documentation comments",
-+ "name": "comment.block.documentation.cairo",
-+ "begin": "/\\*\\*",
-+ "end": "\\*/",
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "block comments",
-+ "name": "comment.block.cairo",
-+ "begin": "/\\*(?!\\*)",
-+ "end": "\\*/",
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ }
-+ ]
-+ }
-+ ]
-+ },
-+ "constants": {
-+ "patterns": [
-+ {
-+ "comment": "ALL CAPS constants",
-+ "name": "constant.other.caps.cairo",
-+ "match": "\\b[A-Z]{2}[A-Z0-9_]*\\b"
-+ },
-+ {
-+ "comment": "constant declarations",
-+ "match": "\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b",
-+ "captures": {
-+ "1": {
-+ "name": "storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "constant.other.caps.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "decimal integers and floats",
-+ "name": "constant.numeric.decimal.cairo",
-+ "match": "\\b\\d[\\d_]*(\\.?)[\\d_]*(?:(E|e)([+-]?)([\\d_]+))?(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
-+ "captures": {
-+ "1": {
-+ "name": "punctuation.separator.dot.decimal.cairo"
-+ },
-+ "2": {
-+ "name": "keyword.operator.exponent.cairo"
-+ },
-+ "3": {
-+ "name": "keyword.operator.exponent.sign.cairo"
-+ },
-+ "4": {
-+ "name": "constant.numeric.decimal.exponent.mantissa.cairo"
-+ },
-+ "5": {
-+ "name": "entity.name.type.numeric.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "hexadecimal integers",
-+ "name": "constant.numeric.hex.cairo",
-+ "match": "\\b0x[\\da-fA-F_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
-+ "captures": {
-+ "1": {
-+ "name": "entity.name.type.numeric.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "octal integers",
-+ "name": "constant.numeric.oct.cairo",
-+ "match": "\\b0o[0-7_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
-+ "captures": {
-+ "1": {
-+ "name": "entity.name.type.numeric.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "binary integers",
-+ "name": "constant.numeric.bin.cairo",
-+ "match": "\\b0b[01_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
-+ "captures": {
-+ "1": {
-+ "name": "entity.name.type.numeric.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "booleans",
-+ "name": "constant.language.bool.cairo",
-+ "match": "\\b(true|false)\\b"
-+ }
-+ ]
-+ },
-+ "escapes": {
-+ "comment": "escapes: ASCII, byte, Unicode, quote, regex",
-+ "name": "constant.character.escape.cairo",
-+ "match": "(\\\\)(?:(?:(x[0-7][\\da-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))",
-+ "captures": {
-+ "1": {
-+ "name": "constant.character.escape.backslash.cairo"
-+ },
-+ "2": {
-+ "name": "constant.character.escape.bit.cairo"
-+ },
-+ "3": {
-+ "name": "constant.character.escape.unicode.cairo"
-+ },
-+ "4": {
-+ "name": "constant.character.escape.unicode.punctuation.cairo"
-+ },
-+ "5": {
-+ "name": "constant.character.escape.unicode.punctuation.cairo"
-+ }
-+ }
-+ },
-+ "attributes": {
-+ "comment": "attributes",
-+ "name": "meta.attribute.cairo",
-+ "begin": "(#)(\\!?)(\\[)",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "punctuation.definition.attribute.cairo"
-+ },
-+ "3": {
-+ "name": "punctuation.brackets.attribute.cairo"
-+ }
-+ },
-+ "end": "\\]",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.attribute.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#strings"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#types"
-+ }
-+ ]
-+ },
-+ "functions": {
-+ "patterns": [
-+ {
-+ "comment": "pub as a function",
-+ "match": "\\b(pub)(\\()",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.other.cairo"
-+ },
-+ "2": {
-+ "name": "punctuation.brackets.round.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "function definition",
-+ "name": "meta.function.definition.cairo",
-+ "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "keyword.other.fn.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.function.cairo"
-+ },
-+ "4": {
-+ "name": "punctuation.brackets.round.cairo"
-+ },
-+ "5": {
-+ "name": "punctuation.brackets.angle.cairo"
-+ }
-+ },
-+ "end": "\\{|;",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.curly.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#constants"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#functions"
-+ },
-+ {
-+ "include": "#macros"
-+ },
-+ {
-+ "include": "#namespaces"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#strings"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#variables"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "function/method calls, chaining",
-+ "name": "meta.function.call.cairo",
-+ "begin": "([A-Za-z0-9_]+)(\\()",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "entity.name.function.cairo"
-+ },
-+ "2": {
-+ "name": "punctuation.brackets.round.cairo"
-+ }
-+ },
-+ "end": "\\)",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.round.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#attributes"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#constants"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#functions"
-+ },
-+ {
-+ "include": "#macros"
-+ },
-+ {
-+ "include": "#namespaces"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#strings"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#variables"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "function/method calls with turbofish",
-+ "name": "meta.function.call.cairo",
-+ "begin": "([A-Za-z0-9_]+)(?=::<.*>\\()",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "entity.name.function.cairo"
-+ }
-+ },
-+ "end": "\\)",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.round.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#attributes"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#constants"
-+ },
-+ {
-+ "include": "#gtypes"
-+ },
-+ {
-+ "include": "#functions"
-+ },
-+ {
-+ "include": "#lifetimes"
-+ },
-+ {
-+ "include": "#macros"
-+ },
-+ {
-+ "include": "#namespaces"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#strings"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#variables"
-+ }
-+ ]
-+ }
-+ ]
-+ },
-+ "keywords": {
-+ "patterns": [
-+ {
-+ "comment": "control flow keywords",
-+ "name": "keyword.control.cairo",
-+ "match": "\\b(break|continue|do|else|for|if|loop|match|return|try|while|yield)\\b"
-+ },
-+ {
-+ "comment": "storage keywords",
-+ "name": "keyword.other.cairo storage.type.cairo",
-+ "match": "\\b(extern|let|macro|mod)\\b"
-+ },
-+ {
-+ "comment": "const keyword",
-+ "name": "storage.modifier.cairo",
-+ "match": "\\b(const)\\b"
-+ },
-+ {
-+ "comment": "type keyword",
-+ "name": "keyword.declaration.type.cairo storage.type.cairo",
-+ "match": "\\b(type)\\b"
-+ },
-+ {
-+ "comment": "enum keyword",
-+ "name": "keyword.declaration.enum.cairo storage.type.cairo",
-+ "match": "\\b(enum)\\b"
-+ },
-+ {
-+ "comment": "trait keyword",
-+ "name": "keyword.declaration.trait.cairo storage.type.cairo",
-+ "match": "\\b(trait)\\b"
-+ },
-+ {
-+ "comment": "struct keyword",
-+ "name": "keyword.declaration.struct.cairo storage.type.cairo",
-+ "match": "\\b(struct)\\b"
-+ },
-+ {
-+ "comment": "storage modifiers",
-+ "name": "storage.modifier.cairo",
-+ "match": "\\b(ref|static)\\b"
-+ },
-+ {
-+ "comment": "other keywords",
-+ "name": "keyword.other.cairo",
-+ "match": "\\b(as|dyn|move|impl|implicits|in|nopanic|of|priv|pub|static_assert|typeof|unsafe|use|where|with)\\b"
-+ },
-+ {
-+ "comment": "fn",
-+ "name": "keyword.other.fn.cairo",
-+ "match": "\\bfn\\b"
-+ },
-+ {
-+ "comment": "crate",
-+ "name": "keyword.other.crate.cairo",
-+ "match": "\\bcrate\\b"
-+ },
-+ {
-+ "comment": "mut",
-+ "name": "storage.modifier.mut.cairo",
-+ "match": "\\bmut\\b"
-+ },
-+ {
-+ "comment": "logical operators",
-+ "name": "keyword.operator.logical.cairo",
-+ "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)"
-+ },
-+ {
-+ "comment": "logical AND, borrow references",
-+ "name": "keyword.operator.borrow.and.cairo",
-+ "match": "&(?![&=])"
-+ },
-+ {
-+ "comment": "assignment operators",
-+ "name": "keyword.operator.assignment.cairo",
-+ "match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)"
-+ },
-+ {
-+ "comment": "single equal",
-+ "name": "keyword.operator.assignment.equal.cairo",
-+ "match": "(?])=(?!=|>)"
-+ },
-+ {
-+ "comment": "comparison operators",
-+ "name": "keyword.operator.comparison.cairo",
-+ "match": "(=(=)?(?!>)|!=|<=|(?=)"
-+ },
-+ {
-+ "comment": "math operators",
-+ "name": "keyword.operator.math.cairo",
-+ "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
-+ },
-+ {
-+ "comment": "less than, greater than (special case)",
-+ "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",
-+ "captures": {
-+ "1": {
-+ "name": "punctuation.brackets.round.cairo"
-+ },
-+ "2": {
-+ "name": "punctuation.brackets.square.cairo"
-+ },
-+ "3": {
-+ "name": "punctuation.brackets.curly.cairo"
-+ },
-+ "4": {
-+ "name": "keyword.operator.comparison.cairo"
-+ },
-+ "5": {
-+ "name": "punctuation.brackets.round.cairo"
-+ },
-+ "6": {
-+ "name": "punctuation.brackets.square.cairo"
-+ },
-+ "7": {
-+ "name": "punctuation.brackets.curly.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "namespace operator",
-+ "name": "keyword.operator.namespace.cairo",
-+ "match": "::"
-+ },
-+ {
-+ "comment": "desnap",
-+ "match": "(\\*)(?=\\w+)",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.operator.desnap.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "snap",
-+ "name": "keyword.operator.snap.cairo",
-+ "match": "@"
-+ },
-+ {
-+ "comment": "dot access",
-+ "name": "keyword.operator.access.dot.cairo",
-+ "match": "\\.(?!\\.)"
-+ },
-+ {
-+ "comment": "ranges, range patterns",
-+ "name": "keyword.operator.range.cairo",
-+ "match": "\\.{2}(=|\\.)?"
-+ },
-+ {
-+ "comment": "colon",
-+ "name": "keyword.operator.key-value.cairo",
-+ "match": ":(?!:)"
-+ },
-+ {
-+ "comment": "dashrocket, skinny arrow",
-+ "name": "keyword.operator.arrow.skinny.cairo",
-+ "match": "->"
-+ },
-+ {
-+ "comment": "hashrocket, fat arrow",
-+ "name": "keyword.operator.arrow.fat.cairo",
-+ "match": "=>"
-+ },
-+ {
-+ "comment": "dollar macros",
-+ "name": "keyword.operator.macro.dollar.cairo",
-+ "match": "\\$"
-+ },
-+ {
-+ "comment": "question mark operator, questionably sized, macro kleene matcher",
-+ "name": "keyword.operator.question.cairo",
-+ "match": "\\?"
-+ }
-+ ]
-+ },
-+ "interpolations": {
-+ "comment": "curly brace interpolations",
-+ "name": "meta.interpolation.cairo",
-+ "match": "({)[^\"{}]*(})",
-+ "captures": {
-+ "1": {
-+ "name": "punctuation.definition.interpolation.cairo"
-+ },
-+ "2": {
-+ "name": "punctuation.definition.interpolation.cairo"
-+ }
-+ }
-+ },
-+ "macros": {
-+ "patterns": [
-+ {
-+ "comment": "macros",
-+ "name": "meta.macro.cairo",
-+ "match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
-+ "captures": {
-+ "2": {
-+ "name": "entity.name.function.macro.cairo"
-+ },
-+ "3": {
-+ "name": "entity.name.type.macro.cairo"
-+ }
-+ }
-+ }
-+ ]
-+ },
-+ "namespaces": {
-+ "patterns": [
-+ {
-+ "comment": "namespace (non-type, non-function path segment)",
-+ "match": "(?",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.brackets.angle.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#block-comments"
-+ },
-+ {
-+ "include": "#comments"
-+ },
-+ {
-+ "include": "#keywords"
-+ },
-+ {
-+ "include": "#lvariables"
-+ },
-+ {
-+ "include": "#punctuation"
-+ },
-+ {
-+ "include": "#types"
-+ },
-+ {
-+ "include": "#variables"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "primitive types",
-+ "name": "entity.name.type.primitive.cairo",
-+ "match": "\\b(bool|never)\\b"
-+ },
-+ {
-+ "comment": "trait declarations",
-+ "match": "\\b(trait)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.declaration.trait.cairo storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.type.trait.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "struct declarations",
-+ "match": "\\b(struct)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.declaration.struct.cairo storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.type.struct.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "enum declarations",
-+ "match": "\\b(enum)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.declaration.enum.cairo storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.type.enum.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "type declarations",
-+ "match": "\\b(type)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
-+ "captures": {
-+ "1": {
-+ "name": "keyword.declaration.type.cairo storage.type.cairo"
-+ },
-+ "2": {
-+ "name": "entity.name.type.declaration.cairo"
-+ }
-+ }
-+ },
-+ {
-+ "comment": "types",
-+ "name": "entity.name.type.cairo",
-+ "match": "\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)"
-+ }
-+ ]
-+ },
-+ "gtypes": {
-+ "patterns": [
-+ {
-+ "comment": "option types",
-+ "name": "entity.name.type.option.cairo",
-+ "match": "\\b(Some|None)\\b"
-+ },
-+ {
-+ "comment": "result types",
-+ "name": "entity.name.type.result.cairo",
-+ "match": "\\b(Ok|Err)\\b"
-+ }
-+ ]
-+ },
-+ "punctuation": {
-+ "patterns": [
-+ {
-+ "comment": "comma",
-+ "name": "punctuation.comma.cairo",
-+ "match": ","
-+ },
-+ {
-+ "comment": "curly braces",
-+ "name": "punctuation.brackets.curly.cairo",
-+ "match": "[{}]"
-+ },
-+ {
-+ "comment": "parentheses, round brackets",
-+ "name": "punctuation.brackets.round.cairo",
-+ "match": "[()]"
-+ },
-+ {
-+ "comment": "semicolon",
-+ "name": "punctuation.semi.cairo",
-+ "match": ";"
-+ },
-+ {
-+ "comment": "square brackets",
-+ "name": "punctuation.brackets.square.cairo",
-+ "match": "[\\[\\]]"
-+ },
-+ {
-+ "comment": "angle brackets",
-+ "name": "punctuation.brackets.angle.cairo",
-+ "match": "(?]"
-+ }
-+ ]
-+ },
-+ "strings": {
-+ "patterns": [
-+ {
-+ "comment": "double-quoted byte array strings",
-+ "name": "string.quoted.double.cairo",
-+ "begin": "(\")",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "punctuation.definition.string.bytearray.cairo"
-+ }
-+ },
-+ "end": "\"",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.definition.string.bytearray.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#escapes"
-+ },
-+ {
-+ "include": "#interpolations"
-+ }
-+ ]
-+ },
-+ {
-+ "comment": "single-quoted short strings",
-+ "name": "string.quoted.single.cairo",
-+ "begin": "(')",
-+ "beginCaptures": {
-+ "1": {
-+ "name": "punctuation.definition.string.short.cairo"
-+ }
-+ },
-+ "end": "'",
-+ "endCaptures": {
-+ "0": {
-+ "name": "punctuation.definition.string.short.cairo"
-+ }
-+ },
-+ "patterns": [
-+ {
-+ "include": "#escapes"
-+ },
-+ {
-+ "include": "#interpolations"
-+ }
-+ ]
-+ }
-+ ]
-+ },
-+ "lvariables": {
-+ "patterns": [
-+ {
-+ "comment": "super",
-+ "name": "variable.language.super.cairo",
-+ "match": "\\bsuper\\b"
-+ }
-+ ]
-+ },
-+ "variables": {
-+ "patterns": [
-+ {
-+ "comment": "variables",
-+ "name": "variable.other.cairo",
-+ "match": "\\b(? [
-- remarkDirective,
-- remarkInferFrontmatter,
-- remarkFrontmatter,
-- remarkMdxFrontmatter,
-- remarkGfm,
-- remarkLinks,
-- remarkBlogPosts,
-- remarkCallout,
-- remarkCode,
-- remarkCodeGroup,
-- remarkDetails,
-- remarkFilename,
-- remarkSponsors,
-- remarkSteps,
-- remarkStrongBlock,
-- remarkSubheading,
-- remarkTwoslash,
-- remarkAuthors,
-- ...(markdown?.remarkPlugins || []),
-+ remarkDirective,
-+ remarkInferFrontmatter,
-+ remarkFrontmatter,
-+ remarkMdxFrontmatter,
-+ remarkGfm,
-+ remarkLinks,
-+ remarkBlogPosts,
-+ remarkCallout,
-+ remarkCode,
-+ remarkCodeGroup,
-+ remarkDetails,
-+ remarkFilename,
-+ remarkSponsors,
-+ remarkSteps,
-+ remarkStrongBlock,
-+ remarkSubheading,
-+ remarkTwoslash,
-+ remarkAuthors,
-+ ...(markdown?.remarkPlugins || []),
- ];
- const defaultThemes = {
-- dark: 'github-dark-dimmed',
-- light: 'github-light',
-+ dark: "github-dark-dimmed",
-+ light: "github-light",
- };
--export const getRehypePlugins = ({ markdown, rootDir = '', twoslash = {}, } = {}) => [
-- rehypeSlug,
-- [
-- rehypeShiki,
-- {
-- transformers: [
-- transformerLineNumbers(),
-- transformerNotationDiff(),
-- transformerNotationFocus(),
-- transformerNotationHighlight(),
-- transformerNotationWordHighlight(),
-- transformerNotationInclude({ rootDir }),
-- transformerEmptyLine(),
-- transformerTagLine(),
-- transformerTitle(),
-- twoslash !== false
-- ? transformerTwoslash({
-- explicitTrigger: true,
-- renderer: twoslashRenderer(),
-- twoslasher,
-- twoslashOptions: {
-- ...twoslash,
-- customTags: [
-- 'allowErrors',
-- ...(defaultTwoslashOptions.customTags ?? []),
-- ...(twoslash.customTags ?? []),
-- ],
-- compilerOptions: {
-- ...(twoslash.compilerOptions ?? {}),
-- ...defaultTwoslashOptions.compilerOptions,
-- },
-- },
-- })
-- : null,
-- transformerSplitIdentifiers(),
-- ].filter(Boolean),
-- themes: defaultThemes,
-- ...markdown?.code,
-- },
-- ],
-- [
-- rehypeInlineShiki,
-- {
-- themes: defaultThemes,
-- ...markdown?.code,
-- },
-- ],
-- rehypeShikiDisplayNotation,
-- [
-- rehypeAutolinkHeadings,
-- {
-- behavior: 'append',
-- content() {
-- return [h('div', { dataAutolinkIcon: true })];
-- },
-- },
-- ],
-- ...(markdown?.rehypePlugins || []),
-+export const getRehypePlugins = ({
-+ markdown,
-+ rootDir = "",
-+ twoslash = {},
-+} = {}) => [
-+ rehypeSlug,
-+ [
-+ // Patch
-+ rehypeShikiFromHighlighter,
-+ highlighter,
-+ // Patch end
-+ {
-+ transformers: [
-+ transformerLineNumbers(),
-+ transformerNotationDiff(),
-+ transformerNotationFocus(),
-+ transformerNotationHighlight(),
-+ transformerNotationWordHighlight(),
-+ transformerNotationInclude({ rootDir }),
-+ transformerEmptyLine(),
-+ transformerTagLine(),
-+ transformerTitle(),
-+ twoslash !== false
-+ ? transformerTwoslash({
-+ explicitTrigger: true,
-+ renderer: twoslashRenderer(),
-+ twoslasher,
-+ twoslashOptions: {
-+ ...twoslash,
-+ customTags: [
-+ "allowErrors",
-+ ...(defaultTwoslashOptions.customTags ?? []),
-+ ...(twoslash.customTags ?? []),
-+ ],
-+ compilerOptions: {
-+ ...(twoslash.compilerOptions ?? {}),
-+ ...defaultTwoslashOptions.compilerOptions,
-+ },
-+ },
-+ })
-+ : null,
-+ transformerSplitIdentifiers(),
-+ ].filter(Boolean),
-+ themes: defaultThemes,
-+ ...markdown?.code,
-+ },
-+ ],
-+ [
-+ rehypeInlineShiki,
-+ {
-+ langs,
-+ themes: defaultThemes,
-+ ...markdown?.code,
-+ },
-+ ],
-+ rehypeShikiDisplayNotation,
-+ [
-+ rehypeAutolinkHeadings,
-+ {
-+ behavior: "append",
-+ content() {
-+ return [h("div", { dataAutolinkIcon: true })];
-+ },
-+ },
-+ ],
-+ ...(markdown?.rehypePlugins || []),
- ];
- export async function mdx() {
-- const { config } = await resolveVocsConfig();
-- const { markdown, rootDir, twoslash } = config;
-- const remarkPlugins = getRemarkPlugins({ markdown });
-- const rehypePlugins = getRehypePlugins({ markdown, rootDir, twoslash });
-- return [
-- mdxPlugin({
-- providerImportSource: 'vocs/mdx-react',
-- remarkPlugins,
-- rehypePlugins,
-- }),
-- ];
-+ const { config } = await resolveVocsConfig();
-+ const { markdown, rootDir, twoslash } = config;
-+ const remarkPlugins = getRemarkPlugins({ markdown });
-+ const rehypePlugins = getRehypePlugins({ markdown, rootDir, twoslash });
-+ return [
-+ mdxPlugin({
-+ providerImportSource: "vocs/mdx-react",
-+ remarkPlugins,
-+ rehypePlugins,
-+ }),
-+ ];
- }
- //# sourceMappingURL=mdx.js.map
diff --git a/_lib/vite/plugins/rehype/inline-shiki.js b/_lib/vite/plugins/rehype/inline-shiki.js
-index 1e2a7426a5a80afa1bdff24388a8849b49e04f2e..20332be7836e5ca932f59747c3de697430b1d711 100644
+index 1e2a7426a5a80afa1bdff24388a8849b49e04f2e..a8394cddd3968f6c153eed58481a80fb5a8e1b09 100644
--- a/_lib/vite/plugins/rehype/inline-shiki.js
+++ b/_lib/vite/plugins/rehype/inline-shiki.js
-@@ -1,30 +1,51 @@
--import { bundledLanguages, getSingletonHighlighter } from 'shiki';
--import { visit } from 'unist-util-visit';
-+import { bundledLanguages, getSingletonHighlighter } from "shiki";
-+import { visit } from "unist-util-visit";
- const inlineShikiRegex = /(.*){:(.*)}$/;
- let promise;
- export const rehypeInlineShiki = function (options = {}) {
-- const themeNames = ('themes' in options ? Object.values(options.themes) : [options.theme]).filter(Boolean);
-- const langs = options.langs || Object.keys(bundledLanguages);
-- return async function (tree) {
-- if (!promise)
-- promise = getSingletonHighlighter({
-- themes: themeNames,
-- langs,
-- });
-- const highlighter = await promise;
-- return visit(tree, 'element', (node, index, parent) => {
+@@ -13,16 +13,33 @@ export const rehypeInlineShiki = function (options = {}) {
+ });
+ const highlighter = await promise;
+ return visit(tree, 'element', (node, index, parent) => {
- if (node.tagName !== 'code')
- return;
-- const match = node.children[0]?.value?.match(inlineShikiRegex);
++ if (node.tagName !== "code") return;
++ // ignore math
++ const classes = Array.isArray(node.properties.className)
++ ? node.properties.className
++ : [];
++ const languageMath = classes.includes("language-math");
++ const mathDisplay = classes.includes("math-display");
++ const mathInline = classes.includes("math-inline");
++ if (languageMath || mathDisplay || mathInline) {
++ return;
++ }
++
+ const match = node.children[0]?.value?.match(inlineShikiRegex);
- if (!match)
- return;
- const [, code, lang] = match;
- const hast = highlighter.codeToHast(code, { ...options, lang });
-- const inlineCode = hast.children[0].children[0];
++ let hast;
++ if (match) {
++ const [, code, lang] = match;
++ hast = highlighter.codeToHast(code, { ...options, lang });
++ } else {
++ if (!node.children[0] || node.children[0].type !== "text") return;
++ const code = node.children[0].value;
++ hast = highlighter.codeToHast(code, {
++ ...options,
++ lang: "cairo",
++ });
++ }
+ const inlineCode = hast.children[0].children[0];
- if (!inlineCode)
- return;
-- parent?.children.splice(index ?? 0, 1, inlineCode);
-+ const themeNames = (
-+ "themes" in options ? Object.values(options.themes) : [options.theme]
-+ ).filter(Boolean);
-+ const langs = options.langs || Object.keys(bundledLanguages);
-+ return async function (tree) {
-+ if (!promise)
-+ promise = getSingletonHighlighter({
-+ themes: themeNames,
-+ langs,
-+ });
-+ const highlighter = await promise;
-+ return visit(tree, "element", (node, index, parent) => {
-+ if (node.tagName !== "code") return;
-+ // ignore math
-+ const classes = Array.isArray(node.properties.className)
-+ ? node.properties.className
-+ : [];
-+ const languageMath = classes.includes("language-math");
-+ const mathDisplay = classes.includes("math-display");
-+ const mathInline = classes.includes("math-inline");
-+ if (languageMath || mathDisplay || mathInline) {
-+ return;
-+ }
-+
-+ const match = node.children[0]?.value?.match(inlineShikiRegex);
-+ if (match) {
-+ const [, code, lang] = match;
-+ const hast = highlighter.codeToHast(code, { ...options, lang });
-+ const inlineCode = hast.children[0].children[0];
-+ if (!inlineCode) return;
-+ parent?.children.splice(index ?? 0, 1, inlineCode);
-+ } else {
-+ if (!node.children[0] || node.children[0].type !== "text") return;
-+ const code = node.children[0].value;
-+ const hast = highlighter.codeToHast(code, {
-+ ...options,
-+ lang: "Cairo",
++ if (!inlineCode) return;
+ parent?.children.splice(index ?? 0, 1, inlineCode);
});
-- };
-+ const inlineCode = hast.children[0].children[0];
-+ if (!inlineCode) return;
-+ parent?.children.splice(index ?? 0, 1, inlineCode);
-+ }
-+ });
-+ };
- };
- //# sourceMappingURL=inline-shiki.js.map
+ };
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7c6d19f9..575a437a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4,9 +4,17 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
+overrides:
+ vocs>shiki: ^1.23.0
+ vocs>@shikijs/core: ^1.23.0
+ vocs>@shikijs/types: ^1.23.0
+ vocs>@shikijs/rehype: ^1.23.0
+ vocs>@shikijs/twoslash: ^1.23.0
+ vocs>@shikijs/transformers: ^1.23.0
+
patchedDependencies:
vocs:
- hash: p6z7kxjkom4q2uemolyyrxbtiy
+ hash: 7wumpnts656yvepr4seo2mjn34
path: patches/vocs.patch
importers:
@@ -33,7 +41,7 @@ importers:
version: 5.6.3
vocs:
specifier: 1.0.0-alpha.62
- version: 1.0.0-alpha.62(patch_hash=p6z7kxjkom4q2uemolyyrxbtiy)(@types/node@22.8.6)(@types/react-dom@18.3.1)(@types/react@18.3.12)(acorn@8.14.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.24.3)(typescript@5.6.3)
+ version: 1.0.0-alpha.62(patch_hash=7wumpnts656yvepr4seo2mjn34)(@types/node@22.8.6)(@types/react-dom@18.3.1)(@types/react@18.3.12)(acorn@8.14.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.24.3)(typescript@5.6.3)
devDependencies:
'@types/react-dom':
specifier: ^18.3.1
@@ -981,26 +989,26 @@ packages:
cpu: [x64]
os: [win32]
- '@shikijs/core@1.22.2':
- resolution: {integrity: sha512-bvIQcd8BEeR1yFvOYv6HDiyta2FFVePbzeowf5pPS1avczrPK+cjmaxxh0nx5QzbON7+Sv0sQfQVciO7bN72sg==}
+ '@shikijs/core@1.23.1':
+ resolution: {integrity: sha512-NuOVgwcHgVC6jBVH5V7iblziw6iQbWWHrj5IlZI3Fqu2yx9awH7OIQkXIcsHsUmY19ckwSgUMgrqExEyP5A0TA==}
- '@shikijs/engine-javascript@1.22.2':
- resolution: {integrity: sha512-iOvql09ql6m+3d1vtvP8fLCVCK7BQD1pJFmHIECsujB0V32BJ0Ab6hxk1ewVSMFA58FI0pR2Had9BKZdyQrxTw==}
+ '@shikijs/engine-javascript@1.23.1':
+ resolution: {integrity: sha512-i/LdEwT5k3FVu07SiApRFwRcSJs5QM9+tod5vYCPig1Ywi8GR30zcujbxGQFJHwYD7A5BUqagi8o5KS+LEVgBg==}
- '@shikijs/engine-oniguruma@1.22.2':
- resolution: {integrity: sha512-GIZPAGzQOy56mGvWMoZRPggn0dTlBf1gutV5TdceLCZlFNqWmuc7u+CzD0Gd9vQUTgLbrt0KLzz6FNprqYAxlA==}
+ '@shikijs/engine-oniguruma@1.23.1':
+ resolution: {integrity: sha512-KQ+lgeJJ5m2ISbUZudLR1qHeH3MnSs2mjFg7bnencgs5jDVPeJ2NVDJ3N5ZHbcTsOIh0qIueyAJnwg7lg7kwXQ==}
- '@shikijs/rehype@1.22.2':
- resolution: {integrity: sha512-A0RHgiYR5uiHvddwHehBN9j8PhOvfT6/GebSTWrapur6M+fD/4i3mlfUv7aFK4b+4GQ1R42L8fC5N98whZjNcg==}
+ '@shikijs/rehype@1.23.1':
+ resolution: {integrity: sha512-PH5bpMDEc4nBP62Ci3lUqkxBWRTm8cdE+eY9er5QD50jAWQxhXcc1Aeax1AlyrASrtjTwCkI22M6N9iSn5p+bQ==}
- '@shikijs/transformers@1.22.2':
- resolution: {integrity: sha512-8f78OiBa6pZDoZ53lYTmuvpFPlWtevn23bzG+azpPVvZg7ITax57o/K3TC91eYL3OMJOO0onPbgnQyZjRos8XQ==}
+ '@shikijs/transformers@1.23.1':
+ resolution: {integrity: sha512-yQ2Cn0M9i46p30KwbyIzLvKDk+dQNU+lj88RGO0XEj54Hn4Cof1bZoDb9xBRWxFE4R8nmK63w7oHnJwvOtt0NQ==}
- '@shikijs/twoslash@1.22.2':
- resolution: {integrity: sha512-4R3A7aH/toZgtlveXHKk01nIsvn8hjAfPJ1aT550zcV4qK6vK/tfaEyYtaljOaY1wig2l5+8sKjNSEz3PcSiEw==}
+ '@shikijs/twoslash@1.23.1':
+ resolution: {integrity: sha512-Qj/+CGAF6TdcRjPDQn1bxyKD8ejnV7VJLqCHzob1uCbwQlJTI5z0gUVAgpqS55z4vdV1Mrx2IpCTl9glhC0l3A==}
- '@shikijs/types@1.22.2':
- resolution: {integrity: sha512-NCWDa6LGZqTuzjsGfXOBWfjS/fDIbDdmVDug+7ykVe1IKT4c1gakrvlfFYp5NhAXH/lyqLM8wsAPo5wNy73Feg==}
+ '@shikijs/types@1.23.1':
+ resolution: {integrity: sha512-98A5hGyEhzzAgQh2dAeHKrWW4HfCMeoFER2z16p5eJ+vmPeF6lZ/elEne6/UCU551F/WqkopqRsr1l2Yu6+A0g==}
'@shikijs/vscode-textmate@9.3.0':
resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==}
@@ -1375,6 +1383,9 @@ packages:
electron-to-chromium@1.5.50:
resolution: {integrity: sha512-eMVObiUQ2LdgeO1F/ySTXsvqvxb6ZH2zPGaMYsWzRDdOddUa77tdmI0ltg+L16UpbWdhPmuF3wIQYyQq65WfZw==}
+ emoji-regex-xs@1.0.0:
+ resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==}
+
emoji-regex@10.4.0:
resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==}
@@ -2042,8 +2053,8 @@ packages:
resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
engines: {node: '>=6'}
- oniguruma-to-js@0.4.3:
- resolution: {integrity: sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==}
+ oniguruma-to-es@0.4.1:
+ resolution: {integrity: sha512-rNcEohFz095QKGRovP/yqPIKc+nP+Sjs4YTHMv33nMePGKrq/r2eu9Yh4646M5XluGJsUnmwoXuiXE69KDs+fQ==}
ora@7.0.1:
resolution: {integrity: sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==}
@@ -2282,8 +2293,14 @@ packages:
regenerator-runtime@0.14.1:
resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==}
- regex@4.4.0:
- resolution: {integrity: sha512-uCUSuobNVeqUupowbdZub6ggI5/JZkYyJdDogddJr60L764oxC2pMZov1fQ3wM9bdyzUILDG+Sqx6NAKAz9rKQ==}
+ regex-recursion@4.2.1:
+ resolution: {integrity: sha512-QHNZyZAeKdndD1G3bKAbBEKOSSK4KOHQrAJ01N1LJeb0SoH4DJIeFhp0uUpETgONifS4+P3sOgoA1dhzgrQvhA==}
+
+ regex-utilities@2.3.0:
+ resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}
+
+ regex@5.0.2:
+ resolution: {integrity: sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==}
rehype-autolink-headings@7.1.0:
resolution: {integrity: sha512-rItO/pSdvnvsP4QRB1pmPiNHUskikqtPojZKJPPPAVx9Hj8i8TwMBhofrrAYRhYOOBZH9tgmG5lPqDLuIWPWmw==}
@@ -2379,8 +2396,8 @@ packages:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'}
- shiki@1.22.2:
- resolution: {integrity: sha512-3IZau0NdGKXhH2bBlUk4w1IHNxPh6A5B2sUpyY+8utLu2j/h1QpFkAaUA1bAMxOWWGtTWcAh531vnS4NJKS/lA==}
+ shiki@1.23.1:
+ resolution: {integrity: sha512-8kxV9TH4pXgdKGxNOkrSMydn1Xf6It8lsle0fiqxf7a1149K1WGtdOu3Zb91T5r1JpvRPxqxU3C2XdZZXQnrig==}
signal-exit@3.0.7:
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
@@ -3489,49 +3506,49 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.24.3':
optional: true
- '@shikijs/core@1.22.2':
+ '@shikijs/core@1.23.1':
dependencies:
- '@shikijs/engine-javascript': 1.22.2
- '@shikijs/engine-oniguruma': 1.22.2
- '@shikijs/types': 1.22.2
+ '@shikijs/engine-javascript': 1.23.1
+ '@shikijs/engine-oniguruma': 1.23.1
+ '@shikijs/types': 1.23.1
'@shikijs/vscode-textmate': 9.3.0
'@types/hast': 3.0.4
hast-util-to-html: 9.0.3
- '@shikijs/engine-javascript@1.22.2':
+ '@shikijs/engine-javascript@1.23.1':
dependencies:
- '@shikijs/types': 1.22.2
+ '@shikijs/types': 1.23.1
'@shikijs/vscode-textmate': 9.3.0
- oniguruma-to-js: 0.4.3
+ oniguruma-to-es: 0.4.1
- '@shikijs/engine-oniguruma@1.22.2':
+ '@shikijs/engine-oniguruma@1.23.1':
dependencies:
- '@shikijs/types': 1.22.2
+ '@shikijs/types': 1.23.1
'@shikijs/vscode-textmate': 9.3.0
- '@shikijs/rehype@1.22.2':
+ '@shikijs/rehype@1.23.1':
dependencies:
- '@shikijs/types': 1.22.2
+ '@shikijs/types': 1.23.1
'@types/hast': 3.0.4
hast-util-to-string: 3.0.1
- shiki: 1.22.2
+ shiki: 1.23.1
unified: 11.0.5
unist-util-visit: 5.0.0
- '@shikijs/transformers@1.22.2':
+ '@shikijs/transformers@1.23.1':
dependencies:
- shiki: 1.22.2
+ shiki: 1.23.1
- '@shikijs/twoslash@1.22.2(typescript@5.6.3)':
+ '@shikijs/twoslash@1.23.1(typescript@5.6.3)':
dependencies:
- '@shikijs/core': 1.22.2
- '@shikijs/types': 1.22.2
+ '@shikijs/core': 1.23.1
+ '@shikijs/types': 1.23.1
twoslash: 0.2.12(typescript@5.6.3)
transitivePeerDependencies:
- supports-color
- typescript
- '@shikijs/types@1.22.2':
+ '@shikijs/types@1.23.1':
dependencies:
'@shikijs/vscode-textmate': 9.3.0
'@types/hast': 3.0.4
@@ -3929,6 +3946,8 @@ snapshots:
electron-to-chromium@1.5.50: {}
+ emoji-regex-xs@1.0.0: {}
+
emoji-regex@10.4.0: {}
emoji-regex@8.0.0: {}
@@ -5011,9 +5030,11 @@ snapshots:
dependencies:
mimic-fn: 2.1.0
- oniguruma-to-js@0.4.3:
+ oniguruma-to-es@0.4.1:
dependencies:
- regex: 4.4.0
+ emoji-regex-xs: 1.0.0
+ regex: 5.0.2
+ regex-recursion: 4.2.1
ora@7.0.1:
dependencies:
@@ -5260,7 +5281,15 @@ snapshots:
regenerator-runtime@0.14.1: {}
- regex@4.4.0: {}
+ regex-recursion@4.2.1:
+ dependencies:
+ regex-utilities: 2.3.0
+
+ regex-utilities@2.3.0: {}
+
+ regex@5.0.2:
+ dependencies:
+ regex-utilities: 2.3.0
rehype-autolink-headings@7.1.0:
dependencies:
@@ -5467,12 +5496,12 @@ snapshots:
shebang-regex@3.0.0: {}
- shiki@1.22.2:
+ shiki@1.23.1:
dependencies:
- '@shikijs/core': 1.22.2
- '@shikijs/engine-javascript': 1.22.2
- '@shikijs/engine-oniguruma': 1.22.2
- '@shikijs/types': 1.22.2
+ '@shikijs/core': 1.23.1
+ '@shikijs/engine-javascript': 1.23.1
+ '@shikijs/engine-oniguruma': 1.23.1
+ '@shikijs/types': 1.23.1
'@shikijs/vscode-textmate': 9.3.0
'@types/hast': 3.0.4
@@ -5766,7 +5795,7 @@ snapshots:
'@types/node': 22.8.6
fsevents: 2.3.3
- vocs@1.0.0-alpha.62(patch_hash=p6z7kxjkom4q2uemolyyrxbtiy)(@types/node@22.8.6)(@types/react-dom@18.3.1)(@types/react@18.3.12)(acorn@8.14.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.24.3)(typescript@5.6.3):
+ vocs@1.0.0-alpha.62(patch_hash=7wumpnts656yvepr4seo2mjn34)(@types/node@22.8.6)(@types/react-dom@18.3.1)(@types/react@18.3.12)(acorn@8.14.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.24.3)(typescript@5.6.3):
dependencies:
'@floating-ui/react': 0.26.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@hono/node-server': 1.13.4(hono@3.12.12)
@@ -5781,9 +5810,9 @@ snapshots:
'@radix-ui/react-navigation-menu': 1.2.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@radix-ui/react-popover': 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@radix-ui/react-tabs': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
- '@shikijs/rehype': 1.22.2
- '@shikijs/transformers': 1.22.2
- '@shikijs/twoslash': 1.22.2(typescript@5.6.3)
+ '@shikijs/rehype': 1.23.1
+ '@shikijs/transformers': 1.23.1
+ '@shikijs/twoslash': 1.23.1(typescript@5.6.3)
'@vanilla-extract/css': 1.16.0
'@vanilla-extract/dynamic': 2.1.2
'@vanilla-extract/vite-plugin': 3.9.5(@types/node@22.8.6)(vite@5.4.10(@types/node@22.8.6))
@@ -5823,7 +5852,7 @@ snapshots:
remark-mdx-frontmatter: 4.0.0
remark-parse: 11.0.0
serve-static: 1.16.2
- shiki: 1.22.2
+ shiki: 1.23.1
tailwindcss: 3.4.14
toml: 3.0.0
twoslash: 0.2.12(typescript@5.6.3)
diff --git a/routes.ts b/routes.ts
index 1969da23..d8348c7f 100644
--- a/routes.ts
+++ b/routes.ts
@@ -7,7 +7,6 @@ const config: Sidebar = [
},
{
text: "Getting Started",
- link: "/getting-started/basics/storage",
items: [
// {
// text: "Local environment setup"
@@ -98,7 +97,6 @@ const config: Sidebar = [
},
{
text: "Components",
- link: "/components/how_to",
items: [
{
text: "Components How-To",
@@ -120,7 +118,6 @@ const config: Sidebar = [
},
{
text: "Applications",
- link: "/applications/upgradeable_contract",
items: [
{
text: " Upgradeable Contract",
@@ -174,7 +171,6 @@ const config: Sidebar = [
},
{
text: "Advanced concepts",
- link: "/advanced-concepts/write_to_any_slot",
items: [
{
text: "Writing to any storage slot",
diff --git a/styles.css b/styles.css
index 2ba7b331..4aeb1128 100644
--- a/styles.css
+++ b/styles.css
@@ -60,48 +60,47 @@ section.vocs_Sidebar_level
}
/* Make sidebar collapsible */
-.vocs_DocsLayout_gutterLeft {
- top: 0;
- left: 0;
- bottom: 0;
-}
-.vocs_DocsLayout_gutterLeft {
- margin-left: 0;
- transition: margin 0.3s ease;
-}
-.sidebar_hidden .vocs_DocsLayout_gutterLeft {
- margin-left: calc(var(--vocs_DocsLayout_leftGutterWidth) * -1);
-};
-
-.vocs_DocsLayout_content_withSidebar {
- margin-left: var(--vocs_DocsLayout_leftGutterWidth)
-}
-.sidebar_hidden .vocs_DocsLayout_content_withSidebar {
- margin-left: 0 !important;
-}
-.vocs_DocsLayout_content_withSidebar {
- transition: margin 300ms ease !important;
- max-width: unset;
-}
-
-.vocs_DesktopTopNav_logo a {
- margin-top: 2px !important;
-}
-
-.vocs_Sidebar_logo {
- padding-top: 0px !important;
-}
-
-.sidebar_toggle {
- position: absolute;
- top: 0;
- right: calc(var(--vocs-topNav_height) * -1);
- height: var(--vocs-topNav_height);
- width: var(--vocs-topNav_height);
-}
-
-.sidebar_toggle button {
- padding: var(--vocs-space_8);
+@media screen and (min-width: 1080px) {
+ .vocs_DocsLayout_gutterLeft {
+ margin-left: 0;
+ transition: margin 0.3s ease;
+ width: var(--vocs-sidebar_width);
+ }
+ .sidebar_hidden .vocs_DocsLayout_gutterLeft {
+ margin-left: calc(var(--vocs-sidebar_width) * -1);
+ }
+
+ .vocs_DocsLayout_content_withSidebar {
+ margin-left: var(--vocs-sidebar_width);
+ }
+ .sidebar_hidden .vocs_DocsLayout_content_withSidebar {
+ margin-left: 0 !important;
+ }
+ .vocs_DocsLayout_content_withSidebar {
+ margin-left: var(--vocs-sidebar_width);
+ transition: margin 300ms ease !important;
+ max-width: unset;
+ }
+
+ .vocs_DesktopTopNav_logo a {
+ margin-top: 2px !important;
+ }
+
+ .vocs_Sidebar_logo {
+ padding-top: 0px !important;
+ }
+
+ .sidebar_toggle {
+ position: absolute;
+ top: 0;
+ right: calc(var(--vocs-topNav_height) * -1);
+ height: var(--vocs-topNav_height);
+ width: var(--vocs-topNav_height);
+ }
+
+ .sidebar_toggle button {
+ padding: var(--vocs-space_8);
+ }
}
/* END sidebar */
@@ -120,3 +119,15 @@ section.vocs_Sidebar_level
font-size: var(--vocs-fontSize_20);
padding-bottom: 0.875em;
}
+
+.vocs_DesktopTopNav_logoWrapper {
+ left: 22px;
+ justify-content: start;
+}
+
+/* Force show theme switcher */
+@media screen and (max-width: 1280px) {
+ .vocs_DesktopTopNav_hideCompact {
+ display: block;
+ }
+}
From b7d405f9adca16936fd2263db74a8f41f3733e63 Mon Sep 17 00:00:00 2001
From: Julio <30329843+julio4@users.noreply.github.com>
Date: Thu, 19 Dec 2024 15:13:48 +0100
Subject: [PATCH 02/13] Prepare release `2.9.2` (#282)
* fix(app): correct sidebar placement
* fix(app): responsive content centering
* fix(app): responsive content centering
* Update issue templates, Close #273
close #273
* Feat: add logos (#278)
* fix #276
* feat: updated logo
* Feat: upgrade to `2.9.2` (#280)
* chore: update 2.9.2
* chore: apply fmt
* fix: hide AA for upcoming fixes
* fix: github edit link
* fix: starknet book deadlink
* fix #279
* small improvement: increase footer bottom padding
* fix #275
* fix: minor
* fix: remove print from cairo_cheatsheet
* Update verify_cairo_programs.yml
---
.github/ISSUE_TEMPLATE/bug_report.md | 23 ++++
.github/ISSUE_TEMPLATE/feature-request.md | 16 +++
.github/workflows/verify_cairo_programs.yml | 2 +-
.tool-versions | 4 +-
Scarb.lock | 79 +++++++++-----
Scarb.toml | 12 +--
components/ThemeImage.tsx | 27 +++++
components/useTheme.tsx | 32 ++++++
footer.tsx | 2 +-
.../commit_reveal/src/commit_reveal.cairo | 7 +-
.../src/ecdsa_verification.cairo | 14 +--
.../hash_trait/src/hash_trait.cairo | 13 ++-
.../library_calls/src/tests.cairo | 7 +-
.../simple_account/src/simple_account.cairo | 12 +--
.../store_using_packing/src/contract.cairo | 4 +-
.../store_using_packing/src/tests.cairo | 5 +-
.../struct_as_mapping_key/src/test.cairo | 5 +-
.../write_to_any_slot/src/contract.cairo | 9 +-
.../write_to_any_slot/src/tests.cairo | 2 +-
.../advanced_factory/src/contract.cairo | 18 ++--
.../advanced_factory/src/tests.cairo | 42 ++++----
.../applications/coin_flip/src/contract.cairo | 18 ++--
.../coin_flip/src/mock_randomness.cairo | 22 ++--
.../applications/coin_flip/src/tests.cairo | 70 ++++++------
.../components/src/countable.cairo | 9 +-
.../src/others/switch_collision.cairo | 8 +-
.../applications/components/src/ownable.cairo | 30 +++---
.../components/src/switchable.cairo | 11 +-
.../src/contract_countable.cairo | 9 +-
.../src/contract_countable_switchable.cairo | 9 +-
...ntract_countable_switchable_internal.cairo | 9 +-
.../src/countable_dep_switch.cairo | 7 +-
.../src/countable_internal_dep_switch.cairo | 8 +-
.../constant_product_amm/src/contracts.cairo | 16 +--
.../constant_product_amm/src/tests.cairo | 6 +-
.../crowdfunding/src/campaign.cairo | 10 +-
.../src/campaign/pledgeable.cairo | 6 +-
.../crowdfunding/src/mock_upgrade.cairo | 10 +-
.../applications/crowdfunding/src/tests.cairo | 100 +++++++++---------
listings/applications/erc20/src/token.cairo | 100 +++++++++---------
.../merkle_tree/src/contract.cairo | 10 +-
.../applications/merkle_tree/src/tests.cairo | 18 ++--
.../nft_dutch_auction/src/erc721.cairo | 28 ++---
.../src/nft_dutch_auction.cairo | 30 +++---
.../src/storage.cairo | 2 +-
listings/applications/simple_vault/Scarb.toml | 1 +
.../applications/simple_vault/src/lib.cairo | 3 -
.../simple_vault/src/simple_vault.cairo | 31 +++---
.../applications/simple_vault/src/tests.cairo | 2 -
.../applications/staking/src/contract.cairo | 8 +-
.../staking/src/tests/staking_tests.cairo | 59 ++++++-----
.../staking/src/tests/tokens.cairo | 4 +-
.../applications/timelock/src/erc721.cairo | 2 +-
.../timelock/src/tests/timelock.cairo | 54 +++++-----
.../timelock/src/tests/utils.cairo | 2 +-
.../applications/timelock/src/timelock.cairo | 14 +--
.../upgradeable_contract/src/tests.cairo | 21 ++--
.../src/upgradeable_contract_v0.cairo | 5 +-
.../src/upgradeable_contract_v1.cairo | 7 +-
listings/cairo_cheatsheet/Scarb.toml | 1 -
.../cairo_cheatsheet/src/enum_example.cairo | 18 ++--
.../cairo_cheatsheet/src/if_let_example.cairo | 12 +--
.../src/mapping_example.cairo | 10 +-
.../cairo_cheatsheet/src/match_example.cairo | 2 +-
.../cairo_cheatsheet/src/struct_example.cairo | 2 +-
.../src/while_let_example.cairo | 2 -
.../bytearray/src/bytearray.cairo | 2 +-
.../calling_other_contracts/src/caller.cairo | 14 +--
.../constructor/src/constructor.cairo | 6 +-
.../getting-started/counter/src/counter.cairo | 6 +-
.../custom_type_serde/src/contract.cairo | 10 +-
.../errors/src/custom_errors.cairo | 8 +-
.../errors/src/simple_errors.cairo | 6 +-
.../errors/src/vault_errors.cairo | 8 +-
.../getting-started/events/src/counter.cairo | 24 ++---
.../factory/src/simple_factory.cairo | 16 +--
.../interfaces_traits/src/explicit.cairo | 10 +-
.../interfaces_traits/src/implicit.cairo | 8 +-
.../src/implicit_internal.cairo | 13 ++-
.../mappings/src/mappings.cairo | 6 +-
.../storage/src/contract.cairo | 8 +-
.../storage/src/minimal_contract.cairo | 6 +-
.../storing_custom_types/src/contract.cairo | 6 +-
.../testing_how_to/src/contract.cairo | 14 +--
.../variables/src/global_variables.cairo | 6 +-
.../variables/src/local_variables.cairo | 8 +-
.../variables/src/storage_variables.cairo | 10 +-
.../visibility/src/visibility.cairo | 8 +-
pages/components/collisions.md | 2 +-
pages/getting-started/basics/storage.md | 2 +-
pages/getting-started/basics/syscalls.md | 2 +-
.../testing/contract-testing.md | 3 -
pages/index.mdx | 11 +-
public/svg/Horizontal_Dark.svg | 29 +++++
public/svg/Horizontal_Light.svg | 29 +++++
public/svg/Icon_Dark.svg | 12 +++
public/svg/Icon_Light.svg | 12 +++
public/svg/Vertical_Dark.svg | 29 +++++
public/svg/Vertical_Light.svg | 29 +++++
routes.ts | 28 ++---
vocs.config.ts | 15 ++-
101 files changed, 904 insertions(+), 643 deletions(-)
create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md
create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md
create mode 100644 components/ThemeImage.tsx
create mode 100644 components/useTheme.tsx
delete mode 100644 listings/applications/simple_vault/src/tests.cairo
create mode 100644 public/svg/Horizontal_Dark.svg
create mode 100644 public/svg/Horizontal_Light.svg
create mode 100644 public/svg/Icon_Dark.svg
create mode 100644 public/svg/Icon_Light.svg
create mode 100644 public/svg/Vertical_Dark.svg
create mode 100644 public/svg/Vertical_Light.svg
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..7c8cc313
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,23 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Checklist:**
+- Using the correct tooling versions, from https://github.com/NethermindEth/StarknetByExample/blob/dev/.tool-versions
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
new file mode 100644
index 00000000..36b7339b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -0,0 +1,16 @@
+---
+name: Feature request
+about: Suggest an idea of example or concept to showcase
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+**Describe the concept/idea you would like to see**
+
+**Is it a new example or a modification/extension of a current one**
+If you consider editing some content, explain exactly why and what.
+
+**Additional context**
+Add any other context or screenshots about the request here.
diff --git a/.github/workflows/verify_cairo_programs.yml b/.github/workflows/verify_cairo_programs.yml
index 518a91f8..151ceee2 100644
--- a/.github/workflows/verify_cairo_programs.yml
+++ b/.github/workflows/verify_cairo_programs.yml
@@ -3,7 +3,7 @@ name: Verify Cairo programs compilation
on:
pull_request:
branches:
- - main
+ - dev
workflow_dispatch:
jobs:
diff --git a/.tool-versions b/.tool-versions
index aac540e2..c69b5af8 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,2 +1,2 @@
-scarb 2.8.2
-starknet-foundry 0.30.0
+scarb 2.9.2
+starknet-foundry 0.35.0
diff --git a/Scarb.lock b/Scarb.lock
index 6cd8c91c..a7c69be7 100644
--- a/Scarb.lock
+++ b/Scarb.lock
@@ -128,105 +128,126 @@ dependencies = [
[[package]]
name = "openzeppelin"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:5dc87a71f0f5d045e02e5bc5ea7a9b0360bbbc3f388b846006280d266feac192"
+checksum = "sha256:05fd9365be85a4a3e878135d5c52229f760b3861ce4ed314cb1e75b178b553da"
dependencies = [
+ "openzeppelin_access",
+ "openzeppelin_account",
+ "openzeppelin_finance",
+ "openzeppelin_governance",
+ "openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
+ "openzeppelin_utils",
]
[[package]]
name = "openzeppelin_access"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:b9139449e53d715992b2d9e887c0c723d886419bee7ceb5561648c70bd6d3174"
+checksum = "sha256:7734901a0ca7a7065e69416fea615dd1dc586c8dc9e76c032f25ee62e8b2a06c"
dependencies = [
"openzeppelin_introspection",
- "openzeppelin_utils",
]
[[package]]
name = "openzeppelin_account"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:841bb881adbe98b64fee1dc1329f6e3fbabdfbd9fa65c66ffb54c55f13764bce"
+checksum = "sha256:1aa3a71e2f40f66f98d96aa9bf9f361f53db0fd20fa83ef7df04426a3c3a926a"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]
+[[package]]
+name = "openzeppelin_finance"
+version = "0.20.0"
+source = "registry+https://scarbs.xyz/"
+checksum = "sha256:f0c507fbff955e4180ea3fa17949c0ff85518c40101f4948948d9d9a74143d6c"
+dependencies = [
+ "openzeppelin_access",
+ "openzeppelin_token",
+]
+
[[package]]
name = "openzeppelin_governance"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:a9d9c983cfd4369e7bbb69433fb264edf376805ed873b1f70a287825a6bd1eaf"
+checksum = "sha256:c0fb60fad716413d537fabd5fcbb2c499ca6beb95af5f0d1699955ecec4c6f63"
dependencies = [
"openzeppelin_access",
+ "openzeppelin_account",
"openzeppelin_introspection",
+ "openzeppelin_token",
+ "openzeppelin_utils",
]
[[package]]
name = "openzeppelin_introspection"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:312bc2e531f036480ad7392dbb31042c38d875ef9dbb5578ea8de5c05e35b7d8"
+checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d"
[[package]]
name = "openzeppelin_merkle_tree"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:8e264c8d5f0591262a235a445b8ca78dd5580c251707b218b829b6b4d6f84a34"
+checksum = "sha256:039608900e92f3dcf479bf53a49a1fd76452acd97eb86e390d1eb92cacdaf3af"
[[package]]
name = "openzeppelin_presets"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:7bc9db7563e434535ebd06c7598ba0f8494e791c5f80401389b356a3ebd65a08"
+checksum = "sha256:5c07a8de32e5d9abe33988c7927eaa8b5f83bc29dc77302d9c8c44c898611042"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
+ "openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
+ "openzeppelin_utils",
]
[[package]]
name = "openzeppelin_security"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:b7497f5e55c6d9f1d7606ad0d12719e3c04765e266fb91fb72740e0af41d03f3"
+checksum = "sha256:27155597019ecf971c48d7bfb07fa58cdc146d5297745570071732abca17f19f"
[[package]]
name = "openzeppelin_token"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:7074c23fbc300b3cccff1037264dfdbe976fb11ae42ce687f4a8ce469adc552a"
+checksum = "sha256:4452f449dc6c1ea97cf69d1d9182749abd40e85bd826cd79652c06a627eafd91"
dependencies = [
+ "openzeppelin_access",
"openzeppelin_account",
- "openzeppelin_governance",
"openzeppelin_introspection",
+ "openzeppelin_utils",
]
[[package]]
name = "openzeppelin_upgrades"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:4de95a7fb8955e63711f34bb954676f6cef127b44b570c0535d7781297821b44"
+checksum = "sha256:15fdd63f6b50a0fda7b3f8f434120aaf7637bcdfe6fd8d275ad57343d5ede5e1"
[[package]]
name = "openzeppelin_utils"
-version = "0.16.0"
+version = "0.20.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:a494aeb5f1371db7f22e922196aa41d1d1698877a766a838350c0b6ffe49fda2"
+checksum = "sha256:44f32d242af1e43982decc49c563e613a9b67ade552f5c3d5cde504e92f74607"
[[package]]
name = "pragma_lib"
version = "1.0.0"
-source = "git+https://github.com/astraly-labs/pragma-lib#86d7ccdc15b349b8b48d9796fc8464c947bea6e1"
+source = "git+https://github.com/astraly-labs/pragma-lib?tag=2.9.1#ee1f3f7e9276cf64e19e267832de380d84c04d28"
[[package]]
name = "simple_account"
@@ -248,15 +269,15 @@ dependencies = [
[[package]]
name = "snforge_scarb_plugin"
-version = "0.2.0"
+version = "0.35.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:2e4ce3ebe3f49548bd26908391b5d78537a765d827df0d96c32aeb88941d0d67"
+checksum = "sha256:20bd6a488fda7201ce2a5fd680d8e715b10e3545147b276747ad079c96c3d5d2"
[[package]]
name = "snforge_std"
-version = "0.30.0"
+version = "0.35.0"
source = "registry+https://scarbs.xyz/"
-checksum = "sha256:2f3c4846881813ac0f5d1460981249c9f5e2a6831e752beedf9b70975495b4ec"
+checksum = "sha256:fe4e1b1526c815441183baed7f93e73bc76a6393d23e1f9c34fbe227bfaedfd6"
dependencies = [
"snforge_scarb_plugin",
]
diff --git a/Scarb.toml b/Scarb.toml
index eca997b2..37e6b8f1 100644
--- a/Scarb.toml
+++ b/Scarb.toml
@@ -12,13 +12,13 @@ test = "$(git rev-parse --show-toplevel)/scripts/test_resolver.sh"
[workspace.tool.snforge]
[workspace.dependencies]
-starknet = "2.8.2"
-cairo_test = "2.8.2"
-assert_macros = "2.8.2"
-snforge_std = "0.30.0"
-openzeppelin = "0.16.0"
+starknet = "2.9.2"
+cairo_test = "2.9.2"
+assert_macros = "2.9.2"
+snforge_std = "0.35.0"
+openzeppelin = "0.20.0"
components = { path = "listings/applications/components" }
-pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib" }
+pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib", tag = "2.9.1" }
[workspace.package]
description = "Collection of examples of how to use the Cairo programming language to create smart contracts on Starknet."
diff --git a/components/ThemeImage.tsx b/components/ThemeImage.tsx
new file mode 100644
index 00000000..d8e57e06
--- /dev/null
+++ b/components/ThemeImage.tsx
@@ -0,0 +1,27 @@
+import { useEffect, useState } from "react";
+import { useTheme } from "./useTheme";
+
+export const ThemeImage = ({
+ light,
+ dark,
+ alt,
+ ...props
+}: {
+ light: string;
+ dark: string;
+ alt: string;
+ [key: string]: any;
+}) => {
+ const [mounted, setMounted] = useState(false);
+ const theme = useTheme();
+
+ useEffect(() => {
+ setMounted(true);
+ }, []);
+ if (!mounted) {
+ return
;
+ }
+
+ // Client-side rendering after hydrating
+ return
;
+};
diff --git a/components/useTheme.tsx b/components/useTheme.tsx
new file mode 100644
index 00000000..a2aa12d2
--- /dev/null
+++ b/components/useTheme.tsx
@@ -0,0 +1,32 @@
+import { useEffect, useState } from "react";
+
+export function useTheme() {
+ const [theme, setTheme] = useState<"dark" | "light">(() => {
+ if (typeof window === "undefined") return "light";
+ return document.documentElement.classList.contains("dark")
+ ? "dark"
+ : "light";
+ });
+
+ useEffect(() => {
+ const handleThemeChange = () => {
+ const newTheme = document.documentElement.classList.contains("dark")
+ ? "dark"
+ : "light";
+ setTheme(newTheme);
+ };
+
+ // Watch for class changes on documentElement
+ const observer = new MutationObserver(handleThemeChange);
+ observer.observe(document.documentElement, {
+ attributes: true,
+ attributeFilter: ["class"],
+ });
+
+ return () => {
+ observer.disconnect();
+ };
+ }, []);
+
+ return theme;
+}
diff --git a/footer.tsx b/footer.tsx
index 41212213..70d07b30 100644
--- a/footer.tsx
+++ b/footer.tsx
@@ -1,6 +1,6 @@
export default function Footer() {
return (
-
+

ICommitmentRevealTraitDispatcher {
let (contract_address, _) = deploy_syscall(
- CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false
+ CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false,
)
- .unwrap_syscall();
+ .unwrap();
ICommitmentRevealTraitDispatcher { contract_address }
}
diff --git a/listings/advanced-concepts/ecdsa_verification/src/ecdsa_verification.cairo b/listings/advanced-concepts/ecdsa_verification/src/ecdsa_verification.cairo
index 5321a85e..c6f601ad 100644
--- a/listings/advanced-concepts/ecdsa_verification/src/ecdsa_verification.cairo
+++ b/listings/advanced-concepts/ecdsa_verification/src/ecdsa_verification.cairo
@@ -9,12 +9,12 @@ use starknet::secp256_trait::{Signature};
// 3. Sign the hash (off chain, keep your private key secret)
#[starknet::interface]
trait IVerifySignature
{
- fn get_signature(self: @TContractState, r: u256, s: u256, v: u32,) -> Signature;
+ fn get_signature(self: @TContractState, r: u256, s: u256, v: u32) -> Signature;
fn verify_eth_signature(
self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
);
fn recover_public_key(
- self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
+ self: @TContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
);
}
@@ -23,7 +23,7 @@ mod verifySignature {
use super::IVerifySignature;
use core::starknet::eth_address::EthAddress;
use starknet::secp256k1::Secp256k1Point;
- use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key,};
+ use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key};
use starknet::eth_signature::{verify_eth_signature, public_key_point_to_eth_address};
#[storage]
@@ -46,7 +46,7 @@ mod verifySignature {
/// # Returns
///
/// * `Signature` - The signature struct.
- fn get_signature(self: @ContractState, r: u256, s: u256, v: u32,) -> Signature {
+ fn get_signature(self: @ContractState, r: u256, s: u256, v: u32) -> Signature {
// Create a Signature object from the given v, r, and s values.
let signature: Signature = signature_from_vrs(v, r, s);
signature
@@ -62,7 +62,7 @@ mod verifySignature {
/// * `s` - The S component of the signature.
/// * `v` - The V component of the signature.
fn verify_eth_signature(
- self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
+ self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
) {
let signature = self.get_signature(r, s, v);
verify_eth_signature(:msg_hash, :signature, :eth_address);
@@ -79,7 +79,7 @@ mod verifySignature {
/// * `s` - The S component of the signature.
/// * `v` - The V component of the signature.
fn recover_public_key(
- self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32
+ self: @ContractState, eth_address: EthAddress, msg_hash: u256, r: u256, s: u256, v: u32,
) {
let signature = self.get_signature(r, s, v);
let public_key_point = recover_public_key::(msg_hash, signature)
@@ -93,7 +93,7 @@ mod verifySignature {
#[cfg(test)]
mod tests {
- use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key,};
+ use starknet::secp256_trait::{Signature, signature_from_vrs, recover_public_key};
use starknet::EthAddress;
use starknet::secp256k1::{Secp256k1Point};
use starknet::eth_signature::{verify_eth_signature, public_key_point_to_eth_address};
diff --git a/listings/advanced-concepts/hash_trait/src/hash_trait.cairo b/listings/advanced-concepts/hash_trait/src/hash_trait.cairo
index 88fde919..ee8b9fb6 100644
--- a/listings/advanced-concepts/hash_trait/src/hash_trait.cairo
+++ b/listings/advanced-concepts/hash_trait/src/hash_trait.cairo
@@ -1,10 +1,10 @@
#[starknet::interface]
pub trait IHashTrait {
fn save_user_with_poseidon(
- ref self: T, id: felt252, username: felt252, password: felt252
+ ref self: T, id: felt252, username: felt252, password: felt252,
) -> felt252;
fn save_user_with_pedersen(
- ref self: T, id: felt252, username: felt252, password: felt252
+ ref self: T, id: felt252, username: felt252, password: felt252,
) -> felt252;
}
@@ -36,7 +36,7 @@ pub mod HashTraits {
#[abi(embed_v0)]
impl HashTrait of super::IHashTrait {
fn save_user_with_poseidon(
- ref self: ContractState, id: felt252, username: felt252, password: felt252
+ ref self: ContractState, id: felt252, username: felt252, password: felt252,
) -> felt252 {
let login = LoginDetails { username, password };
let user = UserDetails { id, login };
@@ -48,7 +48,7 @@ pub mod HashTraits {
}
fn save_user_with_pedersen(
- ref self: ContractState, id: felt252, username: felt252, password: felt252
+ ref self: ContractState, id: felt252, username: felt252, password: felt252,
) -> felt252 {
let login = LoginDetails { username, password };
let user = UserDetails { id, login };
@@ -64,16 +64,15 @@ pub mod HashTraits {
#[cfg(test)]
mod tests {
- use starknet::SyscallResultTrait;
use super::{HashTraits, IHashTraitDispatcher, IHashTraitDispatcherTrait};
use starknet::syscalls::deploy_syscall;
fn deploy() -> IHashTraitDispatcher {
let mut calldata = array![];
let (address, _) = deploy_syscall(
- HashTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false
+ HashTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false,
)
- .unwrap_syscall();
+ .unwrap();
IHashTraitDispatcher { contract_address: address }
}
diff --git a/listings/advanced-concepts/library_calls/src/tests.cairo b/listings/advanced-concepts/library_calls/src/tests.cairo
index 6458ef4d..90c2707e 100644
--- a/listings/advanced-concepts/library_calls/src/tests.cairo
+++ b/listings/advanced-concepts/library_calls/src/tests.cairo
@@ -1,8 +1,7 @@
mod tests {
use starknet::syscalls::deploy_syscall;
- use starknet::SyscallResultTrait;
use library_calls::library_call::{
- MathUtils, MathUtilsLibraryCall, IMathUtilsDispatcher, IMathUtilsDispatcherTrait
+ MathUtils, MathUtilsLibraryCall, IMathUtilsDispatcher, IMathUtilsDispatcherTrait,
};
#[test]
@@ -12,9 +11,9 @@ mod tests {
.unwrap();
let mut calldata: Array = array![];
let (address, _) = deploy_syscall(
- MathUtilsLibraryCall::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false
+ MathUtilsLibraryCall::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false,
)
- .unwrap_syscall();
+ .unwrap();
let mut contract = IMathUtilsDispatcher { contract_address: address };
contract.set_class_hash(math_utils_class_hash);
diff --git a/listings/advanced-concepts/simple_account/src/simple_account.cairo b/listings/advanced-concepts/simple_account/src/simple_account.cairo
index 6de72c81..f1e1386b 100644
--- a/listings/advanced-concepts/simple_account/src/simple_account.cairo
+++ b/listings/advanced-concepts/simple_account/src/simple_account.cairo
@@ -5,7 +5,7 @@ trait ISRC6 {
fn execute_calls(self: @TContractState, calls: Array) -> Array>;
fn validate_calls(self: @TContractState, calls: Array) -> felt252;
fn is_valid_signature(
- self: @TContractState, hash: felt252, signature: Array
+ self: @TContractState, hash: felt252, signature: Array,
) -> felt252;
}
@@ -30,7 +30,7 @@ mod simpleAccount {
struct Storage {
#[substorage(v0)]
src5: SRC5Component::Storage,
- public_key: felt252
+ public_key: felt252,
}
#[constructor]
@@ -43,7 +43,7 @@ mod simpleAccount {
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
- SRC5Event: SRC5Component::Event
+ SRC5Event: SRC5Component::Event,
}
#[abi(embed_v0)]
@@ -68,7 +68,7 @@ mod simpleAccount {
}
fn is_valid_signature(
- self: @ContractState, hash: felt252, signature: Array
+ self: @ContractState, hash: felt252, signature: Array,
) -> felt252 {
if self._is_valid_signature(hash, signature.span()) {
starknet::VALIDATED
@@ -81,10 +81,10 @@ mod simpleAccount {
#[generate_trait]
impl SignatureVerificationImpl of SignatureVerification {
fn _is_valid_signature(
- self: @ContractState, hash: felt252, signature: Span
+ self: @ContractState, hash: felt252, signature: Span,
) -> bool {
check_ecdsa_signature(
- hash, self.public_key.read(), *signature.at(0_u32), *signature.at(1_u32)
+ hash, self.public_key.read(), *signature.at(0_u32), *signature.at(1_u32),
)
}
}
diff --git a/listings/advanced-concepts/store_using_packing/src/contract.cairo b/listings/advanced-concepts/store_using_packing/src/contract.cairo
index 8ef6b2db..e1611a22 100644
--- a/listings/advanced-concepts/store_using_packing/src/contract.cairo
+++ b/listings/advanced-concepts/store_using_packing/src/contract.cairo
@@ -1,7 +1,7 @@
#[derive(Copy, Serde, Drop)]
pub struct Time {
pub hour: u8,
- pub minute: u8
+ pub minute: u8,
}
#[starknet::interface]
@@ -18,7 +18,7 @@ pub mod TimeContract {
#[storage]
struct Storage {
- time: Time
+ time: Time,
}
impl TimePackable of StorePacking