tosijs-ui 1.16.19 → 1.16.21
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/CHANGELOG.md +38 -0
- package/dist/data-table.js +33 -18
- package/dist/doc-system/highlight-styles.js +1 -1
- package/dist/highlight-block.js +1 -1
- package/dist/icon-svg.js +3 -4
- package/dist/icons.js +46 -8
- package/dist/iife.js +98 -98
- package/dist/iife.js.map +11 -11
- package/dist/live-theme.js +1 -1
- package/dist/router.js +53 -25
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +1 -1
- package/package.json +3 -3
package/dist/live-theme.js
CHANGED
package/dist/router.js
CHANGED
|
@@ -9,6 +9,7 @@ named route views (slots).
|
|
|
9
9
|
|
|
10
10
|
```js
|
|
11
11
|
import { defineRoutes, navigate, router, tosiRouteView } from 'tosijs-ui'
|
|
12
|
+
import { elements } from 'tosijs'
|
|
12
13
|
|
|
13
14
|
const home = () => {
|
|
14
15
|
const el = document.createElement('div')
|
|
@@ -28,21 +29,39 @@ const greeting = (params) => {
|
|
|
28
29
|
return el
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
],
|
|
37
|
-
{ hashRouting: true }
|
|
38
|
-
)
|
|
32
|
+
const routes = [
|
|
33
|
+
{ pattern: '', targets: [{ component: home }] },
|
|
34
|
+
{ pattern: 'about', targets: [{ component: about }] },
|
|
35
|
+
{ pattern: 'greet/:name', targets: [{ component: greeting }] },
|
|
36
|
+
]
|
|
39
37
|
|
|
38
|
+
// An app calls defineRoutes once. This page has several router examples sharing the
|
|
39
|
+
// one router, so each link here defines its routes again before it navigates.
|
|
40
|
+
const go = (path) => () => {
|
|
41
|
+
defineRoutes(routes, { hashRouting: true })
|
|
42
|
+
navigate(path)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { button, nav } = elements
|
|
40
46
|
preview.append(
|
|
47
|
+
nav(
|
|
48
|
+
button({ onClick: go('') }, 'Home'),
|
|
49
|
+
button({ onClick: go('about') }, 'About'),
|
|
50
|
+
button({ onClick: go('greet/World') }, 'Greet World')
|
|
51
|
+
),
|
|
41
52
|
tosiRouteView(),
|
|
42
53
|
)
|
|
43
54
|
|
|
44
55
|
// Navigate programmatically
|
|
45
|
-
|
|
56
|
+
go('greet/World')()
|
|
57
|
+
```
|
|
58
|
+
```test
|
|
59
|
+
test('the first example holds the router when the page loads', async () => {
|
|
60
|
+
for (let i = 0; i < 50 && !preview.textContent.includes('Hello, World!'); i++) {
|
|
61
|
+
await waitMs(20)
|
|
62
|
+
}
|
|
63
|
+
expect(preview.textContent).toContain('Hello, World!')
|
|
64
|
+
})
|
|
46
65
|
```
|
|
47
66
|
|
|
48
67
|
## Named Views
|
|
@@ -69,18 +88,21 @@ const sidebar = () => {
|
|
|
69
88
|
return el
|
|
70
89
|
}
|
|
71
90
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
const show = () => {
|
|
92
|
+
defineRoutes(
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
pattern: 'photos/:id/edit',
|
|
96
|
+
targets: [
|
|
97
|
+
{ view: 'main', component: mainContent },
|
|
98
|
+
{ view: 'tools', component: sidebar },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
{ hashRouting: true }
|
|
103
|
+
)
|
|
104
|
+
navigate('photos/42/edit')
|
|
105
|
+
}
|
|
84
106
|
|
|
85
107
|
const container = document.createElement('div')
|
|
86
108
|
container.style.display = 'flex'
|
|
@@ -89,9 +111,14 @@ container.append(
|
|
|
89
111
|
tosiRouteView({ name: 'main', style: { flex: '1' } }),
|
|
90
112
|
tosiRouteView({ name: 'tools', style: { width: '200px' } }),
|
|
91
113
|
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
// An app has one router, and so does this page: the example above holds it, so this one
|
|
115
|
+
// routes when you ask it to.
|
|
116
|
+
const note = document.createElement('p')
|
|
117
|
+
note.textContent = 'One router serves the page; the example above holds it until you press:'
|
|
118
|
+
const showButton = document.createElement('button')
|
|
119
|
+
showButton.textContent = 'Edit photo 42'
|
|
120
|
+
showButton.addEventListener('click', show)
|
|
121
|
+
preview.append(note, showButton, container)
|
|
95
122
|
```
|
|
96
123
|
|
|
97
124
|
## Hash Routing
|
|
@@ -99,8 +126,9 @@ navigate('photos/42/edit')
|
|
|
99
126
|
Set `hashRouting: true` when defining routes to use hash-based URLs
|
|
100
127
|
(`#/path`) instead of History API paths. This is useful when your app
|
|
101
128
|
is served from a static file server that doesn't support URL rewriting.
|
|
129
|
+
The examples above all use it.
|
|
102
130
|
|
|
103
|
-
```js
|
|
131
|
+
```js:static
|
|
104
132
|
import { defineRoutes, navigate, tosiRouteView } from 'tosijs-ui'
|
|
105
133
|
|
|
106
134
|
defineRoutes(
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.16.
|
|
1
|
+
export declare const version = "1.16.21";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.16.
|
|
1
|
+
export const version = '1.16.21';
|
package/llms.txt
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tosijs-ui",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.21",
|
|
4
4
|
"description": "simple robust web-components for use with tosijs or anything else",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "bun --watch bin/dev.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prettier": "^2.8.8",
|
|
58
58
|
"prismjs": "^1.30.0",
|
|
59
59
|
"tjs-lang": "0.14.0-rc.5",
|
|
60
|
-
"tosijs": "1.10.
|
|
60
|
+
"tosijs": "1.10.9",
|
|
61
61
|
"tosijs-schema": "1.10.2",
|
|
62
62
|
"typescript": "^5.9.3",
|
|
63
63
|
"typescript-eslint": "^8.65.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"happy-dom": "^20.7.0",
|
|
68
68
|
"marked": "^16.4.2 || ^17.0.0 || ^18.0.0",
|
|
69
69
|
"tjs-lang": "^0.13.1 || ^0.14.0-rc.5",
|
|
70
|
-
"tosijs": "^1.10.
|
|
70
|
+
"tosijs": "^1.10.9",
|
|
71
71
|
"tosijs-schema": "^1.8.0",
|
|
72
72
|
"chokidar": "^4.0.3"
|
|
73
73
|
},
|