@saasira/holi 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## [0.1.3] - 2026-03-19
6
+
7
+ ### Changed
8
+
9
+ - Recut the release from the scoped npm package setup so publishing can proceed with `@saasira/holi`.
10
+ - Carried forward the npm CDN workflow, changelog, and scoped CDN documentation into the new release line.
11
+
12
+ ### Validation
13
+
14
+ - Verified packaging metadata with `npm pack --dry-run`.
15
+
16
+ ## [0.1.2] - 2026-03-19
17
+
18
+ ### Added
19
+
20
+ - Added a new template-driven `panel` component with matching styles and template assets.
21
+ - Added progressive-enhancement examples for panel, validator, native forms, and service worker management.
22
+ - Added runtime utilities for component state bridging, partial page refresh flows, native host integration, validation, and service worker support.
23
+
24
+ ### Changed
25
+
26
+ - Expanded form control behavior across checkbox, radio, select, input, and textarea components.
27
+ - Improved shared component lifecycle and registry behavior to better support declarative updates and app-level orchestration.
28
+ - Extended datagrid, datatable, dropdown, and gallery behavior and styling for richer interactive scenarios.
29
+ - Updated the build to emit service worker assets and the new example pages into `public/examples`.
30
+
31
+ ### Validation
32
+
33
+ - Verified with `npm run ci:smoke`.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Holi
2
+
3
+ Holi is a template-driven frontend component library focused on progressive enhancement, declarative rendering, and secure expression-based bindings.
4
+
5
+ It is designed for teams that want reusable UI components without committing to a virtual DOM framework or Shadow DOM component model.
6
+
7
+ ## Philosophy
8
+
9
+ Holi follows strict architectural principles:
10
+
11
+ - HTML templates are the source of truth (`<template>` + `<slot>`).
12
+ - Component JS must not generate structure using inline HTML strings.
13
+ - Rendering is declarative through attributes such as `data-if`, `data-repeat`, and `@{...}` interpolation.
14
+ - Components auto-discover and auto-render on page load (with explicit lazy transform opt-in).
15
+ - Expression evaluation is secure-by-design (no `eval`, no `new Function`).
16
+ - No Shadow DOM.
17
+ - Progressive enhancement first.
18
+ - Multiple component libraries and pluggable content providers are supported.
19
+
20
+ Canonical reference: `docs/holi-principles.md`.
21
+
22
+ ## What You Get
23
+
24
+ - Auto initialization on `DOMContentLoaded` via `HoliApp.init(document)`.
25
+ - Three discovery styles for each component:
26
+ - Tag: `<tabs></tabs>`
27
+ - Attribute: `<section component="tabs"></section>`
28
+ - Role: `<section role="tabs"></section>`
29
+ - Template library bundling (`dist/holi.html`) and runtime template injection.
30
+ - Template bindings:
31
+ - `@{expression}` interpolation
32
+ - `data-if`, `data-show`, `data-open`, `visible`
33
+ - `data-repeat` loops with contextual item/index
34
+ - Lifecycle-aware component registry with DOM mutation observation.
35
+ - Content provider pattern for dynamic/lazy content per component.
36
+ - jQuery-like utility surface (`Q`) and native HTTP helper (`HTTP`).
37
+ - Prebuilt component set including accordion, calendar, carousel, chart, datagrid, datatable, dialog, drawer, dropdown, form controls, gallery, tabs, toast, tree, wizard, and more.
38
+
39
+ ## Declarative Dependencies
40
+
41
+ Holi supports declarative dependent updates between components.
42
+
43
+ - Source components publish change notifications through the central runtime.
44
+ - Subscriber components declare interest in one or more source components.
45
+ - The framework only resolves and delivers the notification.
46
+ - The subscriber decides how to react based on its own data source and behavior.
47
+
48
+ This means "local refresh" vs "remote/PPR reload" is not decided by the framework. It is decided by the subscriber component after it receives the dependency update.
49
+
50
+ Common attributes:
51
+
52
+ - Source side: `update`, `render`, `data-ppr-update`
53
+ - Subscriber side: `data-ppr-listen`, `data-ppr-source`
54
+
55
+ Common subscriber hook contract:
56
+
57
+ - `handlePprUpdate(payload)`
58
+ - `refreshPpr(payload)`
59
+ - `refresh(payload)`
60
+ - `updateView(payload)`
61
+
62
+ JSF-style target tokens such as `@this`, `@parent`, `@form`, `@all`, and explicit ids are supported by the dependency resolver.
63
+
64
+ ## Quick Start
65
+
66
+ ```bash
67
+ npm install
68
+ npm run build
69
+ npm run serve
70
+ ```
71
+
72
+ Main artifacts:
73
+
74
+ - `dist/holi.js`
75
+ - `dist/holi.css`
76
+ - `dist/holi.html` (templates)
77
+ - Example site output: `public/examples/**`
78
+
79
+ ## CDN Usage
80
+
81
+ Holi can be shipped directly from a free CDN after publishing the package to npm.
82
+
83
+ Recommended jsDelivr links for `v0.1.3`:
84
+
85
+ ```html
86
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@saasira/holi@0.1.3/dist/holi.css" />
87
+ <script src="https://cdn.jsdelivr.net/npm/@saasira/holi@0.1.3/dist/holi.js"></script>
88
+ <link rel="preload" as="fetch" href="https://cdn.jsdelivr.net/npm/@saasira/holi@0.1.3/dist/holi.html" crossorigin="anonymous" />
89
+ ```
90
+
91
+ Fallback unpkg links:
92
+
93
+ ```html
94
+ <link rel="stylesheet" href="https://unpkg.com/@saasira/holi@0.1.3/dist/holi.css" />
95
+ <script src="https://unpkg.com/@saasira/holi@0.1.3/dist/holi.js"></script>
96
+ <link rel="preload" as="fetch" href="https://unpkg.com/@saasira/holi@0.1.3/dist/holi.html" crossorigin="anonymous" />
97
+ ```
98
+
99
+ Repository setup details for automated npm publishing are documented in `docs/CDN.md`.
100
+
101
+ ## Minimal Usage
102
+
103
+ ```html
104
+ <!doctype html>
105
+ <html>
106
+ <head>
107
+ <meta charset="UTF-8" />
108
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
109
+ <link rel="stylesheet" href="/dist/holi.css" />
110
+ <script src="/dist/holi.js"></script>
111
+ </head>
112
+ <body>
113
+ <tabs provider="demo" data-source="@{demo.simple}"></tabs>
114
+
115
+ <script>
116
+ const tabData = [{ label: "Overview", content: "Overview content" }];
117
+ window.contentProviders = window.contentProviders || {};
118
+ window.contentProviders.demo = class {
119
+ resolve(expr) {
120
+ return expr === "@{demo.simple}" ? tabData : [];
121
+ }
122
+ async getContent(item) {
123
+ return item?.content || "";
124
+ }
125
+ };
126
+ </script>
127
+ </body>
128
+ </html>
129
+ ```
130
+
131
+ ## Project Structure Contracts
132
+
133
+ - Component scripts: `src/scripts/components/<componentname>.js`
134
+ - Component styles: `src/styles/components/<componentname>.css`
135
+ - Component templates: `src/templates/components/<componentname>.html`
136
+ - Shared utilities: `src/scripts/utils/<utilityname>.js`
137
+ - Example sources:
138
+ - `src/examples/pages/*.html`
139
+ - `src/examples/styles/*.css`
140
+ - `src/examples/scripts/*.js`
141
+ - Built examples: `public/examples/**` (referencing `dist/holi.js` and `dist/holi.css`)
142
+
143
+ ## Holi vs React / Angular / Vue
144
+
145
+ | Area | Holi | React | Angular | Vue |
146
+ |---|---|---|---|---|
147
+ | Primary model | HTML template + declarative attrs | Component functions + JSX | Framework with DI, modules, templates | SFC/templates + reactivity |
148
+ | Runtime style | Direct DOM + template clone/bind | Virtual DOM | Framework-managed change detection | Virtual DOM + compiler/runtime |
149
+ | Auto discovery | Yes (tag/component/role selectors) | No (explicit mount) | No (bootstrapped app) | No (explicit mount) |
150
+ | Progressive enhancement | First-class | Possible, not default | Usually app-shell centric | Possible, typically app-centric |
151
+ | Shadow DOM | Not used | Not required | Optional with Angular Elements | Not required |
152
+ | Secure expression engine | Built-in `@{...}` parser (no eval) | N/A (JS expressions in render code) | Template parser | Template parser |
153
+ | Best fit | Multi-page apps, server-rendered pages, declarative component islands | Large SPAs and highly interactive app UIs | Enterprise apps needing full framework conventions | Progressive SPAs and mixed-complexity apps |
154
+
155
+ Practical summary:
156
+
157
+ - Choose Holi when your HTML-first architecture, declarative enhancement, and low-framework runtime footprint are priorities.
158
+ - Choose React/Angular/Vue when you need the broader ecosystem around SPA routing/state tooling, compile-time optimizations, and framework-level DX conventions.
159
+
160
+ ## Development Scripts
161
+
162
+ - `npm run build`: Build library and examples.
163
+ - `npm run build:dev`: Development build and examples.
164
+ - `npm run build:examples`: Build example pages into `public/examples`.
165
+ - `npm run serve`: Build examples and start webpack dev server.
166
+ - `npm run smoke:examples`: Run example smoke checks.
167
+ - `npm run ci:smoke`: Full build + smoke.
168
+
169
+ ## Notes
170
+
171
+ - Holi exports `window.HoliApp` / `window.Holi`.
172
+ - Auto init can be disabled with `window.HoliAutoInit = false` before loading `dist/holi.js`.
173
+ - Templates are loaded from `dist/holi.html` (with runtime fallback paths).