sevgi-function 0.98.2 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f11073d7043461caa01968570217c218040207ff9a6abdcd5e56501946e35e1
4
- data.tar.gz: 9992d6ae73303b55ead462ba6b599e965446dd7b0455621e4ad6aa029aa65376
3
+ metadata.gz: 7fd50bb171b09d5221092de41845690e2b1e8e05e62811b972306b0522f6cbea
4
+ data.tar.gz: d8cff5f7b9af0492f0d0824271b4a2dc95069d2d4e82bbab012b56e0b15dc631
5
5
  SHA512:
6
- metadata.gz: 3cfb465db527caf1f1ba8e0305aebf3c3ba9164b6dc721122e4c5bb776f7843a05baf991fee72bff25a6c2d5be58c4625dfaac91c15d12e192fa1d12fc5ff2a3
7
- data.tar.gz: cb6e493fa0ad5c0332b6424bf8e53d9d72a49fb0729f5f4b9dcd481e94fc492fd07e458d6405aeb44b676ec3927301dd72e33ca0da2bad256d3931955d5183dc
6
+ metadata.gz: ca877b117f6e9e7d7a3da866b3ac73d6120c820038e0192e0e55bb927c9b28c527f68b16ecf02fddbd69f47435fdb940214e70fe78f2f3d96e4f3a006a9732cd
7
+ data.tar.gz: 5cced2a22f74bb0836f96d29de58d2d2dd1052d871bcc24bce6ffd1e59ee2760ab71e5bb2f83d36e7cf6bcdb30e3d3f0f6a4c9f7ca755bde02f2cb405948b16c
data/CHANGELOG.md CHANGED
@@ -3,7 +3,101 @@
3
3
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
- ## Unreleased
6
+ ## 1.0.0 - 2026-09-16
7
+
8
+ ### Added
9
+
10
+ - Added Hatch and Orb Showcase examples and displayed both arc lengths in the Arc example.
11
+
12
+ ### Changed
13
+
14
+ - Matched documentation page widths to the homepage Showcase.
15
+ - Aligned Derender user guidance with UTF-8 normalization and safe subtree selection rules.
16
+ - Clarified the packaged skill's script invocation, subtree copying, and Derender selection and encoding rules.
17
+ - Allowed Canvas and Paper values as the first `SVG` argument when using the default document profile.
18
+ - Made element `dup` and `clone` own independent subtrees while retaining IDs and Ruby copy semantics.
19
+ - Made Segment equality compare length and direction; ordering still compares length only.
20
+ - Limited Tile cell, row, and column queries to the requested geometry and accelerated XML character validation.
21
+ - Simplified the first-run guide and aligned library constructor examples.
22
+ - Updated the packaged skill for canvas origins, alignment, Paper lookup, curved geometry, and export constraints.
23
+ - Revised DSL catalog examples and packaged Sevgi skill guidance to use statement-style calls and show inspection results.
24
+ - Refined Showcase example tabs, made Ruby and XML views fill their panels, and hid executable preambles from Ruby views.
25
+ - Documented non-rendering element data and clarified the related DSL catalog examples.
26
+ - Refined Showcase heading spacing, page-title colors, and DSL catalog cards across light and dark themes.
27
+ - Removed an obsolete ruler example and unused site code.
28
+ - Kept the Squared and Copperplate guidesheet examples together at the end of the Showcase.
29
+ - Updated the packaged skill to avoid duplicate semantic shapes and unnecessary paint passes.
30
+
31
+ ### Fixed
32
+
33
+ - Kept horizontal scrollbars visible in Showcase example code panels.
34
+ - Read Derender input in its declared XML encoding and normalized generated source, XML declarations, and markup to UTF-8.
35
+ - Preserved open-path endpoints and derived edges independently of display precision.
36
+ - Kept near-axis and near-parallel line equations and intersections independent of angle and slope rounding.
37
+ - Corrected the Showcase social image dimensions.
38
+ - Added SVG namespaces to standalone drawing examples and regenerated their outputs.
39
+ - Made failed Sevgi Rake tasks stop dependent tasks and captured required-library failures in executor results.
40
+ - Removed executor signal-handler replacement so the host and shell retain SIGINT ownership.
41
+ - Escaped late export CSS as XML text and inserted it only at a supported final root closing tag.
42
+ - Preserved Derender processing instructions and rejected custom entity references and unsupported trailing document nodes before inclusion.
43
+ - Included both box origins in `Align`, unified Tile index validation, and isolated custom numeric attribute snapshots.
44
+ - Prevented avoidable overflow and underflow in point distances.
45
+ - Corrected browser source-panel expectations and added executable documentation, YARD, and packaged-skill checks.
46
+ - Rendered inline code in DSL catalog summaries and kept linked task themes visible below the sticky header.
47
+ - Restored Showcase tab icons with embedded Font Awesome SVGs.
48
+
49
+ ## 0.100.0 - 2026-09-09
50
+
51
+ ### Added
52
+
53
+ - Added `ArcTo` and `ArcBy` for SVG-native elliptical arc paths.
54
+ - Added Geometry `Arc`, `Ellipse`, and `Circle` with bounds, length, predicates, affine transformations, and
55
+ linear/quadratic intersections. Closed ellipses and circles support sweeps and hatching.
56
+ - Added Geometry `Point.midpoint`, `Element#closed?`, lined `vertices`, open-path traversal, and `Rect#center`.
57
+ - Added Geometry aggregate bounding boxes through `Operation.box`, point collinearity through `Point.collinear?`, and
58
+ polygon `simple?`, `convex?`, and `concave?` predicates.
59
+ - Added Protractor and Arc examples and documented the drawing and calculation APIs.
60
+
61
+ ### Changed
62
+
63
+ - Removed redundant parent scans while duplicating element subtrees.
64
+ - Reused source bounds across Tile cells to reduce repeated calculations and object allocations.
65
+
66
+ ### Fixed
67
+
68
+ - Preserved Showcase card HTML through Markdown rendering so all examples and their tabs remain visible.
69
+ - Preserved XML declarations, pre-root comments, CDATA sections, inline comments, and namespace-only leaves in
70
+ Derender output and evaluation.
71
+ - Limited PDF stamp recoloring to replaced text and carried graphics state across a page's content streams.
72
+ - Corrected decimal interval fitting and made Grid point queries honor the active numeric precision.
73
+ - Prevented implicit shell interpretation of single executable arguments in `F.sh` and `F.sh!`, including paths with spaces or shell metacharacters.
74
+ - Preserved inherited namespaces on detached Derender nodes in generated source and direct evaluation, including imports through `EvaluateChildren` and `IncludeChildren`.
75
+ - Prevented sweep and Hatch lines from crossing the exterior between two tangent vertices of a concave polygon.
76
+ - Aligned Tile cells with their declared bounds for circles, rotated shapes, and polygons whose first vertex differs from their bounding-box origin.
77
+ - Limited `Load` chains to 128 active sources with `Executor::LoadDepthError`, preserving cycle detection and nested load diagnostics.
78
+ - Rejected nil and false aggregate-box inputs with the documented geometry error.
79
+ - Restored precision-aware rejection of zero-length Triangle sides.
80
+ - Made point-set collinearity independent of input order and removed eager polygon edge-pair storage.
81
+ - Applied the collinearity tolerance to every three-point subset, removing coordinate-axis-dependent baseline selection.
82
+
83
+ ## 0.99.0 - 2026-08-09
84
+
85
+ ### Added
86
+
87
+ - Added `SVG.Module` for building anonymous callable drawing modules with their contract installed before definition.
88
+ - Added responsive Mermaid diagrams for the Derender round trip and SVG validation lifecycle.
89
+
90
+ ### Changed
91
+
92
+ - Reorganized the documentation around getting started, usage, composition, documents, layout, output, and examples.
93
+ - Documented how the `igves` and `igsev` command names reflect their conversion directions.
94
+ - Normalized DSL catalog provider labels to lowercase and simplified polyfill-backed editor entries to `inkscape`.
95
+
96
+ ### Fixed
97
+
98
+ - Allowed A5-on-A4 pdfcpu conversion to replace an existing output file.
99
+ - Pre-rendered Mermaid diagrams as inline SVG instead of parsing them in site visitors' browsers.
100
+ - Removed duplicate provider and context labels from DSL catalog entries.
7
101
 
