-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a3e9af6
commit 10e9136
Showing
5 changed files
with
109 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# demo | ||
|
||
## 1.3.3 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [[`854718e`](https://github.com/dan-lee/timescape/commit/854718e4c98a2e6a1bff34bfa4b6c8b9e6f04680)]: | ||
- [email protected] | ||
|
||
## 1.3.2 | ||
|
||
### Patch Changes | ||
|
@@ -91,32 +98,32 @@ | |
Example usage (this works similar for all supported libraries): | ||
|
||
```tsx | ||
import { useTimescapeRange } from 'timescape/react' | ||
import { useTimescapeRange } from "timescape/react"; | ||
// Use `createTimescapeRange` for Svelte | ||
|
||
const { getRootProps, from, to } = useTimescapeRange({ | ||
from: { date: new Date('2000-01-01') }, | ||
from: { date: new Date("2000-01-01") }, | ||
to: { date: new Date() }, | ||
}) | ||
}); | ||
|
||
return ( | ||
<div {...getRootProps()}> | ||
<div> | ||
<input {...from.getInputProps('days')} /> | ||
<input {...from.getInputProps("days")} /> | ||
<span>/</span> | ||
<input {...from.getInputProps('months')} /> | ||
<input {...from.getInputProps("months")} /> | ||
<span>/</span> | ||
<input {...from.getInputProps('years')} /> | ||
<input {...from.getInputProps("years")} /> | ||
</div> | ||
<div> | ||
<input {...to.getInputProps('days')} /> | ||
<input {...to.getInputProps("days")} /> | ||
<span>/</span> | ||
<input {...to.getInputProps('months')} /> | ||
<input {...to.getInputProps("months")} /> | ||
<span>/</span> | ||
<input {...to.getInputProps('years')} /> | ||
<input {...to.getInputProps("years")} /> | ||
</div> | ||
</div> | ||
) | ||
); | ||
``` | ||
|
||
# Breaking changes | ||
|
@@ -141,24 +148,24 @@ | |
```tsx | ||
const [options, setOptions] = useState({ | ||
date: new Date(), | ||
}) | ||
const { ...rest } = useTimescape(options) | ||
}); | ||
const { ...rest } = useTimescape(options); | ||
|
||
const handleChange = () => { | ||
setOptions((prev) => ({ ...prev, date: new Date() })) | ||
} | ||
setOptions((prev) => ({ ...prev, date: new Date() })); | ||
}; | ||
``` | ||
|
||
<td> | ||
|
||
```tsx | ||
const { options, update, ...rest } = useTimescape({ | ||
date: new Date(), | ||
}) | ||
}); | ||
|
||
const handleChange = () => { | ||
update((prev) => ({ ...prev, date: new Date() })) | ||
} | ||
update((prev) => ({ ...prev, date: new Date() })); | ||
}; | ||
``` | ||
|
||
</table> | ||
|
@@ -177,30 +184,30 @@ | |
<td> | ||
|
||
```tsx | ||
const options = useSignal({ date: new Date() }) | ||
const { ...rest } = useTimescape(options) | ||
const options = useSignal({ date: new Date() }); | ||
const { ...rest } = useTimescape(options); | ||
|
||
const handleChange = () => { | ||
options.value = { | ||
...options.value, | ||
date: new Date(), | ||
} | ||
} | ||
}; | ||
}; | ||
``` | ||
|
||
<td> | ||
|
||
```tsx | ||
const { options, ...rest } = useTimescape({ | ||
date: new Date(), | ||
}) | ||
}); | ||
|
||
const handleChange = () => { | ||
options.value = { | ||
...options.value, | ||
date: new Date(), | ||
} | ||
} | ||
}; | ||
}; | ||
``` | ||
|
||
</table> | ||
|
@@ -220,30 +227,30 @@ | |
```tsx | ||
const options = writable({ | ||
date: new Date(), | ||
}) | ||
const { ...rest } = useTimescape(options) | ||
}); | ||
const { ...rest } = useTimescape(options); | ||
|
||
const handleChange = () => { | ||
options.update((options) => ({ | ||
...options, | ||
date: new Date(), | ||
})) | ||
} | ||
})); | ||
}; | ||
``` | ||
|
||
<td> | ||
|
||
```tsx | ||
const { options, ...rest } = useTimescape({ | ||
date: new Date(), | ||
}) | ||
}); | ||
|
||
const handleChange = () => { | ||
options.update((options) => ({ | ||
...options, | ||
date: new Date(), | ||
})) | ||
} | ||
})); | ||
}; | ||
``` | ||
|
||
</table> | ||
|
@@ -262,26 +269,26 @@ | |
```tsx | ||
const [options, setOptions] = createSignal({ | ||
date: new Date(), | ||
}) | ||
const { ...rest } = useTimescape(options) | ||
}); | ||
const { ...rest } = useTimescape(options); | ||
|
||
const handleChange = () => { | ||
setOptions('date', new Date()) | ||
setOptions("date", new Date()); | ||
// or object notation: setOptions({ … }) | ||
} | ||
}; | ||
``` | ||
|
||
<td> | ||
|
||
```tsx | ||
const { options, update, ...rest } = useTimescape({ | ||
date: new Date(), | ||
}) | ||
}); | ||
|
||
const handleChange = () => { | ||
update('date', new Date()) | ||
update("date", new Date()); | ||
// or object notation: update({ … }) | ||
} | ||
}; | ||
``` | ||
|
||
</table> | ||
|
@@ -298,9 +305,9 @@ | |
<td> | ||
|
||
```tsx | ||
const date = ref(new Date()) | ||
const options = reactive({ date }) | ||
const { ...rest } = useTimescape(options) | ||
const date = ref(new Date()); | ||
const options = reactive({ date }); | ||
const { ...rest } = useTimescape(options); | ||
|
||
// Set later: | ||
// <button @click="date = new Date()"> | ||
|
@@ -311,7 +318,7 @@ | |
```tsx | ||
const { options, ...rest } = useTimescape({ | ||
date: new Date(), | ||
}) | ||
}); | ||
|
||
// Set later: | ||
// <button @click="options.date = new Date()"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.