1 | <div align="center" style="text-align: center;">
|
2 | <h1 style="border-bottom: none;">@reallyland/really-code-configurator</h1>
|
3 |
|
4 | <p>Configure and generate code snippet for custom element</p>
|
5 | </div>
|
6 |
|
7 | <hr />
|
8 |
|
9 | <a href="https://www.buymeacoffee.com/RLmMhgXFb" target="_blank" rel="noopener noreferrer"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 20px !important;width: auto !important;" ></a>
|
10 | [![tippin.me][tippin-me-badge]][tippin-me-url]
|
11 | [![Follow me][follow-me-badge]][follow-me-url]
|
12 |
|
13 | [![Version][version-badge]][version-url]
|
14 | [![lit-element][lit-element-version-badge]][lit-element-url]
|
15 | [![Node version][node-version-badge]][node-version-url]
|
16 | [![MIT License][mit-license-badge]][mit-license-url]
|
17 |
|
18 | [![Downloads][downloads-badge]][downloads-url]
|
19 | [![Total downloads][total-downloads-badge]][downloads-url]
|
20 | [![Packagephobia][packagephobia-badge]][packagephobia-url]
|
21 | [![Bundlephobia][bundlephobia-badge]][bundlephobia-url]
|
22 |
|
23 | [![CircleCI][circleci-badge]][circleci-url]
|
24 | [![Dependency Status][daviddm-badge]][daviddm-url]
|
25 |
|
26 | [![codebeat badge][codebeat-badge]][codebeat-url]
|
27 | [![Codacy Badge][codacy-badge]][codacy-url]
|
28 | [![Code of Conduct][coc-badge]][coc-url]
|
29 |
|
30 | > Better element for the web
|
31 |
|
32 | ## Table of contents <!-- omit in toc -->
|
33 |
|
34 | - [Pre-requisites](#Pre-requisites)
|
35 | - [Installation](#Installation)
|
36 | - [Usage](#Usage)
|
37 | - [Browser compatibility](#Browser-compatibility)
|
38 | - [API Reference](#API-Reference)
|
39 | - [Demo](#Demo)
|
40 | - [License](#License)
|
41 |
|
42 | ## Pre-requisites
|
43 |
|
44 | - [Java 8][java-url] _(`web-component-tester` works without any issue with Java 8)_
|
45 | - [Node.js][nodejs-url] >= 8.16.0
|
46 | - [NPM][npm-url] >= 6.4.1 ([NPM][npm-url] comes with [Node.js][nodejs-url], no separate installation is required.)
|
47 | - (Optional for non-[VS Code][vscode-url] users) [Syntax Highlighting for lit-html in VS Code][vscode-lit-html-url]
|
48 | - [web-component-tester][web-component-tester-url] >= 6.9.2 (For running tests, it's recommended to install globally on your system due to its insanely huge install size by running `npm i -g web-component-tester`.)
|
49 |
|
50 | ## Installation
|
51 |
|
52 | ```sh
|
53 | # Install via NPM
|
54 | $ npm install @reallyland/really-code-configurator
|
55 | ```
|
56 |
|
57 | ## Usage
|
58 |
|
59 | **properties.config.ts**
|
60 |
|
61 | ```ts
|
62 | import { PropertyValue } from '@reallyland/really-code-configurator';
|
63 |
|
64 | const properties: PropertyValue[] = [
|
65 | {
|
66 | name: 'propertyString',
|
67 | value: 'property',
|
68 | type: 'string',
|
69 | },
|
70 | {
|
71 | name: 'propertyNumber',
|
72 | value: 0,
|
73 | type: 'number',
|
74 | },
|
75 | {
|
76 | name: 'propertyBoolean',
|
77 | value: true,
|
78 | type: 'boolean',
|
79 | },
|
80 | {
|
81 | name: 'propertyWithSelectableOptions',
|
82 | value: 'option-1',
|
83 | type: 'string',
|
84 | options: [
|
85 | {
|
86 | label: 'option-1',
|
87 | value: 'option-1',
|
88 | },
|
89 | {
|
90 | label: 'option-2',
|
91 | value: 'option-2',
|
92 | },
|
93 | {
|
94 | label: 'option-3',
|
95 | value: 'option-3',
|
96 | },
|
97 | ],
|
98 | },
|
99 | ];
|
100 |
|
101 | const cssProperties: PropertyValue[] = [
|
102 | {
|
103 | name: '--test-property-width',
|
104 | value: '2px',
|
105 | }
|
106 | ];
|
107 |
|
108 | export { properties, cssProperties };
|
109 | ```
|
110 |
|
111 | **index.html**
|
112 |
|
113 | ```html
|
114 | <html>
|
115 | <head>
|
116 | <script type="module">
|
117 | import '/path/to/test-property.js';
|
118 | import '/path/to/@reallyland/really-code-configurator.js';
|
119 | import { properties, cssProperties } from '/path/to/properties.config.js';
|
120 |
|
121 | const configuratorEl = document.createElement('.configurator');
|
122 |
|
123 | /** Load `properties` and `cssProperties` */
|
124 | if (configuratorEl) {
|
125 | configuratorEl.properties = properties;
|
126 | configuratorEl.cssProperties = cssProperties;
|
127 | }
|
128 | </script>
|
129 | </head>
|
130 |
|
131 | <body>
|
132 | <really-code-configurator class="configurator" customelement="test-property">
|
133 | <test-property></test-property>
|
134 | </really-code-configurator>
|
135 | </body>
|
136 | </html>
|
137 | ```
|
138 |
|
139 | ## Browser compatibility
|
140 |
|
141 | `really-code-configurator` works in all major browsers (Chrome, Firefox, IE, Edge, Safari, and Opera).
|
142 |
|
143 | [Heavily tested](/.circleci/config.yml) on the following browsers:
|
144 |
|
145 | | Name | OS |
|
146 | | --- | --- |
|
147 | | Internet Explorer 11 | Windows 7 |
|
148 | | Edge 13 | Windows 10 |
|
149 | | Edge 17 | Windows 10 |
|
150 | | Safari 9 | Mac OS X 10.11 |
|
151 | | Safari 10.1 | Mac OS 10.12 |
|
152 | | Chrome 41 ([WRE][wre-url]) | Linux |
|
153 | | Chrome 69 ([WRE 2019][wre-2019-url]) | Windows 10 |
|
154 | | Firefox 62 (w/o native Shadow DOM) | macOS Mojave (10.14) |
|
155 | | Firefox 63 (native Shadow DOM support) | Windows 10 |
|
156 |
|
157 | ## API Reference
|
158 |
|
159 | - [ReallyCodeConfigurator][]
|
160 |
|
161 | ## Demo
|
162 |
|
163 | _Coming soon_
|
164 |
|
165 | ## License
|
166 |
|
167 | [MIT License](https://motss.mit-license.org/) © Rong Sen Ng (motss)
|
168 |
|
169 |
|
170 | [typescript-url]: https://github.com/Microsoft/TypeScript
|
171 | [java-url]: https://www.java.com/en/download
|
172 | [nodejs-url]: https://nodejs.org
|
173 | [npm-url]: https://www.npmjs.com
|
174 | [lit-element-url]: https://github.com/Polymer/lit-element?utm_source=github.com&utm_medium=referral&utm_content=motss/app-datepicker
|
175 | [node-releases-url]: https://nodejs.org/en/download/releases
|
176 | [vscode-url]: https://code.visualstudio.com
|
177 | [vscode-lit-html-url]: https://github.com/mjbvz/vscode-lit-html
|
178 | [web-component-tester-url]: https://github.com/Polymer/tools/tree/master/packages/web-component-tester
|
179 | [wre-url]: https://developers.google.com/search/docs/guides/rendering
|
180 | [wre-2019-url]: https://www.deepcrawl.com/blog/news/what-version-of-chrome-is-google-actually-using-for-rendering
|
181 | [ReallyCodeConfigurator]: /API_REFERENCE.md#reallycodeconfigurator
|
182 |
|
183 |
|
184 | [array-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
185 | [boolean-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
186 | [function-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
|
187 | [map-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
188 | [number-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
|
189 | [object-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
190 | [promise-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
191 | [regexp-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
192 | [set-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
193 | [string-mdn-url]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
|
194 |
|
195 |
|
196 | [tippin-me-badge]: https://badgen.net/badge/%E2%9A%A1%EF%B8%8Ftippin.me/@igarshmyb/F0918E
|
197 | [follow-me-badge]: https://flat.badgen.net/twitter/follow/igarshmyb?icon=twitter
|
198 |
|
199 | [version-badge]: https://flat.badgen.net/npm/v/@reallyland/really-code-configurator?icon=npm
|
200 | [lit-element-version-badge]: https://flat.badgen.net/npm/v/lit-element/latest?icon=npm&label=lit-element
|
201 | [node-version-badge]: https://flat.badgen.net/npm/node/@reallyland/really-code-configurator
|
202 | [mit-license-badge]: https://flat.badgen.net/npm/license/@reallyland/really-code-configurator
|
203 |
|
204 | [downloads-badge]: https://flat.badgen.net/npm/dm/@reallyland/really-code-configurator
|
205 | [total-downloads-badge]: https://flat.badgen.net/npm/dt/@reallyland/really-code-configurator?label=total%20downloads
|
206 | [packagephobia-badge]: https://flat.badgen.net/packagephobia/install/@reallyland/really-code-configurator
|
207 | [bundlephobia-badge]: https://flat.badgen.net/bundlephobia/minzip/@reallyland/really-code-configurator
|
208 |
|
209 | [circleci-badge]: https://flat.badgen.net/circleci/github/reallyland/really-code-configurator?icon=circleci
|
210 | [daviddm-badge]: https://flat.badgen.net/david/dep/reallyland/really-code-configurator
|
211 |
|
212 | [codebeat-badge]: https://codebeat.co/badges/886f771f-87f8-48a8-b0cf-9aa2edf30dc9
|
213 | [codacy-badge]: https://api.codacy.com/project/badge/Grade/56c2dfca027d4b9c9d92e850d68e08eb
|
214 | [coc-badge]: https://flat.badgen.net/badge/code%20of/conduct/pink
|
215 |
|
216 |
|
217 | [tippin-me-url]: https://tippin.me/@igarshmyb
|
218 | [follow-me-url]: https://twitter.com/igarshmyb?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
219 |
|
220 | [version-url]: https://www.npmjs.com/package/@reallyland/really-code-configurator/v/latest?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
221 | [node-version-url]: https://nodejs.org/en/download?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
222 | [mit-license-url]: https://github.com/reallyland/really-code-configurator/blob/master/LICENSE?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
223 |
|
224 | [downloads-url]: https://www.npmtrends.com/@reallyland/really-code-configurator
|
225 | [packagephobia-url]: https://packagephobia.now.sh/result?p=%40reallyland%2Freally-code-configurator
|
226 | [bundlephobia-url]: https://bundlephobia.com/result?p=@reallyland/really-code-configurator
|
227 |
|
228 | [circleci-url]: https://circleci.com/gh/reallyland/really-code-configurator/tree/master?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
229 | [daviddm-url]: https://david-dm.org/reallyland/really-code-configurator?utm_source=github.com&utm_medium=referral&utm_content=@reallyland/really-code-configurator
|
230 |
|
231 | [codebeat-url]: https://codebeat.co/projects/github-com-reallyland-really-code-configurator-master-a97a5a48-afcd-4c3c-97d9-0909cfc2a5e1
|
232 | [codacy-url]: https://www.codacy.com/app/reallyland/really-code-configurator?utm_source=github.com&utm_medium=referral&utm_content=reallyland/really-code-configurator&utm_campaign=Badge_Grade
|
233 | [coc-url]: https://github.com/reallyland/really-code-configurator/blob/master/CODE_OF_CONDUCT.md
|