@muze-labs/simplyflow 0.9.0 → 0.10.0

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/src/suggest.mjs CHANGED
@@ -1,68 +1 @@
1
- /**
2
- * Return the closest valid option name to a possibly misspelled name.
3
- *
4
- * Used for developer-friendly typo suggestions. Short unknown names such as
5
- * `api` or `db` are ignored by default because they are common app extension
6
- * properties and edit-distance suggestions are noisy for short strings.
7
- *
8
- * @param {string} name The unknown name to compare.
9
- * @param {Iterable<string>} options Valid option names to compare against.
10
- * @param {object} [settings] Optional matching settings.
11
- * @param {number} [settings.maxDistance=2] Maximum edit distance to accept.
12
- * @param {number} [settings.minLength=4] Minimum unknown-name length to check.
13
- * @returns {string|undefined} The closest option, or undefined when no useful suggestion exists.
14
- */
15
- export function closest(name, options, { maxDistance = 2, minLength = 4 } = {})
16
- {
17
- if (name.length < minLength) {
18
- return
19
- }
20
-
21
- let result
22
- let resultDistance = Infinity
23
- for (const option of options) {
24
- const distance = editDistance(name, option, maxDistance)
25
- if (distance < resultDistance) {
26
- result = option
27
- resultDistance = distance
28
- }
29
- }
30
- return resultDistance <= maxDistance ? result : undefined
31
- }
32
-
33
- /**
34
- * Return the edit distance between two short strings.
35
- *
36
- * This is used only for friendly typo suggestions in developer warnings, so it
37
- * intentionally caps large length differences early instead of doing extra work.
38
- *
39
- * @param {string} a First string to compare.
40
- * @param {string} b Second string to compare.
41
- * @param {number} [maxDistance=2] Maximum useful distance for the caller.
42
- * @returns {number} The Levenshtein edit distance, or maxDistance + 1 when the strings are too far apart.
43
- */
44
- export function editDistance(a, b, maxDistance = 2)
45
- {
46
- const tooFar = maxDistance + 1
47
- if (Math.abs(a.length - b.length) > maxDistance) {
48
- return tooFar
49
- }
50
-
51
- const previous = Array.from({ length: b.length + 1 }, (_, index) => index)
52
- const current = new Array(b.length + 1)
53
-
54
- for (let ai = 1; ai <= a.length; ai++) {
55
- current[0] = ai
56
- for (let bi = 1; bi <= b.length; bi++) {
57
- const cost = a[ai - 1] === b[bi - 1] ? 0 : 1
58
- current[bi] = Math.min(
59
- previous[bi] + 1,
60
- current[bi - 1] + 1,
61
- previous[bi - 1] + cost
62
- )
63
- }
64
- previous.splice(0, previous.length, ...current)
65
- }
66
-
67
- return previous[b.length]
68
- }
1
+ export * from '@muze-labs/simplyflow-app/suggest'
package/src/symbols.mjs CHANGED
@@ -1,9 +1 @@
1
- export const DEP = {
2
- ITERATE: Symbol.for('@simplyedit/simplyflow.iterate'),
3
- XRAY: Symbol.for('@simplyedit/simplyflow.xRay'),
4
- SIGNAL: Symbol.for('@simplyedit/simplyflow.Signal'),
5
- TEMPLATE: Symbol.for('@simplyedit/simplyflow.bindTemplate'),
6
- VALUE: Symbol.for('@simplyedit/simplyflow.bindValue'),
7
- LENGTH: 'length',
8
- SIZE: 'size'
9
- }
1
+ export * from '@muze-labs/simplyflow-state/symbols'
package/MUZE_ALIGNMENT.md DELETED
@@ -1,118 +0,0 @@
1
- # Muze alignment: simplyflow
2
-
3
- > Initial alignment roadmap. It is intended as a practical maintenance document, not as a complete code audit.
4
-
5
- ## Muze design principles
6
-
7
- Muze builds web software for technically curious non-professional programmers, without making the tools unattractive to professionals.
8
-
9
- We prefer:
10
-
11
- - simplicity over completeness
12
- - small, decoupled, single-concern libraries
13
- - correct abstractions that do not cross conceptual boundaries
14
- - browser-native standards where possible
15
- - lightweight abstractions only when they make developer code simpler
16
- - stable, long-term APIs
17
- - components and frameworks that are easy to adapt or replace
18
- - standards-based or open-source hosting stacks that avoid lock-in
19
- - software small enough to work well on slow devices and connections
20
- - a view-source philosophy: invite developers to look under the hood and learn
21
-
22
- When making tradeoffs, prefer composability, replaceability, web-platform alignment, and long-term simplicity over convenience, popularity, or feature completeness.
23
-
24
-
25
- ## Muze package namespace policy
26
-
27
- The `@muze-nl` npm namespace should be a trust signal. Packages published there should be close to production-ready: the public API is expected to be stable, the package can be installed and used by a fresh project, and the README should be clear about supported usage.
28
-
29
- Experimental libraries should use the `@muze-labs` namespace until they are mature enough to carry the main Muze production-readiness signal. Moving from `@muze-labs` into `@muze-nl` should be treated as a release-readiness decision, not only a naming cleanup.
30
-
31
- ## Current assessment
32
-
33
- SimplyFlow is powerful and useful, but it sits close to framework territory. It includes signals/effects, reactive databinding, and model helpers such as paging/sorting/filtering/columns. The main alignment task is to split and document these as composable layers rather than one large concept.
34
-
35
- ## Strengths
36
-
37
- - Uses vanilla JavaScript concepts rather than requiring a large frontend framework.
38
- - Signals/effects can be a small and useful primitive for browser apps.
39
- - Databinding and model helpers solve real application problems.
40
- - The README says it can be used standalone, which fits Muze’s decoupled-library goal.
41
-
42
- ## Alignment issues
43
-
44
- ### 1. Split the conceptual surface into explicit packages or modules
45
-
46
- **Principle:** Small, decoupled, single-concern libraries.
47
-
48
- **Problem:** State, effects, binding, model, paging, sort, filter, and columns are imported together in examples and presented as bundled libraries.
49
-
50
- **Why it matters:** The library risks becoming a lightweight framework without a clear boundary.
51
-
52
- **Suggested direction:** Document or package layers separately: `state`, `bind`, `model`, and optional model helpers. Make each usable and explainable on its own.
53
-
54
- **Status:** Open
55
-
56
- ### 2. Clarify relationship to SimplyView and Muze projects
57
-
58
- **Principle:** Replaceability and framework boundaries.
59
-
60
- **Problem:** The README says SimplyFlow is intended for SimplyView but can be used standalone, and may be integrated into SimplyView once vetted.
61
-
62
- **Why it matters:** Users need to know whether this is a stable standalone library or an experimental framework component.
63
-
64
- **Suggested direction:** Add a “Relationship to SimplyView” section with current status and future compatibility promise.
65
-
66
- **Status:** Open
67
-
68
- ### 3. Replace direct `src/` imports in public examples with stable imports
69
-
70
- **Principle:** Stable APIs.
71
-
72
- **Problem:** The README examples import from `simplyflow/src/state.mjs`, `src/bind.mjs`, and `src/model.mjs`.
73
-
74
- **Why it matters:** Importing from source files exposes internal layout as public API and makes refactoring harder.
75
-
76
- **Suggested direction:** Define stable export paths and update examples to use them. Keep source-path imports only in internal docs.
77
-
78
- **Status:** Open
79
-
80
- ### 4. Add a minimal mental model document
81
-
82
- **Principle:** View-source learnability.
83
-
84
- **Problem:** Reactivity and databinding can become magical if the propagation model is not explained.
85
-
86
- **Why it matters:** Curious developers should be able to predict when effects run and how DOM updates happen.
87
-
88
- **Suggested direction:** Add a “How SimplyFlow works” guide: signals, effects, batching, binding lifecycle, cleanup, and model transformations.
89
-
90
- **Status:** Open
91
-
92
- ### 5. Define production-readiness and experimental boundaries
93
-
94
- **Principle:** Stable APIs and user trust.
95
-
96
- **Problem:** The README warns the project is experimental and not for production unless users can fix problems themselves.
97
-
98
- **Why it matters:** That honesty is good, but a Muze roadmap should say what must be done to change that status.
99
-
100
- **Suggested direction:** Add a checklist for moving from experimental to stable: tests, import paths, docs, examples, API freeze, browser support, package metadata.
101
-
102
- **Status:** Open
103
-
104
- ## Open questions
105
-
106
- - Is SimplyFlow part of Muze’s core stack, or a transitional dependency for current apps?
107
- - Should `bind` depend on `state`, or should it accept generic signal-like adapters?
108
- - Should model helpers live in their own package?
109
-
110
- ## Non-goals
111
-
112
- - Do not become a full frontend framework unless that is a deliberate separate project.
113
- - Do not hide DOM/browser behavior behind opaque magic.
114
- - Do not make all Muze apps depend on SimplyFlow by accident.
115
-
116
- ## Review cadence
117
-
118
- Review this document before feature work, before releases, and whenever the public API or dependency surface changes. Close issues by changing their status to `Done` and leaving a short note about the decision.