@rettangoli/ui 0.1.31 → 1.0.0-rc1

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 (89) hide show
  1. package/README.md +20 -85
  2. package/dist/rettangoli-iife-layout.min.js +113 -173
  3. package/dist/rettangoli-iife-ui.min.js +123 -183
  4. package/package.json +5 -4
  5. package/src/common/dimensions.js +72 -0
  6. package/src/common/link.js +111 -0
  7. package/src/common/responsive.js +8 -0
  8. package/src/common.js +43 -8
  9. package/src/components/accordionItem/accordionItem.handlers.js +1 -1
  10. package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
  11. package/src/components/accordionItem/accordionItem.store.js +8 -8
  12. package/src/components/accordionItem/accordionItem.view.yaml +5 -35
  13. package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
  14. package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
  15. package/src/components/breadcrumb/breadcrumb.store.js +66 -10
  16. package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
  17. package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
  18. package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
  19. package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
  20. package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
  21. package/src/components/form/form.handlers.js +25 -108
  22. package/src/components/form/form.schema.yaml +283 -0
  23. package/src/components/form/form.store.js +19 -14
  24. package/src/components/form/form.view.yaml +28 -319
  25. package/src/components/globalUi/globalUi.handlers.js +2 -2
  26. package/src/components/globalUi/globalUi.schema.yaml +8 -0
  27. package/src/components/globalUi/globalUi.store.js +8 -8
  28. package/src/components/globalUi/globalUi.view.yaml +9 -46
  29. package/src/components/navbar/navbar.handlers.js +1 -1
  30. package/src/components/navbar/navbar.schema.yaml +25 -0
  31. package/src/components/navbar/navbar.store.js +28 -14
  32. package/src/components/navbar/navbar.view.yaml +21 -65
  33. package/src/components/pageOutline/pageOutline.handlers.js +17 -11
  34. package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
  35. package/src/components/pageOutline/pageOutline.store.js +6 -7
  36. package/src/components/pageOutline/pageOutline.view.yaml +1 -29
  37. package/src/components/popoverInput/popoverInput.handlers.js +31 -31
  38. package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
  39. package/src/components/popoverInput/popoverInput.store.js +9 -9
  40. package/src/components/popoverInput/popoverInput.view.yaml +5 -22
  41. package/src/components/select/select.handlers.js +31 -35
  42. package/src/components/select/select.schema.yaml +36 -0
  43. package/src/components/select/select.store.js +34 -35
  44. package/src/components/select/select.view.yaml +13 -56
  45. package/src/components/sidebar/sidebar.handlers.js +5 -5
  46. package/src/components/sidebar/sidebar.schema.yaml +57 -0
  47. package/src/components/sidebar/sidebar.store.js +45 -23
  48. package/src/components/sidebar/sidebar.view.yaml +79 -174
  49. package/src/components/sliderInput/sliderInput.handlers.js +28 -8
  50. package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
  51. package/src/components/sliderInput/sliderInput.store.js +9 -9
  52. package/src/components/sliderInput/sliderInput.view.yaml +8 -33
  53. package/src/components/table/table.handlers.js +3 -3
  54. package/src/components/table/table.schema.yaml +27 -0
  55. package/src/components/table/table.store.js +8 -8
  56. package/src/components/table/table.view.yaml +16 -62
  57. package/src/components/tabs/tabs.schema.yaml +26 -0
  58. package/src/components/tabs/tabs.store.js +12 -9
  59. package/src/components/tabs/tabs.view.yaml +4 -60
  60. package/src/components/tooltip/tooltip.schema.yaml +18 -0
  61. package/src/components/tooltip/tooltip.store.js +7 -7
  62. package/src/components/tooltip/tooltip.view.yaml +4 -22
  63. package/src/components/waveform/waveform.handlers.js +6 -6
  64. package/src/components/waveform/waveform.schema.yaml +25 -0
  65. package/src/components/waveform/waveform.store.js +6 -6
  66. package/src/components/waveform/waveform.view.yaml +6 -34
  67. package/src/deps/createGlobalUI.js +2 -2
  68. package/src/primitives/button.js +200 -114
  69. package/src/primitives/colorPicker.js +56 -50
  70. package/src/primitives/dialog.js +2 -1
  71. package/src/primitives/image.js +73 -103
  72. package/src/primitives/input-number.js +139 -93
  73. package/src/primitives/input.js +87 -64
  74. package/src/primitives/popover.js +36 -28
  75. package/src/primitives/slider.js +6 -4
  76. package/src/primitives/svg.js +9 -10
  77. package/src/primitives/text.js +26 -47
  78. package/src/primitives/textarea.js +25 -9
  79. package/src/primitives/view.js +49 -90
  80. package/src/setup.js +1 -7
  81. package/src/styles/buttonMarginStyles.js +1 -13
  82. package/src/styles/cursorStyles.js +1 -5
  83. package/src/styles/flexDirectionStyles.js +4 -4
  84. package/src/styles/marginStylesForTarget.js +13 -0
  85. package/src/styles/textColorStyles.js +14 -6
  86. package/src/styles/textStyles.js +4 -4
  87. package/src/styles/viewStyles.js +6 -6
  88. package/src/styles/viewStylesForTarget.js +58 -0
  89. package/src/styles/flexChildStyles.js +0 -43
