├── .appcast.xml
├── .gitignore
├── CNAME
├── README.md
├── _config.yml
├── assets
└── icon.png
├── package-lock.json
├── package.json
├── sketch-data-faker.sketchplugin
└── Contents
│ ├── Resources
│ └── icon.png
│ └── Sketch
│ ├── index.js
│ ├── index.js.map
│ └── manifest.json
└── src
├── config.js
├── faker.js
├── index.js
├── manifest.json
└── utilities.js
/.appcast.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 | -
8 |
9 |
10 | -
11 |
12 |
13 | -
14 |
15 |
16 | -
17 |
18 |
19 | -
20 |
21 |
22 | -
23 |
24 |
25 | -
26 |
27 |
28 | -
29 |
30 |
31 | -
32 |
33 |
34 | -
35 |
36 |
37 | -
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # build artefacts
2 | .vscode
3 |
4 | # npm
5 | node_modules
6 | .npm
7 | npm-debug.log
8 |
9 | # mac
10 | .DS_Store
11 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | sketchfaker.com
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sketch Data Faker
2 |
3 | Sketch Data Faker enables you to insert random, yet predictable content into your Sketch files. You can specify what type of content to insert for each layer.
4 |
5 | - You can choose from 130+ types of data including Full Name, Email Address, Telephone, Paragraph, etc
6 | - It will insert a random version of that data into the layer that you specify
7 | - You can refresh that layer over and over to get a different version of that same type of data
8 | - It also works inside symbols. This means one duplicated symbol can have different random content of the same type (i.e. creating a list of names in a table)
9 | - It also works with symbols imported from Sketch Libraries
10 |
11 |
12 |
13 |
14 | - [Installation](#installation)
15 | - [How to Use](#how-to-use)
16 | - [Manual Mode](#manual-mode)
17 | - [Automatic Mode (Recommended)](#automatic-mode-recommended)
18 | - [Automatic Mode Content Types](#automatic-mode-content-types)
19 | - [Layer Renaming Helper](#layer-renaming-helper)
20 | - [Full List of Available Content](#full-list-of-available-content)
21 | - [Addresses](#addresses)
22 | - [Product Names and Descriptions](#product-names-and-descriptions)
23 | - [Company Names and Descriptions](#company-names-and-descriptions)
24 | - [Database](#database)
25 | - [Dates](#dates)
26 | - [Finance](#finance)
27 | - [Computers](#computers)
28 | - [Internet](#internet)
29 | - [Lorem](#lorem)
30 | - [Names and Job Titles](#names-and-job-titles)
31 | - [Phone Numbers](#phone-numbers)
32 | - [Random](#random)
33 | - [Files](#files)
34 | - [Localization / Translations](#localization--translations)
35 | - [List of Locales](#list-of-locales)
36 | - [Changelog](#changelog)
37 | - [Data Source and Credits](#data-source-and-credits)
38 |
39 |
40 |
41 | ## Installation
42 |
43 | - To use Sketch Data Faker, install the plugin by double-clicking on the `sketch-data-faker.sketchplugin` file.
44 |
45 | ## How to Use
46 |
47 | - Once installed, data will become available to you in the native Sketch Data Menu just like other types of data.
48 | - You can view more about how to use Sketch's Data features here:
49 |
50 | There are 2 ways to use it: Manual and Automatic (Recommended)
51 |
52 | - In **manual mode**, you select one of the default types of data that Sketch Data Faker has made available in the dropdown menu. No setup/changes to your Sketch file needed, but there are only a few types of data available
53 | - In **automatic mode**, you can insert much more data - over 130 types of data, by _renaming your text layer_ with the name of the content you want. Refer to the [chart below](#full-list-of-available-content) for the names to use.
54 |
55 | ### Using Manual Mode
56 |
57 | 1. To use manual mode, right-click on a text layer. Inside the `Data Feeds` menu that, look for `Sketch Data Faker`.
58 | 2. Inside there you can choose the type of data you want to insert into your layer. For example if you choose `Full Name`, your layer will now be replaced with a random full name (i.e. Jane Doe).
59 |
60 | - The layer text will be replaced with whatever type of data you chose.
61 | - It's now linked up permanently and good to go, so you can refresh the data to get different content of the same type
62 | - It also works inside symbols and library imports, offering unique content for each layer
63 |
64 | ### Using Automatic Mode (Recommended)
65 |
66 | 1. In automatic mode you first **rename your layer** to tell the plugin what type of data you want to receive (see the [chart below](#full-list-of-available-content) for all the data types you can use).
67 | 2. Then, you right-click on the layer and go to the `Data Feeds` menu, and inside `Sketch Data Faker`, choose the `Auto (Layer Name)` option. This tells the plugin to read your layer name and insert that type of data. You only need to do this once per layer and you can do it to multiple layers at the same time
68 |
69 | - Your layer text will now be replaced with data matching what you asked for
70 | - You can refresh to get different content of the same type
71 | - It also works inside symbols and library imports, offering unique content for each layer
72 |
73 | #### Automatic Mode Content Types
74 |
75 | - The chart below has the data types (i.e. `address.zipCode`) that you can choose from.
76 | - Make sure to use the exact spelling including capitalization and the "."
77 |
78 | Quick examples:
79 | - To insert a US Zip Code, rename your text layer `address.zipCode`
80 | - To insert a Street Name, rename your text layer `address.streetName`
81 | - To insert a random sentence, rename your text layer `lorem.sentence`
82 | - To insert a Company Name, rename your text layer `company.companyName`
83 | - To insert a Domain Name, rename your text layer `internet.domainName`
84 | - There are words, colours, cities, states, prices, product names, verbs, adjectives, catch phrases, buzzwords, and more.
85 |
86 | ### Layer Renaming Helper
87 |
88 | If you want help renaming your layers, `Sketch Data Faker` provides a menu inside the `Sketch Plugin` menuitem that will allow you to change your layer names without typing:
89 |
90 | 1. In Sketch, select the layer(s) you want to rename
91 | 2. Go to `Plugins -> Sketch Data Faker -> Set Layer Name` and choose the type of content you want to insert into that layer
92 |
93 | 2b. You can repeat this process for all layers you want to insert new content into
94 |
95 | 3. With the layers still selected in Sketch, set the data source\* `Data -> Sketch Data Faker -> Auto (Layer name)`
96 | 4. Watch as all your selected layers get replaced with new content!
97 |
98 | \*You can find the Data menu either by: `Right-click on a selected layer`, `Control-click on a selected layer`, from the `Layer` menu item in Sketch
99 |
100 | ## Full List of Available Content
101 |
102 | You can name your layer to of these Layer Names below. Remember to follow the category.type format (i.e. `address.city`, not just `city`).
103 |
104 | ### Addresses
105 |
106 | | Name | Layer Name | Example Data | Data Type | Data Source |
107 | | ----------------- | -------------------------- | ------------------------ | --------- | ----------- |
108 | | US ZipCpde | `address.zipCode` | "90210" | Text | Faker.js |
109 | | City | `address.city` | "East Zelmatown" | Text | Faker.js |
110 | | City Prefix | `address.cityPrefix` | "New", "North" | Text | Faker.js |
111 | | City Suffix | `address.citySuffix` | "land", "ton", "shire" | Text | Faker.js |
112 | | Street Name | `address.streetName` | "Jeromy Drive" | Text | Faker.js |
113 | | Street Address | `address.streetAddress` | "29530 Abbott Point" | Text | Faker.js |
114 | | Street Suffix | `address.streetSuffix` | "Isle" , "Way", "Square" | Text | Faker.js |
115 | | Street Preffix | `address.streetPrefix` | "a", "b", "c" | Text | Faker.js |
116 | | Secondary Address | `address.secondaryAddress` | "Apt. 165" | Text | Faker.js |
117 | | County | `address.county` | "Cambridgeshire" | Text | Faker.js |
118 | | Country | `address.country` | "Bangladesh", "Cuba" | Text | Faker.js |
119 | | Country Code | `address.countryCode` | "CA", "US" , "SL" | Text | Faker.js |
120 | | State | `address.state` | "Wisconsin", "Ohio" | Text | Faker.js |
121 | | State Abbr | `address.stateAbbr` | "WI", "IN" | Text | Faker.js |
122 | | Latitude | `address.latitude` | "0.2228" | Text | Faker.js |
123 | | Longitude | `address.longitude` | "112.5458" | Text | Faker.js |
124 |
125 | ### Product Names and Descriptions
126 |
127 | | Name | Layer Name | Example Data | Data Type | Data Source |
128 | | ----------------- | --------------------------- | -------------------------- | --------- | ----------- |
129 | | Colo(u)r | `commerce.color` | "mint green", "gold" | Text | Faker.js |
130 | | Department | `commerce.department` | "Shoes", "Tools", "Beauty" | Text | Faker.js |
131 | | Product Name | `commerce.productName` | "Licensed Soft Keyboard" | Text | Faker.js |
132 | | Price | `commerce.price` | "192.00", "681.00" | Text | Faker.js |
133 | | Product Adjective | `commerce.productAdjective` | "Fantastic", "Handmade" | Text | Faker.js |
134 | | Product Material | `commerce.productMaterial` | "Plastic", "Granite" | Text | Faker.js |
135 | | Product | `commerce.product` | "Tuna", "Gloves", "Soap" | Text | Faker.js |
136 |
137 | ### Company Names and Descriptions
138 |
139 | | Name | Layer Name | Example Data | Data Type | Data Source |
140 | | ---------------- | ------------------------------- | -------------------------------------- | --------- | ----------- |
141 | | Company Suffixes | `company.suffixes` | "Inc,and Sons,LLC,Group" | Text | Faker.js |
142 | | Company Name | `company.companyName` | "Harvey Group" | Text | Faker.js |
143 | | Company Suffix | `company.companySuffix` | "Inc", "LLC" | Text | Faker.js |
144 | | Catch Phrase | `company.catchPhrase` | "Down-sized analyzing toolset" | Text | Faker.js |
145 | | BS Phrase | `company.bs` | "seamless synergize e-commerce" | Text | Faker.js |
146 | | Adjective | `company.catchPhraseAdjective` | "Ergonomic", "Integrated" | Text | Faker.js |
147 | | Descriptor | `company.catchPhraseDescriptor` | "tertiary" , "holistic", "intangible" | Text | Faker.js |
148 | | Noun | `company.catchPhraseNoun` | "collaboration", "throughput" | Text | Faker.js |
149 | | BS Adjective | `company.bsAdjective` | "efficient", "global" | Text | Faker.js |
150 | | Buzz | `company.bsBuzz` | "grow", "expedite", "drive" | Text | Faker.js |
151 | | Noun | `company.bsNoun` | "convergence", "content", "e-commerce" | Text | Faker.js |
152 |
153 | ### Database
154 |
155 | | Name | Layer Name | Example Data | Data Type | Data Source |
156 | | ------------------ | -------------------- | ----------------------------- | --------- | ----------- |
157 | | Database Column | `database.column` | "createdAt", "category" | Text | Faker.js |
158 | | Database Type | `database.type` | "boolean", "tinyint", "time" | Text | Faker.js |
159 | | Database Collation | `database.collation` | "utf8_unicode_ci", "utf8_bin" | Text | Faker.js |
160 | | Database Engine | `database.engine` | "InnoDB", "CVS" | Text | Faker.js |
161 |
162 | ### Dates
163 |
164 | | Name | Layer Name | Example Data | Data Type | Data Source |
165 | | ---------------- | -------------- | ----------------------------------------- | --------- | ----------- |
166 | | Past Full Date | `date.past` | "Sun Feb 18 2018 11:12:04 GMT+0100 (CET)" | Text | Faker.js |
167 | | Future Full Date | `date.future` | "Thu Jan 17 2020 04:00:24 GMT+0100 (CET)" | Text | Faker.js |
168 | | Recent Full Date | `date.recent` | "Sat Nov 24 2018 19:59:37 GMT+0100 (CET)" | Text | Faker.js |
169 | | Month | `date.month` | "October" | Text | Faker.js |
170 | | Weekday | `date.weekday` | "Thursday" | Text | Faker.js |
171 |
172 | ### Finance
173 |
174 | | Name | Layer Name | Example Data | Data Type | Data Source |
175 | | ----------------- | ------------------------- | ------------------------------- | --------- | ----------- |
176 | | Account Number | `finance.account` | "54352123" | Text | Faker.js |
177 | | Account Name/Type | `finance.accountName` | "Savings Account" | Text | Faker.js |
178 | | Last 4 | `finance.mask` | "7577", "2558" | Text | Faker.js |
179 | | Amount | `finance.amount` | "690.53", "946.42" | Text | Faker.js |
180 | | Transaction Type | `finance.transactionType` | "payment" , deposit" | Text | Faker.js |
181 | | Currency Code | `finance.currencyCode` | "SYP", "USD", "CAD" | Text | Faker.js |
182 | | Currency Name | `finance.currencyName` | "Turkish Lira", "Nuevo Sol" | Text | Faker.js |
183 | | Currency Symbol | `finance.currencySymbol` | "$", "ден", "﷼", "$U" | Text | Faker.js |
184 | | Bitcoin Address | `finance.bitcoinAddress` | "1MBD5F25RM4J0SO7IFLK9K6JXZGUZ" | Text | Faker.js |
185 | | iban | `finance.iban` | "CH65279625495775545L7" | Text | Faker.js |
186 | | bic | `finance.bic` | "HBMOHMJ1" | Text | Faker.js |
187 |
188 | ### Computers
189 |
190 | | Name | Layer Name | Example Data | Data Type | Data Source |
191 | | ------------- | --------------------- | --------------------------------------------------------------- | --------- | ----------- |
192 | | Abbreviation | `hacker.abbreviation` | "FTP", "RAM", "SQL" | Text | Faker.js |
193 | | Adjective | `hacker.adjective` | "solid state", "back-end" | Text | Faker.js |
194 | | Noun | `hacker.noun` | "driver", "system" | Text | Faker.js |
195 | | Verb | `hacker.verb` | "quantify", "input" | Text | Faker.js |
196 | | ing-verb | `hacker.ingverb` | "calculating", "backing up" | Text | Faker.js |
197 | | Hacker Phrase | `hacker.phrase` | "Use the online AGP system, then you can hack the haptic card!" | Text | Faker.js |
198 |
199 | ### Internet
200 |
201 | | Name | Layer Name | Example Data | Data Type | Data Source |
202 | | -------------- | ----------------------- | ----------------------------------------------------------------- | --------- | ----------- |
203 | | Email | `internet.email` | "Keira48@yahoo.com" | Text | Faker.js |
204 | | @example Email | `internet.exampleEmail` | "Avis_Conn54@example.org" | Text | Faker.js |
205 | | Username | `internet.userName` | "Liana_Crooks20", "Alexandrine7" | Text | Faker.js |
206 | | Protocol | `internet.protocol` | "https", "http" | Text | Faker.js |
207 | | URL | `internet.url` | "https://germaine.net", "http://velda.com" | Text | Faker.js |
208 | | Domain Name | `internet.domainName` | "noel.info", "stephan.com" | Text | Faker.js |
209 | | Domain Suffix | `internet.domainSuffix` | "org", "net", "com" | Text | Faker.js |
210 | | Domain Word | `internet.domainWord` | "davon", "sunny" | Text | Faker.js |
211 | | IP Address | `internet.ip` | "64.210.26.120" | Text | Faker.js |
212 | | IPv6 Address | `internet.ipv6` | "f270:ba3a:d670:93c0:eded:1e9b:70bd:feb8" | Text | Faker.js |
213 | | User Agent | `internet.userAgent` | "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.1)" | Text | Faker.js |
214 | | Colo(u)r | `internet.color` | "#3d5e37" | Text | Faker.js |
215 | | MAC Address | `internet.mac` | "fb:d0:06:f8:b0:c8" | Text | Faker.js |
216 | | Password | `internet.password` | "gO40I5BVEUfetWO", "kUrNsxJa3yXoYr\_" | Text | Faker.js |
217 |
218 | ### Lorem
219 |
220 | | Name | Layer Name | Example Data | Data Type | Data Source |
221 | | ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- | ----------- |
222 | | Word | `lorem.word` | "rerum" | Text | Faker.js |
223 | | Words | `lorem.words` | "sed sapiente rerum" | Text | Faker.js |
224 | | Sentence | `lorem.sentence` | "Itaque quia temporibus odio deserunt." | Text | Faker.js |
225 | | Slug | `lorem.slug` | "voluptas-qui-eius" | Text | Faker.js |
226 | | Sentences | `lorem.sentences` | "Vitae sint tenetur porro odit id earum. Consequatur blanditiis sit voluptate doloribus quis eligendi repudiandae voluptatibus nihil. Dolor omnis magni reiciendis voluptatum asperiores tempora. Velit animi distinctio illum quisquam." | Text | Faker.js |
227 | | Paragraph | `lorem.paragraph` | "Amet praesentium magni quia voluptas nam molestias itaque consequatur. Iste minima voluptatum incidunt accusamus. Aut neque suscipit vel ratione nihil itaque." | Text | Faker.js |
228 | | Paragraphs | `lorem.paragraphs` | "Amet laudantium eius distinctio molestiae est aliquid aut nesciunt est. Deleniti atque ab. Quasi officia dicta aut. Vel sunt sed occaecati ipsam placeat est a quia. Doloremque aliquam aperiam qui sit officia reprehenderit repellendus id quae. Enim sed id quos ut debitis explicabo sunt necessitatibus cupiditate. Vero aut sunt est. Impedit quis incidunt eum reprehenderit est qui enim sint. Blanditiis consequuntur dolorum vitae aut autem atque ratione. Ea qui dolorem. Ratione reprehenderit amet quia tempore temporibus deserunt. Ipsam ducimus adipisci occaecati. Inventore totam eveniet asperiores sit voluptatem aut rem impedit. Sunt sunt aspernatur ad incidunt exercitationem fuga. Hic excepturi quis omnis ipsum a reprehenderit modi odit vel. Aliquam eos rerum." | Text | Faker.js |
229 | | Text | `lorem.text` | "Aut iste libero unde." | Text | Faker.js |
230 | | Lines | `lorem.lines` | "Et placeat nisi rem ut vitae sed dolore." | Text | Faker.js |
231 |
232 | ### Names and Job Titles
233 |
234 | | Name | Layer Name | Example Data | Data Type | Data Source |
235 | | -------------- | -------------------- | --------------------------- | --------- | ----------- |
236 | | First Name | `name.firstName` | "Jakayla", "Sally" | Text | Faker.js |
237 | | Last Name | `name.lastName` | "Pollich", "Schuppe" | Text | Faker.js |
238 | | Full Name | `name.findName` | "7577", "2558" | Text | Faker.js |
239 | | Job Title | `name.jobTitle` | "Direct Web Developer" | Text | Faker.js |
240 | | Prefix | `name.prefix` | "Mr." , Miss" | Text | Faker.js |
241 | | Suffix | `name.suffix` | "II" | Text | Faker.js |
242 | | Title | `name.title` | "Dynamic Identity Liaison" | Text | Faker.js |
243 | | Job Descriptor | `name.jobDescriptor` | "Dynamic", "National" | Text | Faker.js |
244 | | Job Area | `name.jobArea` | "Security", "Functionality" | Text | Faker.js |
245 | | Job Type | `name.jobType` | "Agent", "Architect" | Text | Faker.js |
246 |
247 | ### Phone Numbers
248 |
249 | | Name | Layer Name | Example Data | Data Type | Data Source |
250 | | -------------------------- | ------------------------- | -------------------------------------- | --------- | ----------- |
251 | | Phone Number | `phone.phoneNumber` | "226.634.3129 x7019" | Text | Faker.js |
252 | | North America Phone Number | `phone.phoneNumberFormat` | "994-651-4933" | Text | Faker.js |
253 | | Phone Formats | `phone.phoneFormats` | "###.###.####", "1-###-###-#### x####" | Text | Faker.js |
254 |
255 | ### Random
256 |
257 | | Name | Layer Name | Example Data | Data Type | Data Source |
258 | | ----------------------- | --------------------- | -------------------------------------------- | --------- | ----------- |
259 | | Random Number | `random.number` | "49109" | Text | Faker.js |
260 | | uuid | `random.uuid` | "f41c75fd-c540-4727-b5df-db7ead603a83" | Text | Faker.js |
261 | | boolean | `random.boolean` | "true", "false" | Text | Faker.js |
262 | | Random word | `random.word` | "Avon", "magnetic" | Text | Faker.js |
263 | | Random words | `random.words` | "6th generation", "matrix Myanmar auxiliary" | Text | Faker.js |
264 | | Locale | `random.locale` | "en_US", "zh_CN" | Text | Faker.js |
265 | | Random Letter or Number | `random.alphaNumeric` | "j", "4" | Text | Faker.js |
266 |
267 | ### Files
268 |
269 | | Name | Layer Name | Example Data | Data Type | Data Source |
270 | | ---------------- | ----------------------- | ----------------------------------- | --------- | ----------- |
271 | | File Name | `system.fileName` | "planner_ftp_bedfordshire.u32" | Text | Faker.js |
272 | | Common File Name | `system.commonFileName` | "back_end_3rd_generation_chief.mp4" | Text | Faker.js |
273 | | MIME Type | `system.mimeType` | "application/x-java-jnlp-file" | Text | Faker.js |
274 | | Common File Type | `system.commonFileType` | "image", "video" | Text | Faker.js |
275 | | File Extension | `system.fileExt` | "onepkg", "pls" | Text | Faker.js |
276 | | Common File Ext | `system.commonFileExt` | "mp4", "jpeg" | Text | Faker.js |
277 | | File Type | `system.fileType` | "image", "font" | Text | Faker.js |
278 | | Version | `system.semver` | "2.6.9" | Text | Faker.js |
279 |
280 | ## Localization / Translations
281 |
282 | Sketch Data Faker supports localization on all text strings, where Faker.js also supports it. In order to set a layer to a specific language or locale, append `|xx` to the end where `xx` is the local code.
283 |
284 | For example, if you want a `First Name` to be German, you would use `name.firstName|de` as your layer name. If you want the product name to be in Canadian English, you would use `commerce.productName|en_CA`.
285 |
286 | See the full list of locales below. Note that Sketch Data Faker will fall back to English if the locale code is wrong or if there is no available translation for that term.
287 |
288 | ### List of Locales
289 |
290 | - az
291 | - cz
292 | - de
293 | - de_AT
294 | - de_CH
295 | - en
296 | - en_AU
297 | - en_BORK
298 | - en_CA
299 | - en_GB
300 | - en_IE
301 | - en_IND
302 | - en_US
303 | - en_ZA
304 | - en_au_ocker
305 | - es
306 | - es_MX
307 | - fa
308 | - fr
309 | - fr_CA
310 | - ge
311 | - id_ID
312 | - it
313 | - ja
314 | - ko
315 | - nb_NO
316 | - nep
317 | - nl
318 | - pl
319 | - pt_BR
320 | - pt_PT
321 | - ru
322 | - sk
323 | - sv
324 | - tr
325 | - uk
326 | - vi
327 | - zh_CN
328 | - zh_TW
329 |
330 | ## Changelog
331 | - 0.8.0 - Update depenencies including support Faker.js 5.2.0 with more data!
332 | - 0.7.0 - Bring back ability to use in Symbols imported from Libraries
333 | - 0.6.1 - Revert work on library imports in order to fix bug with symbols
334 | - 0.6 - Use on text layers as part of library imports
335 | - 0.4 - New Feautre: i18n
336 | - 0.2.1 - New Feature: Layer renaming helper in plugin menu
337 | - 0.1.9 - New Feature: Ability to use on symbols
338 |
339 | ## Data Source and Credits
340 |
341 | All data is from the great faker.js project:
342 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 | title: Sketch Faker
3 | show_downloads: true
4 |
--------------------------------------------------------------------------------
/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paintedbicycle/sketch-data-faker/bb82a3a7ded77ec20c28754ad635d40ef6b369c3/assets/icon.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sketch-data-faker",
3 | "version": "0.8.0",
4 | "description": "A Sketch plugin providing 130+ types of smart placeholder content for your mockups from Faker.js and other sources.",
5 | "engines": {
6 | "sketch": ">=3.0"
7 | },
8 | "author": "Paul Wright",
9 | "homepage": "https://sketchfaker.com",
10 | "identifier": "com.paintedbicycle.sketch.sketchfaker",
11 | "appcast": ".appcast.xml",
12 | "icon": "icon.png",
13 | "skpm": {
14 | "name": "Sketch Data Faker",
15 | "manifest": "src/manifest.json",
16 | "main": "sketch-data-faker.sketchplugin",
17 | "assets": [
18 | "assets/**/*"
19 | ]
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "git+https://github.com/paintedbicycle/sketch-data-faker.git"
24 | },
25 | "scripts": {
26 | "build": "skpm-build",
27 | "watch": "skpm-build --watch",
28 | "start": "skpm-build --watch --run",
29 | "postinstall": "npm run build && skpm-link"
30 | },
31 | "devDependencies": {
32 | "@skpm/builder": "0.7.11"
33 | },
34 | "dependencies": {
35 | "faker": "5.2.0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sketch-data-faker.sketchplugin/Contents/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paintedbicycle/sketch-data-faker/bb82a3a7ded77ec20c28754ad635d40ef6b369c3/sketch-data-faker.sketchplugin/Contents/Resources/icon.png
--------------------------------------------------------------------------------
/sketch-data-faker.sketchplugin/Contents/Sketch/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "compatibleVersion": 3,
3 | "bundleVersion": 1,
4 | "icon": "icon.png",
5 | "suppliesData": true,
6 | "commands": [
7 | {
8 | "script": "index.js",
9 | "handlers": {
10 | "actions": {
11 | "Startup": "onStartup",
12 | "Shutdown": "onShutdown",
13 | "SupplyAutomatically": "onSupplyAutomatically",
14 | "SupplyEmail": "onSupplyEmail",
15 | "SupplyFullName": "onSupplyFullName",
16 | "SupplyFirstName": "onSupplyFirstName",
17 | "SupplyLastName": "onSupplyLastName",
18 | "SupplyPhoneNumber": "onSupplyPhoneNumber",
19 | "SupplyLoremSentence": "onSupplyLoremSentence",
20 | "SupplyLoremParagraph": "onSupplyLoremParagraph",
21 | "SupplyLoremParagraphs": "onSupplyLoremParagraphs"
22 | }
23 | }
24 | },
25 | {
26 | "name": "US Zip Code",
27 | "identifier": "address.zipCode",
28 | "handler": "setLayerNameAndData",
29 | "script": "index.js"
30 | },
31 | {
32 | "name": "City Name",
33 | "identifier": "address.city",
34 | "handler": "setLayerNameAndData",
35 | "script": "index.js"
36 | },
37 | {
38 | "name": "City Prefix",
39 | "identifier": "address.cityPrefix",
40 | "handler": "setLayerNameAndData",
41 | "script": "index.js"
42 | },
43 | {
44 | "name": "City Suffix",
45 | "identifier": "address.citySuffix",
46 | "handler": "setLayerNameAndData",
47 | "script": "index.js"
48 | },
49 | {
50 | "name": "Street Name",
51 | "identifier": "address.streetName",
52 | "handler": "setLayerNameAndData",
53 | "script": "index.js"
54 | },
55 | {
56 | "name": "Street Address",
57 | "identifier": "address.streetAddress",
58 | "handler": "setLayerNameAndData",
59 | "script": "index.js"
60 | },
61 | {
62 | "name": "Street Suffix",
63 | "identifier": "address.streetSuffix",
64 | "handler": "setLayerNameAndData",
65 | "script": "index.js"
66 | },
67 | {
68 | "name": "Street Prefix",
69 | "identifier": "address.streetPrefix",
70 | "handler": "setLayerNameAndData",
71 | "script": "index.js"
72 | },
73 | {
74 | "name": "Secondary Address Line",
75 | "identifier": "address.secondaryAddress",
76 | "handler": "setLayerNameAndData",
77 | "script": "index.js"
78 | },
79 | {
80 | "name": "County",
81 | "identifier": "address.county",
82 | "handler": "setLayerNameAndData",
83 | "script": "index.js"
84 | },
85 | {
86 | "name": "Country",
87 | "identifier": "address.country",
88 | "handler": "setLayerNameAndData",
89 | "script": "index.js"
90 | },
91 | {
92 | "name": "Country Code",
93 | "identifier": "address.countryCode",
94 | "handler": "setLayerNameAndData",
95 | "script": "index.js"
96 | },
97 | {
98 | "name": "State",
99 | "identifier": "address.state",
100 | "handler": "setLayerNameAndData",
101 | "script": "index.js"
102 | },
103 | {
104 | "name": "State Abbreviation",
105 | "identifier": "address.stateAbbr",
106 | "handler": "setLayerNameAndData",
107 | "script": "index.js"
108 | },
109 | {
110 | "name": "Latitude",
111 | "identifier": "address.latitude",
112 | "handler": "setLayerNameAndData",
113 | "script": "index.js"
114 | },
115 | {
116 | "name": "Longitude",
117 | "identifier": "address.longitude",
118 | "handler": "setLayerNameAndData",
119 | "script": "index.js"
120 | },
121 | {
122 | "name": "(Brand) Color",
123 | "identifier": "commerce.color",
124 | "handler": "setLayerNameAndData",
125 | "script": "index.js"
126 | },
127 | {
128 | "name": "Business Department",
129 | "identifier": "commerce.department",
130 | "handler": "setLayerNameAndData",
131 | "script": "index.js"
132 | },
133 | {
134 | "name": "Product Name",
135 | "identifier": "commerce.productName",
136 | "handler": "setLayerNameAndData",
137 | "script": "index.js"
138 | },
139 | {
140 | "name": "Price",
141 | "identifier": "commerce.price",
142 | "handler": "setLayerNameAndData",
143 | "script": "index.js"
144 | },
145 | {
146 | "name": "Product Adjective",
147 | "identifier": "commerce.productAdjective",
148 | "handler": "setLayerNameAndData",
149 | "script": "index.js"
150 | },
151 | {
152 | "name": "Product Material",
153 | "identifier": "commerce.productMaterial",
154 | "handler": "setLayerNameAndData",
155 | "script": "index.js"
156 | },
157 | {
158 | "name": "Product",
159 | "identifier": "commerce.product",
160 | "handler": "setLayerNameAndData",
161 | "script": "index.js"
162 | },
163 | {
164 | "name": "Company Suffixes",
165 | "identifier": "company.suffixes",
166 | "handler": "setLayerNameAndData",
167 | "script": "index.js"
168 | },
169 | {
170 | "name": "Company Name",
171 | "identifier": "company.companyName",
172 | "handler": "setLayerNameAndData",
173 | "script": "index.js"
174 | },
175 | {
176 | "name": "Company Suffix",
177 | "identifier": "company.companySuffix",
178 | "handler": "setLayerNameAndData",
179 | "script": "index.js"
180 | },
181 | {
182 | "name": "Company Catchphrase",
183 | "identifier": "company.catchPhrase",
184 | "handler": "setLayerNameAndData",
185 | "script": "index.js"
186 | },
187 | {
188 | "name": "Company BS Phrase",
189 | "identifier": "company.bs",
190 | "handler": "setLayerNameAndData",
191 | "script": "index.js"
192 | },
193 | {
194 | "name": "Catchphrase Adjective",
195 | "identifier": "company.catchPhraseAdjective",
196 | "handler": "setLayerNameAndData",
197 | "script": "index.js"
198 | },
199 | {
200 | "name": "Catchphrase Descriptor",
201 | "identifier": "company.catchPhraseDescriptor",
202 | "handler": "setLayerNameAndData",
203 | "script": "index.js"
204 | },
205 | {
206 | "name": "Catchphrase Noun",
207 | "identifier": "company.catchPhraseNoun",
208 | "handler": "setLayerNameAndData",
209 | "script": "index.js"
210 | },
211 | {
212 | "name": "BS Adjective",
213 | "identifier": "company.bsAdjective",
214 | "handler": "setLayerNameAndData",
215 | "script": "index.js"
216 | },
217 | {
218 | "name": "BS Buzzword Verb",
219 | "identifier": "company.bsBuzz",
220 | "handler": "setLayerNameAndData",
221 | "script": "index.js"
222 | },
223 | {
224 | "name": "BS Buzzword Noun",
225 | "identifier": "company.bsNoun",
226 | "handler": "setLayerNameAndData",
227 | "script": "index.js"
228 | },
229 | {
230 | "name": "Database Column Name",
231 | "identifier": "database.column",
232 | "handler": "setLayerNameAndData",
233 | "script": "index.js"
234 | },
235 | {
236 | "name": "Database Column Type",
237 | "identifier": "database.type",
238 | "handler": "setLayerNameAndData",
239 | "script": "index.js"
240 | },
241 | {
242 | "name": "Database Collation",
243 | "identifier": "database.collation",
244 | "handler": "setLayerNameAndData",
245 | "script": "index.js"
246 | },
247 | {
248 | "name": "Database Engine",
249 | "identifier": "database.engine",
250 | "handler": "setLayerNameAndData",
251 | "script": "index.js"
252 | },
253 | {
254 | "name": "Past Date (Full)",
255 | "identifier": "date.past",
256 | "handler": "setLayerNameAndData",
257 | "script": "index.js"
258 | },
259 | {
260 | "name": "Future Date (Full)",
261 | "identifier": "date.future",
262 | "handler": "setLayerNameAndData",
263 | "script": "index.js"
264 | },
265 | {
266 | "name": "Recent Date (Full)",
267 | "identifier": "date.recent",
268 | "handler": "setLayerNameAndData",
269 | "script": "index.js"
270 | },
271 | {
272 | "name": "Month",
273 | "identifier": "date.month",
274 | "handler": "setLayerNameAndData",
275 | "script": "index.js"
276 | },
277 | {
278 | "name": "Weekday",
279 | "identifier": "date.weekday",
280 | "handler": "setLayerNameAndData",
281 | "script": "index.js"
282 | },
283 | {
284 | "name": "Account Number",
285 | "identifier": "finance.account",
286 | "handler": "setLayerNameAndData",
287 | "script": "index.js"
288 | },
289 | {
290 | "name": "Account Name/Type",
291 | "identifier": "finance.accountName",
292 | "handler": "setLayerNameAndData",
293 | "script": "index.js"
294 | },
295 | {
296 | "name": "Credit Card Last 4",
297 | "identifier": "finance.mask",
298 | "handler": "setLayerNameAndData",
299 | "script": "index.js"
300 | },
301 | {
302 | "name": "Purchase Amount / Price",
303 | "identifier": "finance.amount",
304 | "handler": "setLayerNameAndData",
305 | "script": "index.js"
306 | },
307 | {
308 | "name": "Transaction Type",
309 | "identifier": "finance.transactionType",
310 | "handler": "setLayerNameAndData",
311 | "script": "index.js"
312 | },
313 | {
314 | "name": "Currency Code",
315 | "identifier": "finance.currencyCode",
316 | "handler": "setLayerNameAndData",
317 | "script": "index.js"
318 | },
319 | {
320 | "name": "Currency Name",
321 | "identifier": "finance.currencyName",
322 | "handler": "setLayerNameAndData",
323 | "script": "index.js"
324 | },
325 | {
326 | "name": "Currency Symbol",
327 | "identifier": "finance.currencySymbol",
328 | "handler": "setLayerNameAndData",
329 | "script": "index.js"
330 | },
331 | {
332 | "name": "Bitcoin Address",
333 | "identifier": "finance.bitcoinAddress",
334 | "handler": "setLayerNameAndData",
335 | "script": "index.js"
336 | },
337 | {
338 | "name": "IBAN Number",
339 | "identifier": "finance.iban",
340 | "handler": "setLayerNameAndData",
341 | "script": "index.js"
342 | },
343 | {
344 | "name": "BIC Code",
345 | "identifier": "finance.bic",
346 | "handler": "setLayerNameAndData",
347 | "script": "index.js"
348 | },
349 | {
350 | "name": "Technical Abbreviation",
351 | "identifier": "hacker.abbreviation",
352 | "handler": "setLayerNameAndData",
353 | "script": "index.js"
354 | },
355 | {
356 | "name": "Technical Adjective",
357 | "identifier": "hacker.adjective",
358 | "handler": "setLayerNameAndData",
359 | "script": "index.js"
360 | },
361 | {
362 | "name": "Technical Noun",
363 | "identifier": "hacker.noun",
364 | "handler": "setLayerNameAndData",
365 | "script": "index.js"
366 | },
367 | {
368 | "name": "Technical Verb",
369 | "identifier": "hacker.verb",
370 | "handler": "setLayerNameAndData",
371 | "script": "index.js"
372 | },
373 | {
374 | "name": "Technical '-Ing' Verb",
375 | "identifier": "hacker.ingverb",
376 | "handler": "setLayerNameAndData",
377 | "script": "index.js"
378 | },
379 | {
380 | "name": "'Hacker' Phrase",
381 | "identifier": "hacker.phrase",
382 | "handler": "setLayerNameAndData",
383 | "script": "index.js"
384 | },
385 | {
386 | "name": "Email Address",
387 | "identifier": "internet.email",
388 | "handler": "setLayerNameAndData",
389 | "script": "index.js"
390 | },
391 | {
392 | "name": "Example.org Email Address",
393 | "identifier": "internet.exampleEmail",
394 | "handler": "setLayerNameAndData",
395 | "script": "index.js"
396 | },
397 | {
398 | "name": "Username",
399 | "identifier": "internet.userName",
400 | "handler": "setLayerNameAndData",
401 | "script": "index.js"
402 | },
403 | {
404 | "name": "Internet Protocol",
405 | "identifier": "internet.protocol",
406 | "handler": "setLayerNameAndData",
407 | "script": "index.js"
408 | },
409 | {
410 | "name": "URL",
411 | "identifier": "internet.url",
412 | "handler": "setLayerNameAndData",
413 | "script": "index.js"
414 | },
415 | {
416 | "name": "Domain Name",
417 | "identifier": "internet.domainName",
418 | "handler": "setLayerNameAndData",
419 | "script": "index.js"
420 | },
421 | {
422 | "name": "Domain Suffix",
423 | "identifier": "internet.domainSuffix",
424 | "handler": "setLayerNameAndData",
425 | "script": "index.js"
426 | },
427 | {
428 | "name": "Domain Word",
429 | "identifier": "internet.domainWord",
430 | "handler": "setLayerNameAndData",
431 | "script": "index.js"
432 | },
433 | {
434 | "name": "IP Address",
435 | "identifier": "internet.ip",
436 | "handler": "setLayerNameAndData",
437 | "script": "index.js"
438 | },
439 | {
440 | "name": "IPv6 Address",
441 | "identifier": "internet.ipv6",
442 | "handler": "setLayerNameAndData",
443 | "script": "index.js"
444 | },
445 | {
446 | "name": "User Agent String",
447 | "identifier": "internet.userAgent",
448 | "handler": "setLayerNameAndData",
449 | "script": "index.js"
450 | },
451 | {
452 | "name": "HEX Colo(u)r Code",
453 | "identifier": "internet.color",
454 | "handler": "setLayerNameAndData",
455 | "script": "index.js"
456 | },
457 | {
458 | "name": "MAC Address",
459 | "identifier": "internet.mac",
460 | "handler": "setLayerNameAndData",
461 | "script": "index.js"
462 | },
463 | {
464 | "name": "Sample Password",
465 | "identifier": "internet.password",
466 | "handler": "setLayerNameAndData",
467 | "script": "index.js"
468 | },
469 | {
470 | "name": "Lorem Word",
471 | "identifier": "lorem.word",
472 | "handler": "setLayerNameAndData",
473 | "script": "index.js"
474 | },
475 | {
476 | "name": "Lorem Words",
477 | "identifier": "lorem.words",
478 | "handler": "setLayerNameAndData",
479 | "script": "index.js"
480 | },
481 | {
482 | "name": "Lorem Sentence",
483 | "identifier": "lorem.sentence",
484 | "handler": "setLayerNameAndData",
485 | "script": "index.js"
486 | },
487 | {
488 | "name": "Lorem Slug",
489 | "identifier": "lorem.slug",
490 | "handler": "setLayerNameAndData",
491 | "script": "index.js"
492 | },
493 | {
494 | "name": "Lorem Sentences",
495 | "identifier": "lorem.sentences",
496 | "handler": "setLayerNameAndData",
497 | "script": "index.js"
498 | },
499 | {
500 | "name": "Lorem Paragraph",
501 | "identifier": "lorem.paragraph",
502 | "handler": "setLayerNameAndData",
503 | "script": "index.js"
504 | },
505 | {
506 | "name": "Lorem Paragraphs",
507 | "identifier": "lorem.paragraphs",
508 | "handler": "setLayerNameAndData",
509 | "script": "index.js"
510 | },
511 | {
512 | "name": "Lorem Text",
513 | "identifier": "lorem.text",
514 | "handler": "setLayerNameAndData",
515 | "script": "index.js"
516 | },
517 | {
518 | "name": "Lorem Lines",
519 | "identifier": "lorem.lines",
520 | "handler": "setLayerNameAndData",
521 | "script": "index.js"
522 | },
523 | {
524 | "name": "First Name",
525 | "identifier": "name.firstName",
526 | "handler": "setLayerNameAndData",
527 | "script": "index.js"
528 | },
529 | {
530 | "name": "Last Name",
531 | "identifier": "name.lastName",
532 | "handler": "setLayerNameAndData",
533 | "script": "index.js"
534 | },
535 | {
536 | "name": "Full Name (First Last)",
537 | "identifier": "name.findName",
538 | "handler": "setLayerNameAndData",
539 | "script": "index.js"
540 | },
541 | {
542 | "name": "Job Title",
543 | "identifier": "name.jobTitle",
544 | "handler": "setLayerNameAndData",
545 | "script": "index.js"
546 | },
547 | {
548 | "name": "Name Prefix",
549 | "identifier": "name.prefix",
550 | "handler": "setLayerNameAndData",
551 | "script": "index.js"
552 | },
553 | {
554 | "name": "Name Suffix",
555 | "identifier": "name.suffix",
556 | "handler": "setLayerNameAndData",
557 | "script": "index.js"
558 | },
559 | {
560 | "name": "Title",
561 | "identifier": "name.title",
562 | "handler": "setLayerNameAndData",
563 | "script": "index.js"
564 | },
565 | {
566 | "name": "Job Descriptor Word",
567 | "identifier": "name.jobDescriptor",
568 | "handler": "setLayerNameAndData",
569 | "script": "index.js"
570 | },
571 | {
572 | "name": "Job Area",
573 | "identifier": "name.jobArea",
574 | "handler": "setLayerNameAndData",
575 | "script": "index.js"
576 | },
577 | {
578 | "name": "Job Type",
579 | "identifier": "name.jobType",
580 | "handler": "setLayerNameAndData",
581 | "script": "index.js"
582 | },
583 | {
584 | "name": "Phone Number",
585 | "identifier": "phone.phoneNumber",
586 | "handler": "setLayerNameAndData",
587 | "script": "index.js"
588 | },
589 | {
590 | "name": "North American Phone Number",
591 | "identifier": "phone.phoneNumberFormat",
592 | "handler": "setLayerNameAndData",
593 | "script": "index.js"
594 | },
595 | {
596 | "name": "Phone Format Placeholder",
597 | "identifier": "phone.phoneFormats",
598 | "handler": "setLayerNameAndData",
599 | "script": "index.js"
600 | },
601 | {
602 | "name": "Random Number",
603 | "identifier": "random.number",
604 | "handler": "setLayerNameAndData",
605 | "script": "index.js"
606 | },
607 | {
608 | "name": "UUID",
609 | "identifier": "random.uuid",
610 | "handler": "setLayerNameAndData",
611 | "script": "index.js"
612 | },
613 | {
614 | "name": "Boolean",
615 | "identifier": "random.boolean",
616 | "handler": "setLayerNameAndData",
617 | "script": "index.js"
618 | },
619 | {
620 | "name": "Random Word",
621 | "identifier": "random.word",
622 | "handler": "setLayerNameAndData",
623 | "script": "index.js"
624 | },
625 | {
626 | "name": "Random Words",
627 | "identifier": "random.words",
628 | "handler": "setLayerNameAndData",
629 | "script": "index.js"
630 | },
631 | {
632 | "name": "Language Locale",
633 | "identifier": "random.locale",
634 | "handler": "setLayerNameAndData",
635 | "script": "index.js"
636 | },
637 | {
638 | "name": "Random AlphaNum Character",
639 | "identifier": "random.alphaNumeric",
640 | "handler": "setLayerNameAndData",
641 | "script": "index.js"
642 | },
643 | {
644 | "name": "Random Filename",
645 | "identifier": "system.fileName",
646 | "handler": "setLayerNameAndData",
647 | "script": "index.js"
648 | },
649 | {
650 | "name": "Common Filename",
651 | "identifier": "system.commonFileName",
652 | "handler": "setLayerNameAndData",
653 | "script": "index.js"
654 | },
655 | {
656 | "name": "MIME Type",
657 | "identifier": "system.mimeType",
658 | "handler": "setLayerNameAndData",
659 | "script": "index.js"
660 | },
661 | {
662 | "name": "Common File Type",
663 | "identifier": "system.commonFileType",
664 | "handler": "setLayerNameAndData",
665 | "script": "index.js"
666 | },
667 | {
668 | "name": "File Extension",
669 | "identifier": "system.fileExt",
670 | "handler": "setLayerNameAndData",
671 | "script": "index.js"
672 | },
673 | {
674 | "name": "Common File Extension",
675 | "identifier": "system.commonFileExt",
676 | "handler": "setLayerNameAndData",
677 | "script": "index.js"
678 | },
679 | {
680 | "name": "File Type",
681 | "identifier": "system.fileType",
682 | "handler": "setLayerNameAndData",
683 | "script": "index.js"
684 | },
685 | {
686 | "name": "Semver",
687 | "identifier": "system.semver",
688 | "handler": "setLayerNameAndData",
689 | "script": "index.js"
690 | }
691 | ],
692 | "menu": {
693 | "title": "Sketch Data Faker",
694 | "items": [
695 | {
696 | "title": "Set Layer Name",
697 | "items": [
698 | {
699 | "title": "Addresses",
700 | "items": [
701 | "address.zipCode",
702 | "address.city",
703 | "address.cityPrefix",
704 | "address.citySuffix",
705 | "address.streetName",
706 | "address.streetAddress",
707 | "address.streetSuffix",
708 | "address.streetPrefix",
709 | "address.secondaryAddress",
710 | "address.county",
711 | "address.country",
712 | "address.countryCode",
713 | "address.state",
714 | "address.stateAbbr",
715 | "address.latitude",
716 | "address.longitude"
717 | ]
718 | },
719 | {
720 | "title": "Commerce/Money/Product",
721 | "items": [
722 | "commerce.color",
723 | "commerce.department",
724 | "commerce.productName",
725 | "commerce.price",
726 | "commerce.productAdjective",
727 | "commerce.productMaterial",
728 | "commerce.product"
729 | ]
730 | },
731 | {
732 | "title": "Company/Startup",
733 | "items": [
734 | "company.suffixes",
735 | "company.companyName",
736 | "company.companySuffix",
737 | "company.catchPhrase",
738 | "company.bs",
739 | "company.catchPhraseAdjective",
740 | "company.catchPhraseDescriptor",
741 | "company.catchPhraseNoun",
742 | "company.bsAdjective",
743 | "company.bsBuzz",
744 | "company.bsNoun"
745 | ]
746 | },
747 | {
748 | "title": "Dates",
749 | "items": [
750 | "date.past",
751 | "date.future",
752 | "date.recent",
753 | "date.month",
754 | "date.weekday"
755 | ]
756 | },
757 | {
758 | "title": "Finance/Bank",
759 | "items": [
760 | "finance.account",
761 | "finance.accountName",
762 | "finance.mask",
763 | "finance.amount",
764 | "finance.transactionType",
765 | "finance.currencyCode",
766 | "finance.currencyName",
767 | "finance.currencySymbol",
768 | "finance.bitcoinAddress",
769 | "finance.iban",
770 | "finance.bic"
771 | ]
772 | },
773 | {
774 | "title": "Computers/Technical",
775 | "items": [
776 | "hacker.abbreviation",
777 | "hacker.adjective",
778 | "hacker.noun",
779 | "hacker.verb",
780 | "hacker.ingverb",
781 | "hacker.phrase",
782 | "database.column",
783 | "database.type",
784 | "database.collation",
785 | "database.engine"
786 | ]
787 | },
788 | {
789 | "title": "Internet",
790 | "items": [
791 | "internet.email",
792 | "internet.exampleEmail",
793 | "internet.userName",
794 | "internet.protocol",
795 | "internet.url",
796 | "internet.domainName",
797 | "internet.domainSuffix",
798 | "internet.domainWord",
799 | "internet.ip",
800 | "internet.ipv6",
801 | "internet.userAgent",
802 | "internet.color",
803 | "internet.mac",
804 | "internet.password"
805 | ]
806 | },
807 | {
808 | "title": "Lorem",
809 | "items": [
810 | "lorem.word",
811 | "lorem.words",
812 | "lorem.sentence",
813 | "lorem.slug",
814 | "lorem.sentences",
815 | "lorem.paragraph",
816 | "lorem.paragraphs",
817 | "lorem.text",
818 | "lorem.lines"
819 | ]
820 | },
821 | {
822 | "title": "Name",
823 | "items": [
824 | "name.firstName",
825 | "name.lastName",
826 | "name.findName",
827 | "name.jobTitle",
828 | "name.prefix",
829 | "name.suffix",
830 | "name.title",
831 | "name.jobDescriptor",
832 | "name.jobArea",
833 | "name.jobType"
834 | ]
835 | },
836 | {
837 | "title": "Phone",
838 | "items": [
839 | "phone.phoneNumber",
840 | "phone.phoneNumberFormat",
841 | "phone.phoneFormats"
842 | ]
843 | },
844 | {
845 | "title": "Random",
846 | "items": [
847 | "random.number",
848 | "random.uuid",
849 | "random.boolean",
850 | "random.word",
851 | "random.words",
852 | "random.locale",
853 | "random.alphaNumeric"
854 | ]
855 | },
856 | {
857 | "title": "Files",
858 | "items": [
859 | "system.fileName",
860 | "system.commonFileName",
861 | "system.mimeType",
862 | "system.commonFileType",
863 | "system.fileExt",
864 | "system.commonFileExt",
865 | "system.fileType",
866 | "system.semver"
867 | ]
868 | }
869 | ]
870 | }
871 | ]
872 | },
873 | "version": "0.8.0",
874 | "description": "A Sketch plugin providing 130+ types of smart placeholder content for your mockups from Faker.js and other sources.",
875 | "homepage": "https://sketchfaker.com",
876 | "name": "Sketch Data Faker",
877 | "identifier": "Sketch Data Faker",
878 | "disableCocoaScriptPreprocessor": true,
879 | "appcast": "https://raw.githubusercontent.com/paintedbicycle/sketch-data-faker/master/.appcast.xml",
880 | "author": "Paul Wright"
881 | }
--------------------------------------------------------------------------------
/src/config.js:
--------------------------------------------------------------------------------
1 | const config = {
2 | debug: false
3 | };
4 |
5 | export default config;
6 |
--------------------------------------------------------------------------------
/src/faker.js:
--------------------------------------------------------------------------------
1 | const sketch = require("sketch");
2 | const { DataSupplier } = sketch;
3 | const util = require("util");
4 | const faker = require("faker");
5 |
6 | import { showUserErrors } from "./utilities";
7 |
8 | export function supplyFakerData(context, type) {
9 | let dataKey = context.data.key;
10 |
11 | const document = sketch.getSelectedDocument();
12 | const items = util.toArray(context.data.items).map(sketch.fromNative);
13 | let errors = [];
14 |
15 | items.forEach((item, index) => {
16 | let newLayerData = null;
17 | let custom = false;
18 | let layerError = false;
19 |
20 | // In order to work in both layers and symbols we grab the original
21 | // layer by getting the id from either the override or the layer
22 |
23 | let layer;
24 | let originalLayerName;
25 | if (item.type === "Text") {
26 | // item.id is for regular layers
27 | layer = document.getLayerWithID(item.id);
28 | originalLayerName = layer.name;
29 | } else if (item.type === "DataOverride") {
30 | // For overrides we can just grab the name directly
31 | // Sketch already knows the layer it's going to apply to so we don't
32 | // actually need the full layer
33 | originalLayerName = item.override.affectedLayer.name;
34 | }
35 |
36 | let search = originalLayerName.split("|")[0];
37 | let locale = originalLayerName.split("|")[1];
38 |
39 | // Set up search string
40 | let searchTerm = "{{" + search + "}}";
41 |
42 | // Set up locale
43 | if (locale) {
44 | faker.locale = locale;
45 | } else {
46 | faker.locale = "en";
47 | }
48 |
49 | switch (type) {
50 | case "fullName":
51 | newLayerData = faker.name.findName();
52 | break;
53 | case "firstName":
54 | newLayerData = faker.name.firstName();
55 | break;
56 | case "lastName":
57 | newLayerData = faker.name.lastName();
58 | break;
59 | case "email":
60 | newLayerData = faker.internet.email();
61 | break;
62 | case "phoneNumber":
63 | newLayerData = faker.phone.phoneNumber();
64 | break;
65 | case "loremSentence":
66 | newLayerData = faker.lorem.sentence();
67 | break;
68 | case "loremParagraph":
69 | newLayerData = faker.lorem.paragraph();
70 | break;
71 | case "loremParagraphs":
72 | newLayerData = faker.lorem.paragraphs();
73 | break;
74 | default:
75 | // Set custom to true so we can override layer name
76 | custom = true;
77 | try {
78 | newLayerData = faker.fake(searchTerm);
79 | } catch (e) {
80 | layerError = true;
81 | errors.push({
82 | type: "noData",
83 | layer: {
84 | name: layer && layer.name ? layer.name : originalLayerName
85 | }
86 | });
87 | }
88 | break;
89 | }
90 |
91 | // If this specific layer has an error, go to next layer
92 | if (layerError) return;
93 |
94 | // Replace the layer text
95 | DataSupplier.supplyDataAtIndex(dataKey, newLayerData, index);
96 |
97 | // The DataSupplier method above overwrites the layer name
98 | // so we now put the original layer name back again so the next
99 | // time the user runs our plugin, the name is correct
100 | if (layer && custom === true) {
101 | layer.name = originalLayerName;
102 | }
103 | });
104 |
105 | if (errors) showUserErrors(errors);
106 | }
107 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | const sketch = require('sketch');
2 | const { DataSupplier } = sketch;
3 |
4 | import { supplyFakerData } from './faker';
5 | import { changeLayerName, showUserErrors } from './utilities';
6 |
7 | export function onStartup() {
8 | DataSupplier.registerDataSupplier(
9 | 'public.text',
10 | 'Full Name',
11 | 'SupplyFullName'
12 | );
13 | DataSupplier.registerDataSupplier(
14 | 'public.text',
15 | 'First Name',
16 | 'SupplyFirstName'
17 | );
18 | DataSupplier.registerDataSupplier(
19 | 'public.text',
20 | 'Last Name',
21 | 'SupplyLastName'
22 | );
23 | DataSupplier.registerDataSupplier(
24 | 'public.text',
25 | 'Email Address',
26 | 'SupplyEmail'
27 | );
28 | DataSupplier.registerDataSupplier(
29 | 'public.text',
30 | 'Phone Number',
31 | 'SupplyPhoneNumber'
32 | );
33 | DataSupplier.registerDataSupplier(
34 | 'public.text',
35 | 'Lorem Sentence',
36 | 'SupplyLoremSentence'
37 | );
38 | DataSupplier.registerDataSupplier(
39 | 'public.text',
40 | 'Lorem Paragraph',
41 | 'SupplyLoremParagraph'
42 | );
43 | DataSupplier.registerDataSupplier(
44 | 'public.text',
45 | 'Lorem Paragraphs',
46 | 'SupplyLoremParagraphs'
47 | );
48 | DataSupplier.registerDataSupplier(
49 | 'public.text',
50 | 'Auto (Layer Name)',
51 | 'SupplyAutomatically'
52 | );
53 | }
54 |
55 | export function onShutdown() {
56 | DataSupplier.deregisterDataSuppliers();
57 | }
58 |
59 | export function onSupplyAutomatically(context) {
60 | supplyFakerData(context);
61 | }
62 | export function onSupplyFullName(context) {
63 | supplyFakerData(context, 'fullName');
64 | }
65 | export function onSupplyFirstName(context) {
66 | supplyFakerData(context, 'firstName');
67 | }
68 | export function onSupplyLastName(context) {
69 | supplyFakerData(context, 'lastName');
70 | }
71 | export function onSupplyEmail(context) {
72 | supplyFakerData(context, 'email');
73 | }
74 | export function onSupplyPhoneNumber(context) {
75 | supplyFakerData(context, 'phoneNumber');
76 | }
77 | export function onSupplyLoremSentence(context) {
78 | supplyFakerData(context, 'loremSentence');
79 | }
80 | export function onSupplyLoremParagraph(context) {
81 | supplyFakerData(context, 'loremParagraph');
82 | }
83 | export function onSupplyLoremParagraphs(context) {
84 | supplyFakerData(context, 'loremParagraphs');
85 | }
86 |
87 | export function setLayerNameAndData(context) {
88 | try {
89 | let identifier = String(__command.identifier());
90 | changeLayerName(identifier);
91 | } catch (error) {
92 | showUserErrors(error);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "compatibleVersion": 3,
3 | "bundleVersion": 1,
4 | "icon": "icon.png",
5 | "suppliesData": true,
6 | "commands": [
7 | {
8 | "script": "index.js",
9 | "handlers": {
10 | "actions": {
11 | "Startup": "onStartup",
12 | "Shutdown": "onShutdown",
13 | "SupplyAutomatically": "onSupplyAutomatically",
14 | "SupplyEmail": "onSupplyEmail",
15 | "SupplyFullName": "onSupplyFullName",
16 | "SupplyFirstName": "onSupplyFirstName",
17 | "SupplyLastName": "onSupplyLastName",
18 | "SupplyPhoneNumber": "onSupplyPhoneNumber",
19 | "SupplyLoremSentence": "onSupplyLoremSentence",
20 | "SupplyLoremParagraph": "onSupplyLoremParagraph",
21 | "SupplyLoremParagraphs": "onSupplyLoremParagraphs"
22 | }
23 | }
24 | },
25 |
26 | {
27 | "name": "US Zip Code",
28 | "identifier": "address.zipCode",
29 | "handler": "setLayerNameAndData",
30 | "script": "index.js"
31 | },
32 | {
33 | "name": "City Name",
34 | "identifier": "address.city",
35 | "handler": "setLayerNameAndData",
36 | "script": "index.js"
37 | },
38 | {
39 | "name": "City Prefix",
40 | "identifier": "address.cityPrefix",
41 | "handler": "setLayerNameAndData",
42 | "script": "index.js"
43 | },
44 | {
45 | "name": "City Suffix",
46 | "identifier": "address.citySuffix",
47 | "handler": "setLayerNameAndData",
48 | "script": "index.js"
49 | },
50 | {
51 | "name": "Street Name",
52 | "identifier": "address.streetName",
53 | "handler": "setLayerNameAndData",
54 | "script": "index.js"
55 | },
56 | {
57 | "name": "Street Address",
58 | "identifier": "address.streetAddress",
59 | "handler": "setLayerNameAndData",
60 | "script": "index.js"
61 | },
62 | {
63 | "name": "Street Suffix",
64 | "identifier": "address.streetSuffix",
65 | "handler": "setLayerNameAndData",
66 | "script": "index.js"
67 | },
68 | {
69 | "name": "Street Prefix",
70 | "identifier": "address.streetPrefix",
71 | "handler": "setLayerNameAndData",
72 | "script": "index.js"
73 | },
74 | {
75 | "name": "Secondary Address Line",
76 | "identifier": "address.secondaryAddress",
77 | "handler": "setLayerNameAndData",
78 | "script": "index.js"
79 | },
80 | {
81 | "name": "County",
82 | "identifier": "address.county",
83 | "handler": "setLayerNameAndData",
84 | "script": "index.js"
85 | },
86 | {
87 | "name": "Country",
88 | "identifier": "address.country",
89 | "handler": "setLayerNameAndData",
90 | "script": "index.js"
91 | },
92 | {
93 | "name": "Country Code",
94 | "identifier": "address.countryCode",
95 | "handler": "setLayerNameAndData",
96 | "script": "index.js"
97 | },
98 | {
99 | "name": "State",
100 | "identifier": "address.state",
101 | "handler": "setLayerNameAndData",
102 | "script": "index.js"
103 | },
104 | {
105 | "name": "State Abbreviation",
106 | "identifier": "address.stateAbbr",
107 | "handler": "setLayerNameAndData",
108 | "script": "index.js"
109 | },
110 | {
111 | "name": "Latitude",
112 | "identifier": "address.latitude",
113 | "handler": "setLayerNameAndData",
114 | "script": "index.js"
115 | },
116 | {
117 | "name": "Longitude",
118 | "identifier": "address.longitude",
119 | "handler": "setLayerNameAndData",
120 | "script": "index.js"
121 | },
122 |
123 | {
124 | "name": "(Brand) Color",
125 | "identifier": "commerce.color",
126 | "handler": "setLayerNameAndData",
127 | "script": "index.js"
128 | },
129 | {
130 | "name": "Business Department",
131 | "identifier": "commerce.department",
132 | "handler": "setLayerNameAndData",
133 | "script": "index.js"
134 | },
135 | {
136 | "name": "Product Name",
137 | "identifier": "commerce.productName",
138 | "handler": "setLayerNameAndData",
139 | "script": "index.js"
140 | },
141 | {
142 | "name": "Price",
143 | "identifier": "commerce.price",
144 | "handler": "setLayerNameAndData",
145 | "script": "index.js"
146 | },
147 | {
148 | "name": "Product Adjective",
149 | "identifier": "commerce.productAdjective",
150 | "handler": "setLayerNameAndData",
151 | "script": "index.js"
152 | },
153 | {
154 | "name": "Product Material",
155 | "identifier": "commerce.productMaterial",
156 | "handler": "setLayerNameAndData",
157 | "script": "index.js"
158 | },
159 | {
160 | "name": "Product",
161 | "identifier": "commerce.product",
162 | "handler": "setLayerNameAndData",
163 | "script": "index.js"
164 | },
165 |
166 | {
167 | "name": "Company Suffixes",
168 | "identifier": "company.suffixes",
169 | "handler": "setLayerNameAndData",
170 | "script": "index.js"
171 | },
172 | {
173 | "name": "Company Name",
174 | "identifier": "company.companyName",
175 | "handler": "setLayerNameAndData",
176 | "script": "index.js"
177 | },
178 | {
179 | "name": "Company Suffix",
180 | "identifier": "company.companySuffix",
181 | "handler": "setLayerNameAndData",
182 | "script": "index.js"
183 | },
184 | {
185 | "name": "Company Catchphrase",
186 | "identifier": "company.catchPhrase",
187 | "handler": "setLayerNameAndData",
188 | "script": "index.js"
189 | },
190 | {
191 | "name": "Company BS Phrase",
192 | "identifier": "company.bs",
193 | "handler": "setLayerNameAndData",
194 | "script": "index.js"
195 | },
196 | {
197 | "name": "Catchphrase Adjective",
198 | "identifier": "company.catchPhraseAdjective",
199 | "handler": "setLayerNameAndData",
200 | "script": "index.js"
201 | },
202 | {
203 | "name": "Catchphrase Descriptor",
204 | "identifier": "company.catchPhraseDescriptor",
205 | "handler": "setLayerNameAndData",
206 | "script": "index.js"
207 | },
208 | {
209 | "name": "Catchphrase Noun",
210 | "identifier": "company.catchPhraseNoun",
211 | "handler": "setLayerNameAndData",
212 | "script": "index.js"
213 | },
214 | {
215 | "name": "BS Adjective",
216 | "identifier": "company.bsAdjective",
217 | "handler": "setLayerNameAndData",
218 | "script": "index.js"
219 | },
220 | {
221 | "name": "BS Buzzword Verb",
222 | "identifier": "company.bsBuzz",
223 | "handler": "setLayerNameAndData",
224 | "script": "index.js"
225 | },
226 | {
227 | "name": "BS Buzzword Noun",
228 | "identifier": "company.bsNoun",
229 | "handler": "setLayerNameAndData",
230 | "script": "index.js"
231 | },
232 |
233 | {
234 | "name": "Database Column Name",
235 | "identifier": "database.column",
236 | "handler": "setLayerNameAndData",
237 | "script": "index.js"
238 | },
239 | {
240 | "name": "Database Column Type",
241 | "identifier": "database.type",
242 | "handler": "setLayerNameAndData",
243 | "script": "index.js"
244 | },
245 | {
246 | "name": "Database Collation",
247 | "identifier": "database.collation",
248 | "handler": "setLayerNameAndData",
249 | "script": "index.js"
250 | },
251 | {
252 | "name": "Database Engine",
253 | "identifier": "database.engine",
254 | "handler": "setLayerNameAndData",
255 | "script": "index.js"
256 | },
257 |
258 | {
259 | "name": "Past Date (Full)",
260 | "identifier": "date.past",
261 | "handler": "setLayerNameAndData",
262 | "script": "index.js"
263 | },
264 | {
265 | "name": "Future Date (Full)",
266 | "identifier": "date.future",
267 | "handler": "setLayerNameAndData",
268 | "script": "index.js"
269 | },
270 | {
271 | "name": "Recent Date (Full)",
272 | "identifier": "date.recent",
273 | "handler": "setLayerNameAndData",
274 | "script": "index.js"
275 | },
276 | {
277 | "name": "Month",
278 | "identifier": "date.month",
279 | "handler": "setLayerNameAndData",
280 | "script": "index.js"
281 | },
282 | {
283 | "name": "Weekday",
284 | "identifier": "date.weekday",
285 | "handler": "setLayerNameAndData",
286 | "script": "index.js"
287 | },
288 |
289 | {
290 | "name": "Account Number",
291 | "identifier": "finance.account",
292 | "handler": "setLayerNameAndData",
293 | "script": "index.js"
294 | },
295 | {
296 | "name": "Account Name/Type",
297 | "identifier": "finance.accountName",
298 | "handler": "setLayerNameAndData",
299 | "script": "index.js"
300 | },
301 | {
302 | "name": "Credit Card Last 4",
303 | "identifier": "finance.mask",
304 | "handler": "setLayerNameAndData",
305 | "script": "index.js"
306 | },
307 | {
308 | "name": "Purchase Amount / Price",
309 | "identifier": "finance.amount",
310 | "handler": "setLayerNameAndData",
311 | "script": "index.js"
312 | },
313 | {
314 | "name": "Transaction Type",
315 | "identifier": "finance.transactionType",
316 | "handler": "setLayerNameAndData",
317 | "script": "index.js"
318 | },
319 | {
320 | "name": "Currency Code",
321 | "identifier": "finance.currencyCode",
322 | "handler": "setLayerNameAndData",
323 | "script": "index.js"
324 | },
325 | {
326 | "name": "Currency Name",
327 | "identifier": "finance.currencyName",
328 | "handler": "setLayerNameAndData",
329 | "script": "index.js"
330 | },
331 | {
332 | "name": "Currency Symbol",
333 | "identifier": "finance.currencySymbol",
334 | "handler": "setLayerNameAndData",
335 | "script": "index.js"
336 | },
337 | {
338 | "name": "Bitcoin Address",
339 | "identifier": "finance.bitcoinAddress",
340 | "handler": "setLayerNameAndData",
341 | "script": "index.js"
342 | },
343 | {
344 | "name": "IBAN Number",
345 | "identifier": "finance.iban",
346 | "handler": "setLayerNameAndData",
347 | "script": "index.js"
348 | },
349 | {
350 | "name": "BIC Code",
351 | "identifier": "finance.bic",
352 | "handler": "setLayerNameAndData",
353 | "script": "index.js"
354 | },
355 |
356 | {
357 | "name": "Technical Abbreviation",
358 | "identifier": "hacker.abbreviation",
359 | "handler": "setLayerNameAndData",
360 | "script": "index.js"
361 | },
362 | {
363 | "name": "Technical Adjective",
364 | "identifier": "hacker.adjective",
365 | "handler": "setLayerNameAndData",
366 | "script": "index.js"
367 | },
368 | {
369 | "name": "Technical Noun",
370 | "identifier": "hacker.noun",
371 | "handler": "setLayerNameAndData",
372 | "script": "index.js"
373 | },
374 | {
375 | "name": "Technical Verb",
376 | "identifier": "hacker.verb",
377 | "handler": "setLayerNameAndData",
378 | "script": "index.js"
379 | },
380 | {
381 | "name": "Technical '-Ing' Verb",
382 | "identifier": "hacker.ingverb",
383 | "handler": "setLayerNameAndData",
384 | "script": "index.js"
385 | },
386 | {
387 | "name": "'Hacker' Phrase",
388 | "identifier": "hacker.phrase",
389 | "handler": "setLayerNameAndData",
390 | "script": "index.js"
391 | },
392 |
393 | {
394 | "name": "Email Address",
395 | "identifier": "internet.email",
396 | "handler": "setLayerNameAndData",
397 | "script": "index.js"
398 | },
399 | {
400 | "name": "Example.org Email Address",
401 | "identifier": "internet.exampleEmail",
402 | "handler": "setLayerNameAndData",
403 | "script": "index.js"
404 | },
405 | {
406 | "name": "Username",
407 | "identifier": "internet.userName",
408 | "handler": "setLayerNameAndData",
409 | "script": "index.js"
410 | },
411 | {
412 | "name": "Internet Protocol",
413 | "identifier": "internet.protocol",
414 | "handler": "setLayerNameAndData",
415 | "script": "index.js"
416 | },
417 | {
418 | "name": "URL",
419 | "identifier": "internet.url",
420 | "handler": "setLayerNameAndData",
421 | "script": "index.js"
422 | },
423 | {
424 | "name": "Domain Name",
425 | "identifier": "internet.domainName",
426 | "handler": "setLayerNameAndData",
427 | "script": "index.js"
428 | },
429 | {
430 | "name": "Domain Suffix",
431 | "identifier": "internet.domainSuffix",
432 | "handler": "setLayerNameAndData",
433 | "script": "index.js"
434 | },
435 | {
436 | "name": "Domain Word",
437 | "identifier": "internet.domainWord",
438 | "handler": "setLayerNameAndData",
439 | "script": "index.js"
440 | },
441 | {
442 | "name": "IP Address",
443 | "identifier": "internet.ip",
444 | "handler": "setLayerNameAndData",
445 | "script": "index.js"
446 | },
447 | {
448 | "name": "IPv6 Address",
449 | "identifier": "internet.ipv6",
450 | "handler": "setLayerNameAndData",
451 | "script": "index.js"
452 | },
453 | {
454 | "name": "User Agent String",
455 | "identifier": "internet.userAgent",
456 | "handler": "setLayerNameAndData",
457 | "script": "index.js"
458 | },
459 | {
460 | "name": "HEX Colo(u)r Code",
461 | "identifier": "internet.color",
462 | "handler": "setLayerNameAndData",
463 | "script": "index.js"
464 | },
465 | {
466 | "name": "MAC Address",
467 | "identifier": "internet.mac",
468 | "handler": "setLayerNameAndData",
469 | "script": "index.js"
470 | },
471 | {
472 | "name": "Sample Password",
473 | "identifier": "internet.password",
474 | "handler": "setLayerNameAndData",
475 | "script": "index.js"
476 | },
477 |
478 | {
479 | "name": "Lorem Word",
480 | "identifier": "lorem.word",
481 | "handler": "setLayerNameAndData",
482 | "script": "index.js"
483 | },
484 | {
485 | "name": "Lorem Words",
486 | "identifier": "lorem.words",
487 | "handler": "setLayerNameAndData",
488 | "script": "index.js"
489 | },
490 | {
491 | "name": "Lorem Sentence",
492 | "identifier": "lorem.sentence",
493 | "handler": "setLayerNameAndData",
494 | "script": "index.js"
495 | },
496 | {
497 | "name": "Lorem Slug",
498 | "identifier": "lorem.slug",
499 | "handler": "setLayerNameAndData",
500 | "script": "index.js"
501 | },
502 | {
503 | "name": "Lorem Sentences",
504 | "identifier": "lorem.sentences",
505 | "handler": "setLayerNameAndData",
506 | "script": "index.js"
507 | },
508 | {
509 | "name": "Lorem Paragraph",
510 | "identifier": "lorem.paragraph",
511 | "handler": "setLayerNameAndData",
512 | "script": "index.js"
513 | },
514 | {
515 | "name": "Lorem Paragraphs",
516 | "identifier": "lorem.paragraphs",
517 | "handler": "setLayerNameAndData",
518 | "script": "index.js"
519 | },
520 | {
521 | "name": "Lorem Text",
522 | "identifier": "lorem.text",
523 | "handler": "setLayerNameAndData",
524 | "script": "index.js"
525 | },
526 | {
527 | "name": "Lorem Lines",
528 | "identifier": "lorem.lines",
529 | "handler": "setLayerNameAndData",
530 | "script": "index.js"
531 | },
532 |
533 | {
534 | "name": "First Name",
535 | "identifier": "name.firstName",
536 | "handler": "setLayerNameAndData",
537 | "script": "index.js"
538 | },
539 | {
540 | "name": "Last Name",
541 | "identifier": "name.lastName",
542 | "handler": "setLayerNameAndData",
543 | "script": "index.js"
544 | },
545 | {
546 | "name": "Full Name (First Last)",
547 | "identifier": "name.findName",
548 | "handler": "setLayerNameAndData",
549 | "script": "index.js"
550 | },
551 | {
552 | "name": "Job Title",
553 | "identifier": "name.jobTitle",
554 | "handler": "setLayerNameAndData",
555 | "script": "index.js"
556 | },
557 | {
558 | "name": "Name Prefix",
559 | "identifier": "name.prefix",
560 | "handler": "setLayerNameAndData",
561 | "script": "index.js"
562 | },
563 | {
564 | "name": "Name Suffix",
565 | "identifier": "name.suffix",
566 | "handler": "setLayerNameAndData",
567 | "script": "index.js"
568 | },
569 | {
570 | "name": "Title",
571 | "identifier": "name.title",
572 | "handler": "setLayerNameAndData",
573 | "script": "index.js"
574 | },
575 | {
576 | "name": "Job Descriptor Word",
577 | "identifier": "name.jobDescriptor",
578 | "handler": "setLayerNameAndData",
579 | "script": "index.js"
580 | },
581 | {
582 | "name": "Job Area",
583 | "identifier": "name.jobArea",
584 | "handler": "setLayerNameAndData",
585 | "script": "index.js"
586 | },
587 | {
588 | "name": "Job Type",
589 | "identifier": "name.jobType",
590 | "handler": "setLayerNameAndData",
591 | "script": "index.js"
592 | },
593 |
594 | {
595 | "name": "Phone Number",
596 | "identifier": "phone.phoneNumber",
597 | "handler": "setLayerNameAndData",
598 | "script": "index.js"
599 | },
600 | {
601 | "name": "North American Phone Number",
602 | "identifier": "phone.phoneNumberFormat",
603 | "handler": "setLayerNameAndData",
604 | "script": "index.js"
605 | },
606 | {
607 | "name": "Phone Format Placeholder",
608 | "identifier": "phone.phoneFormats",
609 | "handler": "setLayerNameAndData",
610 | "script": "index.js"
611 | },
612 |
613 | {
614 | "name": "Random Number",
615 | "identifier": "random.number",
616 | "handler": "setLayerNameAndData",
617 | "script": "index.js"
618 | },
619 | {
620 | "name": "UUID",
621 | "identifier": "random.uuid",
622 | "handler": "setLayerNameAndData",
623 | "script": "index.js"
624 | },
625 | {
626 | "name": "Boolean",
627 | "identifier": "random.boolean",
628 | "handler": "setLayerNameAndData",
629 | "script": "index.js"
630 | },
631 | {
632 | "name": "Random Word",
633 | "identifier": "random.word",
634 | "handler": "setLayerNameAndData",
635 | "script": "index.js"
636 | },
637 | {
638 | "name": "Random Words",
639 | "identifier": "random.words",
640 | "handler": "setLayerNameAndData",
641 | "script": "index.js"
642 | },
643 | {
644 | "name": "Language Locale",
645 | "identifier": "random.locale",
646 | "handler": "setLayerNameAndData",
647 | "script": "index.js"
648 | },
649 | {
650 | "name": "Random AlphaNum Character",
651 | "identifier": "random.alphaNumeric",
652 | "handler": "setLayerNameAndData",
653 | "script": "index.js"
654 | },
655 |
656 | {
657 | "name": "Random Filename",
658 | "identifier": "system.fileName",
659 | "handler": "setLayerNameAndData",
660 | "script": "index.js"
661 | },
662 | {
663 | "name": "Common Filename",
664 | "identifier": "system.commonFileName",
665 | "handler": "setLayerNameAndData",
666 | "script": "index.js"
667 | },
668 | {
669 | "name": "MIME Type",
670 | "identifier": "system.mimeType",
671 | "handler": "setLayerNameAndData",
672 | "script": "index.js"
673 | },
674 | {
675 | "name": "Common File Type",
676 | "identifier": "system.commonFileType",
677 | "handler": "setLayerNameAndData",
678 | "script": "index.js"
679 | },
680 | {
681 | "name": "File Extension",
682 | "identifier": "system.fileExt",
683 | "handler": "setLayerNameAndData",
684 | "script": "index.js"
685 | },
686 | {
687 | "name": "Common File Extension",
688 | "identifier": "system.commonFileExt",
689 | "handler": "setLayerNameAndData",
690 | "script": "index.js"
691 | },
692 | {
693 | "name": "File Type",
694 | "identifier": "system.fileType",
695 | "handler": "setLayerNameAndData",
696 | "script": "index.js"
697 | },
698 | {
699 | "name": "Semver",
700 | "identifier": "system.semver",
701 | "handler": "setLayerNameAndData",
702 | "script": "index.js"
703 | }
704 | ],
705 | "menu": {
706 | "title": "Sketch Data Faker",
707 | "items": [
708 | {
709 | "title": "Set Layer Name",
710 | "items": [
711 | {
712 | "title": "Addresses",
713 | "items": [
714 | "address.zipCode",
715 | "address.city",
716 | "address.cityPrefix",
717 | "address.citySuffix",
718 | "address.streetName",
719 | "address.streetAddress",
720 | "address.streetSuffix",
721 | "address.streetPrefix",
722 | "address.secondaryAddress",
723 | "address.county",
724 | "address.country",
725 | "address.countryCode",
726 | "address.state",
727 | "address.stateAbbr",
728 | "address.latitude",
729 | "address.longitude"
730 | ]
731 | },
732 | {
733 | "title": "Commerce/Money/Product",
734 | "items": [
735 | "commerce.color",
736 | "commerce.department",
737 | "commerce.productName",
738 | "commerce.price",
739 | "commerce.productAdjective",
740 | "commerce.productMaterial",
741 | "commerce.product"
742 | ]
743 | },
744 | {
745 | "title": "Company/Startup",
746 | "items": [
747 | "company.suffixes",
748 | "company.companyName",
749 | "company.companySuffix",
750 | "company.catchPhrase",
751 | "company.bs",
752 | "company.catchPhraseAdjective",
753 | "company.catchPhraseDescriptor",
754 | "company.catchPhraseNoun",
755 | "company.bsAdjective",
756 | "company.bsBuzz",
757 | "company.bsNoun"
758 | ]
759 | },
760 |
761 | {
762 | "title": "Dates",
763 | "items": [
764 | "date.past",
765 | "date.future",
766 | "date.recent",
767 | "date.month",
768 | "date.weekday"
769 | ]
770 | },
771 | {
772 | "title": "Finance/Bank",
773 | "items": [
774 | "finance.account",
775 | "finance.accountName",
776 | "finance.mask",
777 | "finance.amount",
778 | "finance.transactionType",
779 | "finance.currencyCode",
780 | "finance.currencyName",
781 | "finance.currencySymbol",
782 | "finance.bitcoinAddress",
783 | "finance.iban",
784 | "finance.bic"
785 | ]
786 | },
787 | {
788 | "title": "Computers/Technical",
789 | "items": [
790 | "hacker.abbreviation",
791 | "hacker.adjective",
792 | "hacker.noun",
793 | "hacker.verb",
794 | "hacker.ingverb",
795 | "hacker.phrase",
796 | "database.column",
797 | "database.type",
798 | "database.collation",
799 | "database.engine"
800 | ]
801 | },
802 | {
803 | "title": "Internet",
804 | "items": [
805 | "internet.email",
806 | "internet.exampleEmail",
807 | "internet.userName",
808 | "internet.protocol",
809 | "internet.url",
810 | "internet.domainName",
811 | "internet.domainSuffix",
812 | "internet.domainWord",
813 | "internet.ip",
814 | "internet.ipv6",
815 | "internet.userAgent",
816 | "internet.color",
817 | "internet.mac",
818 | "internet.password"
819 | ]
820 | },
821 | {
822 | "title": "Lorem",
823 | "items": [
824 | "lorem.word",
825 | "lorem.words",
826 | "lorem.sentence",
827 | "lorem.slug",
828 | "lorem.sentences",
829 | "lorem.paragraph",
830 | "lorem.paragraphs",
831 | "lorem.text",
832 | "lorem.lines"
833 | ]
834 | },
835 | {
836 | "title": "Name",
837 | "items": [
838 | "name.firstName",
839 | "name.lastName",
840 | "name.findName",
841 | "name.jobTitle",
842 | "name.prefix",
843 | "name.suffix",
844 | "name.title",
845 | "name.jobDescriptor",
846 | "name.jobArea",
847 | "name.jobType"
848 | ]
849 | },
850 | {
851 | "title": "Phone",
852 | "items": [
853 | "phone.phoneNumber",
854 | "phone.phoneNumberFormat",
855 | "phone.phoneFormats"
856 | ]
857 | },
858 | {
859 | "title": "Random",
860 | "items": [
861 | "random.number",
862 | "random.uuid",
863 | "random.boolean",
864 | "random.word",
865 | "random.words",
866 | "random.locale",
867 | "random.alphaNumeric"
868 | ]
869 | },
870 | {
871 | "title": "Files",
872 | "items": [
873 | "system.fileName",
874 | "system.commonFileName",
875 | "system.mimeType",
876 | "system.commonFileType",
877 | "system.fileExt",
878 | "system.commonFileExt",
879 | "system.fileType",
880 | "system.semver"
881 | ]
882 | }
883 | ]
884 | }
885 | ]
886 | }
887 | }
888 |
--------------------------------------------------------------------------------
/src/utilities.js:
--------------------------------------------------------------------------------
1 | const sketch = require('sketch');
2 | const UI = require('sketch/ui');
3 |
4 | export function changeLayerName(newLayerName) {
5 | const document = sketch.getSelectedDocument();
6 | const selectedLayers = document.selectedLayers;
7 | let errors = [];
8 |
9 | try {
10 | if (selectedLayers.length === 0) {
11 | UI.message('No layers are selected.');
12 | //errors.push('No layers are selected.');
13 | } else {
14 | selectedLayers.forEach(selectedLayer => {
15 | let layer = document.getLayerWithID(
16 | selectedLayer.symbolInstance
17 | ? selectedLayer.symbolInstance.id
18 | : selectedLayer.id
19 | );
20 | layer.name = newLayerName;
21 | });
22 | }
23 | } catch (error) {
24 | errors.push(error);
25 | }
26 |
27 | if (errors) showUserErrors(errors);
28 | }
29 |
30 | export function showUserErrors(errors) {
31 | if (errors.length === 1) {
32 | UI.alert(
33 | 'Sketch Data Faker Error',
34 | 'A layer named "' +
35 | errors[0].layer.name +
36 | '" returned no data. \n\nPlease double-check the layer name matches one of the data types.'
37 | );
38 | } else if (errors.length > 1) {
39 | function stringError() {
40 | return errors
41 | .map(error => {
42 | return error.layer.name;
43 | })
44 | .join('\n');
45 | }
46 | UI.alert(
47 | 'Sketch Data Faker Error',
48 | `There were some layers that returned no data. \n\nPlease double-check that the following layer names match one of the data types:\n\n${stringError()}`
49 | );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------