Skip to content

Instantly share code, notes, and snippets.

@librasteve
librasteve / MyCromps-Thead.rakumod
Created December 27, 2024 14:43
MyCromps-Thead.rakumod
class Cell is export {
has $.data is required;
multi method new($data) {
$.new: :$data
}
method RENDER {
q:to/END/
<td><.data></td>
@librasteve
librasteve / BaseLib.rakumod
Last active December 27, 2024 14:40
BaseLib.rakumod - table
use HTML::Functional; # :CRO exclusions not needed here
my @components = <Results ActiveTable Table Grid>;
#warn self.thead.raku; $*ERR.flush;
role THead {
has @.thead;
method thead( --> Str() ) {
thead do for @!thead -> $cell {
@librasteve
librasteve / MyCromps.rakumod
Last active December 27, 2024 14:40
MyCromps.rakumod
class Cell {
has $.data;
multi method new($data) {
$.new: :$data
}
method RENDER {
q:to/END/
<td><.data></td>
@librasteve
librasteve / htmxas3.md
Last active December 17, 2024 12:12
htmxas3.md
use Cro::HTTP::Router;
use Cro::WebApp::Template;

sub happy_tm_xmas-routes() is export {

    route {

        $cromponent.add: Results, ActiveTable, THead, HCell, Row, Cell;
@librasteve
librasteve / htmxas2.md
Created December 17, 2024 12:02
htmxas2.md
use Cromponent;
use Cromponent::MyLib;

my $cromponent = Cromponent.new;
my ($index, $topic);

{  #block to avoid namespace collision

 use HTML::Functional;
@librasteve
librasteve / htmxas1.md
Last active December 17, 2024 11:49
htmxas1
class ActiveTable is export {
	has THead() $.thead;

	method RENDER {
		q:to/END/
			<table class="striped">
				<?.thead>
					<&THead(.thead)>
 ?&gt;
@librasteve
librasteve / htmxas1.md
Created December 17, 2024 11:43
htmxas1.md
class ActiveTable is export {
	has THead() $.thead;

	method RENDER {
		q:to/END/
			<table class="striped">
				<?.thead>
					<&THead(.thead)>
 ?&gt;
@librasteve
librasteve / cromnest.raku
Created December 8, 2024 20:00
Cromponent Nests
#!/usr/bin/env raku
use lib "lib";
use Cro::WebApp::Template;
use Cro::HTTP::Router;
use Cro::HTTP::Server;
use Cromponent;
class Col {
@librasteve
librasteve / Template-Register.rakumod
Created December 4, 2024 18:01
HTML::Component::CroTmp prototype
use Cro::HTTP::Router;
use Cro::WebApp::Template;
my constant $location = 'templates';
my constant $base = $*PROGRAM.parent.parent.parent.parent.add($location);
#| API for an HTML::Component that uses the Cro::WebApp cro template
#| mechanism, each component has one static cro template file that is
#| registered with the Cro::Template::Repository when it is instantiated.
#|
@librasteve
librasteve / index.md
Created November 30, 2024 18:42
merry_cromas/index.crotmp

md

<div hx-target="this" hx-swap="outerHTML">

  <p>Tree Height is 235m</p>
  <p>Tree Area is 8648m^2</p>

  <div hx-target="#svg">
    <button hx-get="/merry_cromas/tree_me">Tree Me</button>
    <button hx-get="/merry_cromas/bauble_up">Bauble Up</button>