Commit Graph

153 Commits

Author SHA1 Message Date
Sped0n
794b5c0ea6 fix: fix indexing issue in loadImages function 2024-01-23 00:28:05 +08:00
Spedon
2fd34c2f7f refactor: replace svh with a more compatible approach (#252)
* first attempt

* second attempt

* blind commit
2024-01-23 00:06:42 +08:00
Spedon
49e9f904e2 fix: fix article regresssion (#250)
* refactor: output article element when needed

* refactor: refactor container styles and media queries

- Add the `$tablet` variable to `_container.scss`
- Add a media query to `_container.scss`
- Import `_container.scss` in `critical.scss`
- Remove the import of `_container.scss` in `style.scss`
2024-01-22 20:35:15 +08:00
Spedon
9fa1b718b8 feat: add loading indicator for desktop and mobile (#244)
* feat: add new CSS rule for hiding elements

- Add a new CSS rule for the class "hide" with a display property set to "none".

* feat: refactor image loading and navigation logic on desktop

- Add a line of code in `assets/ts/desktop/stage.ts` to reset the `src` of `elc` and add a class `hide` to it
- Add a line of code in `assets/ts/desktop/stage.ts` to call the `loader` function with `elc` as an argument
- Add a function `loader` in `assets/ts/desktop/stage.ts` to handle image loading and error events
- Modify the `initStageNav` function in `assets/ts/desktop/stageNav.ts` to watch the `isLoading` state and set custom cursor accordingly
- Modify the `initStageNav` function in `assets/ts/desktop/stageNav.ts` to handle close click events by calling the `handleClick` function and setting `isLoading` state to false
- Modify the `initStageNav` function in `assets/ts/desktop/stageNav.ts` to handle previous/next click events by calling the `handleClick` function only if `isLoading` is false
- Modify the `initStageNav` function in `assets/ts/desktop/stageNav.ts` to handle previous/next hover events by setting `loadedText` and updating custom cursor depending on `isLoading` state

* feat: refactor createGallery function and enhance loading functionality on mobile

- Add a loading text element to the gallery.scss file
- Add a loading indicator to the createGallery function in gallery.ts
- Modify the createGallery function in gallery.ts to hide the loading text element on image load
- Move the image element append logic to the parent container in the createGallery function in gallery.ts

* feat: update translations and add new loading translation in i18n files

* chore: remove css source map

* chore: modify build command to ignore css source map

* refactor: remove unnecessary style

* fix: fix desktop cursor text transition bug
2024-01-20 23:34:13 +08:00
Spedon
ae1a08eb82 feat: embed threshold and index val of navbar into html/inline js (#241)
* feat: refactor image retrieval logic and improve variable initialization

- Add a new file `layouts/partials/function/getImageSlice.html`
- Initialize variables `$context`, `$Path`, and `$params`
- Set `$Path` based on the result of the `partial/function/currentMenuItem.html` partial
- Retrieve the page `$gallery` based on `$Path`
- Return all resources of type `image` from `$gallery`

* refactor: adapt getImageSlice function to `single.json`

* feat: refactor navigation UI components to use static go template

* feat: update navigation functionality and threshold rendering
2024-01-20 18:03:26 +08:00
Spedon
d9452ca8d2 fix: prevent page scrolling when in mobile modal (#238)
* fix: import `_partial/container.scss` in `style.scss`

- Add import for `_partial/container.scss` in `style.scss`

* chore: ignore CSS map files in .gitignore

- Added a new entry for `*.css.map` to the .gitignore file

* chore: update dependabot interval to weekly

- Update the interval of the dependabot from daily to weekly.

* fix: try to fix safari floating address bar issue

* fix: try again with svh
2024-01-20 16:46:10 +08:00
Spedon
8ba41fc32c v0.0.5 (#219)
* feat: refactor condition for checking `site.Params.bundled`

- Add default condition for checking if `site.Params.bundled` is true or false

* refactor: update info page content

* chore: update site description

* refactor: refactor variable assignments and return statement in menu template

- Change the variable assignment from `.DirName` to `.Identifier` in the file `layouts/_default/single.json`
- Change the variable assignments in the file `layouts/partials/function/currentMenuItem.html`:
  - From `$dirName := ""` to `$identifier := ""`
  - From `$id := -1` to `$title := ""` and `$weight := -1`
  - From `$dirName = .Identifier` to `$identifier = .Identifier`, `$title = .Title`, and `$weight = .Weight`
- Change the return statement in the file `layouts/partials/function/currentMenuItem.html` from `(dict "DirName" $dirName "ID" $id)` to `(dict "Identifier" $identifier "Title" $title "Weight" $weight)`

* feat: update nav links structure for current link styling

- Remove javascript code related to setting current link style and title
- Update nav links to use updated HTML structure for current link styling

* feat: update page titles and meta tags in layout files

- Update the `baseof.html` layout to include the current page title in the `<title>` tag
- Add OpenGraph meta tags for the page title and description in `meta.html` layout
2024-01-07 23:16:55 +08:00
Spedon
30a01cfd63 minor update (#195)
* refactor: update package.json dependencies and build tools

* feat: bump up geist font version

* refactor: non-nullable-type-assertion-style bypass

* chore: bump up version in package.json

* docs: update get started doc

* styles: prettier format
2023-12-14 13:48:45 +08:00
Spedon
ebdf2405f0 refactor: remove debug log in stage.ts (#154) 2023-11-13 22:42:34 +08:00
Spedon
c2956b7d4b fix: fix preloading in desktop (#152)
* chore(Geist): bump geist font to v1.0.1

* refactor(_typography.scss): split the CSS lang tag to ensure compatibility with Chromium-based browsers

* refactor(stage.ts): bump up preload count on desktop

* feat(params.toml): add support for user defined resize option

* feat(_fonts.scss): add a new font file to better support fullwidth plus and minus

* refactor(info): update info

* chore(build.yml): update branch name for updating bundled artifacts to include the current date

* chore(package.json): update version from 0.0.1 to v0.0.2 to reflect changes made in the codebase

* feat: refactor initialization process for retrieving and sorting image data

- Modify `main.ts` to use async initialization of resources
- Change the return type of `initResources` function to `Promise<ImageJSON[]>`
- Add try-catch block to handle errors in `initResources` function
- Use fetch API to retrieve image data from `index.json`
- Sort the image data based on the index field

* refactor: update file naming and variable assignments in layouts

- Add new file `exampleSite/config/_default/outputs.toml` with the contents `page = ["HTML", "JSON"]`
- Rename file `layouts/partials/resources/imageJSON.html` to `layouts/_default/single.json`
- Modify variable assignments and references in the `single.json` layou

* chore: remove code that includes imageJSON.html partials in layouts

- Remove the code that includes the "resources/imageJSON.html" partial in the 404.html layout
- Remove the code that includes the "resources/imageJSON.html" partial in the single.html layout

* refactor: add `getElPrev()` and `getElNext()` functions to `hires`

- Add `getElPrev()` and `getElNext()` to the `hires` function call

* refactor: refactor image retrieval for improved accuracy

- Add logging of `c0` variable for debugging
- Change `els.push(imgs[increment(s.index + i, s.length)])` to `els.push(imgs[increment(c0 + i, s.length)])` to retrieve images correctly
- Change `return imgs[increment(s.index, s.length)]` to `return imgs[decrement(c[c.length - 1].i, s.length)]` to retrieve previous element correctly
- Change `return imgs[decrement(s.index, s.length)]` to `return imgs[increment(c[c.length - 1].i, s.length)]` to retrieve next element correctly
2023-11-13 22:19:17 +08:00
Spedon
5394ea20eb fix: now preloading will also work in stageNav (#150)
* chore(Geist): bump geist font to v1.0.1

* refactor(_typography.scss): split the CSS lang tag to ensure compatibility with Chromium-based browsers

* refactor(stage.ts): bump up preload count on desktop

* feat(params.toml): add support for user defined resize option

* feat(_fonts.scss): add a new font file to better support fullwidth plus and minus

* refactor(info): update info

* chore(build.yml): update branch name for updating bundled artifacts to include the current date

* chore(package.json): update version from 0.0.1 to v0.0.2 to reflect changes made in the codebase

* feat: refactor initialization process for retrieving and sorting image data

- Modify `main.ts` to use async initialization of resources
- Change the return type of `initResources` function to `Promise<ImageJSON[]>`
- Add try-catch block to handle errors in `initResources` function
- Use fetch API to retrieve image data from `index.json`
- Sort the image data based on the index field

* refactor: update file naming and variable assignments in layouts

- Add new file `exampleSite/config/_default/outputs.toml` with the contents `page = ["HTML", "JSON"]`
- Rename file `layouts/partials/resources/imageJSON.html` to `layouts/_default/single.json`
- Modify variable assignments and references in the `single.json` layou

* chore: remove code that includes imageJSON.html partials in layouts

- Remove the code that includes the "resources/imageJSON.html" partial in the 404.html layout
- Remove the code that includes the "resources/imageJSON.html" partial in the single.html layout

* refactor: add `getElPrev()` and `getElNext()` functions to `hires`

- Add `getElPrev()` and `getElNext()` to the `hires` function call
2023-11-13 21:14:36 +08:00
Spedon
9b08d255f1 Use JSON file to replace raw string in DOM (#147)
* chore(Geist): bump geist font to v1.0.1

* refactor(_typography.scss): split the CSS lang tag to ensure compatibility with Chromium-based browsers

* refactor(stage.ts): bump up preload count on desktop

* feat(params.toml): add support for user defined resize option

* feat(_fonts.scss): add a new font file to better support fullwidth plus and minus

* refactor(info): update info

* chore(build.yml): update branch name for updating bundled artifacts to include the current date

* chore(package.json): update version from 0.0.1 to v0.0.2 to reflect changes made in the codebase

* feat: refactor initialization process for retrieving and sorting image data

- Modify `main.ts` to use async initialization of resources
- Change the return type of `initResources` function to `Promise<ImageJSON[]>`
- Add try-catch block to handle errors in `initResources` function
- Use fetch API to retrieve image data from `index.json`
- Sort the image data based on the index field

* refactor: update file naming and variable assignments in layouts

- Add new file `exampleSite/config/_default/outputs.toml` with the contents `page = ["HTML", "JSON"]`
- Rename file `layouts/partials/resources/imageJSON.html` to `layouts/_default/single.json`
- Modify variable assignments and references in the `single.json` layou

* chore: remove code that includes imageJSON.html partials in layouts

- Remove the code that includes the "resources/imageJSON.html" partial in the 404.html layout
- Remove the code that includes the "resources/imageJSON.html" partial in the single.html layout
2023-11-13 20:51:08 +08:00
Spedon
9c073e98e1 v0.0.2 (#144)
* chore(Geist): bump geist font to v1.0.1

* refactor(_typography.scss): split the CSS lang tag to ensure compatibility with Chromium-based browsers

* refactor(stage.ts): bump up preload count on desktop

* feat(params.toml): add support for user defined resize option

* feat(_fonts.scss): add a new font file to better support fullwidth plus and minus

* refactor(info): update info

* chore(build.yml): update branch name for updating bundled artifacts to include the current date

* chore(package.json): update version from 0.0.1 to v0.0.2 to reflect changes made in the codebase
2023-11-10 21:00:09 +08:00
Sped0n
b9dc117fd8 refactor(state.ts): extract logic to get threshold session index into a separate function for reusability and clarity 2023-11-04 19:36:19 +08:00
Sped0n
bf3ddfc3f8 feat(state.ts): add sessionStorage support to store and restore thresholdsIndex value when navigating between pages 2023-11-04 15:35:49 +08:00
Sped0n
de523d08f4 fix(main.ts): change import statements to use import then syntax instead of top layer await to improve compatibility with Firefox and Chromium browsers 2023-11-04 14:25:33 +08:00
Sped0n
1dc5d62ccf fix(gallery.ts): fix swiper init bug 2023-11-03 16:04:41 +08:00
Sped0n
a629ec08c3 feat(utils.ts): add capitalizeFirstLetter function to capitalize the first letter of a string for better readability and consistency 2023-11-03 14:19:55 +08:00
Sped0n
f4eda42785 feat(i18n): add translations for the new languages (de, es, fr, it, CJK) 2023-11-03 14:19:06 +08:00
Sped0n
8caf13e5d5 fix(stage.ts, collection.ts, gallery.ts, resources.ts): set the alt attribute of the image element to the value of the alt property in the ImageJSON object to improve accessibility and provide alternative text for images. 2023-11-03 09:55:32 +08:00
Sped0n
cd84d21a99 feat(gallery.ts): add dynamic import for gsap and swiper libraries to improve performance by loading them only when needed 2023-11-03 09:02:06 +08:00
Sped0n
137b099ace feat(stage.ts): add support for dynamic import of gsap library and initialize gsap and Power3 variables when mousemove event is triggered to improve performance and reduce initial load time 2023-11-03 09:01:20 +08:00
Sped0n
7df382ee1f feat(utils.ts): add loadGsap and loadSwiper function to asynchronously load library 2023-11-03 08:59:22 +08:00
Sped0n
98f2012e9d fix(main.ts): fix imported module and function for correct init 2023-11-03 08:48:31 +08:00
Sped0n
2229c56b1e chore(fonts): update font files and font-family declarations
- Update font files for different languages: NotoSansCJKsc-Regular.woff2, NotoSansCJKtc-Regular.woff2, NotoSansCJKjp-Regular.woff2, NotoSansCJKkr-Regular.woff2, NotoSans-Regular.woff2
- Update font-family declarations in _typography.scss to use the new font files:
  - Change font-family for body to 'sans-serif'
  - Change font-family for button to 'Noto Sans', sans-serif
- Add font-family declarations for different languages in _typography.scss:
  - For English language (en), use 'Geist', sans-serif
  - For Simplified Chinese language (zh-cn, zh-sg), use 'Noto Sans', 'Noto Sans CJK SC', sans-serif
  - For Traditional Chinese language (zh-hk, zh-mo, zh-tw), use 'Noto Sans', 'Noto Sans CJK TC', sans-serif
  - For Japanese language (ja), use 'Noto Sans', 'Noto Sans CJK JP', sans-serif
  - For Korean language (ko), use 'Noto Sans', 'Noto Sans CJK KR', sans-serif
2023-11-03 08:47:11 +08:00
Sped0n
f5ebeead9e fix(nav.ts): fix circular dependency in desktop view 2023-11-02 12:30:13 +08:00
Sped0n
d936f1b272 fix(gallery.ts): solve circular dependency in mobile view 2023-11-02 12:29:39 +08:00
Sped0n
0cc97325c0 fix(stage.ts): add error logging to catch block in expandImage() and minimizeImage() functions for better error handling 2023-11-02 12:28:30 +08:00
Sped0n
dd01dd8bec refactor(utils.ts): add parameter arg0 to addWatcher callback for improved readability 2023-11-02 12:27:58 +08:00
Sped0n
9d365d8c96 fix(gallery.ts): add { passive: true } option to event listeners for better performance and scrolling behavior 2023-11-02 10:46:38 +08:00
Sped0n
a395513bd6 fix(customCursor.ts): move import statement for active to the top for better organization
fix(customCursor.ts): add return type void to onMouse function for clarity
fix(customCursor.ts): add passive option to window event listener for mousemove to improve performance
fix(stageNav.ts): move import statement for setCustomCursor to the top for better organization
fix(stageNav.ts): add return type void to handleClick function for clarity
fix(stageNav.ts): add return type void to handleKey function for clarity
fix(stageNav.ts): add passive option to overlay event listeners for click, keydown, mouseover, and focus to improve performance
fix(stageNav.ts): add passive option to window event listener for keydown to improve performance
fix(stageNav.ts): add return type void to nextImage function for clarity
fix(stageNav.ts): add return type void to prevImage function for clarity
fix(gallery.ts): move import statement for Swiper to the top for better organization
fix(gallery.ts): add return type void to slideUp function for clarity
fix(gallery.ts): add return type void to initGallery function for clarity
fix(gallery.ts): add passive option to window event listener for touchstart to improve performance
fix(gallery.ts): add return type void to changeSlide function for clarity
fix(gallery.ts): add return type void to scrollToActive function for clarity
fix(gallery.ts): add return type void to createGallery function for clarity
fix(gallery.ts): add passive option to close event listeners for click and keydown to improve performance
fix(gallery.ts): add passive option to overlay event listeners for click, keydown, mouseover, and focus to improve performance
fix(gallery.ts): add passive option to window event listener for touchstart to improve performance
fix(nav.ts): add return type void to initNav function for clarity
fix(utils.ts): add return type number to getRandom function for clarity
fix(utils.ts): add return type void to onVisible function for clarity
fix(utils.ts): add return type void to addWatcher function in Watchable class for clarity
2023-11-01 23:09:02 +08:00
Sped0n
bb15dbea36 chore(style.scss): update import statement for article partial to import swiper.scss from node_modules
chore(link.html): remove unused swiper css import statement
2023-11-01 23:04:05 +08:00
Sped0n
7b48cf6e91 chore(font.scss): update font-face declaration for 'Geist' font and add font-display property for better font loading performance
chore(font.scss): add font-face declaration for 'fw' font and set font-display property for better font loading performance
chore(typography.scss): update font-family property for body element to use 'Geist' font as the primary font
chore(typography.scss): update font-family property for button element to use 'fw' font as the primary font
2023-11-01 23:02:37 +08:00
Sped0n
3d88d5a243 style(base.scss): remove empty line at the end of the file for consistency
style(nav.scss): remove unused import statement for mixins in _core folder
2023-11-01 23:02:02 +08:00
Sped0n
2f75ed3d59 feat(scss): add critical.scss file and import necessary partials for critical styles 2023-11-01 23:01:38 +08:00
Sped0n
e1720906f7 refactor(article.scss): remove margin-top from .info class to improve layout consistency
feat(article.scss): add media query to apply margin-top to .info class on tablets and devices with no hover support to improve responsiveness
2023-10-31 00:35:17 +08:00
Sped0n
bffd43c6cc feat(gallery.ts): add support for loading active images when sliding up to improve user experience 2023-10-31 00:06:47 +08:00
Sped0n
68ddbce37b feat(collection.ts): add image preloading functionality to improve performance and user experience 2023-10-31 00:06:14 +08:00
Sped0n
6606dcec93 refactor(stage.ts): extract getElNextFive() function to improve code readability and reusability
refactor(stage.ts): move lores(getElNextFive()) to setPositions() function to ensure images are preloaded before setting positions
refactor(stage.ts): move lores(getElTrail()) to setPositions() function to ensure images are preloaded before setting positions when isOpen is true
refactor(stage.ts): remove redundant lores(imgs) call from minimizeImage() function
refactor(stage.ts): move lores(getElNextFive()) to initStage() function to ensure images are preloaded when stage is initialized
refactor(stage.ts): remove unused e.src assignment in createStage() function
2023-10-31 00:05:43 +08:00
Sped0n
1e945353df refactor(state.ts): improve code readability by adding comments and organizing code into sections
feat(state.ts): add nextFive property to state object to store the next five indices for preload
feat(state.ts): add getNextFive function to calculate the next five indices based on the current index and length
2023-10-31 00:04:29 +08:00
Sped0n
102e9aacf7 fix(state.ts): change the increment value in decThreshold function from 1 to -1 to correctly decrease the threshold value 2023-10-31 00:03:59 +08:00
Sped0n
f9af230110 refactor(collection.ts): rename variable 'container' to 'collection' for better clarity and semantics
refactor(collection.ts): update classList manipulation to use 'collection' instead of 'container' for consistency and clarity
2023-10-31 00:03:14 +08:00
Sped0n
4b2639d669 style(article.scss): add margin-top to .info class to create space below the navigation bar
style(article.scss): remove media query for positioning .info class on tablets and devices without hover support
2023-10-31 00:02:28 +08:00
Sped0n
071f53071e feat(gallery.ts): change image source to a data attribute and dynamically load it when the image is visible 2023-10-30 17:47:06 +08:00
Sped0n
b5aae19c70 feat(stage.ts): add functions to switch between high-resolution and low-resolution images for better image quality and performance 2023-10-30 17:45:46 +08:00
Sped0n
3cbbc5b6da refactor(resources.ts): update ImageJSON interface to include separate properties for low resolution and high resolution image URLs, heights, and widths for better organization and clarity
refactor(imageJSON.html): modify image resizing logic to generate separate low resolution and high resolution image URLs, heights, and widths to improve performance and optimize image loading
2023-10-30 17:44:59 +08:00
Sped0n
6be9717f2f style(article.scss): add media query for tablets and devices with no hover support to fix positioning of .info element
The media query was added to ensure that the .info element is positioned correctly on tablets and devices with no hover support. The top property was set to the height of the navigation bar and the position was set to fixed to keep the element in place. This change improves the layout and user experience on different devices.
2023-10-30 17:44:21 +08:00
Sped0n
40f278ce1c feat(nav.ts): add functionality to set the current link based on the currentMenuItemIndex attribute 2023-10-30 15:55:02 +08:00
Sped0n
ead0a84ac7 refactor(main.ts): improve code readability by adding conditional check for ijs length before initializing stage or collection
fix(resources.ts): handle case when imagesJson element is not found to prevent error and return empty array
2023-10-30 15:54:36 +08:00
Sped0n
f328d727d5 refactor(stage.ts): reorder imports for better readability and consistency
fix(stage.ts): fix incorrect import order of incIndex and state in stage.ts
2023-10-30 15:54:03 +08:00