Skip to content

$mol_book in dom #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

$mol_book in dom #761

wants to merge 18 commits into from

Conversation

zerkalica
Copy link
Collaborator

@zerkalica zerkalica commented Mar 30, 2025

Можно встраивать mol_book в mol_book

Дочерние mol_book теперь рендерятся в дом целиком, а не только их pages, как раньше, можно юзать события, auto и другое dom-специфичное апи в дочерних mol_book.

dom_name у mol_book пришлось переделать на article, иначе не работали оранжевые точки в хедере, т.к. :first-of-type не работает с разными тегами в одном контейнере.

Также убрал minimal_height 64 в catalog в Menu

https://t.me/mam_mol/161837

т.к. подскрол в auto, надо не забывать про крышку: hyoo-ru/page.hyoo.ru#3

@zerkalica zerkalica force-pushed the fib-destructor branch 5 times, most recently from a2dc8ba to a6a8f98 Compare April 1, 2025 07:49
zerkalica added a commit to hyoo-ru/page.hyoo.ru that referenced this pull request Apr 1, 2025
@@ -12,6 +12,7 @@
/* padding: 0 1px;
scroll-padding: 0 1px;
gap: 1px; */
--mol_book2_grip_top: 1.5rem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем переменная для этого?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так гвоздями все прибито, если чуть меньше сделать хедеры, точки эти едут, т.к. они абсолютом делаются.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А хедер ты меньше через переменные делаешь тоже?

Comment on lines +31 to +40
[mol_book2] > *:not(:first-child):not([mol_book2]):not([mol_book2_gap])::before,
/* Append dots to not last page in the book, exclude page before placeholder */
[mol_book2] > *:not(:last-child):not([mol_book2]):not([mol_book2_gap]):not(:has(+ [mol_book2_placeholder]))::after,

/* Can't add dots to the book due to display: contents */
/* Prepend dots to all pages in the not first child book, exclude placeholder and second level child book */
[mol_book2] > *:not(:first-child)[mol_book2] > *:not([mol_book2]):not([mol_book2_gap])::before,

/* Append dots to all pages in the not last child book not before placeholder */
[mol_book2] > *:not(:last-child)[mol_book2]:not(:has(+ [mol_book2_placeholder])) > :not([mol_book2]):not([mol_book2_gap])::after
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может всё же какой-то атрибут к страницам добавлять, через призрака? А то это какая-то адская логика в стилях.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что б просетить атрибут, надо через js получить положение паги в общей иерархии паг.

Этот факт заблокирует весь первый буклет, вместо того что бы отрисовать паги с загрузкой в каждой к примеру.

Если буклет не блокировать, пропускать промис, то скорее всего будет меняться состав паг во время рендера, дребезг.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Какое отношение рендеринг призраков имеет к рендерингу бука?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не важно как добавляется атрибут, важно что для его значения надо знать где страница находится в иерархии.

Ты ж имеешь в виду атрибут типа last, first и т.д.? Без него не решить куда точки поставить, а куда нет.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не важно, где определено свойство, важно, где оно вызывается.

right: -1px;
}

:where([mol_book2]) > * {
:where([mol_book2]) > *:not([mol_book]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А где-то ещё используется первый бук?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ошибка, тут надо book2

Comment on lines +82 to +84
[mol_book2] [mol_book2] > [mol_book2_placeholder] {
display: none;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем его тогда вообще рендерить?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Проверял эвенты

Идея была в том, что буклет ничего не знает про иерархию, просто предоставляет placeholder, хотелось бы его рендерить, справа от всех, но при этом не ломая структуру дом, что б владение и эвенты адекватными оставались, типа как портал.

Но у меня не получилось так сделать на css, поэтому можно выпилить наверное.

Comment on lines +59 to +63
override scroll_task_top() {
// avoid mem creation for non-top book
if (this.top_book) return null
this.scroll_task()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему бы не сделать рекурсивную логику? Верхний бук спрашивает у нижнего куда в нём скроллить и в конечном счёте получает глубоко вложенную страницу.

Copy link
Collaborator Author

@zerkalica zerkalica Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

непонятное что-то

У меня логика была такая:

  1. страница к которой надо подскролить, может быть только одна, надо исключить конкуренцию подскролов, поэтому mem с этой логикой должен быть один. Конкуренция может появиться из-за асинхронщины при получения состава страниц в каком-либо буклете.

  2. Скролл может быть только у топового буклета, следовательно дочерние никуда никуда скролить не должны.

Отсюда, как раз наоборот, дочерние буклеты должны топовому передавать страницы, к которым они хотят, что б топовый подскролил.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Речь про получение страницы в топовом буке для подскролла..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так все мое объяснение выше про нее
Вся эта логика только в топовом и работает благодаря отсутствию this.top_book

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ты там ниже ищешь страницу, к которой скроллить, не девая вложенным компонентам самим решать.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants