@humandialog/forms.svelte 0.5.15 → 0.5.16

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.
@@ -1,5 +1,5 @@
1
1
  <svelte:options accessors={true}/>
2
- <script>import { tick } from "svelte";
2
+ <script>import { tick, afterUpdate } from "svelte";
3
3
  import Pallete_row from "./palette.row.svelte";
4
4
  import { createEventDispatcher } from "svelte";
5
5
  import Icon from "../../icon.svelte";
@@ -22,9 +22,23 @@ export function showAsToolbox(rect) {
22
22
  const windowWidth = window.innerWidth - 2 * margin;
23
23
  toolboxX = margin;
24
24
  toolboxY = rect.bottom + margin;
25
- css_style = `position: fixed; left:${toolboxX}px; top:${toolboxY}px;`;
25
+ const mainContentDiv = document.getElementById("__hd_svelte_main_content_container");
26
+ toolboxY += window.scrollY;
27
+ css_style = `position: absolute; left:${toolboxX}px; top:${toolboxY}px;`;
26
28
  dispatch("palette_shown");
27
29
  }
30
+ let toolboxElement;
31
+ afterUpdate(
32
+ async () => {
33
+ if (isToolbox && visible && toolboxElement) {
34
+ let layoutRoot = document.getElementById("__hd_svelte_layout_root");
35
+ if (!!layoutRoot && toolboxElement.parentElement != layoutRoot) {
36
+ await tick();
37
+ layoutRoot.appendChild(toolboxElement);
38
+ }
39
+ }
40
+ }
41
+ );
28
42
  export function show(x, y, up = false) {
29
43
  isToolbox = false;
30
44
  css_style = `width: ${width_px}px; max-height:${max_height_px}px; position: fixed; left:${x}px; top:${y}px;`;
@@ -130,6 +144,7 @@ function mousedown(e) {
130
144
  beforeTrackingClient = new DOMPoint(touch.clientX, touch.clientY);
131
145
  beforeTrackingPos = new DOMPoint(toolboxX, toolboxY);
132
146
  isMoving = true;
147
+ e.stopPropagation();
133
148
  }
134
149
  function mousemove(e) {
135
150
  if (isMoving && beforeTrackingClient && beforeTrackingPos) {
@@ -138,7 +153,8 @@ function mousemove(e) {
138
153
  const touch = e.touches.item(0);
139
154
  const trackDelta = new DOMPoint(touch.clientX - beforeTrackingClient.x, touch.clientY - beforeTrackingClient.y);
140
155
  toolboxX = beforeTrackingPos.x + trackDelta.x;
141
- css_style = `position: fixed; left:${toolboxX}px; top:${toolboxY}px;`;
156
+ css_style = `position: absolute; left:${toolboxX}px; top:${toolboxY}px;`;
157
+ e.stopPropagation();
142
158
  }
143
159
  }
144
160
  function mouseup(e) {
@@ -156,7 +172,8 @@ function mouseup(e) {
156
172
  hidden={!visible}
157
173
  on:touchstart={mousedown}
158
174
  on:touchmove={mousemove}
159
- on:touchend={mouseup}>
175
+ on:touchend={mouseup}
176
+ bind:this={toolboxElement}>
160
177
  {#if filtered_commands && filtered_commands.length}
161
178
  {#each filtered_commands as cmd, idx (cmd.caption)}
162
179
  {@const id = "cpi_" + idx}
@@ -3,10 +3,10 @@
3
3
  /** @typedef {typeof __propDef.slots} InputboxSlots */
4
4
  export default class Inputbox extends SvelteComponentTyped<{
5
5
  [x: string]: any;
6
+ self?: null | undefined;
6
7
  invalid?: boolean | undefined;
7
8
  label?: string | undefined;
8
9
  context?: string | undefined;
9
- self?: null | undefined;
10
10
  c?: string | undefined;
11
11
  typename?: string | undefined;
12
12
  a?: string | undefined;
@@ -29,10 +29,10 @@ import { SvelteComponentTyped } from "svelte";
29
29
  declare const __propDef: {
30
30
  props: {
31
31
  [x: string]: any;
32
+ self?: null | undefined;
32
33
  invalid?: boolean | undefined;
33
34
  label?: string | undefined;
34
35
  context?: string | undefined;
35
- self?: null | undefined;
36
36
  c?: string | undefined;
37
37
  typename?: string | undefined;
38
38
  a?: string | undefined;
@@ -4,8 +4,8 @@
4
4
  export default class Simple extends SvelteComponentTyped<{
5
5
  focus?: boolean | undefined;
6
6
  select?: string | undefined;
7
- context?: string | undefined;
8
7
  self?: null | undefined;
8
+ context?: string | undefined;
9
9
  nav?: boolean | undefined;
10
10
  collection?: string | undefined;
11
11
  objects?: null | undefined;
@@ -24,8 +24,8 @@ declare const __propDef: {
24
24
  props: {
25
25
  focus?: boolean | undefined;
26
26
  select?: string | undefined;
27
- context?: string | undefined;
28
27
  self?: null | undefined;
28
+ context?: string | undefined;
29
29
  nav?: boolean | undefined;
30
30
  collection?: string | undefined;
31
31
  objects?: null | undefined;
@@ -4,8 +4,8 @@
4
4
  export default class Template extends SvelteComponentTyped<{
5
5
  focus?: boolean | undefined;
6
6
  select?: string | undefined;
7
- context?: string | undefined;
8
7
  self?: null | undefined;
8
+ context?: string | undefined;
9
9
  nav?: boolean | undefined;
10
10
  collection?: string | undefined;
11
11
  objects?: null | undefined;
@@ -32,8 +32,8 @@ declare const __propDef: {
32
32
  props: {
33
33
  focus?: boolean | undefined;
34
34
  select?: string | undefined;
35
- context?: string | undefined;
36
35
  self?: null | undefined;
36
+ context?: string | undefined;
37
37
  nav?: boolean | undefined;
38
38
  collection?: string | undefined;
39
39
  objects?: null | undefined;
package/console.svelte ADDED
@@ -0,0 +1,128 @@
1
+ <script>
2
+ import { reef, session } from "@humandialog/auth.svelte";
3
+ import { afterUpdate } from "svelte";
4
+ import { contextTypesStore, contextItemsStore} from './stores.js'
5
+
6
+ let prevLines = [];
7
+ let prompt = '>'
8
+ let input = ""
9
+ let inputElement;
10
+ let protocol = 'cons';
11
+ let protoButtonBorderClass = ''
12
+
13
+ async function onKeyDown(e)
14
+ {
15
+ if(!$session.isActive)
16
+ {
17
+ prevLines = [...prevLines, "Sign-in first"]
18
+ input = "";
19
+ }
20
+
21
+ if(e.key == 'Enter')
22
+ {
23
+ prevLines = [...prevLines, `${prompt} ${input}`];
24
+
25
+ if(input.startsWith('self'))
26
+ {
27
+ let navItem = getNav('props');
28
+ if(!navItem)
29
+ navItem = getNav('data')
30
+
31
+ if(navItem)
32
+ input = input.replace('self', navItem)
33
+ }
34
+
35
+ const apiVer = $session.configuration.api_version;
36
+ const result = await reef.fetch(`/${protocol}/${apiVer}/${input}`)
37
+ const res = await result.text();
38
+ prevLines = [...prevLines, res]
39
+
40
+
41
+ input = "";
42
+ }
43
+ else if(e.key == 'Esc' || e.key == 'Escape')
44
+ {
45
+ input = "";
46
+ }
47
+ }
48
+
49
+ function getNav(contextLevel)
50
+ {
51
+ let navItem = '';
52
+ const pageItem = $contextItemsStore[contextLevel]
53
+ if(pageItem)
54
+ {
55
+ if(pageItem.$ref)
56
+ navItem = pageItem.$ref; //.substr(2);
57
+ else if(pageItem.Id)
58
+ {
59
+ if(pageItem.$type)
60
+ navItem = pageItem.$type + '/' + pageItem.Id;
61
+ else if(pageItem.oclType)
62
+ navItem = pageItem.oclType + '/' + pageItem.Id;
63
+ else if($contextTypesStore[contextLevel])
64
+ navItem = $contextTypesStore[contextLevel] + '/' + pageItem.Id;
65
+ }
66
+ }
67
+ return navItem;
68
+ }
69
+
70
+ afterUpdate(() =>
71
+ {
72
+ inputElement?.scrollIntoView();
73
+ })
74
+
75
+
76
+ function protoChange()
77
+ {
78
+ if(protocol == 'cons')
79
+ {
80
+ protocol = 'json';
81
+ protoButtonBorderClass = "border border-stone-400"
82
+ }
83
+ else
84
+ {
85
+ protocol = 'cons';
86
+ protoButtonBorderClass = ""
87
+ }
88
+ }
89
+
90
+ </script>
91
+
92
+ <div class="h-full overflow-y-auto">
93
+ <button class="fixed right-0 m-2 w-6 h-6 text-stone-200 {protoButtonBorderClass}" on:click={protoChange}>
94
+ <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
95
+ <path d="M16 4C14 4 11 5 11 9C11 13 11 15 11 18C11 21 6 23 6 23C6 23 11 25 11 28C11 31 11 35 11 39C11 43 14 44 16 44"/>
96
+ <path d="M32 4C34 4 37 5 37 9C37 13 37 15 37 18C37 21 42 23 42 23C42 23 37 25 37 28C37 31 37 35 37 39C37 43 34 44 32 44"/>
97
+ </svg>
98
+ </button>
99
+
100
+ <div class="p-2 w-full min-h-full
101
+ bg-stone-800 border-l border-t border-black font-mono text-stone-200">
102
+ {#each prevLines as line}
103
+ <p class="whitespace-pre-wrap">{line}</p>
104
+ {/each}
105
+ <p bind:this={inputElement} class="whitespace-pre-wrap">{prompt}
106
+ <input type=text name="cmd" id="cmd"
107
+ autocomplete="off"
108
+ class="bg-stone-800 w-11/12"
109
+ bind:value={input}
110
+ on:keydown={onKeyDown}
111
+ placeholder="Type command here">
112
+ </p>
113
+ </div>
114
+ </div>
115
+ <style>
116
+ input:focus {
117
+ outline: 0px solid transparent;
118
+ }
119
+
120
+ svg {
121
+ stroke: currentColor;
122
+ fill: currentColor;
123
+ stroke-width: 0;
124
+ width: 100%;
125
+ height: auto;
126
+ max-height: 100%;
127
+ }
128
+ </style>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} ConsoleProps */
2
+ /** @typedef {typeof __propDef.events} ConsoleEvents */
3
+ /** @typedef {typeof __propDef.slots} ConsoleSlots */
4
+ export default class Console extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type ConsoleProps = typeof __propDef.props;
11
+ export type ConsoleEvents = typeof __propDef.events;
12
+ export type ConsoleSlots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: never;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
package/desk.svelte CHANGED
@@ -107,8 +107,8 @@
107
107
  bottom_bar_visible = $bottom_bar_visible_store
108
108
  let dts = $data_tick_store;
109
109
 
110
- if(!hasSelectedItem())
111
- bottom_bar_visible = false;
110
+ //if(!hasSelectedItem())
111
+ // bottom_bar_visible = false;
112
112
 
113
113
  if(tools_visible)
114
114
  {
@@ -118,9 +118,9 @@
118
118
  content_top = 'top-[50px] sm:top-[40px]'
119
119
 
120
120
  if(bottom_bar_visible)
121
- content_height = `min-h-[calc(100vh-290px)] sm:min-h-[calc(100vh-280px)]`
121
+ content_height = `h-[calc(100vh-290px)] sm:h-[calc(100vh-280px)]`
122
122
  else
123
- content_height = `min-h-[calc(100vh-50px)] sm:min-h-[calc(100vh-40px)]`
123
+ content_height = `h-[calc(100vh-50px)] sm:h-[calc(100vh-40px)]`
124
124
 
125
125
  }
126
126
  else
@@ -128,9 +128,9 @@
128
128
  tools_visibility = "hidden"
129
129
  content_top = `top-[50px] sm:top-0`
130
130
  if(bottom_bar_visible)
131
- content_height = `min-h-[calc(100vh-290px)] sm:min-h-[calc(100vh-240px)]`
131
+ content_height = `h-[calc(100vh-290px)] sm:h-[calc(100vh-240px)]`
132
132
  else
133
- content_height = `min-h-[calc(100vh-50px)] sm:min-h-screen`
133
+ content_height = `h-[calc(100vh-50px)] sm:h-screen`
134
134
  }
135
135
 
136
136
 
@@ -161,7 +161,7 @@
161
161
  on:click={handleSelect}
162
162
  on:contextmenu={handleSelect}>
163
163
 
164
- <div class="bg-white dark:bg-stone-900 dark:text-white min-h-screen">
164
+ <div class="bg-white dark:bg-stone-900 dark:text-white overflow-x-clip overflow-y-clip h-screen">
165
165
  <!--###########################################################-->
166
166
  <!--## HORIZONTAL TOOLBAR (FOR PHONES) ######################-->
167
167
  <!--###########################################################-->
@@ -206,7 +206,11 @@
206
206
  </div>
207
207
  {/if}
208
208
 
209
- <section on:click|capture={auto_hide_sidebar}>
209
+ <!-- ! below overflow-x-clip prevents horizontal scrollbar when vertical scrollbar is visible. Default
210
+ behaviour is the content expand vertically, and only vertical scrollbar can be visible.
211
+ When content on the main page needs to be expanded horizontally (like kanban chart for example) then
212
+ that component should define overflow-x-* itself -->
213
+ <section on:click|capture={auto_hide_sidebar} class="">
210
214
 
211
215
  <!--###########################################################-->
212
216
  <!--## HORIZONTAL TOOLS ######################-->
@@ -231,14 +235,15 @@
231
235
  <!--## CONTENT ##################-->
232
236
  <!--#######################################################-->
233
237
  <!-- fixed => relative, content-height => min content height -- -->
234
- <div class="relative left-0 w-screen
238
+ <div id="__hd_svelte_main_content_container"
239
+ class="relative left-0 w-screen
235
240
  sm:left-[40px] sm:w-[calc(100vw-40px)]
236
241
  {content_top}
237
242
  {content_height}
238
243
  {lg_content_area_horizontal_dim}
239
- z-0 overflow-x-hidden"
244
+ z-0 overflow-x-hidden overflow-y-auto"
240
245
  >
241
- <Configurable config={layout.mainContent} min_h_class={content_height}>
246
+ <Configurable config={layout.mainContent} min_h_class="min-h-full">
242
247
  <div slot='alt'></div>
243
248
  </Configurable>
244
249
  </div>
@@ -2,8 +2,8 @@
2
2
  /** @typedef {typeof __propDef.events} FormEvents */
3
3
  /** @typedef {typeof __propDef.slots} FormSlots */
4
4
  export default class Form extends SvelteComponentTyped<{
5
- context?: string | undefined;
6
5
  self?: null | undefined;
6
+ context?: string | undefined;
7
7
  c?: string | undefined;
8
8
  cl?: string | undefined;
9
9
  fit?: boolean | undefined;
@@ -19,8 +19,8 @@ export type FormSlots = typeof __propDef.slots;
19
19
  import { SvelteComponentTyped } from "svelte";
20
20
  declare const __propDef: {
21
21
  props: {
22
- context?: string | undefined;
23
22
  self?: null | undefined;
23
+ context?: string | undefined;
24
24
  c?: string | undefined;
25
25
  cl?: string | undefined;
26
26
  fit?: boolean | undefined;
@@ -44,6 +44,7 @@
44
44
 
45
45
  let config = null;
46
46
  let has_selection_details = false;
47
+ let selection_details_caption = 'Properties'
47
48
 
48
49
  let show_sign_in_out_icons = false;
49
50
  let is_logged_in = false;
@@ -57,6 +58,8 @@
57
58
  {
58
59
  config = appConfig.mainToolbar;
59
60
  has_selection_details = appConfig.selectionDetails;
61
+ if(has_selection_details)
62
+ selection_details_caption = appConfig.selectionDetails.caption ?? 'Properties';
60
63
  is_logged_in = $session.isActive;
61
64
  show_sign_in_out_icons = config.signin ? true : false;
62
65
  sign_in_href = $signInHRef;
@@ -200,7 +203,7 @@
200
203
  if(has_selection_details)
201
204
  {
202
205
  options.push( {
203
- caption: 'Properties',
206
+ caption: selection_details_caption,
204
207
  icon: $bottom_bar_visible_store ? FaToggleOn : FaToggleOff,
205
208
  action: (focused) => { $bottom_bar_visible_store = !$bottom_bar_visible_store }
206
209
  });
package/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export { default as ListComboProperty } from './components/list/list.combo.svelt
38
38
  export { default as ListStaticProperty } from './components/list/list.static.svelte';
39
39
  export { default as Modal } from './modal.svelte';
40
40
  export { default as MembersPage } from './tenant.members.svelte';
41
+ export { default as Console } from './console.svelte';
41
42
  export { default as Tag } from './components/tag.svelte';
42
43
  export { default as Tags } from './components/tags.svelte';
43
44
  export { default as Kanban } from './components/kanban/kanban.svelte';
package/index.js CHANGED
@@ -44,6 +44,7 @@ export { default as ListComboProperty } from './components/list/list.combo.svelt
44
44
  export { default as ListStaticProperty } from './components/list/list.static.svelte';
45
45
  export { default as Modal } from './modal.svelte';
46
46
  export { default as MembersPage } from './tenant.members.svelte';
47
+ export { default as Console } from './console.svelte';
47
48
  export { default as Tag } from './components/tag.svelte';
48
49
  export { default as Tags } from './components/tags.svelte';
49
50
  export { default as Kanban } from './components/kanban/kanban.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "0.5.15",
3
+ "version": "0.5.16",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -123,6 +123,7 @@
123
123
  "./components/tags.svelte": "./components/tags.svelte",
124
124
  "./components/textarea.ltop.svelte": "./components/textarea.ltop.svelte",
125
125
  "./components/tile.title.svelte": "./components/tile.title.svelte",
126
+ "./console.svelte": "./console.svelte",
126
127
  "./desk.svelte": "./desk.svelte",
127
128
  "./form.box.svelte": "./form.box.svelte",
128
129
  "./horizontal.toolbar.svelte": "./horizontal.toolbar.svelte",
package/page.svelte.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  /** @typedef {typeof __propDef.slots} PageSlots */
4
4
  export default class Page extends SvelteComponentTyped<{
5
5
  [x: string]: any;
6
+ self?: null | undefined;
6
7
  clearsContext?: string | undefined;
7
8
  context?: string | undefined;
8
- self?: null | undefined;
9
9
  c?: string | undefined;
10
10
  cl?: string | undefined;
11
11
  typename?: string | undefined;
@@ -26,9 +26,9 @@ import { SvelteComponentTyped } from "svelte";
26
26
  declare const __propDef: {
27
27
  props: {
28
28
  [x: string]: any;
29
+ self?: null | undefined;
29
30
  clearsContext?: string | undefined;
30
31
  context?: string | undefined;
31
- self?: null | undefined;
32
32
  c?: string | undefined;
33
33
  cl?: string | undefined;
34
34
  typename?: string | undefined;
package/stores.js CHANGED
@@ -21,7 +21,7 @@ export function setNavigatorTitle(key, title)
21
21
 
22
22
  export function hasSelectedItem()
23
23
  {
24
- let itm = get(contextItemsStore).sel
24
+ let itm = get(contextItemsStore).props
25
25
  return itm !== null && itm !== undefined;
26
26
  }
27
27
 
package/tile.svelte.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  /** @typedef {typeof __propDef.events} TileEvents */
3
3
  /** @typedef {typeof __propDef.slots} TileSlots */
4
4
  export default class Tile extends SvelteComponentTyped<{
5
- context?: string | undefined;
6
5
  self?: null | undefined;
6
+ context?: string | undefined;
7
7
  c?: string | undefined;
8
8
  cl?: string | undefined;
9
9
  }, {
@@ -18,8 +18,8 @@ export type TileSlots = typeof __propDef.slots;
18
18
  import { SvelteComponentTyped } from "svelte";
19
19
  declare const __propDef: {
20
20
  props: {
21
- context?: string | undefined;
22
21
  self?: null | undefined;
22
+ context?: string | undefined;
23
23
  c?: string | undefined;
24
24
  cl?: string | undefined;
25
25
  };
@@ -36,6 +36,7 @@
36
36
  let tabs = new Array();
37
37
  let config = null;
38
38
  let has_selection_details = false;
39
+ let selection_detils_caption = 'Properties';
39
40
 
40
41
  let show_sign_in_out_icons = false;
41
42
  let is_logged_in = false;
@@ -45,6 +46,8 @@
45
46
  $:{
46
47
  config = appConfig.mainToolbar;
47
48
  has_selection_details = appConfig.selectionDetails;
49
+ if(has_selection_details)
50
+ selection_detils_caption = appConfig.selectionDetails.caption ?? 'Properties'
48
51
  is_logged_in = $session.isActive;
49
52
  show_sign_in_out_icons = config.signin ? true : false;
50
53
  sign_in_href = $signInHRef;
@@ -168,7 +171,7 @@
168
171
  if(has_selection_details)
169
172
  {
170
173
  options.push( {
171
- caption: 'Properties',
174
+ caption: selection_detils_caption,
172
175
  icon: $bottom_bar_visible_store ? FaToggleOn : FaToggleOff,
173
176
  action: (focused) => { $bottom_bar_visible_store = !$bottom_bar_visible_store }
174
177
  });