diff --git a/.github/RELEASE-NOTE-TEMPLATE.md b/.github/RELEASE-NOTE-TEMPLATE.md
new file mode 100644
index 0000000..307945b
--- /dev/null
+++ b/.github/RELEASE-NOTE-TEMPLATE.md
@@ -0,0 +1,30 @@
+# What's new in Faz X.X.X
+
+## YYYY-MM-DD
+
+We are pleased to announce the release of Faz X.X.X.
+
+
+
+
+Here are the highlights:
+
+## Features
+
+* Describe new features here. [#issue-number](https://github.com/candango/faz/issues/issue-number)
+
+## Build
+
+* Describe build changes or improvements here. [#issue-number](https://github.com/candango/faz/issues/issue-number)
+
+## Refactory
+
+* Describe refactoring efforts or code structure improvements here. [#issue-number](https://github.com/candango/faz/issues/issue-number)
+
+## Bug Fixes
+
+* List bug fixes here, if any. [#issue-number](https://github.com/candango/faz/issues/issue-number)
+
+## Other Notes
+
+* Add any additional notes or acknowledgments here.
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
index 12b7c41..c7972e1 100644
--- a/.github/workflows/run_tests.yml
+++ b/.github/workflows/run_tests.yml
@@ -2,27 +2,31 @@ name: Run faz tests
on: [push, pull_request]
+permissions:
+ contents: read
+
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
- node-version: ["18", "20", "21"]
+ node-version: ["22", "24", "26"]
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v7
- name: Set up Node ${{ matrix.node-version }}
- uses: actions/setup-node@v4
+ uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
+ - name: Set up pnpm
+ uses: pnpm/action-setup@v6
- name: Install dependencies
- # Solution from: https://stackoverflow.com/a/67740771/2887989
run: |
- export YARN_ENABLE_IMMUTABLE_INSTALLS=false
- npm install -g yarn
- npm run yarn
- yarn install
- - name: Run jest unit tests
+ pnpm install --frozen-lockfile
+ - name: Run build
+ run: |
+ pnpm run build
+ - name: Run vitest unit tests
run: |
- npm test
+ pnpm test
diff --git a/.gitignore b/.gitignore
index 5b2910b..9165514 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,6 @@ yarn-error.log
# Less
stylesheets/*.css
stylesheets/*.css.map
+
+# Project
+.gemini/
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..40bbe5c
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,81 @@
+# AGENTS.md
+
+## Project Identity
+
+Candango Faz is a Web Components toolkit for incremental modernization of legacy applications.
+
+This repository is not primarily an application. It is a substrate for building reusable custom elements that can be embedded into existing systems, including legacy PHP applications, server-rendered pages, and mixed frontend stacks.
+
+The strategic goal is to let teams replace tangled combinations of business logic, control flow, markup, Bootstrap classes, and imperative JavaScript with focused HTML tags that encapsulate UI behavior and presentation.
+
+## Core Mission
+
+Faz exists to support gradual migration, not big-bang rewrites.
+
+A typical target environment may contain legacy PHP templates with conditionals, echoes, inline markup, duplicated Bootstrap snippets, and procedural JavaScript. Faz should make it possible to replace those fragments incrementally with reusable custom elements, one screen or one UI island at a time.
+
+The intended migration pattern is:
+
+1. Identify a painful legacy UI fragment.
+2. Extract the behavior and presentation into a Faz component.
+3. Replace the legacy fragment with a single custom element tag.
+4. Keep the surrounding legacy system running.
+5. Repeat until the system becomes easier to maintain.
+
+This avoids the common failure mode where a team disappears for months attempting a full rewrite and returns with an incomplete proof of concept while the legacy system remains unchanged.
+
+## Architectural Implications
+
+Agents working in this repository must preserve the following priorities:
+
+- **HTML-first integration:** Components must be easy to consume from plain HTML and server-rendered templates.
+- **Attribute-driven APIs:** Public component APIs should work naturally through HTML attributes and properties.
+- **Legacy compatibility:** Do not assume a clean SPA environment. Components may be mounted inside old pages with existing CSS and JavaScript.
+- **Incremental adoption:** Changes should support partial replacement of legacy UI, not require full application rewrites.
+- **Reusable UI islands:** Components should encapsulate behavior, state, and presentation cleanly enough to be reused across legacy screens.
+- **Bootstrap-aware presentation:** Faz builds on Bootstrap conventions and should cooperate with Bootstrap-based layouts.
+- **Small blast radius:** Prefer changes that can be adopted component-by-component without forcing consumers to reorganize their whole frontend.
+
+## Development Guidance
+
+When designing or changing APIs, ask:
+
+- Can this be used from a legacy PHP template with a simple tag?
+- Does the component expose enough behavior through attributes/properties?
+- Does this require consumers to adopt a full frontend runtime architecture?
+- Can this replace a small legacy fragment without rewriting the whole page?
+- Will this behave predictably when embedded into an existing Bootstrap page?
+
+Avoid designs that only make sense in a modern greenfield SPA.
+
+## Security and Build Hardening TODOs
+
+The current build and CI setup needs supply-chain hardening before release automation becomes trusted.
+
+TODO:
+
+- Replace the mutable Yarn CI install flow with a reproducible package-manager workflow.
+ - Current GitHub Actions disables immutable installs and runs `npm run yarn`, which deletes and regenerates `yarn.lock`, `.yarnrc.yml`, and `node_modules`.
+ - Prefer a committed lockfile and an immutable install command.
+ - The project may migrate from Yarn to pnpm, but the migration must preserve reproducibility.
+- Add explicit least-privilege permissions to GitHub Actions.
+ - The test workflow should start with `permissions: contents: read` unless a job needs more.
+- Decide whether to pin GitHub Actions by SHA.
+ - Current workflow uses tag references such as `actions/checkout@v4` and `actions/setup-node@v4`.
+ - Pinning by SHA reduces tag-compromise risk.
+- Retire or modernize Travis CI.
+ - `.travis.yml` still targets Node.js 12 and caches `node_modules`.
+ - If Travis is no longer used, remove it to avoid stale CI behavior.
+- Decide release sourcemap policy.
+ - `build.mjs` currently emits sourcemaps into `dist/js`.
+ - Keep them intentionally for open-source/debuggability or disable them for release builds.
+- Review bundled legal comment handling.
+ - `build.mjs` uses `legalComments: "none"`.
+ - Consider `legalComments: "eof"` or another policy that preserves required dependency notices.
+- Audit legacy `eval()` usage before exposing related code paths.
+ - `input/filterbox.js` contains callback evaluation via `eval(...)`.
+ - If that code is still reachable, replace it with an explicit callback registry or allowlist.
+
+## Working Definition
+
+Candango Faz is a toolkit for replacing legacy UI fragments with reusable Web Components, enabling progressive modernization without stopping the business for a rewrite.
diff --git a/LICENSE b/LICENSE
index d096af3..1257355 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,201 +1,21 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2018-2023 Flavio Garcia.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+MIT License
+
+Copyright (c) 2026 Flavio Garcia
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSE-apache-old b/LICENSE-apache-old
new file mode 100644
index 0000000..39e3663
--- /dev/null
+++ b/LICENSE-apache-old
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2018-2025 Flavio Garcia.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
index d1175fb..dead1c8 100644
--- a/README.md
+++ b/README.md
@@ -1,43 +1,110 @@
# Candango Faz
-**master:** [](https://travis-ci.org/candango/faz)
+Candango Faz is a Web Components toolkit for incremental modernization of legacy applications.
-**develop:** [](https://travis-ci.org/candango/faz)
+It provides a small substrate for replacing tangled server-rendered UI fragments with reusable custom elements. A common target is an existing PHP or server-rendered application where markup, conditionals, Bootstrap classes, and imperative JavaScript are mixed together. Faz lets teams replace those fragments gradually with focused HTML tags instead of stopping the business for a full rewrite.
-## Introduction
+## Purpose
-Candango faz is a toolkit based on bootstrap and solid-js.
+Faz is designed for progressive migration:
-# Installation
+1. Find a painful legacy UI fragment.
+2. Extract its behavior and presentation into a Faz component.
+3. Replace the legacy fragment with a custom element tag.
+4. Keep the surrounding application running.
+5. Repeat safely, one UI island at a time.
-## npm
+The project is intentionally HTML-first. Components should be easy to consume from plain HTML, server-rendered templates, and older Bootstrap-based pages.
+## Installation
+
+```bash
+npm i faz
```
-> npm i faz
+
+```bash
+pnpm add faz
```
-## yarn
+## Package entrypoints
+
+The package exposes built ESM and declaration artifacts through the package export map:
+```ts
+import {
+ FazElement,
+ FazFormElement,
+ FazPaginator,
+ bindReactive,
+ randomId,
+ toBoolean,
+} from "faz";
```
-> yarn add faz
+
+Additional public entrypoints:
+
+```ts
+import { bindReactive } from "faz/reactivity";
+import { FazPaginator } from "faz/paginator";
```
-# Development
+The `faz/src` entrypoint is still published for compatibility with existing Faz-based packages, but consumers should prefer the built package entrypoints whenever possible.
+
+## Development
-## At the command line
+This project uses pnpm.
+Install dependencies:
+
+```bash
+pnpm install
```
-> yarn
-> npm run lessc:dev
-> npm run run
+
+Run the full build:
+
+```bash
+pnpm run build
```
-## Running tests
+Run tests:
+```bash
+pnpm test
```
-> yarn
+
+Run development stylesheet compilation:
+
+```bash
+pnpm run lessc:dev
```
- - Add new Node.Js at the Run/Debug configurations.
- - Java Script file: node_modules/http-server/bin/http-server
- - Working directory: the faz project root directory
+Run the showcase watcher:
+
+```bash
+pnpm run showcase
+```
+
+## Build and distribution
+
+The build generates:
+
+- `dist/js/*` bundled ESM artifacts;
+- `dist/types/*` TypeScript declarations;
+- `dist/css/*` compiled stylesheets.
+
+The package entrypoint is `dist/js/index.js`, and the public type entrypoint is `dist/types/index.d.ts`.
+
+Before publishing or testing downstream consumers, run:
+
+```bash
+pnpm install --frozen-lockfile
+pnpm run build
+pnpm test
+pnpm pack
+```
+
+## License
+
+Candango Faz was licensed under Apache-2.0 from 2018 to 2025.
+
+Since 2026 it is licensed under the MIT License.
diff --git a/app/breadcrumb.js b/app/breadcrumb.js
index a11e006..d6e0062 100644
--- a/app/breadcrumb.js
+++ b/app/breadcrumb.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazNavbar, FazBreadcrumb } from "../faz";
diff --git a/app/code-highlight.js b/app/code-highlight.js
index 61bf1db..d9139ea 100644
--- a/app/code-highlight.js
+++ b/app/code-highlight.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import hljs from "highlight.js/lib/highlight";
import "highlightjs-line-numbers.js";
diff --git a/app/datepicker.js b/app/datepicker.js
index 625174f..4dbf2f2 100644
--- a/app/datepicker.js
+++ b/app/datepicker.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazInputDatepicker, FazDatepicker, FazNavbar } from "../faz";
diff --git a/app/filterbox.js b/app/filterbox.js
index 50c64c6..8247bad 100644
--- a/app/filterbox.js
+++ b/app/filterbox.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazFilterbox, FazNavbar } from "../faz";
diff --git a/app/form.js b/app/form.js
index 59d959e..1a0fda6 100644
--- a/app/form.js
+++ b/app/form.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flavio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { fixture } from "can"
import {default as MainNavbar} from "./main-navbar"
diff --git a/app/global.js b/app/global.js
index 7b34458..78b7960 100644
--- a/app/global.js
+++ b/app/global.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flavio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
window.codemirrorit = function(id) {
let referenceNode = document.getElementById(id)
diff --git a/app/input.js b/app/input.js
index 90913c5..53bd8ab 100644
--- a/app/input.js
+++ b/app/input.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazNavbar } from "../faz";
diff --git a/app/main-navbar.js b/app/main-navbar.js
index fae4858..30845ba 100644
--- a/app/main-navbar.js
+++ b/app/main-navbar.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { ObservableObject } from "can";
import {FazStacheItem} from "../item";
diff --git a/app/nav.js b/app/nav.js
index dd532cc..5cf46d9 100644
--- a/app/nav.js
+++ b/app/nav.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazAlert, FazNavElement, FazNavbar } from "../faz";
diff --git a/app/navbar.js b/app/navbar.js
index 7f28679..45942bb 100644
--- a/app/navbar.js
+++ b/app/navbar.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazNavbar } from "../faz";
diff --git a/app/pagination.js b/app/pagination.js
index cb28116..6de8806 100644
--- a/app/pagination.js
+++ b/app/pagination.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flavio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazNavbar, FazPaginationElement } from "../faz";
diff --git a/app/picklist.js b/app/picklist.js
index 3e658b6..3aba25b 100644
--- a/app/picklist.js
+++ b/app/picklist.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazPicklist, FazNavbar } from "../faz";
diff --git a/app/sidebar.js b/app/sidebar.js
index f2a5007..978630b 100644
--- a/app/sidebar.js
+++ b/app/sidebar.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flavio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazSidebarElement, FazNavbar } from "../faz";
diff --git a/assets.mjs b/assets.mjs
new file mode 100644
index 0000000..58c5ef8
--- /dev/null
+++ b/assets.mjs
@@ -0,0 +1,5 @@
+
+export const assets = {
+ assets:[
+ ]
+}
diff --git a/breadcrumb/breadcrumb-item.js b/breadcrumb/breadcrumb-item.js
deleted file mode 100644
index c5ffb41..0000000
--- a/breadcrumb/breadcrumb-item.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ObservableArray, type } from "can";
-import { default as FazItem } from "../item";
-import itemTemplate from "./stache/breadcrumb-item.stache";
-
-export class FazBreadcrumbItem extends FazItem {
-
- static get props() {
- return $.extend(super.props, {
- disabled: {type: type.convert(Boolean), default: false},
- target: {type: type.convert(String), default: ""},
- });
- }
-
- get classes() {
- let classes = ["breadcrumb-item"];
- if(this.active) {
- classes.push("active");
- }
- return classes.join(" ");
- }
-
- get html() {
- return itemTemplate(this);
- }
-
- setParent(parent) {
- this.parent = parent;
- }
-
- processElement(parent, element) {
- this.setParent(parent);
- for(let attribute of element.attributes) {
- switch (attribute.name.toLowerCase()) {
- case "id":
- this.id = attribute.value;
- break;
- case "href":
- this.href = attribute.value;
- break;
- }
- }
- this.content = element.innerHTML;
- }
-
- process(parent, element, activeItem) {
-
- }
-}
-
-export class FazBreadcrumbItemList extends ObservableArray {
- static get props() {
- return {
- get enabled() {
- return this.filter({disabled: false});
- },
- get last() {
- return this[this.length-1];
- },
- get active() {
- return this.filter({active: true});
- }
- };
- }
-
- constructor(items) {
- super(items);
- this.on( "add", function ( ev, items, index ) {
- console.log( "add", items, index );
- });
- }
-
- clearAll() {
- while(this.length>0) {
- this.pop();
- }
- }
-
- static items = type.convert(FazBreadcrumbItem);
-}
diff --git a/breadcrumb/breadcrumb.js b/breadcrumb/breadcrumb.js
deleted file mode 100644
index f65f73d..0000000
--- a/breadcrumb/breadcrumb.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Copyright 2018-2022 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {StacheElement, type} from "can";
-import { FazBreadcrumbItem, FazBreadcrumbItemList } from "./breadcrumb-item";
-import breadcrumbTemplate from "./stache/breadcrumb.stache";
-
-export default class FazBreadcrumb extends StacheElement {
- static view = breadcrumbTemplate;
-
- static get props() {
- return {
- isLoading: {type: Boolean, default: true},
- content: {type: type.convert(String)},
- source: {type: type.convert(String)},
- items: {type: FazBreadcrumbItemList, get default() {
- return new FazBreadcrumbItemList([]);
- }},
- set jsonString(value) {
- try {
- let data = JSON.parse(value);
- this.items.clearAll();
- data.items.forEach(function(item){
- this.items.push(item);
- }.bind(this));
- } catch (e) {
- console.error(e);
- }
- }
- };
- }
-
- connectedCallback() {
- this.content = this.innerHTML;
- for(let attribute of this.attributes) {
- switch (attribute.name.toLowerCase()) {
- case "json-string":
- this.jsonString = attribute.value;
- break;
- case "source":
- this.source = attribute.value;
- break;
- }
- }
- this.querySelectorAll("faz-breadcrumb > faz-breadcrumb-item").forEach(
- function(item) {
- let breadcrumbItem = new FazBreadcrumbItem();
- breadcrumbItem.processElement(this, item);
- this.items.push(breadcrumbItem);
- }.bind(this)
- );
- super.connectedCallback();
-
- if (this.items.last!==undefined) {
- this.items.last.active = true;
- }
-
- }
-
- static get seal() {
- return true;
- }
-}
-
-customElements.define("faz-breadcrumb", FazBreadcrumb);
diff --git a/breadcrumb/fixtures/breadcrumb.json b/breadcrumb/fixtures/breadcrumb.json
deleted file mode 100644
index e7c16ce..0000000
--- a/breadcrumb/fixtures/breadcrumb.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "items": [
- {
- "content": "Root From Source"
- },
- {
- "content": "First Level From Source",
- "href": "#firstLevelFromSrouce"
- },
- {
- "content": "Edge From Source",
- "href": "#edgeFromSrouce"
- }
- ]
-}
diff --git a/breadcrumb/index.html b/breadcrumb/index.html
deleted file mode 100644
index 528f801..0000000
--- a/breadcrumb/index.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
diff --git a/breadcrumb/stache/breadcrumb.stache b/breadcrumb/stache/breadcrumb.stache
deleted file mode 100644
index 6ba5703..0000000
--- a/breadcrumb/stache/breadcrumb.stache
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/build.mjs b/build.mjs
index 3563740..d1d936f 100644
--- a/build.mjs
+++ b/build.mjs
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2023 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import * as esbuild from "esbuild";
import {entryPoints} from "./entryPoints.mjs";
@@ -31,7 +16,7 @@ await esbuild.build({
format: "esm",
define: { gobal: "window" },
target: ["esnext"],
- outdir: "dist/esm",
+ outdir: "dist/js",
logLevel: "info",
legalComments: "none",
// outExtension: { '.js': '.cjs' },
diff --git a/date.js b/date.js
index 94246ae..133234f 100644
--- a/date.js
+++ b/date.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2019 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
export default class DateUtil {
@@ -28,7 +13,7 @@ export default class DateUtil {
let days = [];
Array.from(
{length: new Date(year, month + 1, 0).getDate()},
- (x, day)=> days.push(
+ (_, day)=> days.push(
new Date(year, month, day + 1)
)
);
@@ -41,7 +26,7 @@ export default class DateUtil {
let dayMatrix = new Array(weeks);
Array.from(
{length: weeks},
- (x, i)=> dayMatrix[i] = new Array(7)
+ (_, i)=> dayMatrix[i] = new Array(7)
);
let week = 0;
DateUtil.daysOfMonthArray(year, month).forEach(day=>{
diff --git a/datepicker/datepicker.js b/datepicker/datepicker.js
index 3cf335a..715fcce 100644
--- a/datepicker/datepicker.js
+++ b/datepicker/datepicker.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { domEvents } from "can";
diff --git a/entryPoints.mjs b/entryPoints.mjs
index 486ea3f..704736f 100644
--- a/entryPoints.mjs
+++ b/entryPoints.mjs
@@ -1,22 +1,8 @@
-/**
- * Copyright 2018-2023 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
export const entryPoints = [
{ out: "form", in: "src/form.tsx" },
- { out: "id", in: "src/id.ts" },
{ out: "index", in: "src/index.ts" },
- { out: "item", in: "src/item.ts" },
+ { out: "element", in: "src/element.ts" },
+ { out: "test", in: "src/test.ts" },
+ { out: "values", in: "src/values.ts" },
];
diff --git a/form/form.js b/form/form.js
deleted file mode 100644
index 1c6b970..0000000
--- a/form/form.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Copyright 2018-2022 Flavio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {FazElementItem, FazReactItem} from "../item"
-import React from "react"
-
-
-export class FazFormReact extends FazReactItem {
-
- defineStates(props) {
- this.values = {}
- this.state['action'] = undefined
- this.state['method'] = "get"
- this.state['type'] = "primary"
- this.state['message'] = undefined
- this.state['errors'] = []
- this.state['valueUpdated'] = 0
- if (props.action) {
- this.state['action'] = props.action
- }
- if (props.method) {
- this.state['method'] = props.method.toLowerCase()
- }
- if (props.message) {
- this.state['message'] = props.message
- }
- if (props.errors) {
- this.state['errors'] = props.errors
- }
- this.from = this.from.bind(this)
- this.to = this.to.bind(this)
- }
-
- hasValue(index) {
- return this.values[index] !== undefined
- }
-
- valueIsEmpty(index) {
- if (this.hasValue(index)) {
- return this.values[index] === ""
- }
- return false
- }
-
- /**
- *
- * @param {String} index
- * @param defaultValue
- */
- from(index, defaultValue="") {
- if(!this.hasValue(index)) {
- this.values[index] = defaultValue
- }
- return this.values[index]
- }
-
- /**
- *
- * @param {Event} event
- * @param {string} index
- */
- to(event, index) {
- this.values[index] = event.target.value
- this.incrementState(index)
- }
-
- get prefix() {
- return "faz-form-react"
- }
-
- get hasMessage() {
- return this.state.message !== "";
- }
-
- get hasErrors() {
- return this.state.errors.length > 0;
- }
-
-}
-
-export default class FazFormElement extends FazElementItem {
-
- constructor(props) {
- super(props)
- }
-
- attributesToStates() {
- super.attributesToStates()
- for (let attribute of this.attributes) {
- switch (attribute.name.toLowerCase()) {
- case "action":
- this.reactItem.state['action'] = attribute.value
- break
- case "method":
- this.reactItem.state['method'] = attribute.value
- break
- case "active":
- this.reactItem.state['active'] = attribute.value
- break
- }
- }
- }
-}
diff --git a/input/datepicker.js b/input/datepicker.js
index f2c68a1..961d8c5 100644
--- a/input/datepicker.js
+++ b/input/datepicker.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2020 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import FazDatepicker from "../datepicker/datepicker";
import { domEvents } from "can";
diff --git a/input/filterbox.js b/input/filterbox.js
index 3000678..58a4f86 100644
--- a/input/filterbox.js
+++ b/input/filterbox.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2022 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import {FazElementItem, FazReactItem} from "../item"
import {isString} from "lodash"
diff --git a/input/picklist.js b/input/picklist.js
index cea9553..3551076 100644
--- a/input/picklist.js
+++ b/input/picklist.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import {ObservableArray, type} from "can";
import { FazStacheItem } from "../item";
diff --git a/jest.config.ts b/jest.config.ts
deleted file mode 100644
index dcf4919..0000000
--- a/jest.config.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import type { Config } from "@jest/types";
-
-// Solutions for jest:
-// jsdom: https://stackoverflow.com/a/69228464/2887989
-// watch: https://stackoverflow.com/a/39091907/2887989
-// this file: https://stackoverflow.com/a/76995084/2887989
-const config: Config.InitialOptions = {
- verbose: true,
- testEnvironment: "jsdom",
- transform: {
- "^.+\\.ts?$": ["ts-jest", {tsconfig: "./tsconfig.json"}],
- },
- preset: "ts-jest",
- moduleNameMapper: {
- "React": "/node_modules/solid-js/h/jsx-runtime/dist/jsx.cjs",
- "solid-js/web": "/node_modules/solid-js/web/dist/web.cjs",
- "solid-js": "/node_modules/solid-js/dist/solid.cjs"
- }
-};
-
-export default config;
diff --git a/karma.conf.js b/karma.conf.js
deleted file mode 100644
index cc1af1e..0000000
--- a/karma.conf.js
+++ /dev/null
@@ -1,149 +0,0 @@
-const path = require("path");
-const webpack = require("webpack");
-
-// This is related to the new jsx transform
-// SEE: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
-// Yanked from the create react app. O.o
-const hasJsxRuntime = (() => {
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
- return false;
- }
- try {
- require.resolve("react/jsx-runtime");
- return true;
- } catch (e) {
- return false;
- }
-})();
-
-const defaultWebpackOptions = {
- mode: 'development',
- output: {
- filename: '[name]-test.js',
- path: path.resolve(__dirname, "test/dist")
- },
- stats: {
- modules: false,
- colors: true,
- },
- watch: false,
- module: {
- rules: [
- {
- test: /\.stache$/,
- use: {
- loader: "can-stache-loader"
- }
- },
- {
- test: /\.js|\.jsx$/,
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: [
- [
- require.resolve("@babel/preset-env")
- ],
- [
- require.resolve("@babel/preset-react"),
- {
- runtime: hasJsxRuntime ? "automatic" :
- "classic",
- }
- ],
- ],
- // SEE: https://newbedev.com/babel-7-referenceerror-regeneratorruntime-is-not-defined
- plugins: [
- require.resolve("@babel/plugin-transform-runtime")
- ],
- }
- }
- }
- ]
- },
- // optimization: {
- // runtimeChunk: 'single',
- // splitChunks: {
- // chunks: 'all',
- // minSize: 0,
- // cacheGroups: {
- // commons: {
- // name: 'commons',
- // chunks: 'initial',
- // minChunks: 1,
- // },
- // },
- // },
- // },
- plugins: [
- new webpack.SourceMapDevToolPlugin({
- append: '\n//# sourceMappingURL=[url]',
- filename: '[name].bundle.map',
- })
- ],
-};
-
-module.exports = (config) => {
- config.set({
- // ... normal karma configuration
- browsers: ['Electron'],
- client: {
- captureConsole: true,
- useIframe: false,
- clearContext: false,
- qunit: {
- showUI: true,
- testTimeout: 500
- }
-
- },
- // make sure to include webpack as a framework
- frameworks: ['webpack', "qunit"],
- reporters: ['dots'],
- //browserNoActivityTimeout: 15000,
- customLaunchers: {
- CustomElectron: {
- base: 'Electron',
- browserWindowOptions: {
- show: true,
- // DEV: More preferentially, should link your own `webPreferences` from your Electron app instead
- webPreferences: {
- // Preferred `preload` mechanism to expose `require`
-
-
- // Alternative non-preload mechanism to expose `require`
- // nodeIntegration: true,
- // contextIsolation: false
-
-
-
- // nativeWindowOpen is set to `true` by default by `karma-electron` as well, see #50
- nativeWindowOpen: false
- }
- }
- }
- },
- plugins: [
- 'karma-qunit',
- 'karma-electron',
- 'karma-webpack'
-
- ],
-
- files: [
- "./node_modules/jquery/dist/jquery.min.js",
- // all files ending in ".test.js"
- // !!! use watched: false as we use webpacks watch
- { pattern: './test/**/*-test.js', watched: false },
- { pattern: "./test/dist/*-test.*.js", watched: false }
- ],
-
- preprocessors: {
- // add webpack as preprocessor
- './test/**/*-test.js': ["webpack"]
- },
-
- webpack: defaultWebpackOptions,
- });
-}
diff --git a/nav/index.html b/nav/index.html
deleted file mode 100644
index c865261..0000000
--- a/nav/index.html
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
-
-
-
- Candango Faz Toolkit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{else}}
-
- {{/hasTabs}}
-{{/ this.isLoading }}
diff --git a/navbar/navbar-brand.js b/navbar/navbar-brand.js
index ee7fa83..2c61a64 100644
--- a/navbar/navbar-brand.js
+++ b/navbar/navbar-brand.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import {FazStacheItem} from "../item";
diff --git a/navbar/navbar-collapse.js b/navbar/navbar-collapse.js
index 6408116..e407fe8 100644
--- a/navbar/navbar-collapse.js
+++ b/navbar/navbar-collapse.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazStacheItem, FazStacheItemList } from "../item";
import {default as FazNavbarBrand} from "./navbar-brand";
diff --git a/navbar/navbar-nav-item-title.js b/navbar/navbar-nav-item-title.js
index 2c7cce5..d2947b0 100644
--- a/navbar/navbar-nav-item-title.js
+++ b/navbar/navbar-nav-item-title.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazStacheItem } from "../item";
diff --git a/navbar/navbar-nav-item.js b/navbar/navbar-nav-item.js
index 6db965b..0d0fa19 100644
--- a/navbar/navbar-nav-item.js
+++ b/navbar/navbar-nav-item.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { type } from "can";
import { FazStacheItem, FazStacheItemList } from "../item";
diff --git a/navbar/navbar-nav.js b/navbar/navbar-nav.js
index c0a037e..1e34b13 100644
--- a/navbar/navbar-nav.js
+++ b/navbar/navbar-nav.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazStacheItem, FazStacheItemList} from "../item";
import navTemplate from "./stache/navbar-nav.stache";
diff --git a/navbar/navbar-toggler.js b/navbar/navbar-toggler.js
index a239881..0f19225 100644
--- a/navbar/navbar-toggler.js
+++ b/navbar/navbar-toggler.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import { FazStacheItem } from "../item";
import navbarTogglerTemplate from "./stache/navbar-toggler.stache";
diff --git a/navbar/navbar.js b/navbar/navbar.js
index d993f51..bf2b1f3 100644
--- a/navbar/navbar.js
+++ b/navbar/navbar.js
@@ -1,18 +1,3 @@
-/**
- * Copyright 2018-2021 Flavio Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import {
ajax, DeepObservable, ObservableObject, type
diff --git a/package.json b/package.json
index 30c5ba8..5416719 100644
--- a/package.json
+++ b/package.json
@@ -1,18 +1,35 @@
{
"name": "faz",
- "version": "0.1.9",
- "description": "Vanilla JS HTML Web Components",
- "main": "./dist/index.js",
- "module": "./dist/esm/index.js",
+ "version": "0.5.3",
+ "description": "JS HTML Web Components",
+ "main": "dist/js/index.js",
+ "module": "dist/js/index.js",
"mainFields": [
"module",
"main"
],
- "types": "./src/types/index.d.ts",
+ "types": "dist/types/index.d.ts",
"files": [
"dist",
- "src"
+ "src",
+ "types"
],
+ "exports": {
+ ".": {
+ "types": "./dist/types/index.d.ts",
+ "import": "./dist/js/index.js"
+ },
+ "./reactivity": {
+ "types": "./dist/types/reactivity.d.ts",
+ "import": "./dist/js/reactivity.js"
+ },
+ "./paginator": {
+ "types": "./dist/types/paginator.d.ts",
+ "import": "./dist/js/paginator.js"
+ },
+ "./src": "./src/index.ts",
+ "./src/*": "./src/*"
+ },
"repository": {
"type": "git",
"url": "git+https://github.com/candango/faz.git"
@@ -22,7 +39,8 @@
},
"homepage": "https://github.com/candango/faz#readme",
"author": "Flavio Garcia ",
- "license": "Apache-2.0",
+ "license": "MIT",
+ "type": "module",
"keywords": [
"webcomponent",
"solidjs",
@@ -30,59 +48,51 @@
"toolkit"
],
"dependencies": {
- "axios": "1.6.1",
- "bootstrap": "5.3.2",
- "bootstrap-icons": "1.11.2",
- "bootswatch": "5.3.2",
- "can": "6.6.2",
- "jquery": "3.7.0",
- "less": "4.2.0",
- "lodash": "4.17.21",
- "solid-js": "1.8.5"
+ "less": "4.5.1",
+ "solid-js": "1.9.13"
},
"devDependencies": {
- "@codemirror/lang-html": "6.4.5",
- "@codemirror/language": "6.8.0",
- "@codemirror/view": "6.16.0",
- "@testing-library/dom": "9.3.3",
- "@testing-library/jest-dom": "6.1.5",
- "@types/jest": "29.5.11",
- "@types/lodash": "4.14.197",
+ "@testing-library/jest-dom": "6.9.1",
+ "@types/jest": "30.0.0",
+ "@types/nise": "1.4.5",
+ "@types/node": "25.0.3",
"can-stache-loader": "3.0.0",
- "electron": "27.0.4",
- "esbuild": "0.19.10",
- "esbuild-jest": "0.5.0",
+ "esbuild": "0.27.2",
"esbuild-plugin-copy": "2.1.1",
- "esbuild-plugin-solid": "0.5.0",
+ "esbuild-plugin-solid": "0.6.0",
"http-server": "14.1.1",
- "jest": "29.7.0",
- "jest-environment-jsdom": "29.7.0",
- "prettier": "3.1.1",
- "qunit": "2.17.2",
- "ts-jest": "29.1.1",
- "ts-loader": "9.5.1",
+ "jsdom": "27.0.0",
+ "nise": "6.1.5",
+ "prettier": "3.7.4",
"ts-node": "10.9.2",
- "typescript": "5.3.3"
+ "typescript": "5.9.3",
+ "vite": "8.0.16",
+ "vite-plugin-solid": "2.11.12",
+ "vitest": "4.0.18"
},
"scripts": {
- "watch": "node watch.mjs",
- "showcase": "http-server & npm run watch",
+ "watch": "pnpm run watch:clean && node watch.mjs",
+ "watch:clean": "rm -rf watch/dist",
+ "showcase": "http-server & pnpm run watch",
"esbuild": "node build.mjs",
- "build": "npm run build:clean && npm run lessc && npm run esbuild",
- "build:prod": "npm run build:clean && webpack --config webpack.config.prod.js && npm run lessc",
+ "ts:build": "pnpm run ts:clean && pnpm run ts:declaration && cp -r types dist",
+ "ts:declaration": "tsc -p tsconfig.types.json -d --declarationDir types --emitDeclarationOnly && rm -rf tsconfig.types.tsbuildinfo",
+ "ts:clean": "rm -rf tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo types/*",
+ "build": "pnpm run build:clean && pnpm run lessc && pnpm run esbuild && pnpm run ts:build",
"build:clean": "rm -rf dist",
"build:vendors": "rm -rf dist",
- "lessc": "npm run lessc:faz && npm run lessc:showcase",
+ "lessc": "pnpm run lessc:faz && pnpm run lessc:showcase",
"lessc:faz": "lessc stylesheets/faz.less dist/css/faz.css --source-map",
"lessc:showcase": "lessc stylesheets/showcase.less dist/css/showcase.css --source-map",
- "lessc:dev": "npm run lessc:dev:faz && npm run lessc:dev:showcase",
+ "lessc:dev": "pnpm run lessc:dev:faz && pnpm run lessc:dev:showcase",
"lessc:dev:faz": "lessc stylesheets/faz.less stylesheets/faz.css --source-map",
"lessc:dev:showcase": "lessc stylesheets/showcase.less stylesheets/showcase.css --source-map",
- "test": "jest",
- "test:browser": "karma start --single-run",
- "yarn": "npm run yarn:clean && npm run yarn:v2 && npm run yarn:install",
- "yarn:install": "yarn install",
- "yarn:clean": "rm -rf yarn.lock .yarn .yarnrc.yml .next node_modules",
- "yarn:v2": "yarn set version berry && yarn config set nodeLinker node-modules"
+ "test": "vitest run"
+ },
+ "packageManager": "pnpm@10.25.0",
+ "pnpm": {
+ "overrides": {
+ "@asamuzakjp/css-color": "4.1.1"
+ }
}
}
diff --git a/pagination/index.html b/pagination/index.html
deleted file mode 100644
index 5039f72..0000000
--- a/pagination/index.html
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
- Candango Faz Toolkit - Alerts
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Pagination
-
-
-
One page
-
Pagination has count equals 9 (9 records counted).
-
Records per page(perPage property) by default is 10 resulting in a pagination with only one page.
-
All navigation buttons won't be displayed.
-
-
-
-
-
-
-
Multiple pages and one block
-
A pagination with count equals 91 resulting in multiple pages.
-
Pages per page(perBlock property) by default is 10 resulting in a pagination with only one block.
-
All block navigation buttons won't be displayed.
-
-
-
-
-
-
-
Multiple pages and multiple blocks
-
A pagination with count equals 340 resulting in multiple pages and multiple blocks.
-
-
-
-
-
-
-
Start on a defined page
-
Set current page as 173.
-
The pagination will be rendered with the page 173 selected at the block of pages 18, displaying pages from 171 to 180.
-
Block navigation buttons will be displayed.
-
-
-
-
-
-
-
Disabled pagination
-
Pagination is disabled but we still show the
- current page.
-
-
-
-
-
-
-
-
Initial callback to be called after pagination is rendered
-
-
-
-
-
-
-
Page callback to be called after page is changed
-
-
-
-
-
-
-
Negative page value
-
A negative page value will be informed
- defaulting the current page value to 1 and sending a warning at
- the console.
-
-
-
-
-
-
-
Page value bigger than the page count
-
A page valu bigger than the page count will be
- informed defaulting the current page value as the page count
- and sending a warning at the console.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pagination/pagination.js b/pagination/pagination.js
deleted file mode 100644
index 17b33b4..0000000
--- a/pagination/pagination.js
+++ /dev/null
@@ -1,565 +0,0 @@
-/**
- * Copyright 2018-2022 Flávio Gonçalves Garcia
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {FazElementItem, FazReactItem} from "../item"
-import ReactDOM from "react-dom"
-import React from "react"
-
-export class FazReactPagination extends FazReactItem {
-
- defineStates(props) {
- super.defineStates(props);
- this.state['ariaLabel'] = undefined
- // Used to be records
- this.state['count'] = 0
- // Used to be currentPage
- this.state['page'] = 1
- // Used to be pagesPerBlock
- this.state['perBlock'] = 10
- // Used to be pagesPerPage
- this.state['perPage'] = 10
-
- this.state['labels'] = {
- first : "First",
- firstTooltip : "Go to the first page",
- last : "Last",
- lastTooltip : "Go to the last page",
- previous : "Previous",
- previousBlock : "Previous {perBlock}",
- previousTooltip : "Go to the previous page",
- previousBlockTooltip : "Go to the previous {perBlock} pages",
- next : "Next",
- nextBlock : "Next {perBlock}",
- nextBlockTooltip : "Go to the next {perBlock} pages",
- nextTooltip : "Go to the next page",
- }
- this.state['initCallback'] = undefined
- this.state['pageCallback'] = undefined
-
- for(let key in props) {
- switch (key) {
- case "ariaLabel":
- this.state['ariaLabel'] = props[key]
- break
- case "count":
- this.state['count'] = parseInt(props[key])
- break
- case "page":
- this.state['page'] =parseInt(props[key])
- break
- case "perBlock":
- this.state['perBlock'] = parseInt(props[key])
- break
- case "perPage":
- this.state['perPage'] = parseInt(props[key])
- break
- }
- }
-
- }
-
- afterMount() {
- this.callInitCallback()
- }
-
- get prefix() {
- return "faz-react-pagination"
- }
-
- get containerId() {
- return "faz-pagination-container-".concat(this.state.id)
- }
-
- render() {
- return