Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander K committed Jan 7, 2024
1 parent 4490178 commit 1828534
Show file tree
Hide file tree
Showing 46 changed files with 2,148 additions and 240 deletions.
60 changes: 60 additions & 0 deletions ABS.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
require_relative 'bs/all'
BS.will_generate if __FILE__ == $0

draw_grid = $draw_grid || -> _ { draw_stars }
name = $name || 'ABS'

path = File.join __dir__, 'output'
BS.setup name: name, path: path, description: <<END
Abstract PDF for multi-page list items.
The file is meant to be used on the exploratory side of things.
The Left items have pagination directly in the item and there is no predefined page for resolution of the item.
They offer standard abstract blank slate that stands out of the way.
Right items are new in this configuration.
Right items have predefined main page and nested pages in corner notes.
In this PDF I look at right items to be exploratory too so the main page is not the review summary but likely
to be a question/fact/decision that gets tested/looked-into over time.
Checklist flavour could be there.
---
UI patterns:
- RM user should have toolbar closed
- file-scoped notes are above the grid
- items can be found outside the grid at sides
- item-scoped corner notes are in the upper-right corner of the grid
- pagination is not UI-interactive, only page turning is meant
END
BS.grid 18

BS.page :root do
instance_eval &draw_grid
end

is_left = -> page { page[:item_pos].x == -1 }

BS::Items.generate left: 18, right: 18 do
if is_left[page]
BS::Pagination.generate page do
instance_eval &draw_grid
end
else
instance_eval &draw_grid
end
end

# prefix vs filtering?
right_items = BS.pages.xs(:item).reject &is_left

BS::CornerNotes.generate right_items do
instance_eval &draw_grid
end

# iteration notes per file as I use it
BS::TopNotes.generate do
instance_eval &draw_grid
#draw_stars # always creative setup or consistent to file?
end

BS::Items.integrate stick: [
{ type: :corner_note }
]
BS::TopNotes.integrate
42 changes: 42 additions & 0 deletions BS2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require_relative 'bs/all'
BS.will_generate if __FILE__ == $0

draw_grid = $draw_grid || -> _ { draw_stars }
name = $name || 'BS2'

path = File.join __dir__, 'output'
BS.setup name: name, path: path, description: <<END
BS2 is two levels deep BS.
The right side items are actually sub-items of the left-side ones.
It can be seen as NBS for more free diagrams and the right side is a legend to go deeper into parts of them.
---
UI patterns:
- RM user should have toolbar closed
- file-scoped notes are above the grid
- items can be found outside the grid at sides
END
BS.grid 18

BS.page :root do
instance_eval &draw_grid
end

BS::Items.generate left: 18 do
instance_eval &draw_grid
end

BS.pages.xs(:item).each { |parent|
BS::Items[:item2].generate parent: parent, right: 18 do
instance_eval &draw_grid
end
}

BS::TopNotes.generate do
instance_eval &draw_grid
end

BS::Items.integrate
BS::Items[:item2].integrate BS.pages.drop(1).to_sa, stick: [
:item_pos
]
BS::TopNotes.integrate
145 changes: 145 additions & 0 deletions BSE.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
require_relative 'bs/all'
BS.will_generate if __FILE__ == $0

year = 2024
month = 1

# - double-run day pagination?
# - contour is noisy so no point now in it (file with algorithm I'll keep)

path = File.join __dir__, 'output'
BS.setup name: 'BSE', path: path, description: <<END
Blank Slate Exec PDF.
Builds upon existing Blank Slate PDF patterns and adds time dimension explicitly.
Root page - month view with an option to go into day details notes.
Day details notes are paginated.
Weeks pages are linked from squares right below days squares.
Week pages are the main habits/whatever view with no further depth.
There is 18 pages per week for that per week.
In the project language weeks are items on the left and habits/whatever are subitems on the right.
There are corner-notes per week.
---
UI patterns:
- RM user should have toolbar closed
- file-scoped notes are above the grid
- items can be found outside the grid at sides
- item-scoped corner notes are in the upper-right corner of the grid
- pagination is not UI-interactive, only page turning is meant
END
BS.grid 18

draw_grid = -> _ { draw_dots } # want to postpone with smart dots avoiding lines collision noise

BS.page :root do
instance_eval &draw_grid
end

month = BS::Month.new.setup year: year, month: month, parent: BS.page(:root)

BS::Items.generate left: month.week_squares.count do
BS::Items[:subitem].generate parent: page, right: 18, include_parent: true do
instance_eval &draw_grid
end
end

