@rettangoli/ui 0.1.2-rc3 → 0.1.2-rc31

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.
Files changed (56) hide show
  1. package/dist/rettangoli-iife-layout.min.js +115 -43
  2. package/dist/rettangoli-iife-ui.min.js +187 -67
  3. package/package.json +5 -3
  4. package/src/cli/buildSvg.js +86 -0
  5. package/src/cli/index.js +1 -0
  6. package/src/common.js +19 -0
  7. package/src/components/breadcrumb/breadcrumb.handlers.js +9 -0
  8. package/src/components/breadcrumb/breadcrumb.store.js +29 -0
  9. package/src/components/breadcrumb/breadcrumb.view.yaml +64 -0
  10. package/src/components/dropdownMenu/dropdownMenu.handlers.js +4 -4
  11. package/src/components/dropdownMenu/dropdownMenu.store.js +5 -17
  12. package/src/components/dropdownMenu/dropdownMenu.view.yaml +15 -13
  13. package/src/components/form/form.handlers.js +173 -25
  14. package/src/components/form/form.store.js +176 -22
  15. package/src/components/form/form.view.yaml +217 -33
  16. package/src/components/pageOutline/pageOutline.handlers.js +57 -17
  17. package/src/components/pageOutline/pageOutline.store.js +46 -1
  18. package/src/components/pageOutline/pageOutline.view.yaml +7 -5
  19. package/src/components/popoverInput/popoverInput.handlers.js +99 -0
  20. package/src/components/popoverInput/popoverInput.store.js +48 -0
  21. package/src/components/popoverInput/popoverInput.view.yaml +55 -0
  22. package/src/components/select/select.handlers.js +116 -11
  23. package/src/components/select/select.store.js +84 -18
  24. package/src/components/select/select.view.yaml +40 -10
  25. package/src/components/sidebar/sidebar.view.yaml +1 -1
  26. package/src/components/sliderInput/sliderInput.handlers.js +41 -0
  27. package/src/components/sliderInput/sliderInput.store.js +18 -0
  28. package/src/components/sliderInput/sliderInput.view.yaml +42 -0
  29. package/src/components/table/table.handlers.js +1 -1
  30. package/src/components/tabs/tabs.handlers.js +10 -0
  31. package/src/components/tabs/tabs.store.js +29 -0
  32. package/src/components/tabs/tabs.view.yaml +64 -0
  33. package/src/components/tooltip/tooltip.handlers.js +0 -0
  34. package/src/components/tooltip/tooltip.store.js +12 -0
  35. package/src/components/tooltip/tooltip.view.yaml +27 -0
  36. package/src/components/waveform/waveform.handlers.js +92 -0
  37. package/src/components/waveform/waveform.store.js +17 -0
  38. package/src/components/waveform/waveform.view.yaml +38 -0
  39. package/src/entry-iife-layout.js +3 -0
  40. package/src/entry-iife-ui.js +4 -0
  41. package/src/index.js +5 -1
  42. package/src/primitives/button.js +10 -0
  43. package/src/primitives/colorPicker.js +9 -0
  44. package/src/primitives/dialog.js +254 -0
  45. package/src/primitives/input.js +41 -11
  46. package/src/primitives/popover.js +280 -0
  47. package/src/primitives/slider.js +18 -9
  48. package/src/primitives/svg.js +2 -0
  49. package/src/primitives/textarea.js +25 -1
  50. package/src/styles/cursorStyles.js +38 -2
  51. package/src/components/dialog/dialog.handlers.js +0 -5
  52. package/src/components/dialog/dialog.store.js +0 -25
  53. package/src/components/dialog/dialog.view.yaml +0 -44
  54. package/src/components/popover/popover.handlers.js +0 -5
  55. package/src/components/popover/popover.store.js +0 -12
  56. package/src/components/popover/popover.view.yaml +0 -57
