Skip to content

Commit

Permalink
v 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aboyko committed Jul 13, 2017
1 parent 70382db commit 4a30b7e
Show file tree
Hide file tree
Showing 149 changed files with 19,843 additions and 230 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"author": "Reinvently",
"identifier": "com.reinvently.sketch.moodboadrs",
"version": "1.0.0",
"version": "1.1.0",
"description": "A streamlined Sketch plugin for creating moodboards quickly and easily. Just do a search, check the suitable images, and - voila - you have a beautiful moodboard. Keep inspired!",
"authorEmail": "hello@reinvently.com",
"name": "Reinvently MoodBooards",
"name": "Moodboard Builder",
"appcast": "https://raw.githubusercontent.com/Reinvently/moodboards-sketch-plugin/master/appcast.xml",
"commands": [
{
Expand All @@ -25,15 +25,15 @@
"shortcut": ""
},
{
"name": "Feedback",
"name": "Feedback (hello@reinvently.com)",
"identifier": "com.reinvently.sketch.feedback",
"handler": "openFeedback",
"script": "script.cocoascript",
"shortcut": ""
}
],
"menu": {
"title": "Reinvently MoodBooards",
"title": "Moodboard Builder",
"items": [
"com.reinvently.sketch.run",
"-",
Expand Down
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));
}

12 changes: 12 additions & 0 deletions appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@
</description>
<enclosure url="https://github.com/Reinvently/moodboards-sketch-plugin/releases/download/v1.0.0/ReinventlyMoodboards.sketchplugin.zip" sparkle:version="1.0" />
</item>
<item>
<title>Version 1.1.0</title>
<description>
<![CDATA[
<ul>
<li>Minor update v1.1</li>
</ul>
]]>
</description>
<enclosure url="https://github.com/Reinvently/moodboards-sketch-plugin/releases/download/v1.1.0/ReinventlyMoodboards.sketchplugin.zip" sparkle:version="1.1" />
</item>

</channel>
</rss>
46 changes: 30 additions & 16 deletions source/SketchPlugin.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions source/SketchPlugin/Config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,34 @@
#import <Foundation/Foundation.h>

#pragma mark - Config

typedef struct {

CGSize moodboardGridSize;
CGSize artboardGridSize;

CGSize imageSize;

NSEdgeInsets imagesInsets;
NSEdgeInsets artboardInsets;

} RSPMoodboardConfig;

///
/// return default config (size, insets etc) for moodboard
extern RSPMoodboardConfig defaultMoodboardConfig(void);

#define DEFAULT_PANEL_SIZE CGSizeMake(970, 1076)

extern CGSize const DefaultPanelSize;

#pragma mark - Keys
#define DOCUMENT_KEY @"document"

extern NSString *const kSketchDocument;

#pragma mark - View Const
#define MAIN_NIB @"RSPMainPanel"
#define CELL_NIB @"PhotoCollectionViewItem"
#define PANEL_THREAD_KEY @"rsp_toolbar"
#define DEBUG_PANEL_THREAD_KEY @"rsp_debug"
#define PROCESS_THREAD_KEY @"rsp_main"

#pragma makr - String Literals
#define PageNameText @"Moodboard"
#define ArtboardNameText @"Moodboard %li"
#define GridHintText @"%i columns x %i rows"
#define SelectedHintText @"%lu images selected"

extern NSString *const kPanelThread;

extern NSString *const kDebugPanelThread;

extern NSString *const kProcessThread;
16 changes: 16 additions & 0 deletions source/SketchPlugin/Config/Config.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,19 @@ RSPMoodboardConfig defaultMoodboardConfig(void) {
};
return DefaultMoodboardConfig;
}


CGSize const DefaultPanelSize = {970, 1076};

#pragma mark - Keys

NSString *const kSketchDocument = @"document";

#pragma mark - View Const

NSString *const kPanelThread = @"rsp_toolbar";

NSString *const kDebugPanelThread = @"rsp_debug";

NSString *const kProcessThread = @"rsp_main";

12 changes: 12 additions & 0 deletions source/SketchPlugin/Config/Macros.h
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 source/SketchPlugin/HTML/Sources/CSSAttributeSelector.m
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
Loading

0 comments on commit 4a30b7e

Please sign in to comment.