8
102
  ## 0.98.2 - 2026-07-25
9
103
 
@@ -212,7 +306,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
212
306
 
213
307
  ### Changed
214
308
 
215
- - Added the checker board example to the documentation showcase flow.
309
+ - Added the checkerboard example to the documentation showcase flow.
216
310
  - Consolidated Victor Book attribution for adapted showcase examples into a single documentation note.
217
311
 
218
312
  ### Fixed
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Sevgi Function
2
2
 
3
3
  Sevgi Function contains the supported `Sevgi::F` toolbox shared by Sevgi components and advanced extensions. It is not
4
- intended as a general-purpose utility library; nested helper modules organize the facade implementation and are not
5
- consumer mixins.
4
+ a general-purpose utility library. Nested helper modules organize the facade implementation and are not consumer
5
+ mixins.
6
6
 
7
7
  ## Install
8
8
 
@@ -19,9 +19,14 @@ require "sevgi/function"
19
19
  ## Example
20
20
 
21
21
  ```ruby
22
- Sevgi::F.eq?(0.1 + 0.2, 0.3, precision: 12)
22
+ Sevgi::F.with_precision(12) do
23
+ Sevgi::F.eq?(0.1 + 0.2, 0.3) # => true
24
+ end
23
25
  ```
24
26
 
