-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aboyko
committed
Jul 13, 2017
1 parent
70382db
commit 4a30b7e
Showing
149 changed files
with
19,843 additions
and
230 deletions.
There are no files selected for viewing
Binary file modified
BIN
+0 Bytes
(100%)
...tchplugin/Contents/Sketch/SketchPlugin.framework/Versions/A/Resources/AnalyticsWindow.nib
Binary file not shown.
Binary file added
BIN
+798 Bytes
...tchplugin/Contents/Sketch/SketchPlugin.framework/Versions/A/Resources/Localizable.strings
Binary file not shown.
Binary file modified
BIN
-5 Bytes
(100%)
...sketchplugin/Contents/Sketch/SketchPlugin.framework/Versions/A/Resources/RSPMainPanel.nib
Binary file not shown.
Binary file modified
BIN
+12.3 KB
(100%)
...tlyMoodboards.sketchplugin/Contents/Sketch/SketchPlugin.framework/Versions/A/SketchPlugin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 18 additions & 7 deletions
25
ReinventlyMoodboards.sketchplugin/Contents/Sketch/script.cocoascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
@import 'SketchPlugin.framework/RSPHelper.js' | ||
var onRun = function(context) { | ||
var main = RSPMain.alloc().init(); | ||
main.run(context) | ||
var main = RSPMain.alloc().init(); | ||
main.run(context) | ||
}; | ||
|
||
function openHelp(){ | ||
openURL('https://github.com/Reinvently/moodboards-sketch-plugin'); | ||
openURL('http://reinvently.com/moodboard-builder-sketch-plugin/'); | ||
} | ||
|
||
function openFeedback(){ | ||
openURL('https://github.com/Reinvently/moodboards-sketch-plugin/issues/new'); | ||
function openFeedback(context){ | ||
//reference the Sketch Document | ||
var doc = context.document; | ||
|
||
var body = ""; | ||
var emailService = NSSharingService.sharingServiceNamed(NSSharingServiceNameComposeEmail); | ||
emailService.recipients = ["hello@reinvently.com"]; | ||
emailService.subject = "Feedback Moodboard Builder"; | ||
|
||
emailService.performWithItems([body]); | ||
|
||
doc.showMessage("Thanks!"); | ||
} | ||
|
||
function openURL(url){ | ||
NSWorkspace.sharedWorkspace().openURL(NSURL.URLWithString(url)); | ||
} | ||
NSWorkspace.sharedWorkspace().openURL(NSURL.URLWithString(url)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Macros.h | ||
// SketchPlugin | ||
// | ||
// Created by aboyko on 7/13/17. | ||
// Copyright © 2017 Reinvently. All rights reserved. | ||
// | ||
@import AppKit; | ||
|
||
static inline NSString *RSPLocalizedString(NSString *key) { | ||
return NSLocalizedStringFromTableInBundle(key, nil, [NSBundle bundleWithIdentifier:@"com.reinvently.sketchPlugin.SketchPlugin"], @""); | ||
} |
111 changes: 111 additions & 0 deletions
111
source/SketchPlugin/HTML/Sources/CSSAttributeSelector.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// | ||
// CSSAttributeSelector.m | ||
// HTMLKit | ||
// | ||
// Created by Iska on 14/05/15. | ||
// Copyright (c) 2015 BrainCookie. All rights reserved. | ||
// | ||
|
||
#import "CSSAttributeSelector.h" | ||
#import "HTMLElement.h" | ||
#import "NSCharacterSet+HTMLKit.h" | ||
|
||
@interface CSSAttributeSelector () | ||
{ | ||
CSSAttributeSelectorType _type; | ||
NSString *_name; | ||
NSString *_value; | ||
} | ||
@end | ||
|
||
@implementation CSSAttributeSelector | ||
|
||
+ (instancetype)classSelector:(NSString *)className | ||
{ | ||
return [[self alloc] initWithType:CSSAttributeSelectorIncludes attributeName:@"class" attrbiuteValue:className]; | ||
} | ||
|
||
+ (instancetype)idSelector:(NSString *)elementId | ||
{ | ||
return [[self alloc] initWithType:CSSAttributeSelectorExactMatch attributeName:@"id" attrbiuteValue:elementId]; | ||
} | ||
|
||
+ (instancetype)hasAttributeSelector:(NSString *)attributeName | ||
{ | ||
return [[self alloc] initWithType:CSSAttributeSelectorExists attributeName:attributeName attrbiuteValue:@""]; | ||
} | ||
|
||
- (instancetype)initWithType:(CSSAttributeSelectorType)type | ||
attributeName:(NSString *)name | ||
attrbiuteValue:(NSString *)value | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
_type = type; | ||
_name = [name copy]; | ||
_value = value ? [value copy]: @""; | ||
} | ||
return self; | ||
} | ||
|
||
- (BOOL)acceptElement:(HTMLElement *)element | ||
{ | ||
switch (_type) { | ||
case CSSAttributeSelectorExists: | ||
{ | ||
return !!element[_name]; | ||
} | ||
case CSSAttributeSelectorExactMatch: | ||
{ | ||
return [element[_name] isEqualToString:_value]; | ||
} | ||
case CSSAttributeSelectorIncludes: | ||
{ | ||
NSArray *components = [element[_name] componentsSeparatedByCharactersInSet:[NSCharacterSet HTMLWhitespaceCharacterSet]]; | ||
return [components containsObject:_value]; | ||
} | ||
case CSSAttributeSelectorBegins: | ||
{ | ||
return [element[_name] hasPrefix:_value]; | ||
} | ||
case CSSAttributeSelectorEnds: | ||
{ | ||
return [element[_name] hasSuffix:_value]; | ||
} | ||
case CSSAttributeSelectorContains: | ||
{ | ||
return [element[_name] containsString:_value]; | ||
} | ||
case CSSAttributeSelectorHyphen: | ||
{ | ||
return [element[_name] isEqualToString:_value] || [element[_name] hasPrefix:[_value stringByAppendingString:@"-"]]; | ||
} | ||
case CSSAttributeSelectorNot: | ||
{ | ||
return ![element[_name] isEqualToString:_value]; | ||
} | ||
default: | ||
return NO; | ||
} | ||
} | ||
|
||
#pragma mark - Description | ||
|
||
- (NSString *)debugDescription | ||
{ | ||
if (self.type == CSSAttributeSelectorExists) { | ||
return [NSString stringWithFormat:@"[%@]", self.name]; | ||
} | ||
|
||
NSString *matcher = @{@(CSSAttributeSelectorExactMatch): @"=", | ||
@(CSSAttributeSelectorIncludes): @"~=", | ||
@(CSSAttributeSelectorBegins): @"^=", | ||
@(CSSAttributeSelectorEnds): @"$=", | ||
@(CSSAttributeSelectorContains): @"*=", | ||
@(CSSAttributeSelectorHyphen): @"|=", | ||
@(CSSAttributeSelectorNot): @"!="}[@(self.type)]; | ||
|
||
return [NSString stringWithFormat:@"[%@%@'%@']", self.name, matcher, self.value]; | ||
} | ||
|
||
@end |
Oops, something went wrong.