@stanko/ctrls 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Stanko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,21 @@
1
1
  # Ctrls
2
2
 
3
+ Minimal library for controlling parameters, designed specifically for algorithmic art.
4
+
5
+ [![Multiple Ctrls screenshots, on light and dark backgrounds](https://muffinman.io/ctrls/ctrls.png)](https://muffinman.io/ctrls/)
6
+
3
7
  ## Made for algorithmic art
4
8
 
5
- I made Ctrls for my [algorithmic art projects](https://muffinman.io/art/). By default, the state is saved in the URL, which lets you navigate history and easily share links. Besides standard components like checkboxes and ranges, it also includes two that are especially useful for generative projects: RNG seed and easing. These not only let you adjust parameters but also provide functions (`rng` and `easing`) that you can call directly.
9
+ I built Ctrls for my [algorithmic art projects](https://muffinman.io/art/). By default, the state is saved in the URL, which lets you navigate history and share links easily. Along with standard components like checkboxes and ranges, it includes two especially useful for generative work: RNG seed and easing. These not only let you adjust parameters but also expose functions (rng and easing) you can call directly.
6
10
 
7
- You can play with the live example above or check the older version on my [Space Invaders generator](https://muffinman.io/invaders/).
11
+ Play with the live example above or check the older version in my [Space Invaders generator](https://muffinman.io/invaders/).
8
12
 
9
13
  ## Features
10
14
 
11
15
  - Minimal API
12
- - Six components (RNG seed, easing, boolean, radio, range and dual range)
13
- - Fully typed, including the dynamic typings for properties it controls
14
- - Light and dark themes included
15
- - Easy to theme through CSS variables
16
+ - Six components : RNG seed, easing, boolean, radio, range and dual range
17
+ - Fully typed, including dynamic typings for controlled properties
18
+ - Light and dark themes included, theming via CSS variables
16
19
 
17
20
  ## Quick start
18
21
 
@@ -22,7 +25,7 @@ Install the library:
22
25
  npm install @stanko/ctrls
23
26
  ````
24
27
 
25
- Define your controls as an array and instantiate a `Ctrls` class:
28
+ Define controls as an array, then instantiate the `Ctrls` class:
26
29
 
27
30
  ```ts
28
31
  import { Ctrls } from "@stanko/ctrls";
@@ -62,12 +65,14 @@ export const options = new Ctrls(config, {
62
65
  showRandomizeButton: true,
63
66
  });
64
67
 
68
+ // Render Ctrls elements on the page
69
+ document.querySelector('.my-controls').appendChild(options.element);
70
+
71
+ // If you need to pass values you can export a type for them for convenience
65
72
  export type Options = ReturnValue<options.getValues()>;
66
73
  ```
67
74
 
68
- Add your handlers. Ctrls provides `onChange` and `onInput` methods.
69
-
70
- To get the current values, use `.getValues()`.
75
+ Add `onChange` or `onInput` handlers. If you need to get the current values, use `.getValues()`.
71
76
 
72
77
  ```ts
73
78
  options.onChange = (updatedValues: Partial<Options>) => {
@@ -85,25 +90,45 @@ options.onInput = (updatedValues: Partial<Options>) => {
85
90
 
86
91
  ## API
87
92
 
88
- To instantiate:
93
+ Constructor accepts two parameters - an array of control config object (see below for details) and an options object.
94
+
95
+ ```ts
96
+ constructor(controls: Configs, options?: ControlsOptions)
97
+ ```
98
+
99
+ The available options are:
89
100
 
90
101
  ```ts
91
102
  type ControlsOptions = {
92
- showRandomizeButton?: boolean;
93
- storage?: "hash" | null;
94
- theme?: "system" | "light" | "dark";
103
+ showRandomizeButton?: boolean; // default: true
104
+ storage?: "hash" | "none"; // default: "hash"
105
+ theme?: "system" | "light" | "dark"; // default: "system"
106
+ parent?: Element; // if passed, the Ctrls element will be appended to this HTML element
95
107
  };
96
108
  ```
97
109
 
98
110
  Public API:
99
111
 
100
- * `element`
101
- * `onChange`
102
- * `onInput`
103
- * `getValues`
104
- * `randomize`
112
+ ```ts
113
+ // The main Ctrls element
114
+ .element: HTMLDivElement
115
+
116
+ // Change handler called whenever any of the values is changed.
117
+ // It's only parameter is an object containing the updated values.
118
+ // The only way this object can have multiple attributes is when using the hash storage.
119
+ .onChange(updatedValues)
120
+
121
+ // Input handler called while user is inputting values (while dragging a slider for example).
122
+ // Same as `onChange`, the only parameter is an object containing the updated values.
123
+ .onInput(updatedValues)
124
+
125
+ // Returns the values as an object, including rng and easing functions.
126
+ .getValues()
127
+
128
+ // Randomizes values for all controls that don't have randomization disabled.
129
+ .randomize()
130
+ ```
105
131
 
106
- But technically all of the methods are public. I've done this on purpose to let you experiment.
107
132
 
108
133
  ## Controls
109
134
 
@@ -116,11 +141,11 @@ All controls share the following properties:
116
141
  name: string;
117
142
 
118
143
  // --- Optional --- //
119
- // If passed it will be used instead of the name
144
+ // If passed, it will be used instead of the name
120
145
  label?: string;
121
- // Depends on the control type, if it is not passed it will be randomly generated
146
+ // Depends on the control type, the default value for the control
122
147
  defaultValue?: T;
123
- // Should the value be randomized when randomize button is clicked
148
+ // Disabled the value randomization (via randomize method or button)
124
149
  isRandomizationDisabled?: boolean; // default: false
125
150
  }
126
151
  ```
@@ -129,7 +154,7 @@ Some controls will have a few more properties explained below.
129
154
 
130
155
  ### Boolean
131
156
 
132
- A checkbox control for boolean parameter.
157
+ Checkbox control for boolean parameters.
133
158
 
134
159
  <div class="example">
135
160
 
@@ -144,7 +169,7 @@ A checkbox control for boolean parameter.
144
169
 
145
170
  ### Seed
146
171
 
147
- A text input which generates a random text seed and creates a random number generator using the seed.
172
+ Text input that generates a random text seed and creates a seeded random number generator.
148
173
 
149
174
  <div class="example">
150
175
 
@@ -157,7 +182,7 @@ A text input which generates a random text seed and creates a random number gene
157
182
 
158
183
  </div>
159
184
 
160
- A seeded RNG will be created and it will be included in the values. For the example above the return value of `.getValues()` would look like this:
185
+ A seeded RNG will be created and included in the values. For the example above `.getValues()` returns:
161
186
 
162
187
  ```ts
163
188
  {
@@ -168,7 +193,7 @@ A seeded RNG will be created and it will be included in the values. For the exam
168
193
 
169
194
  ### Easing
170
195
 
171
- Cubic-bezier easing control which also creates easing function you can use directly. It includes five presets, which can be changed through the `presets` property. To disable presets pass an empty array.
196
+ Cubic-bezier easing control that also generates an easing function. Includes five presets (configurable via the `presets` property). Pass an empty array to disable presets.
172
197
 
173
198
  ```ts
174
199
  {
@@ -198,7 +223,7 @@ Example:
198
223
 
199
224
  Please note that the string `ease_` will be removed from the preset labels.
200
225
 
201
- An easing function will be created and it will be included in the values. For the example above the return value of `.getValues()` would look like this:
226
+ An easing function will be created and included in the values. For the example above `.getValues()` returns:
202
227
 
203
228
  ```ts
204
229
  {
@@ -209,7 +234,7 @@ An easing function will be created and it will be included in the values. For th
209
234
 
210
235
  ### Range
211
236
 
212
- A range slider that controls a number parameter. Accepts minimum, maximum and step values. It includes a few additional properties:
237
+ Range slider that controls a number parameter. Accepts minimum, maximum and step values. It includes a few additional properties:
213
238
 
214
239
  ```ts
215
240
  {
@@ -241,7 +266,7 @@ Example:
241
266
 
242
267
  ### Dual range
243
268
 
244
- A range input with two handles that control minimum and maximum values. Includes the same additional properties as the range input.
269
+ Range input with two handles that control minimum and maximum values. Includes the same additional properties as the range input. Uses my own [dual-range-input](https://github.com/stanko/dual-range-input) library.
245
270
 
246
271
  ```ts
247
272
  {
@@ -273,7 +298,7 @@ Example:
273
298
 
274
299
  ### Radio
275
300
 
276
- A grid of radio buttons. Can be set to have between one and five columns.
301
+ Grid of radio buttons. Can be set to have between one and five columns.
277
302
 
278
303
  ```ts
279
304
  {
@@ -308,27 +333,38 @@ Example:
308
333
 
309
334
  ## Theming
310
335
 
311
- Ctrls relies on CSS variables for theming. There is a lot of variables you can tweak, but I suggest starting with these four:
336
+ Ctrls uses CSS variables for theming. There are many you can adjust, but I recommend starting with these four:
337
+
338
+ ```scss
339
+ .ctrls {
340
+ // Theme color's hue, default is blue
341
+ --ctrls-h: 245;
312
342
 
313
- ```css
314
- --ctrls-c: 0.7;
315
- --ctrls-h: 220;
316
- --ctrls-radius: 4px;
317
- --ctrls-range-thumb-radius: 4px;
343
+ // Theme color's chroma
344
+ --ctrls-c: 0.25;
345
+
346
+ // Radius
347
+ --ctrls-radius: 4px;
348
+ --ctrls-range-thumb-radius: 4px;
349
+ }
318
350
  ```
319
351
 
352
+ Try tweaking these values live in this example. For convenience, the range thumb radius is set to half the main radius.
353
+
320
354
  <div class="theme-controls">
321
355
  </div>
322
356
 
357
+ Check [the source file](https://github.com/Stanko/ctrls/blob/dev/src/scss/_ctrls.scss) to see all of the available variables.
358
+
323
359
  ## Why?
324
360
 
325
- You might ask why I made another library when [dat.GUI](https://github.com/dataarts/dat.gui) and [TweakPane](https://tweakpane.github.io/docs/) already exist. They both solve a general use case, with extensive options and elaborate APIs, while I wanted something smaller and easier to adapt for [my algorithmic drawings](https://muffinman.io/art/).
361
+ You might ask why I made another library when [dat.GUI](https://github.com/dataarts/dat.gui) and [TweakPane](https://tweakpane.github.io/docs/) already exist. Both target general use cases with extensive options and elaborate APIs, while I wanted something smaller and easier to adapt for [my algorithmic drawings](https://muffinman.io/art/).
326
362
 
327
- I originally built a crude library with no plans to release it. Over time I polished it, ported it to TypeScript, and realized it might actually be useful to others. The code is solid, though I would love to add a few more features.
363
+ I first hacked together a crude library with no plans to release it. Over time I polished it, ported it to TypeScript, and realized it could be useful to others. The code is solid, though I would love to add a few more features.
328
364
 
329
- Ctrls is a very opinionated library tailored to my likings. I'm open to suggestions, but they need to fit algorithmic art workflows and align with my vision. It's not meant to be a general-purpose library - others already cover that space well.
365
+ Ctrls is opinionated and tailored to my likings. I'm open to suggestions, but they need to fit algorithmic art use-case and align with my vision. It's not meant to be a general-purpose library - others already cover that space well.
330
366
 
331
- I also want to mention that I really like TweakPane, and Ctrls' homepage is heavily influenced by it.
367
+ Finally, I should note that I really like Tweakpane, and Ctrls homepage is heavily inspired by it.
332
368
 
333
369
  ## Cheers!
334
370
 
@@ -336,14 +372,14 @@ Thank you for stopping by! If you end up using Ctrls, please let me know, I woul
336
372
 
337
373
  ## TODO
338
374
 
339
- * [ ] Demo - favicon and metadata
340
- * [ ] Readme - screenshots
341
- * [ ] Prefix input names' with `ctrl_${id}_${name}` to avoid collisions
342
375
  * [ ] Allow users to pass a custom PRNG lib
343
376
  * [ ] Hash storage - check if there is an instance using hash storage already
344
- * [ ] Demo - stop animation when not in viewport
345
377
  * [ ] Add title which collapses the controls
346
378
  * [ ] Storage - local storage
379
+ * [x] Prefix input names' with `ctrl_${id}_${name}` to avoid collisions
380
+ * [x] Demo - stop animation when not in viewport
381
+ * [x] Demo - favicon and metadata
382
+ * [x] Readme - screenshots
347
383
  * [x] Use web safe / system fonts by default
348
384
  * [x] Experiment with chroma for light and dark shades of the main color
349
385
  * [x] On input event / handler
@@ -17,6 +17,7 @@ export declare class RadioCtrl implements Ctrl<string> {
17
17
  items: Option[];
18
18
  element: HTMLElement;
19
19
  columns: 1 | 2 | 3 | 4 | 5;
20
+ id: string;
20
21
  constructor(config: CtrlTypeRegistry["radio"]["config"], onChange: CtrlChangeHandler<string>, onInput: CtrlChangeHandler<string>);
21
22
  parse: (string: string) => string;
22
23
  getRandomValue: () => string;
@@ -1,4 +1,6 @@
1
1
  import random from "../utils/random";
2
+ import { toKebabCase } from "../utils/string-utils";
3
+ import { getRandomString } from "../utils/get-random-string";
2
4
  export class RadioCtrl {
3
5
  constructor(config, onChange, onInput) {
4
6
  this.type = "radio";
@@ -21,7 +23,7 @@ export class RadioCtrl {
21
23
  const inputs = items.map((item) => {
22
24
  const input = document.createElement("input");
23
25
  input.setAttribute("type", "radio");
24
- input.setAttribute("name", this.name);
26
+ input.setAttribute("name", this.id);
25
27
  input.setAttribute("value", item.value);
26
28
  input.checked = item.value === value;
27
29
  input.addEventListener("change", () => {
@@ -58,7 +60,9 @@ export class RadioCtrl {
58
60
  this.value = item?.value || this.getDefaultValue();
59
61
  // Unselect previous option
60
62
  const prev = this.element.querySelector(`input:checked`);
61
- prev.checked = false;
63
+ if (prev) {
64
+ prev.checked = false;
65
+ }
62
66
  // Select new option
63
67
  const next = this.element.querySelector(`[value="${this.value}"]`);
64
68
  next.checked = true;
@@ -73,6 +77,7 @@ export class RadioCtrl {
73
77
  this.columns = config.columns || 3;
74
78
  this.name = config.name;
75
79
  this.label = config.label || config.name;
80
+ this.id = `ctrls-${getRandomString()}-${toKebabCase(this.name)}`;
76
81
  const defaultValue = this.items.find((item) => item.value === config.defaultValue);
77
82
  this.value = defaultValue?.value || this.getDefaultValue();
78
83
  this.isRandomizationDisabled = config.isRandomizationDisabled || false;
@@ -94,6 +94,7 @@ type ControlsOptions = {
94
94
  showRandomizeButton?: boolean;
95
95
  storage?: "hash" | "none";
96
96
  theme?: "system" | "light" | "dark";
97
+ parent?: Element;
97
98
  };
98
99
  export declare class Ctrls<Configs extends readonly TypedControlConfig[]> {
99
100
  options: ControlsOptions;
@@ -141,6 +141,9 @@ export class Ctrls {
141
141
  if (this.options.storage === "hash") {
142
142
  this.addHashListeners();
143
143
  }
144
+ if (this.options.parent) {
145
+ this.options.parent.appendChild(this.element);
146
+ }
144
147
  }
145
148
  getValues() {
146
149
  const options = {};
package/dist/ctrls.css CHANGED
@@ -209,7 +209,7 @@
209
209
  --ctrls-checkbox-hover-text: var(--ctrls-gray-200);
210
210
  --ctrls-checkbox-checked-bg: var(--ctrls-theme);
211
211
  --ctrls-checkbox-checked-text: var(--ctrls-gray-50);
212
- --ctrls-checkbox-checked-hover-bg: oklch(0.4 0.35 var(--ctrls-h));
212
+ --ctrls-checkbox-checked-hover-bg: oklch(0.5 var(--ctrls-c) var(--ctrls-h));
213
213
  --ctrls-easing-border: var(--ctrls-gray-200);
214
214
  --ctrls-ctrls__easing-handle-bg: var(--ctrls-gray-50);
215
215
  --ctrls-ctrls__easing-handle-border: var(--ctrls-gray-300);
@@ -236,6 +236,9 @@
236
236
  --ctrls-btn-bg: oklch(0.2 0.001 var(--ctrls-h));
237
237
  --ctrls-btn-hover-bg: oklch(0.1 0.001 var(--ctrls-h));
238
238
  --ctrls-input-bg: var(--ctrls-input-wrapper-bg);
239
+ --ctrls-checkbox-checked-hover-bg: oklch(
240
+ 0.45 calc(var(--ctrls-c) - 0.1) var(--ctrls-h)
241
+ );
239
242
  }
240
243
  }
241
244
  .ctrls--dark-theme {
@@ -258,6 +261,9 @@
258
261
  --ctrls-btn-bg: oklch(0.2 0.001 var(--ctrls-h));
259
262
  --ctrls-btn-hover-bg: oklch(0.1 0.001 var(--ctrls-h));
260
263
  --ctrls-input-bg: var(--ctrls-input-wrapper-bg);
264
+ --ctrls-checkbox-checked-hover-bg: oklch(
265
+ 0.45 calc(var(--ctrls-c) - 0.1) var(--ctrls-h)
266
+ );
261
267
  }
262
268
 
263
269
  .ctrls {
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../node_modules/@stanko/dual-range-input/dist/index.css","../src/scss/_ctrls.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;;AC3IF;EACE;AAAA;AAAA;EAGA;EACA;EACA;EACA;EAGA;EACA;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EACA;EAEA;EACA;EAGA;EAGA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAGA;EACA;EAEA;EAEA;EACA;EAEA;EAGA;EAEA;EACA;;;AA0CF;EACE;IAtCA;IAEA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IAGA;IAGA;IACA;IACA;IAGA;IACA;IAGA;IAGA;IAEA;IAGA;;;AASF;EA3CE;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EAGA;;;AAeF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EAGE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;;AAGF;EACE;EACA;;;AAIJ;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;;AAGF;EACE;EACA,YACE;;AAIJ;EACE;;;AAKJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;;;AAOA;EACE;;AAGF;AAAA;AAAA;EAEE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAKA;AAAA;EACE;EACA;EACA;;;AAIJ;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAIF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAmCJ;EA5BE;EACA;EACA;EACA;EACA;EAEA;;;AA0BF;EAhCE;EACA;EACA;EACA;EACA;EAEA;;;AA8BF;EAtBE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAkBA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAKF;EAvDE;EACA;EACA;EACA;EACA;EAEA;;;AAqDF;EA7CE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAwCA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EAGE;;AAEA;EACE;;AANJ;EASE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;;AAIJ;AAEA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAEF;EACA;EACA;;AAEA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;;AAIE;EACE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EAEE;;AAEA;EACE;EACA","file":"ctrls.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../node_modules/@stanko/dual-range-input/dist/index.css","../src/scss/_ctrls.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;;AC3IF;EACE;AAAA;AAAA;EAGA;EACA;EACA;EACA;EAGA;EACA;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EACA;EAEA;EACA;EAGA;EAGA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAGA;EACA;EAEA;EAEA;EACA;EAEA;EAGA;EAEA;EACA;;;AA+CF;EACE;IA3CA;IAEA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IAGA;IAGA;IACA;IACA;IAGA;IACA;IAGA;IAGA;IAEA;IAGA;IAGA;AAAA;AAAA;;;AAWF;EAhDE;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EAGA;EAGA;AAAA;AAAA;;;AAiBF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EAGE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;;AAGF;EACE;EACA;;;AAIJ;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;;AAGF;EACE;EACA,YACE;;AAIJ;EACE;;;AAKJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;;;AAOA;EACE;;AAGF;AAAA;AAAA;EAEE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAKA;AAAA;EACE;EACA;EACA;;;AAIJ;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAIF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAmCJ;EA5BE;EACA;EACA;EACA;EACA;EAEA;;;AA0BF;EAhCE;EACA;EACA;EACA;EACA;EAEA;;;AA8BF;EAtBE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAkBA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAKF;EAvDE;EACA;EACA;EACA;EACA;EAEA;;;AAqDF;EA7CE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAwCA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EAGE;;AAEA;EACE;;AANJ;EASE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;;AAIJ;AAEA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAEF;EACA;EACA;;AAEA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;;AAIE;EACE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EAEE;;AAEA;EACE;EACA","file":"ctrls.css"}
@@ -0,0 +1 @@
1
+ export declare const getRandomString: (slice?: number) => string;
@@ -0,0 +1,5 @@
1
+ export const getRandomString = (slice = 4) => {
2
+ const random = Math.random().toString(36).substring(2).slice(0, slice);
3
+ const time = Date.now().toString(36).slice(0, slice);
4
+ return `${random}${time}`;
5
+ };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@stanko/ctrls",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "start": "vite",
7
- "build": "tsc && vite build",
6
+ "start": "npm run parse-markdown && vite",
7
+ "build": "npm run parse-markdown && tsc && rm -rf ./docs && vite build && touch ./docs/.nojekyll",
8
8
  "build-css": "sass ./src/scss/index.scss ./dist/ctrls.css",
9
9
  "build-lib": "rm -rf ./dist && tsc -p ./tsconfig-lib.json && npm run build-css",
10
+ "parse-markdown": "node ./parse-markdown.js",
10
11
  "preview": "vite preview",
11
12
  "prepare": "cp ./pre-commit ./.git/hooks/pre-commit && chmod +x ./.git/hooks/pre-commit"
12
13
  },
Binary file
Binary file