@@ -1,16 +1,19 @@
1
1
  export const createInitialState = () => Object.freeze({});
2
2
 
3
- const blacklistedAttrs = ['id', 'class', 'style', 'slot'];
3
+ const blacklistedProps = ["id", "class", "style", "slot", "items", "selectedTab"];
4
4
 
5
- const stringifyAttrs = (attrs) => {
6
- return Object.entries(attrs).filter(([key]) => !blacklistedAttrs.includes(key)).map(([key, value]) => `${key}=${value}`).join(' ');
7
- }
5
+ const stringifyProps = (props = {}) => {
6
+ return Object.entries(props)
7
+ .filter(([key]) => !blacklistedProps.includes(key))
8
+ .map(([key, value]) => `${key}=${value}`)
9
+ .join(" ");
10
+ };
8
11
 
9
- export const selectViewData = ({ state, props, attrs }) => {
10
- const containerAttrString = stringifyAttrs(attrs);
12
+ export const selectViewData = ({ props }) => {
13
+ const containerAttrString = stringifyProps(props);
11
14
 
12
15
  const items = props.items || [];
13
- const selectedTab = attrs['selected-tab'];
16
+ const selectedTab = props.selectedTab;
14
17
 
15
18
  // Mark selected tab with styling
16
19
  const itemsWithSelection = items.map(item => ({
@@ -24,6 +27,6 @@ export const selectViewData = ({ state, props, attrs }) => {
24
27
  return {
25
28
  containerAttrString,
26
29
  items: itemsWithSelection,
27
- selectedTab
30
+ selectedTab,
28
31
  };
29
- }
32
+ };
@@ -1,66 +1,10 @@
1
- elementName: rtgl-tabs
2
-
3
- viewDataSchema:
4
- type: object
5
- properties:
6
- containerAttrString:
7
- type: string
8
- items:
9
- type: array
10
- items:
11
- type: object
12
- properties:
13
- label:
14
- type: string
15
- id:
16
- type: string
17
- isSelected:
18
- type: boolean
19
- bgColor:
20
- type: string
21
- textColor:
22
- type: string
23
- borderColor:
24
- type: string
25
- selectedTab:
26
- type: string
27
-
28
- propsSchema:
29
- type: object
30
- properties:
31
- items:
32
- type: array
33
- items:
34
- type: object
35
- properties:
36
- label:
37
- type: string
38
- id:
39
- type: string
40
- testId:
41
- type: string
42
-
43
- attrsSchema:
44
- type: object
45
- properties:
46
- selected-tab:
47
- type: string
48
-
49
1
  refs:
50
- tab-*:
2
+ tab*:
51
3
  eventListeners:
52
4
  click:
53
5
  handler: handleClickItem
54
-
55
- events:
56
- item-click:
57
- type: object
58
- properties:
59
- id:
60
- type: string
61
-
62
6
  template:
63
7
  - rtgl-view d=h g=sm bgc=mu p=sm br=lg ${containerAttrString}:
64
- - $for item in items:
65
- - rtgl-view#tab-${item.id} data-id=${item.id} cur=p bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}:
66
- - rtgl-text s=sm c=${item.textColor}: "${item.label}"
8
+ - $for item, i in items:
9
+ - rtgl-view#tab${i} data-id=${item.id} cur=pointer bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}:
10
+ - rtgl-text s=sm c=${item.textColor}: ${item.label}
@@ -0,0 +1,18 @@
1
+ componentName: rtgl-tooltip
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ open:
6
+ type: string
7
+ x:
8
+ type: string
9
+ 'y':
10
+ type: string
11
+ place:
12
+ type: string
13
+ content:
14
+ type: string
15
+ events: []
16
+ methods:
17
+ type: object
18
+ properties: {}
@@ -1,12 +1,12 @@
1
1
  export const createInitialState = () => Object.freeze({
2
2
  });
3
3
 
4
- export const selectViewData = ({ attrs }) => {
4
+ export const selectViewData = ({ props }) => {
5
5
  return {
6
- open: !!attrs.open,
7
- x: attrs.x || 0,
8
- y: attrs.y || 0,
9
- placement: attrs.placement || 'top',
10
- content: attrs.content || ''
6
+ open: !!props.open,
7
+ x: props.x || 0,
8
+ y: props.y || 0,
9
+ place: props.place || 't',
10
+ content: props.content || ''
11
11
  };
12
- }
12
+ }
@@ -1,23 +1,5 @@
1
- elementName: rtgl-tooltip
2
-
3
- viewDataSchema:
4
- type: object
5
-
6
- attrsSchema:
7
- type: object
8
- properties:
9
- open:
10
- type: string
11
- x:
12
- type: string
13
- y:
14
- type: string
15
- placement:
16
- type: string
17
- content:
18
- type: string
19
-
20
1
  template:
21
- - rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement} no-overlay:
22
- - rtgl-view slot=content bgc=background bc=border br=md p=sm ah=c av=c:
23
- - rtgl-text ta=c s=sm c=foreground: ${content}
2
+ - rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay:
3
+ - rtgl-view slot=content bgc=bg bc=bo br=md p=sm ah=c av=c:
4
+ - rtgl-text ta=c s=sm c=fg: ${content}
5
+ refs: {}
@@ -1,18 +1,18 @@
1
1
  export const handleAfterMount = async (deps) => {
2
- const { props, store, render, getRefIds, } = deps;
2
+ const { props, store, render, refs } = deps;
3
3
  const { waveformData } = props;
4
4
 
5
- store.setWaveformData(waveformData);
5
+ store.setWaveformData({ data: waveformData });
6
6
  render();
7
7
 
8
- const canvas = getRefIds().canvas?.elm;
8
+ const canvas = refs.canvas;
9
9
  if (canvas) {
10
10
  renderWaveform(waveformData, canvas);
11
11
  }
12
12
  };
13
13
 
14
14
  export const handleOnUpdate = async (deps, payload) => {
15
- const { store, render, getRefIds, props } = deps;
15
+ const { store, render, refs, props } = deps;
16
16
  const { waveformData } = props;
17
17
 
18
18
  if (!waveformData) {
@@ -20,10 +20,10 @@ export const handleOnUpdate = async (deps, payload) => {
20
20
  return;
21
21
  }
22
22
 
23
- store.setWaveformData(waveformData);
23
+ store.setWaveformData({ data: waveformData });
24
24
  render();
25
25
 
26
- const canvas = getRefIds().canvas?.elm;
26
+ const canvas = refs.canvas;
27
27
  if (canvas) {
28
28
  renderWaveform(waveformData, canvas);
29
29
  }
@@ -0,0 +1,25 @@
1
+ componentName: rtgl-waveform
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ w:
6
+ type: string
7
+ description: Width of the waveform visualizer
8
+ default: '250'
9
+ h:
10
+ type: string
11
+ description: Height of the waveform visualizer
12
+ default: '150'
13
+ cur:
14
+ type: string
15
+ description: cursor
16
+ waveformData:
17
+ type: object
18
+ description: File ID of the waveform data in object storage
19
+ isLoading:
20
+ type: boolean
21
+ description: Whether the waveform data is currently being loaded
22
+ events: []
23
+ methods:
24
+ type: object
25
+ properties: {}
@@ -2,16 +2,16 @@ export const createInitialState = () => Object.freeze({
2
2
  waveformData: null,
3
3
  });
4
4
 
5
- export const setWaveformData = (state, data) => {
6
- state.waveformData = data;
5
+ export const setWaveformData = ({ state }, payload = {}) => {
6
+ state.waveformData = payload.data;
7
7
  };
8
8
 
9
- export const selectViewData = ({ state, attrs, props }) => {
9
+ export const selectViewData = ({ state, props }) => {
10
10
  return {
11
11
  isLoading: props.isLoading,
12
- w: attrs.w || "250",
13
- h: attrs.h || "150",
14
- cur: attrs.cur,
12
+ w: props.w || "250",
13
+ h: props.h || "150",
14
+ cur: props.cur,
15
15
  waveformData: props.waveformData,
16
16
  };
17
17
  };
@@ -1,38 +1,10 @@
1
- elementName: rtgl-waveform
2
-
3
- attrsSchema:
4
- type: object
5
- properties:
6
- w:
7
- type: string
8
- description: Width of the waveform visualizer
9
- default: '250'
10
- h:
11
- type: string
12
- description: Height of the waveform visualizer
13
- default: '150'
14
- cur:
15
- type: string
16
- description: cursor
17
-
18
- propsSchema:
19
- type: object
20
- properties:
21
- waveformData:
22
- type: object
23
- description: File ID of the waveform data in object storage
24
- isLoading:
25
- type: boolean
26
- description: Whether the waveform data is currently being loaded
27
-
28
1
  refs:
29
2
  canvas:
30
3
  selector: canvas
31
-
32
4
  template:
33
- - rtgl-view w=f h=f pos=rel w=${w} h=${h} cur=${cur}:
34
- - $if isLoading:
35
- - rtgl-view w=f h=f av=c ah=c:
36
- - rtgl-text c=mu-fg: ...
37
- $else:
38
- - 'canvas#canvas style="width:100%; height:100%;"':
5
+ - rtgl-view pos=rel w=${w} h=${h} cur=${cur}:
6
+ - $if isLoading:
7
+ - rtgl-view w=f h=f av=c ah=c:
8
+ - rtgl-text c=mu-fg: ...
9
+ $else:
10
+ - canvas#canvas style="width:100%; height:100%;": null
@@ -98,7 +98,7 @@ const createGlobalUI = (globalUIElement) => {
98
98
  * @param {Array<Object>} options.items - Array of dropdown menu items (required)
99
99
  * @param {number} options.x - X coordinate position (required)
100
100
  * @param {number} options.y - Y coordinate position (required)
101
- * @param {string} [options.placement] - Dropdown menu placement (default: "bottom-start")
101
+ * @param {string} [options.place] - Dropdown menu place token (default: "bs")
102
102
  * @returns {Promise<Object|null>} Promise that resolves with clicked item info or null if closed without selection
103
103
  * @returns {Object} [result.index] - Index of the clicked item
104
104
  * @returns {Object} [result.item] - The clicked item object
@@ -130,4 +130,4 @@ const createGlobalUI = (globalUIElement) => {
130
130
  };
131
131
  }
132
132
 
133
- export default createGlobalUI;
133
+ export default createGlobalUI;