Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Add Tokamak DevTools extension for Chrome#255

Draft
carson-katri wants to merge 25 commits intomainfrom
devtools
Draft

Add Tokamak DevTools extension for Chrome#255
carson-katri wants to merge 25 commits intomainfrom
devtools

Conversation

@carson-katri
Copy link
Copy Markdown
Member

The tool itself is written in Tokamak. The extension might work in Firefox too, but I haven't tried it. So far it lets you browse the View tree, hover over Views to highlight them, and click on Views to view some basic info about them.

Screen Shot 2020-08-10 at 2 33 02 PM

Todo:

  • Fix various crashes
  • Correctly update when the tree changes
  • New features can probably be done in separate PRs

carson-katri and others added 24 commits August 2, 2020 20:22
# Conflicts:
#	Sources/TokamakCore/Modifiers/FlexFrameLayout.swift
#	Sources/TokamakCore/Modifiers/ModifiedContent.swift
#	Sources/TokamakCore/Tokens/Color.swift
#	Sources/TokamakCore/Views/Text/Text.swift
#	Sources/TokamakDemo/TokamakDemo.swift
#	Sources/TokamakStaticHTML/Views/Containers/List.swift
@carson-katri carson-katri changed the base branch from main to dark-mode August 10, 2020 18:37
// OutlineGroup(tree.root, children: onlyComposite ? \.compositeChildren : \.children) {
// Text(String($0.type.split(separator: "<").first!))
// .foregroundColor($0.isPrimitive ? .primary : ($0.isHost ? .green : .blue))
// .font(.system(size: 12, weight: $0.isPrimitive ? .regular : .bold, design: .monospaced))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 Line should be 100 characters or less: currently 107 characters (line_length)

@ie-ahm-robox
Copy link
Copy Markdown
Collaborator

Fails
🚫

DevTools/src/TokamakDevTools/Sources/TokamakDevTools/Model/NodeInspector.swift#L4 - Initializing an optional variable with nil is redundant. (redundant_optional_initialization)

Generated by 🚫 Danger Swift against 086ae30

Base automatically changed from dark-mode to main August 10, 2020 20:05
Copy link
Copy Markdown
Member

@j-f1 j-f1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

Comment on lines +1 to +3
# TokamakDevTools

A description of this package.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be deleted?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or alternatively, could you replace this with a description of how to install the extension in Chrome/Firefox?

)
self.nodes = changes.union(self.nodes)
self.traverse()
return .undefined
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated but it would be cool to add an overload to JSClosure that takes a closure with a Void return type and wraps it to return .undefined.

.font(.system(size: 13, weight: weight, design: .monospaced))
.onHover {
if let target = node.target {
if $0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give this a clearer name or is $0 the convention here?

Suggested change
if $0 {
if isHovered {

Comment on lines +1 to +7
import XCTest

import TokamakDevToolsTests

var tests = [XCTestCaseEntry]()
tests += TokamakDevToolsTests.allTests()
XCTMain(tests)
Copy link
Copy Markdown
Member

@j-f1 j-f1 Aug 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to use tests for the devtools? If not can you remove them?

@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

4 participants