month.generate do
BS::Pagination.generate page do
instance_eval &draw_grid
end
end

BS::CornerNotes.generate BS.pages.xs(:item) do
instance_eval &draw_grid
end

BS::TopNotes.generate do
instance_eval &draw_grid
end

BS::Items.integrate stick: [ :subitem_pos ]
BS::Items[:subitem].integrate stick: [ :item_pos ]
BS::TopNotes.integrate
month.integrate

# corner notes are accessible from sub-items too
BS.pages.xs(:subitem).each { |subitem|
corner_note = BS.pages.xs(:corner_note).find { |x|
x.parent == subitem.parent
}
subitem.visit do
BS::CornerNotes.link corner_note
end
}
# manually integrating since I used items manually
BS.pages.xs(:item).each { |week_page|
index = week_page[:item_index]
pos = month.week_squares[index]
week_page.parent.visit do
link pos.expand(1, 0), week_page
end
}
BS.pages.xs(:month_day).each { |day_page|
square = day_page[:month_square] # day square it is
week_page = BS.pages.xs(:item).find { |x| x[:item_index] == square.week }
day_page.visit do
link square.pos.down.expand(1, 0), week_page
end
}
# rendering week pages + linking
(BS.pages.xs(:item) + BS.pages.xs(:subitem)).each { |week_page|
week_days = month.squares.select { |x| x.week == week_page[:item_index] }
week_page.visit do
size = g.w / 2
had_saturday = false
week_days.each { |day_square|
i = day_square.weekday
if i == 5
had_saturday = true
end
is_saturday = i == 5
is_sunday = i == 6
# with this layout week has to start on Monday
if i == 6
i = 5 # same square position
end
x = i % 2
y = i / 2
x *= size
y = 18 - y * size
pos = Pos[x, y]
(x, y) = g.at [x, y]
gsize = g.xs.step * size
square = Square.sized(x, y, gsize, -gsize)

unless is_sunday && had_saturday
color 8 do
polygon *square.points.map(&:to_a)
end
end

color 8 do
day = day_square.day.to_s
pos.x -= 1 if is_saturday
text_at = grid.at pos.x, pos.y, corner: 0

day_page = BS.pages.xs(:month_day).find { |x| x[:month_square] == day_square }
link_pos = pos.down(6).right(5) # shift is here instead of at text...
link link_pos, day_page

# assumes day cell size, scaling of text is the same
step = g.xs.at(2, corner: 1) - g.xs.at(1, corner: 0)
big_step = g.xs.at(6, corner: 1) - g.xs.at(1, corner: 0)

font $roboto do
font_size step * 0.25 do
text = day.to_s
pad_x = step * 0.05
pad_y = step * 0.025
pdf.text_box text, at: text_at, width: big_step-pad_x, height: big_step-pad_y, align: :right, valign: :bottom
end
end
# movable into month module +-, still abstractions around numbers update is of interest
end
}
end
}
65 changes: 65 additions & 0 deletions NBS.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
require_relative 'bs/all'
BS.will_generate if __FILE__ == $0

#flavour = :nested # not much value in nesting with PDFs it seems
flavour = :flat
item_count = 6

path = File.join __dir__, 'output'
BS.setup name: "NBS", path: path, description: <<END
Abstract PDF for graphs or possibly mind-mapping.
Root page is a table of contents for items.
Items at the left (mostly top) outside the grid can be seen as layers.
Then there are nodes and each has own pages inside if needed.
Experimental.
---
UI patterns:
- RM user should have toolbar closed
- file-scoped notes are above the grid
- items can be found outside the grid at sides
END
BS.grid 18

BS.page :root do
draw_dots # looking for some story consistency with other views
#draw_dots border: true
#draw_stars # could be lines but it is too chaotic and non-defined here
end

BS::Items.generate left: item_count

BS.pages.xs(:item).each { |parent|
BS::Nova.generate parent: parent do
if flavour == :nested
BS::Nova.draw_nova_grid page
end

if flavour == :flat
BS::Pagination.generate page do
draw_stars dots: false
end
end
end
}

if flavour == :nested
BS.pages.xs(:nova).each { |parent|
BS::Nova[:nova2].generate parent: parent, nova_size: 2 do
draw_stars dots: false
end
}
end

# iteration notes per file as I use it
BS::TopNotes.generate do
draw_stars # creative
end

BS::Items.integrate stick: [
:nova_pos,
:nova2_pos,
{ type: :corner_note }
]
BS::TopNotes.integrate
BS::Nova.integrate
BS::Nova[:nova2].integrate

0 comments on commit 1828534

Please sign in to comment.