27
+ The facade also provides `.sevgi` file discovery, generated-file output, argv-safe child processes, naming helpers,
28
+ and terminal status output. Use the linked API documentation for exact results and failure contracts.
29
+
25
30
  ## Ruby compatibility
26
31
 
27
32
  Requires Ruby 3.4.0 or newer. CI verifies the current Ruby 3.4 release and the development Ruby from `.ruby-version`.
data/lib/sevgi/core.rb CHANGED
@@ -39,7 +39,7 @@ module Sevgi
39
39
  end
40
40
  end
41
41
 
42
- # Error raised for internal invariants and implementation paths that should be unreachable.
42
+ # Error raised for broken internal invariants and unreachable implementation paths.
43
43
  PanicError = Class.new(Error) unless defined?(self::PanicError)
44
44
 
45
45
  # Error raised for invalid public API usage.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Sevgi
4
4
  module Function
5
- # ANSI color and style methods promoted to {Sevgi::F}. This module organizes the facade implementation; it is not a
5
+ # ANSI color and style methods promoted to {Sevgi::F}. This module organizes the facade implementation. It is not a
6
6
  # consumer mixin contract.
7
7
  module Color
8
8
  # Wraps a string in the blue terminal style.
@@ -4,10 +4,10 @@ require "fileutils"
4
4
 
5
5
  module Sevgi
6
6
  module Function
7
- # File-system methods promoted to {Sevgi::F}. This module organizes the facade implementation; it is not a consumer
7
+ # File-system methods promoted to {Sevgi::F}. This module organizes the facade implementation. It is not a consumer
8
8
  # mixin contract.
9
9
  module File
10
- # Checks whether a file would change if written with content.
10
+ # Checks whether a file differs from the supplied content.
11
11
  # @param file [String] file path to compare
12
12
  # @param content [String] proposed file content
13
13
  # @yield optional normalization filter applied to both old and new content
@@ -78,7 +78,7 @@ module Sevgi
78
78
  def atan2(y, x) = to_degrees(::Math.atan2(finite_real(:y, y), finite_real(:x, x)))
79
79
 
80
80
  # Returns the cosine of an angle expressed in degrees. Integer quarter turns return exact `-1.0`, `0.0`, or
81
- # `1.0`; other angles use Ruby's floating-point Math implementation.
81
+ # `1.0`. Other angles use Ruby's floating-point Math implementation.
82
82
  # @param degrees [Numeric] angle in degrees
83
83
  # @return [Float]
84
84
  # @raise [Sevgi::ArgumentError] when degrees is not a finite real number
@@ -94,6 +94,7 @@ module Sevgi
94
94
  def cot(degrees) = 1.0 / ::Math.tan(to_radians(degrees))
95
95
 
96
96
  # Counts complete divisions in a length.
97
+ # A positive quotient one floating-point step below the next integer counts as that integer.
97
98
  # @param length [Numeric] finite real total length
98
99
  # @param division [Numeric] finite real, non-zero division size
99
100
  # @return [Integer]
@@ -103,7 +104,11 @@ module Sevgi
103
104
  divisor = finite_real(:division, division)
