-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* generate json for text layers * allow to generate json format in nodejs * support shared text styles * mock sketch version * fix mock * fix typo * avoid bundling nodobjc * move resizeConstraint out of hack file * change mocked sketch version to 47 * look for italic fonts * fix tests * fix lint * fix tests
- Loading branch information
1 parent
45a34db
commit 2f96c56
Showing
24 changed files
with
780 additions
and
253 deletions.
There are no files selected for viewing
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,21 @@ | ||
import * as React from 'react'; | ||
import generateId from 'sketch-file/generateId'; | ||
|
||
import { renderToJSON } from '../../lib'; | ||
|
||
let id = 0; | ||
const nextId = () => ++id; // eslint-disable-line | ||
|
||
const displayName = Component => | ||
Component.displayName || Component.name || `UnknownSymbol${nextId()}`; | ||
|
||
export default function createSymbol(Component, name) { | ||
const masterName = name || displayName(Component); | ||
const symbolID = generateId(masterName); | ||
const symbolMaster = renderToJSON( | ||
<symbolmaster symbolID={symbolID} name={masterName}> | ||
<Component /> | ||
</symbolmaster>, | ||
); | ||
return symbolMaster; | ||
} |
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,7 +1,9 @@ | ||
// @flow | ||
|
||
declare module 'pegjs' { | ||
declare var generate: (template: string) => { | ||
parse: (s: string) => any | ||
} | ||
declare var generate: ( | ||
template: string, | ||
) => { | ||
parse: (s: string) => any, | ||
}; | ||
} |
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,7 +1,7 @@ | ||
// @flow | ||
|
||
declare module 'sketchapp-json-plugin' { | ||
declare var fromSJSONDictionary: (json: Object) => any | ||
declare module '@skpm/sketchapp-json-plugin' { | ||
declare var fromSJSONDictionary: (json: Object, version?: string) => any | ||
declare var appVersionSupported: () => bool | ||
declare var toSJSON: (nativeLayer: any) => string | ||
} |
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
Oops, something went wrong.