tosijs-ui 1.2.2 → 1.3.0

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/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # tosijs-ui
2
2
 
3
- > `xinjs-ui` has been renamed `tosijs-ui`. Updating the documentation and links is a
4
- > work in progress. The goal is for the API to remain stable during the transition.
5
-
6
3
  <!--{ "pin": "top" }-->
7
4
 
8
5
  [ui.tosijs.net live demo](https://ui.tosijs.net) | [tosijs](https://tosijs.net) | [discord](https://discord.gg/ramJ9rgky5) | [github](https://github.com/tonioloewald/tosijs-ui#readme) | [npm](https://www.npmjs.com/package/tosijs-ui)
@@ -12,10 +9,10 @@
12
9
  [![tosijs on jsdelivr](https://data.jsdelivr.com/v1/package/npm/tosijs-ui/badge)](https://www.jsdelivr.com/package/npm/tosijs-ui)
13
10
 
14
11
  <center>
15
- <xin-lottie
12
+ <tosi-lottie
16
13
  style="width: 280px; height: 280px; background: #da1167; border-radius: 40px;"
17
14
  src="/tosi-ui.json"
18
- ></xin-lottie>
15
+ ></tosi-lottie>
19
16
  </center>
20
17
 
21
18
  Copyright ©2023-2025 Tonio Loewald
@@ -23,11 +20,40 @@ Copyright ©2023-2025 Tonio Loewald
23
20
  ## the tosijs-ui library
24
21
 
25
22
  A set of [web-components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
26
- created with [xinjs](https://xinjs.net), designed to augment what the browser gives you
23
+ created with [tosijs](https://tosijs.net), designed to augment what the browser gives you
27
24
  for free rather than replace it.
28
25
 
29
26
  It works beautifully with other web-component libraries, such as [shoelace.style](https://shoelace.style/).
30
27
 
28
+ ## Migrating to v1.3.0
29
+
30
+ v1.3.0 completes the rename from `xinjs-ui` to `tosijs-ui`. All custom element
31
+ tags now use the `tosi-` prefix and all exports use `Tosi*`/`tosi*` names.
32
+
33
+ ### Breaking changes
34
+
35
+ - **Custom element tags** have changed from `<xin-*>` to `<tosi-*>`.
36
+ For example: `<xin-select>` is now `<tosi-select>`, `<xin-icon>` is now
37
+ `<tosi-icon>`, `<xin-example>` is now `<tosi-example>`, etc.
38
+ - **CSS selectors** targeting old tag names (e.g. `xin-select { ... }`) must
39
+ be updated.
40
+ - **CSS custom properties** in component `styleSpec` objects retain `--xin-*`
41
+ fallbacks for backward compatibility, but new code should use `--tosi-*`.
42
+
43
+ ### Deprecated exports still work
44
+
45
+ The old `xin*` JavaScript exports (`xinSelect`, `xinTabs`, `xinTable`, etc.)
46
+ remain available and will continue to work. Most log a runtime deprecation
47
+ warning; a few are silent aliases marked with JSDoc `@deprecated`. They will
48
+ be removed in a future major version.
49
+
50
+ ### Migration checklist
51
+
52
+ 1. Search your HTML for `<xin-` and replace with `<tosi-`
53
+ 2. Search your CSS for `xin-` selectors and update to `tosi-`
54
+ 3. Search your JS/TS for `xinSelect`, `xinTabs`, etc. and switch to `tosiSelect`, `tosiTabs`, etc.
55
+ 4. Search for `--xin-` CSS variable overrides and switch to `--tosi-`
56
+
31
57
  ## Quick Start
32
58
 
33
59
  ### Using npm and a bundler
@@ -38,33 +64,28 @@ Add tosijs-ui to your project, e.g.
38
64
  npm add tosijs-ui
39
65
  ```
40
66
 
41
- Then you can import the component `elementCreator` and create the element any way you
42
- like, the easiest way being to use the `elementCreator` itself. A `tosijs` `elementCreator`
43
- is syntax sugar around `document.createElement()`.
67
+ Then import the component `elementCreator` and create elements. A `tosijs`
68
+ `elementCreator` is syntax sugar around `document.createElement()`.
44
69
 
45
70
  ```ts
46
- import { dataTable } from 'tosijs-ui'
71
+ import { tosiTable } from 'tosijs-ui'
47
72
 
48
- document.body.append(dataTable())
73
+ document.body.append(tosiTable())
49
74
  ```
50
75
 
51
76
  ### Using the iife via cdn
52
77
 
53
78
  The `tosijs-ui` iife build bundles `tosijs`, `tosijs-ui`, and `marked` into
54
- a single minified javascript source file. You can access `tosijs` and `xinjsui`
79
+ a single minified javascript source file. You can access `xinjs` and `xinjsui`
55
80
  as globals which contain all the things exported by `tosijs` and `tosijs-ui`.
56
81
 
57
- > iife support is new so it may not have propagated to the cdn yet. This
58
- > example loads the library from ui.xinjs.net for now.
59
-
60
82
  ```
61
- <script src="https://ui.xinjs.net/iife.js"></script>
62
- <button id="menu">Menu <xin-icon icon="chevronDown"></xin-icon></button>
83
+ <script src="https://ui.tosijs.net/iife.js"></script>
84
+ <button id="menu">Menu <tosi-icon icon="chevronDown"></tosi-icon></button>
63
85
  <script>
64
- import { elements } from 'tosijs'
65
- import { popMenu, icons } from 'tosijs-ui'
66
-
67
- const button = { elements }
86
+ const { elements } = xinjs
87
+ const { popMenu, icons } = xinjsui
88
+ const { button } = elements
68
89
 
69
90
  const showMenu = (target) => {
70
91
  popMenu({
@@ -80,7 +101,7 @@ as globals which contain all the things exported by `tosijs` and `tosijs-ui`.
80
101
  {
81
102
  caption: 'Version',
82
103
  action() {
83
- alert(`xinjs ${xinjs.version}\nxinjs-ui ${xinjsui.version}`)
104
+ alert(`tosijs ${xinjs.version}\ntosijs-ui ${xinjsui.version}`)
84
105
  }
85
106
  }
86
107
  ]
@@ -101,7 +122,7 @@ as globals which contain all the things exported by `tosijs` and `tosijs-ui`.
101
122
  </script>
102
123
  ```
103
124
 
104
- [Click here to see a simple iife demo](https://ui.xinjs.net/iife.html)
125
+ [Click here to see a simple iife demo](https://ui.tosijs.net/iife.html)
105
126
 
106
127
  ## custom-elements
107
128
 
@@ -111,15 +132,15 @@ use HTML or the `ElementCreator` function exported.
111
132
  E.g. to use the markdown viewer:
112
133
 
113
134
  ```
114
- import { markdownViewer } from 'tosijs-ui'
115
- document.body.append(markdownViewer('# hello world\nthis is a test'))
135
+ import { tosiMd } from 'tosijs-ui'
136
+ document.body.append(tosiMd('# hello world\nthis is a test'))
116
137
  ```
117
138
 
118
139
  ```js
119
- import { markdownViewer } from 'tosijs-ui'
140
+ import { tosiMd } from 'tosijs-ui'
120
141
 
121
142
  preview.append(
122
- markdownViewer(`
143
+ tosiMd(`
123
144
  ## hello world
124
145
  here is some markdown
125
146
  `)
@@ -129,15 +150,15 @@ here is some markdown
129
150
  Assuming you import the module somewhere, the HTML will work as well.
130
151
 
131
152
  ```
132
- <xin-md>
153
+ <tosi-md>
133
154
  ## hello world
134
155
  here is some markdown
135
- </xin-md>
156
+ </tosi-md>
136
157
  ```
137
158
 
138
- The big difference with using the `markdownViewer()` function is that the `tosijs` `Component`
159
+ The big difference with using the `tosiMd()` function is that the `tosijs` `Component`
139
160
  class will automatically pick a new tag if the expected tag is taken (e.g. by a previously
140
- defined custom-element from another library). `markdownViewer()` will create an element of
161
+ defined custom-element from another library). `tosiMd()` will create an element of
141
162
  the correct type.
142
163
 
143
164
  The other thing is that `tosijs` `ElementCreator` functions are convenient and composable,
@@ -149,16 +170,16 @@ JSX, TSX, or HTML.
149
170
  In general, `tosijs` strives to work _with_ the browser rather than trying to _replace_ it.
150
171
 
151
172
  In a similar vein, `tosijs-ui` comprises a collection of [web-components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
152
- with the goal of augmenting what _already_ works well, and the components are intended be interoperable as
153
- similar as possible to things that you already use, such as `<input>` or `<select>` elements.
173
+ with the goal of augmenting what _already_ works well, and the components are intended to be
174
+ as similar as possible to things that you already use, such as `<input>` or `<select>` elements.
154
175
  E.g. where appropriate, the `value` of an element is its malleable `state`, and when this changes,
155
176
  the element emits a `change` event.
156
177
 
157
- Similarly, the xinjs base `Component` class and the components in this collection strive to
178
+ Similarly, the tosijs base `Component` class and the components in this collection strive to
158
179
  be as similar in operation as possible to DOM elements as makes sense. E.g. binary attributes
159
180
  work as expected. Adding the `hidden` attribute makes them disappear. If a component subclass
160
181
  has a `value` property then it will be rendered if the value changes (similarly it will be
161
- rendered if an initialized attribute is changed). Intinsic properties of components will
182
+ rendered if an initialized attribute is changed). Intrinsic properties of components will
162
183
  default to `null` rather than `undefined`.
163
184
 
164
185
  Similarly, because web-components are highly interoperable, there's no reason to reinvent
@@ -170,7 +191,7 @@ and accessible.
170
191
  The goal here is to provide useful components and other utilities that add to what's built
171
192
  into HTML5 and CSS3 and to make custom-elements work as much as possible like drop-in replacements
172
193
  for an `<input>` or `<textarea>` (while mitigating the historical pathologies of things like
173
- `<select>` and `<input type="radio">`). E.g. the `<xin-select>` does not suffer from a
194
+ `<select>` and `<input type="radio">`). E.g. the `<tosi-select>` does not suffer from a
174
195
  race-condition between having its value set and being given an `<option>` with the intended value
175
196
  and you can differentiate between the user picking a value (`action`) and the value changing (`change`).
176
197
 
@@ -1,5 +1,5 @@
1
1
  import { Component as WebComponent, ElementCreator } from 'tosijs';
2
- export declare class XinCarousel extends WebComponent {
2
+ export declare class TosiCarousel extends WebComponent {
3
3
  static initAttributes: {
4
4
  dots: boolean;
5
5
  arrows: boolean;
@@ -111,4 +111,8 @@ export declare class XinCarousel extends WebComponent {
111
111
  disconnectedCallback(): void;
112
112
  render(): void;
113
113
  }
114
- export declare const xinCarousel: ElementCreator<XinCarousel>;
114
+ /** @deprecated Use TosiCarousel instead */
115
+ export declare const XinCarousel: typeof TosiCarousel;
116
+ export declare const tosiCarousel: ElementCreator<TosiCarousel>;
117
+ /** @deprecated Use tosiCarousel instead */
118
+ export declare const xinCarousel: ElementCreator<TosiCarousel>;
@@ -17,7 +17,7 @@ export interface TableData {
17
17
  }
18
18
  export type ArrayFilter = (array: any[]) => any[];
19
19
  export type SelectCallback = (selected: any[]) => void;
20
- export declare class DataTable extends WebComponent {
20
+ export declare class TosiTable extends WebComponent {
21
21
  static initAttributes: {
22
22
  rowHeight: number;
23
23
  charWidth: number;
@@ -78,5 +78,10 @@ export declare class DataTable extends WebComponent {
78
78
  private dropColumn;
79
79
  render(): void;
80
80
  }
81
- export declare const dataTable: ElementCreator<DataTable>;
82
- export declare const xinTable: ElementCreator<DataTable>;
81
+ /** @deprecated Use TosiTable instead */
82
+ export declare const DataTable: typeof TosiTable;
83
+ export declare const tosiTable: ElementCreator<TosiTable>;
84
+ /** @deprecated Use tosiTable instead */
85
+ export declare const dataTable: ElementCreator<TosiTable>;
86
+ /** @deprecated Use tosiTable instead */
87
+ export declare const xinTable: ElementCreator<TosiTable>;
package/dist/float.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Component as WebComponent, ElementCreator } from 'tosijs';
2
- export declare class XinFloat extends WebComponent {
3
- static floats: Set<XinFloat>;
2
+ export declare class TosiFloat extends WebComponent {
3
+ static floats: Set<TosiFloat>;
4
4
  static initAttributes: {
5
5
  drag: boolean;
6
6
  remainOnResize: "hide" | "remove" | "remain";
@@ -16,4 +16,8 @@ export declare class XinFloat extends WebComponent {
16
16
  connectedCallback(): void;
17
17
  disconnectedCallback(): void;
18
18
  }
19
- export declare const xinFloat: ElementCreator<XinFloat>;
19
+ /** @deprecated Use TosiFloat instead */
20
+ export declare const XinFloat: typeof TosiFloat;
21
+ export declare const tosiFloat: ElementCreator<TosiFloat>;
22
+ /** @deprecated Use tosiFloat instead */
23
+ export declare const xinFloat: ElementCreator<TosiFloat>;