104
105
  ArgumentError.("Division must not be zero") if divisor.zero?
105
106
 
106
- (length / divisor).to_i
107
+ quotient = length / divisor
108
+ whole = quotient.to_i
109
+ candidate = whole + 1
110
+
111
+ quotient > whole && quotient.next_float == candidate ? candidate : whole
107
112
  end
108
113
 
109
114
  # Compares two numeric values after approximate rounding.
@@ -156,7 +161,7 @@ module Sevgi
156
161
  precision.nil? ? number : number.round(valid_precision(precision))
157
162
  end
158
163
 
159
- # Returns the sine of an angle expressed in degrees. Integer quarter turns return exact `-1.0`, `0.0`, or `1.0`;
164
+ # Returns the sine of an angle expressed in degrees. Integer quarter turns return exact `-1.0`, `0.0`, or `1.0`.
160
165
  # other angles use Ruby's floating-point Math implementation.
161
166
  # @param degrees [Numeric] angle in degrees
162
167
  # @return [Float]
@@ -11,7 +11,7 @@ module Sevgi
11
11
  # Checks whether a program exists and is executable.
12
12
  # @param program [Object] program name, absolute path, or relative slash-containing path
13
13
  # @return [Boolean] true when an executable regular file is found
14
- # @note PATH is evaluated on every call; empty PATH segments mean the current directory.
14
+ # @note PATH is evaluated on every call. Empty PATH segments mean the current directory.
15
15
  def executable?(program)
16
16
  program = program.to_s
17
17
  return false if program.empty?
@@ -26,7 +26,7 @@ module Sevgi
26
26
  # @param args [Array<Object>] command arguments
27
27
  # @return [nil]
28
28
  # @raise [Sevgi::Error] when the program cannot be found in PATH
29
- # @note The first argument is checked as one exact argv entry; it is never shell-split.
29
+ # @note The first argument is checked as one exact argv entry. It is never shell-split.
30
30
  def executable!(*args)
31
31
  program = args.first.to_s
32
32
  Error.("Missing executable: #{program}") unless executable?(program)
@@ -232,7 +232,7 @@ module Sevgi
232
232
  ArgumentError.("Shell command required") if args.empty?
233
233
 
234
234
  @coathooks = 0
235
- outs, errs, status = Open3.popen3(*args) do |stdin, stdout, stderr, wait_thread|
235
+ outs, errs, status = Open3.popen3(*command(args)) do |stdin, stdout, stderr, wait_thread|
236
236
  capture(stdin, stdout, stderr, wait_thread, &input)
237
237
  end
238
238
 
@@ -241,7 +241,14 @@ module Sevgi
241
241
 
242
242
  private
243
243
 
244
- # rubocop:disable Lint/RescueException
244
+ def command(args)
245
+ args = args.dup
246
+ index = args.first.is_a?(::Hash) ? 1 : 0
247
+ args[index] = [args[index], args[index]] unless args[index].is_a?(::Array)
248
+ args
249
+ end
250
+
251
+ # rubocop:disable-next Lint/RescueException
245
252
  def capture(stdin, stdout, stderr, wait_thread, &input)
246
253
  registered = false
247
254
  Signals.register(self, wait_thread.pid)
@@ -256,7 +263,6 @@ module Sevgi
256
263
  close_input(stdin)
257
264
  Signals.unregister(self) if registered
258
265
  end
259
- # rubocop:enable Lint/RescueException
260
266
 
261
267
  def start_readers(stdout, stderr)