@@ -1,5 +1,5 @@
1
- import {
2
- css,
1
+ import {
2
+ css,
3
3
  dimensionWithUnit,
4
4
  convertObjectToCssString,
5
5
  styleMapKeys,
@@ -22,7 +22,6 @@ class RettangoliSliderElement extends HTMLElement {
22
22
  input[type="range"] {
23
23
  -webkit-appearance: none;
24
24
  appearance: none;
25
- width: 200px;
26
25
  height: 8px;
27
26
  background: var(--muted);
28
27
  border-radius: var(--border-radius-full);
@@ -79,7 +78,7 @@ class RettangoliSliderElement extends HTMLElement {
79
78
  RettangoliSliderElement.initializeStyleSheet();
80
79
  this.shadow = this.attachShadow({ mode: "closed" });
81
80
  this.shadow.adoptedStyleSheets = [RettangoliSliderElement.styleSheet];
82
-
81
+
83
82
  // Initialize style tracking properties
84
83
  this._styles = {
85
84
  default: {},
@@ -89,12 +88,12 @@ class RettangoliSliderElement extends HTMLElement {
89
88
  xl: {},
90
89
  };
91
90
  this._lastStyleString = "";
92
-
91
+
93
92
  // Create initial DOM structure
94
93
  this._inputElement = document.createElement('input');
95
94
  this._inputElement.type = 'range';
96
95
  this._styleElement = document.createElement('style');
97
-
96
+
98
97
  this.shadow.appendChild(this._styleElement);
99
98
  this.shadow.appendChild(this._inputElement);
100
99
 
@@ -105,7 +104,7 @@ class RettangoliSliderElement extends HTMLElement {
105
104
 
106
105
  static get observedAttributes() {
107
106
  return [
108
- "key",
107
+ "key",
109
108
  "value",
110
109
  "min",
111
110
  "max",
@@ -149,6 +148,16 @@ class RettangoliSliderElement extends HTMLElement {
149
148
  };
150
149
 
151
150
  attributeChangedCallback(name, oldValue, newValue) {
151
+ // Handle key attribute change - reset value
152
+ if (name === "key" && oldValue !== newValue) {
153
+ requestAnimationFrame(() => {
154
+ const value = this.getAttribute("value");
155
+ const min = this.getAttribute("min") || "0";
156
+ this._inputElement.value = value ?? min;
157
+ });
158
+ return;
159
+ }
160
+
152
161
  // Handle input-specific attributes first
153
162
  if (["value", "min", "max", "step", "disabled"].includes(name)) {
154
163
  this._updateInputAttributes();
@@ -248,7 +257,7 @@ class RettangoliSliderElement extends HTMLElement {
248
257
  } else {
249
258
  this._inputElement.step = "1";
250
259
  }
251
-
260
+
252
261
  if (isDisabled) {
253
262
  this._inputElement.setAttribute("disabled", "");
254
263
  } else {
@@ -266,4 +275,4 @@ export default ({ render, html }) => {
266
275
  // Note: render and html parameters are accepted but not used
267
276
  // This maintains backward compatibility with existing code
268
277
  return RettangoliSliderElement;
269
- };
278
+ };
@@ -1,6 +1,7 @@
1
1
  import { css, dimensionWithUnit } from "../common.js";
2
2
  import flexChildStyles from "../styles/flexChildStyles.js";
3
3
  import paddingSvgStyles from "../styles/paddingSvgStyles.js";
4
+ import marginStyles from "../styles/marginStyles.js";
4
5
  import cursorStyles from "../styles/cursorStyles.js";
5
6
  import textColorStyles from "../styles/textColorStyles.js";
6
7
 
@@ -18,6 +19,7 @@ class RettangoliSvgElement extends HTMLElement {
18
19
  }
19
20
  ${textColorStyles}
20
21
  ${paddingSvgStyles}
22
+ ${marginStyles}
21
23
  ${flexChildStyles}
22
24
  ${cursorStyles}
23
25
  `);
@@ -48,10 +48,21 @@ class RettangoliTextAreaElement extends HTMLElement {
48
48
  this._textareaElement = document.createElement('textarea');
49
49
  this._textareaElement.setAttribute('type', 'text');
50
50
  this.shadow.appendChild(this._textareaElement);
51
+
52
+ // Bind event handler
53
+ this._textareaElement.addEventListener('input', this._onChange);
51
54
  }
52
55
 
56
+ _onChange = (event) => {
57
+ this.dispatchEvent(new CustomEvent('textarea-change', {
58
+ detail: {
59
+ value: this._textareaElement.value,
60
+ },
61
+ }));
62
+ };
63
+
53
64
  static get observedAttributes() {
54
- return ["key", "w", "ellipsis", "cols", "rows", "placeholder"];
65
+ return ["key", "w", "ellipsis", "cols", "rows", "placeholder", "value"];
55
66
  }
56
67
 
57
68
  get value() {
@@ -67,6 +78,14 @@ class RettangoliTextAreaElement extends HTMLElement {
67
78
  }
68
79
 
69
80
  attributeChangedCallback(name, oldValue, newValue) {
81
+ // Handle key attribute change - reset value
82
+ if (name === "key" && oldValue !== newValue) {
83
+ requestAnimationFrame(() => {
84
+ const value = this.getAttribute("value");
85
+ this._textareaElement.value = value ?? "";
86
+ });
87
+ return;
88
+ }
70
89
  this._updateTextareaAttributes();
71
90
  }
72
91
 
@@ -74,6 +93,7 @@ class RettangoliTextAreaElement extends HTMLElement {
74
93
  const cols = this.getAttribute("cols");
75
94
  const rows = this.getAttribute("rows");
76
95
  const placeholder = this.getAttribute("placeholder");
96
+ const value = this.getAttribute("value");
77
97
 
78
98
  if (cols !== null) {
79
99
  this._textareaElement.setAttribute("cols", cols);
@@ -92,6 +112,10 @@ class RettangoliTextAreaElement extends HTMLElement {
92
112
  } else {
93
113
  this._textareaElement.removeAttribute("placeholder");
94
114
  }
115
+
116
+ if (value !== null) {
117
+ this._textareaElement.value = value;
118
+ }
95
119
  }
96
120
  }
97
121
 
@@ -2,10 +2,46 @@ import { generateCSS } from '../common.js'
2
2
 
3
3
  const styles = {
4
4
  "cur": {
5
- "p": "pointer",
6
- "m": "move",
5
+ "alias": "alias",
6
+ "all-scroll": "all-scroll",
7
+ "auto": "auto",
8
+ "cell": "cell",
9
+ "col-resize": "col-resize",
10
+ "context-menu": "context-menu",
11
+ "copy": "copy",
12
+ "crosshair": "crosshair",
13
+ "default": "default",
14
+ "e-resize": "e-resize",
15
+ "ew-resize": "ew-resize",
7
16
  "grab": "grab",
8
17
  "grabbing": "grabbing",
18
+ "help": "help",
19
+ "move": "move",
20
+ "n-resize": "n-resize",
21
+ "ne-resize": "ne-resize",
22
+ "nesw-resize": "nesw-resize",
23
+ "ns-resize": "ns-resize",
24
+ "nw-resize": "nw-resize",
25
+ "nwse-resize": "nwse-resize",
26
+ "no-drop": "no-drop",
27
+ "none": "none",
28
+ "not-allowed": "not-allowed",
29
+ "pointer": "pointer",
30
+ "progress": "progress",
31
+ "row-resize": "row-resize",
32
+ "s-resize": "s-resize",
33
+ "se-resize": "se-resize",
34
+ "sw-resize": "sw-resize",
35
+ "text": "text",
36
+ "url": "url",
37
+ "w-resize": "w-resize",
38
+ "wait": "wait",
39
+ "zoom-in": "zoom-in",
40
+ "zoom-out": "zoom-out",
41
+
42
+ // Keep short aliases for common cursors
43
+ "p": "pointer",
44
+ "m": "move",
9
45
  },
10
46
  };
11
47
 
@@ -1,5 +0,0 @@
1
-
2
- export const handleClickDialogueOverlay = (e, deps) => {
3
- const { dispatchEvent } = deps;
4
- dispatchEvent(new CustomEvent('close-dialogue'));
5
- }
@@ -1,25 +0,0 @@
1
- export const INITIAL_STATE = Object.freeze({
2
- //
3
- });
4
-
5
- export const toViewData = ({ state, props }) => {
6
- return {
7
- isOpen: props.isOpen,
8
- w: props.w || 600,
9
- position: {
10
- x: 0,
11
- y: 0
12
- }
13
- };
14
- }
15
-
16
- export const selectState = ({ state }) => {
17
- return state;
18
- }
19
-
20
- export const setState = (state) => {
21
- // do doSomething
22
- }
23
-
24
-
25
-
@@ -1,44 +0,0 @@
1
- elementName: rtgl-dialog
2
-
3
- viewDataSchema:
4
- type: object
5
-
6
- propsSchema:
7
- type: object
8
- properties:
9
- isOpen:
10
- type: boolean
11
- w:
12
- type: string
13
-
14
- refs:
15
- dialog-overlay:
16
- eventListeners:
17
- click:
18
- handler: handleClickDialogueOverlay
19
-
20
- events:
21
- close-dialogue:
22
- type: object
23
- properties: {}
24
-
25
- styles:
26
- # '@keyframes dialog-in':
27
- # from:
28
- # opacity: 0
29
- # transform: scale(0.95)
30
- # to:
31
- # opacity: 1
32
- # transform: scale(1)
33
-
34
- # '#dialog-container':
35
- # animation: dialog-in 150ms cubic-bezier(0.16, 1, 0.3, 1)
36
- # transform-origin: top
37
-
38
- template:
39
- - $if isOpen:
40
- - rtgl-view pos=fix cor=full ah=c:
41
- - 'rtgl-view#dialog-overlay pos=fix cor=full ah=c av=c bgc=bg op=0.5':
42
- - rtgl-view h=10vh:
43
- - rtgl-view#dialog-container z=100 bw=xs p=lg bgc=bg w=${w} br=sm:
44
- - slot name=content:
@@ -1,5 +0,0 @@
1
-
2
- export const handleClickOverlay = (e, deps) => {
3
- const { dispatchEvent } = deps;
4
- dispatchEvent(new CustomEvent('click-overlay'));
5
- }
@@ -1,12 +0,0 @@
1
- export const INITIAL_STATE = Object.freeze({});
2
-
3
- export const toViewData = ({ state, props }) => {
4
- return {
5
- isOpen: props.isOpen,
6
- position: props.position,
7
- };
8
- }
9
-
10
- export const selectState = ({ state }) => {
11
- return state;
12
- }
@@ -1,57 +0,0 @@
1
- elementName: rtgl-popover
2
-
3
- viewDataSchema:
4
- type: object
5
- properties:
6
- isOpen:
7
- type: boolean
8
- position:
9
- type: object
10
- properties:
11
- x:
12
- type: number
13
- y:
14
- type: number
15
- placement:
16
- type: string
17
-
18
- propsSchema:
19
- type: object
20
- properties:
21
- placement:
22
- type: string
23
- default: bottom
24
- isOpen:
25
- type: boolean
26
- position:
27
- type: object
28
- properties:
29
- x:
30
- type: number
31
- y:
32
- type: number
33
-
34
- refs:
35
- popoverOverlay:
36
- eventListeners:
37
- click:
38
- handler: handleClickOverlay
39
-
40
- styles:
41
- '@keyframes popover-in':
42
- from:
43
- opacity: 0
44
- transform: scale(0.95)
45
- to:
46
- opacity: 1
47
- transform: scale(1)
48
-
49
- '#popoverContainer':
50
- animation: popover-in 150ms cubic-bezier(0.16, 1, 0.3, 1)
51
- transform-origin: top
52
-
53
- template:
54
- - $if isOpen:
55
- - rtgl-view#popoverOverlay pos=fix cor=full:
56
- - 'rtgl-view#popoverContainer pos=fix style="left: ${position.x}px; top: ${position.y}px;" id=floatingElement bw=xs p=md bgc=mu':
57
- - slot name=content: