From e0055d1701705ca562f9e0b598225994eb07ed64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-=C3=89tienne?= Date: Sun, 10 Nov 2024 17:42:14 +0100 Subject: [PATCH] Renamed module to STPluginNeon (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renamed the module `NeonPlugin` → `STPluginNeon` In order to avoid a name collision with the main type `NeonPlugin`. This in turn, allows for easier disambiguation for projects that also have their own `Theme` or `Colors` type. E.g. it is now possible to do this, even if your project has its own `Theme` type: ```swift import SwiftUI import STTextViewSwiftUI import STPluginNeon extension STPluginNeon.Theme { public static let myCustomTheme = STPluginNeon.Theme(colors: [:], fonts: [:]) } ``` ## Discussion See issue #11 --- DemoApp/EditorViewController.swift | 11 +++-------- DemoAppSwiftUI/DemoAppSwiftUI/ContentView.swift | 6 +++--- Package.swift | 4 ++-- README.md | 4 ++-- .../{NeonPlugin => STPluginNeon}/Coordinator.swift | 0 .../{NeonPlugin => STPluginNeon}/NSColor+hex.swift | 0 Sources/{NeonPlugin => STPluginNeon}/NeonPlugin.swift | 0 .../STTextViewSystemInterface.swift | 0 .../{NeonPlugin => STPluginNeon}/Theme+Default.swift | 0 Sources/{NeonPlugin => STPluginNeon}/Theme.swift | 0 .../Themes.xcassets/Contents.json | 0 .../Themes.xcassets/neon.plugin.default/Contents.json | 0 .../boolean.colorset/Contents.json | 0 .../comment.colorset/Contents.json | 0 .../constructor.colorset/Contents.json | 0 .../function.call.colorset/Contents.json | 0 .../include.colorset/Contents.json | 0 .../keyword.colorset/Contents.json | 0 .../keyword.function.colorset/Contents.json | 0 .../keyword.return.colorset/Contents.json | 0 .../neon.plugin.default/method.colorset/Contents.json | 0 .../neon.plugin.default/number.colorset/Contents.json | 0 .../operator.colorset/Contents.json | 0 .../parameter.colorset/Contents.json | 0 .../neon.plugin.default/plain.colorset/Contents.json | 0 .../property.colorset/Contents.json | 0 .../punctuation.special.colorset/Contents.json | 0 .../neon.plugin.default/string.colorset/Contents.json | 0 .../text.literal.colorset/Contents.json | 0 .../text.title.colorset/Contents.json | 0 .../neon.plugin.default/type.colorset/Contents.json | 0 .../variable.builtin.colorset/Contents.json | 0 .../variable.colorset/Contents.json | 0 Sources/{NeonPlugin => STPluginNeon}/TokenName.swift | 0 34 files changed, 10 insertions(+), 15 deletions(-) rename Sources/{NeonPlugin => STPluginNeon}/Coordinator.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/NSColor+hex.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/NeonPlugin.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/STTextViewSystemInterface.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/Theme+Default.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/Theme.swift (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/boolean.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/comment.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/constructor.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/function.call.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/include.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/keyword.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/keyword.function.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/keyword.return.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/method.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/number.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/operator.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/parameter.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/plain.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/property.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/punctuation.special.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/string.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/text.literal.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/text.title.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/type.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/variable.builtin.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/Themes.xcassets/neon.plugin.default/variable.colorset/Contents.json (100%) rename Sources/{NeonPlugin => STPluginNeon}/TokenName.swift (100%) diff --git a/DemoApp/EditorViewController.swift b/DemoApp/EditorViewController.swift index 3012763..0f4b0f6 100644 --- a/DemoApp/EditorViewController.swift +++ b/DemoApp/EditorViewController.swift @@ -1,7 +1,7 @@ import AppKit import STTextView -import NeonPlugin +import STPluginNeon class EditorViewController: NSViewController { @@ -20,13 +20,8 @@ class EditorViewController: NSViewController { let sourceCodeTheme = Theme( ///Themes.xcassets - colors: Theme.Colors(bundle: Bundle(path: Bundle.main.resourcePath! + "/STTextView-Plugin-Neon_NeonPlugin.bundle")!, name: "neon.plugin.default"), - tokensCustomFontDict: [ - "default": NSFont.monospacedSystemFont(ofSize: 14, weight: .regular), - "keyword": NSFont.monospacedSystemFont(ofSize: 14, weight: .medium), - "constructor": NSFont.monospacedSystemFont(ofSize: 14, weight: .medium), - "text.title": NSFont.monospacedSystemFont(ofSize: 14, weight: .medium) - ] + colors: Theme.Colors(bundle: Bundle(path: Bundle.main.resourcePath! + "/STTextView-Plugin-Neon_STPluginNeon.bundle")!, name: "neon.plugin.default"), + fonts: Theme.Fonts(bundle: Bundle(path: Bundle.main.resourcePath! + "/STTextView-Plugin-Neon_STPluginNeon.bundle")!, name: "neon.plugin.default") ) textView.addPlugin( diff --git a/DemoAppSwiftUI/DemoAppSwiftUI/ContentView.swift b/DemoAppSwiftUI/DemoAppSwiftUI/ContentView.swift index 384467d..14443b4 100644 --- a/DemoAppSwiftUI/DemoAppSwiftUI/ContentView.swift +++ b/DemoAppSwiftUI/DemoAppSwiftUI/ContentView.swift @@ -6,14 +6,14 @@ // import SwiftUI -import STTextViewUI -import NeonPlugin +import STTextViewSwiftUI +import STPluginNeon struct ContentView: View { @State private var text: AttributedString = "" @State private var selection: NSRange? var body: some View { - STTextViewUI.TextView( + TextView( text: $text, selection: $selection, options: [.wrapLines, .highlightSelectedLine], diff --git a/Package.swift b/Package.swift index 10c66ed..9311476 100644 --- a/Package.swift +++ b/Package.swift @@ -9,7 +9,7 @@ let package = Package( products: [ .library( name: "STTextView-Plugin-Neon", - targets: ["NeonPlugin"]), + targets: ["STPluginNeon"]), ], dependencies: [ .package(url: "https://github.com/krzyzanowskim/STTextView", branch: "main"), @@ -18,7 +18,7 @@ let package = Package( ], targets: [ .target( - name: "NeonPlugin", + name: "STPluginNeon", dependencies: [ .product(name: "STTextView", package: "STTextView"), .product(name: "Neon", package: "Neon"), diff --git a/README.md b/README.md index de57f57..8417b50 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ https://github.com/user-attachments/assets/910b9862-c682-4dcc-ae0e-dbb55e8a3fe5 Add the plugin package as a dependency of your application, then register/add it to the STTextView instance: ```swift -import NeonPlugin +import STPluginNeon textView.addPlugin( NeonPlugin( @@ -21,7 +21,7 @@ SwiftUI: ```swift import SwiftUI import STTextViewUI -import NeonPlugin +import STPluginNeon struct ContentView: View { @State private var text: AttributedString = "" diff --git a/Sources/NeonPlugin/Coordinator.swift b/Sources/STPluginNeon/Coordinator.swift similarity index 100% rename from Sources/NeonPlugin/Coordinator.swift rename to Sources/STPluginNeon/Coordinator.swift diff --git a/Sources/NeonPlugin/NSColor+hex.swift b/Sources/STPluginNeon/NSColor+hex.swift similarity index 100% rename from Sources/NeonPlugin/NSColor+hex.swift rename to Sources/STPluginNeon/NSColor+hex.swift diff --git a/Sources/NeonPlugin/NeonPlugin.swift b/Sources/STPluginNeon/NeonPlugin.swift similarity index 100% rename from Sources/NeonPlugin/NeonPlugin.swift rename to Sources/STPluginNeon/NeonPlugin.swift diff --git a/Sources/NeonPlugin/STTextViewSystemInterface.swift b/Sources/STPluginNeon/STTextViewSystemInterface.swift similarity index 100% rename from Sources/NeonPlugin/STTextViewSystemInterface.swift rename to Sources/STPluginNeon/STTextViewSystemInterface.swift diff --git a/Sources/NeonPlugin/Theme+Default.swift b/Sources/STPluginNeon/Theme+Default.swift similarity index 100% rename from Sources/NeonPlugin/Theme+Default.swift rename to Sources/STPluginNeon/Theme+Default.swift diff --git a/Sources/NeonPlugin/Theme.swift b/Sources/STPluginNeon/Theme.swift similarity index 100% rename from Sources/NeonPlugin/Theme.swift rename to Sources/STPluginNeon/Theme.swift diff --git a/Sources/NeonPlugin/Themes.xcassets/Contents.json b/Sources/STPluginNeon/Themes.xcassets/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/boolean.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/boolean.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/boolean.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/boolean.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/comment.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/comment.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/comment.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/comment.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/constructor.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/constructor.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/constructor.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/constructor.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/function.call.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/function.call.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/function.call.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/function.call.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/include.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/include.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/include.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/include.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.function.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.function.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.function.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.function.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.return.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.return.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/keyword.return.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/keyword.return.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/method.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/method.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/method.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/method.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/number.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/number.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/number.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/number.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/operator.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/operator.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/operator.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/operator.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/parameter.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/parameter.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/parameter.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/parameter.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/plain.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/plain.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/plain.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/plain.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/property.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/property.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/property.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/property.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/punctuation.special.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/punctuation.special.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/punctuation.special.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/punctuation.special.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/string.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/string.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/string.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/string.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/text.literal.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/text.literal.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/text.literal.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/text.literal.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/text.title.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/text.title.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/text.title.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/text.title.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/type.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/type.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/type.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/type.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/variable.builtin.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/variable.builtin.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/variable.builtin.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/variable.builtin.colorset/Contents.json diff --git a/Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/variable.colorset/Contents.json b/Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/variable.colorset/Contents.json similarity index 100% rename from Sources/NeonPlugin/Themes.xcassets/neon.plugin.default/variable.colorset/Contents.json rename to Sources/STPluginNeon/Themes.xcassets/neon.plugin.default/variable.colorset/Contents.json diff --git a/Sources/NeonPlugin/TokenName.swift b/Sources/STPluginNeon/TokenName.swift similarity index 100% rename from Sources/NeonPlugin/TokenName.swift rename to Sources/STPluginNeon/TokenName.swift