262
268
  [
@@ -336,11 +342,11 @@ module Sevgi
336
342
  # Runs a command and captures stdout, stderr, and exit status.
337
343
  # @param args [Array<String>] command and arguments
338
344
  # @yield optional stdin producer, evaluated once after output readers start
339
- # @yieldreturn [String, nil] content to write to stdin; nil writes nothing
345
+ # @yieldreturn [String, nil] content to write to stdin. Nil writes nothing
340
346
  # @return [Sevgi::Function::Shell::Result]
341
347
  # @raise [Sevgi::ArgumentError] when no command is given
342
348
  # @raise [SystemCallError] when the executable cannot be spawned or process pipes cannot be opened
343
- # @raise [StandardError] when the input block raises; the child is terminated and reaped before propagation
349
+ # @raise [StandardError] when the input block raises. The child is terminated and reaped before propagation
344
350
  # @note The child's stdin is closed after the input block. During execution, the first SIGINT sends TERM to the
345
351
  # child process and the second SIGINT as KILL to each active child outside trap context, then restores the
346
352
  # previous handler.
@@ -349,12 +355,12 @@ module Sevgi
349
355
  # Runs a command, requiring both executable lookup and successful exit status.
350
356
  # @param args [Array<String>] command and arguments
351
357
  # @yield optional stdin producer, evaluated once after output readers start
352
- # @yieldreturn [String, nil] content to write to stdin; nil writes nothing
358
+ # @yieldreturn [String, nil] content to write to stdin. Nil writes nothing
353
359
  # @return [Sevgi::Function::Shell::Result]
354
360
  # @raise [Sevgi::ArgumentError] when no command is given
355
361
  # @raise [Sevgi::Error] when the executable is missing or the command fails
356
362
  # @raise [SystemCallError] when the executable cannot be spawned or process pipes cannot be opened
357
- # @raise [StandardError] when the input block raises; the child is terminated and reaped before propagation
363
+ # @raise [StandardError] when the input block raises. The child is terminated and reaped before propagation
358
364
  # @note The child's stdin is closed after the input block. During execution, the first SIGINT sends TERM to the
359
365
  # child process and the second SIGINT as KILL to each active child outside trap context, then restores the previous
360
366
  # handler.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Sevgi
4
4
  module Function
5
- # String methods promoted to {Sevgi::F}. This module organizes the facade implementation; it is not a consumer mixin
5
+ # String methods promoted to {Sevgi::F}. This module organizes the facade implementation. It is not a consumer mixin
6
6
  # contract.
7
7
  module String
8
8
  # Returns the final constant name segment from a module path.
@@ -20,10 +20,10 @@ module Sevgi
20
20
 
21
21
  extend String
22
22
 
23
- # English pluralization promoted to {Sevgi::F}. This module organizes the facade implementation; it is not a
23
+ # English pluralization promoted to {Sevgi::F}. This module organizes the facade implementation. It is not a
24
24
  # consumer mixin contract.
25
25
  module Pluralize
26
- # Words that should not be pluralized.
26
+ # Words excluded from pluralization.
27
27
  # @api private
28
28
  UNCOUNTABLES = %w[
29
29
  equipment
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Sevgi
4
4
  module Function
5
- # Terminal status methods promoted to {Sevgi::F}. This module organizes the facade implementation; it is not a
5
+ # Terminal status methods promoted to {Sevgi::F}. This module organizes the facade implementation. It is not a
6
6
  # consumer mixin contract.
7
7
  module UI
8
8
  # Reports an in-progress status message.
@@ -3,6 +3,6 @@
3
3
  module Sevgi
4
4
  module Function
5
5
  # Current version of the Sevgi function gem.
6
- VERSION = "0.98.2"
6
+ VERSION = "1.0.0"
7
7
  end
8
8
  end
@@ -13,13 +13,13 @@ require_relative "function/ui"
13
13
  require_relative "function/version"
14
14
 
15
15
  module Sevgi
16
- # Support toolbox for Sevgi components and advanced extensions. The supported helper facade is {Sevgi::F}; it
16
+ # Support toolbox for Sevgi components and advanced extensions. The supported helper facade is {Sevgi::F}. It
17
17
  # provides degree-based trigonometry and precision, file discovery and output, argv-safe commands, naming helpers,
18
18
  # and small terminal status tools. It is not intended as a general-purpose utility library.
19
19
  #
20
20
  # {Function::Location}, {Function::Locate}, and {Function::Shell::Result} are public supporting values. The
21
21
  # thread-local precision accessors remain on {Function::Math.precision}. Other nested helper modules organize the
22
- # facade implementation and its method documentation; consumers should not include or extend them.
22
+ # facade implementation and its method documentation. Consumers do not include or extend them.
23
23
  #
24
24
  # @example Use the supported facade in library code
25
25
  # Sevgi::F.with_precision(3) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevgi-function
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.98.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recai Oktaş
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubygems_version: 4.0.16
53
+ rubygems_version: 4.0.20
54
54
  specification_version: 4
55
55
  summary: Shared utility functions for Sevgi components.
56
56
  test_files: []